@carbonenginejs/runtime-resource 0.12.2 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -0
- package/dist/CjsResMan.js +393 -29
- package/dist/CjsResMan.js.map +1 -1
- package/dist/format/carbonEffect/CjsCarbonEffectReader.js +165 -118
- package/dist/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -1
- package/dist/format/carbonEffect/buildCarbonEffectContainer.js +182 -0
- package/dist/format/carbonEffect/buildCarbonEffectContainer.js.map +1 -0
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js +7 -113
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
- package/dist/format/carbonEffect/carbonEffectRecords.js +258 -66
- package/dist/format/carbonEffect/carbonEffectRecords.js.map +1 -1
- package/dist/format/carbonEffect/carbonEffectResourceTransform.js +197 -0
- package/dist/format/carbonEffect/carbonEffectResourceTransform.js.map +1 -0
- package/dist/format/effect/effectBodyInventory.js +146 -0
- package/dist/format/effect/effectBodyInventory.js.map +1 -0
- package/dist/format/effect/effectPermutationGraph.js +13 -13
- package/dist/format/effect/effectPermutationGraph.js.map +1 -1
- package/dist/format/index.js +4 -4
- package/dist/formats/black/CjsBlackFormat.js +19 -1
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/bnk/CjsBnkFormat.js +28 -9
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/busNodes.js +252 -0
- package/dist/formats/bnk/core/busNodes.js.map +1 -0
- package/dist/formats/bnk/core/effectNodes.js +147 -0
- package/dist/formats/bnk/core/effectNodes.js.map +1 -0
- package/dist/formats/bnk/core/eventAction.js +135 -24
- package/dist/formats/bnk/core/eventAction.js.map +1 -1
- package/dist/formats/bnk/core/globalSettings.js +215 -0
- package/dist/formats/bnk/core/globalSettings.js.map +1 -0
- package/dist/formats/bnk/core/helpers.js +37 -5
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/musicNodes.js +43 -19
- package/dist/formats/bnk/core/musicNodes.js.map +1 -1
- package/dist/formats/bnk/core/nodeBase.js +28 -7
- package/dist/formats/bnk/core/nodeBase.js.map +1 -1
- package/dist/formats/dds/core/helpers.js +40 -1
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/dxbc/CjsDxbcFormat.js +45 -0
- package/dist/formats/dxbc/CjsDxbcFormat.js.map +1 -1
- package/dist/formats/dxbc/core/disassemble.js +240 -0
- package/dist/formats/dxbc/core/disassemble.js.map +1 -0
- package/dist/formats/gltf/CjsGltfFormat.js +1 -39
- package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/formats/gltf/core/helpers.js +1 -21
- package/dist/formats/gltf/core/helpers.js.map +1 -1
- package/dist/formats/hlsl/CjsHlslFormat.js +0 -21
- package/dist/formats/hlsl/CjsHlslFormat.js.map +1 -1
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js +118 -49
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -1
- package/dist/formats/hlsl/core/detailMapFamily.js +128 -0
- package/dist/formats/hlsl/core/detailMapFamily.js.map +1 -0
- package/dist/formats/hlsl/core/localLightFamily.js +133 -0
- package/dist/formats/hlsl/core/localLightFamily.js.map +1 -0
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +79 -73
- package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -1
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js +8 -1
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js.map +1 -1
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js +11 -691
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js.map +1 -1
- package/dist/formats/index.js +4 -2
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/obj/CjsObjFormat.js +1 -22
- package/dist/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/formats/obj/core/helpers.js +1 -21
- package/dist/formats/obj/core/helpers.js.map +1 -1
- package/dist/formats/pickle/CjsPickleFormat.js +214 -0
- package/dist/formats/pickle/CjsPickleFormat.js.map +1 -0
- package/dist/formats/pickle/core/CjsPickleProtocol0Reader.js +551 -0
- package/dist/formats/pickle/core/CjsPickleProtocol0Reader.js.map +1 -0
- package/dist/formats/pickle/index.js +2 -0
- package/dist/formats/pickle/index.js.map +1 -0
- package/dist/formats/red/core/redGraph.js +11 -8
- package/dist/formats/red/core/redGraph.js.map +1 -1
- package/dist/formats/stl/CjsStlFormat.js +1 -46
- package/dist/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/formats/stl/core/helpers.js +1 -21
- package/dist/formats/stl/core/helpers.js.map +1 -1
- package/dist/formats/webgl/CjsWebglFormat.js +33 -55
- package/dist/formats/webgl/CjsWebglFormat.js.map +1 -1
- package/dist/formats/webgl/core/buildGlslEffectContainer.js +70 -0
- package/dist/formats/webgl/core/buildGlslEffectContainer.js.map +1 -0
- package/dist/formats/webgl/core/effectPackage.js +216 -108
- package/dist/formats/webgl/core/effectPackage.js.map +1 -1
- package/dist/formats/webgl/core/errors.js +1 -1
- package/dist/formats/webgl/core/errors.js.map +1 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +166 -24
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +63 -5
- package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
- package/dist/formats/webgl/core/glsl/packedLightFixups.js +98 -0
- package/dist/formats/webgl/core/glsl/packedLightFixups.js.map +1 -0
- package/dist/formats/webgl/core/glslBackendBlock.js +552 -0
- package/dist/formats/webgl/core/glslBackendBlock.js.map +1 -0
- package/dist/formats/webgl/core/glslBackendBodySet.js +243 -0
- package/dist/formats/webgl/core/glslBackendBodySet.js.map +1 -0
- package/dist/formats/webgl/core/{cewgCompleteness.js → glslEffectCompleteness.js} +12 -8
- package/dist/formats/webgl/core/glslEffectCompleteness.js.map +1 -0
- package/dist/formats/webgl/core/helpers.js +33 -172
- package/dist/formats/webgl/core/helpers.js.map +1 -1
- package/dist/formats/webgl/core/inspectGlslEffectContainer.js +122 -0
- package/dist/formats/webgl/core/inspectGlslEffectContainer.js.map +1 -0
- package/dist/formats/webgl/core/readGlslEffectContainer.js +249 -0
- package/dist/formats/webgl/core/readGlslEffectContainer.js.map +1 -0
- package/dist/formats/webgpu/CjsWebgpuFormat.js +15 -15
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js +37 -145
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js.map +1 -1
- package/dist/formats/webgpu/core/{cewgpu/CewgpuContainer.js → carbonWebgpu/CarbonWebgpuContainer.js} +13 -27
- package/dist/formats/webgpu/core/carbonWebgpu/CarbonWebgpuContainer.js.map +1 -0
- package/dist/formats/webgpu/core/{cewgpu → carbonWebgpu}/containerViews.js +1 -1
- package/dist/formats/webgpu/core/carbonWebgpu/containerViews.js.map +1 -0
- package/dist/formats/webgpu/core/{cewgpu → carbonWebgpu}/validateContainer.js +4 -4
- package/dist/formats/webgpu/core/carbonWebgpu/validateContainer.js.map +1 -0
- package/dist/formats/webgpu/core/effectBackendBodySet.js +18 -18
- package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
- package/dist/formats/webgpu/core/errors.js +1 -1
- package/dist/formats/webgpu/core/errors.js.map +1 -1
- package/dist/formats/webgpu/core/helpers.js +22 -22
- package/dist/formats/webgpu/core/helpers.js.map +1 -1
- package/dist/formats/webgpu/core/packageEffect.js +11 -15
- package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
- package/dist/formats/webgpu/core/packageEffectSelection.js +1 -1
- package/dist/formats/webgpu/core/packageEffectSelection.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +23 -23
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +6 -6
- package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
- package/dist/formats/yaml/CjsYamlFormat.js +3 -3
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/formats/yaml/core/CjsYamlReader.js +4 -6
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
- package/dist/formats/yaml/core/helpers.js +27 -1
- package/dist/formats/yaml/core/helpers.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/resource/CjsLoadingObject.js +19 -0
- package/dist/resource/CjsLoadingObject.js.map +1 -0
- package/dist/resource/CjsResource.js +4 -0
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/ResourceHandlerMode.js +14 -0
- package/dist/resource/ResourceHandlerMode.js.map +1 -0
- package/dist/resource/index.js +2 -0
- package/dist/resource/index.js.map +1 -1
- package/dist/resource/shader/Tr2EffectRes.js +118 -213
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
- package/dist/resource/shader/Tr2Shader.js +37 -15
- package/dist/resource/shader/Tr2Shader.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectConstant.js +37 -29
- package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectDescription.js +39 -34
- package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js +51 -30
- package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +45 -25
- package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectResource.js +51 -17
- package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +219 -88
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js +28 -18
- package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2Pass.js +96 -39
- package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
- package/dist/resource/shader/reflection/carbonRecordFields.js +159 -0
- package/dist/resource/shader/reflection/carbonRecordFields.js.map +1 -0
- package/dist/resource/shader/reflection/shaderStage.js +22 -0
- package/dist/resource/shader/reflection/shaderStage.js.map +1 -0
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js +68 -10
- package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
- package/dist/worker/CjsResManMainThreadLoader.js +9 -7
- package/dist/worker/CjsResManMainThreadLoader.js.map +1 -1
- package/dist/worker/CjsResManWorker.js +5 -4
- package/dist/worker/CjsResManWorker.js.map +1 -1
- package/dist/worker/CjsResManWorkerLoader.js +9 -6
- package/dist/worker/CjsResManWorkerLoader.js.map +1 -1
- package/docs/README.md +2 -2
- package/docs/architecture.md +12 -3
- package/docs/concepts/resource-lifecycle.md +9 -8
- package/docs/concepts/shader-resource-model.md +14 -17
- package/docs/concepts/writing-an-engine-adapter.md +1 -1
- package/docs/formats/README.md +4 -2
- package/docs/formats/carbon-effect-container.md +127 -26
- package/docs/formats/dxbc/architecture.md +1 -1
- package/docs/formats/dxbc/reference/api.md +28 -0
- package/docs/formats/hlsl/README.md +3 -3
- package/docs/formats/hlsl/architecture.md +8 -9
- package/docs/formats/hlsl/guides/hydrating-json-output.md +3 -5
- package/docs/formats/hlsl/guides/reading-effects.md +5 -1
- package/docs/formats/hlsl/reference/advanced-analysis.md +20 -25
- package/docs/formats/hlsl/reference/api.md +0 -7
- package/docs/formats/hlsl/reference/json-graph.md +1 -4
- package/docs/formats/pickle.md +82 -0
- package/docs/formats/webgl/README.md +71 -13
- package/docs/formats/webgl/architecture.md +16 -17
- package/docs/formats/webgl/carbon-constant-layouts.md +3 -3
- package/docs/formats/webgl/decl-io.md +3 -3
- package/docs/formats/webgl/memory-structured.md +27 -8
- package/docs/formats/webgl/texture-sample.md +1 -1
- package/docs/formats/webgpu/README.md +3 -3
- package/docs/formats/webgpu/architecture.md +5 -6
- package/docs/formats/webgpu/formats/{cewgpu.md → carbon-webgpu.md} +10 -11
- package/docs/formats/webgpu/guides/effect-packaging.md +6 -8
- package/docs/formats/webgpu/reference/api.md +11 -12
- package/docs/formats/webgpu/reference/wgsl-compatibility.md +11 -8
- package/docs/formats/wwise.md +63 -2
- package/docs/reference/classes/core.md +10 -0
- package/docs/reference/classes/formats.md +40 -48
- package/docs/reference/classes/resources.md +2 -2
- package/docs/reference/queues.md +88 -4
- package/docs/reference/workers.md +7 -0
- package/package.json +61 -61
- package/dist/format/carbonEffect/carbonDescriptionFromPortable.js +0 -372
- package/dist/format/carbonEffect/carbonDescriptionFromPortable.js.map +0 -1
- package/dist/format/effect/effectReflectionPackage.js +0 -636
- package/dist/format/effect/effectReflectionPackage.js.map +0 -1
- package/dist/formats/hlsl/core/HlslReader.js +0 -16
- package/dist/formats/hlsl/core/HlslReader.js.map +0 -1
- package/dist/formats/hlsl/core/portableReflection.js +0 -848
- package/dist/formats/hlsl/core/portableReflection.js.map +0 -1
- package/dist/formats/hlsl/portable.js +0 -2
- package/dist/formats/hlsl/portable.js.map +0 -1
- package/dist/formats/webgl/core/cewg/CewgPackage.js +0 -340
- package/dist/formats/webgl/core/cewg/CewgPackage.js.map +0 -1
- package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js +0 -104
- package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js.map +0 -1
- package/dist/formats/webgl/core/cewg/binary.js +0 -19
- package/dist/formats/webgl/core/cewg/binary.js.map +0 -1
- package/dist/formats/webgl/core/cewgCompleteness.js.map +0 -1
- package/dist/formats/webgl/core/effectPackageValidation.js +0 -331
- package/dist/formats/webgl/core/effectPackageValidation.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/containerViews.js.map +0 -1
- package/dist/formats/webgpu/core/cewgpu/validateContainer.js.map +0 -1
- package/dist/resource/shader/portable.js +0 -33
- package/dist/resource/shader/portable.js.map +0 -1
- package/docs/formats/hlsl/reference/portable-reflection.md +0 -141
- package/docs/formats/webgl/effect-reflection.md +0 -127
|
@@ -3,40 +3,98 @@
|
|
|
3
3
|
Status: Evolving
|
|
4
4
|
Scope: `@carbonenginejs/runtime-resource/formats/webgl`
|
|
5
5
|
Audience: Shader-tool authors, runtime integrators, and maintainers
|
|
6
|
-
Summary: Explains
|
|
6
|
+
Summary: Explains WebGL effect packages, completeness, and DXBC-to-GLSL conversion.
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
9
9
|
|
|
10
|
-
`@carbonenginejs/runtime-resource/formats/webgl`
|
|
11
|
-
supported compiled Carbon effect stages into GLSL ES 3.00 package
|
|
12
|
-
preserves complete source permutation topology
|
|
13
|
-
|
|
14
|
-
objects.
|
|
10
|
+
`@carbonenginejs/runtime-resource/formats/webgl` builds effect packages and
|
|
11
|
+
converts supported compiled Carbon effect stages into GLSL ES 3.00 package
|
|
12
|
+
data. It preserves complete source permutation topology without creating live
|
|
13
|
+
shader or GPU objects.
|
|
15
14
|
|
|
16
15
|
## Use this package when
|
|
17
16
|
|
|
18
|
-
Use `format-webgl` to inspect or build
|
|
17
|
+
Use `format-webgl` to inspect or build package bytes, translate supported DXBC
|
|
19
18
|
stages, or convert one compiled effect while preserving all source
|
|
20
|
-
permutations
|
|
21
|
-
|
|
19
|
+
permutations. Use runtime and engine packages for live shader objects, resource
|
|
20
|
+
selection, bindings, and draws.
|
|
22
21
|
|
|
23
22
|
## Where it fits
|
|
24
23
|
|
|
25
24
|
```text
|
|
26
25
|
compiled effect bytes
|
|
27
26
|
|
|
|
28
|
-
+---- format-hlsl ----
|
|
27
|
+
+---- format-hlsl ---- source parsing and permutation analysis
|
|
29
28
|
+---- format-dxbc ---- decoded shader programs
|
|
30
29
|
|
|
|
31
30
|
v
|
|
32
31
|
format-webgl
|
|
33
|
-
|
|
32
|
+
Carbon container + GLSL ES 3.00
|
|
34
33
|
|
|
|
35
|
-
+---- runtime-resource ---- selection, cache, Tr2Shader
|
|
34
|
+
+---- runtime-resource ---- selection, cache, Tr2Shader
|
|
36
35
|
+---- runtime-trinity ----- effect/material facade and parameters
|
|
37
36
|
`---- WebGL engine -------- programs, bindings, and draws
|
|
38
37
|
```
|
|
39
38
|
|
|
39
|
+
The emitted artifact is a shared Carbon v15 container, not a tagged-chunk
|
|
40
|
+
package; the GLSL replaces the DXBC in each stage's program slot. Backend body
|
|
41
|
+
keys deliberately retain the historical `body_<offset>_<size>` form.
|
|
42
|
+
`EFFECT_PERMUTATION_GRAPH_CHUNK` (`PGRF`) still records every Cartesian
|
|
43
|
+
permutation, its option indices, its exact source record, and a
|
|
44
|
+
content-deduplicated body identity.
|
|
45
|
+
|
|
46
|
+
## Completeness
|
|
47
|
+
|
|
48
|
+
The build result reports four flags plus a separate qualification:
|
|
49
|
+
|
|
50
|
+
- `sourceComplete` is true only for version-15 effects.
|
|
51
|
+
- `backendComplete` remains false. Successful translation does not yet prove
|
|
52
|
+
the engine's physical binding/layout and transform contract.
|
|
53
|
+
- `runtimeComplete` remains false. Live shader objects and GPU handles are
|
|
54
|
+
outside the format package.
|
|
55
|
+
- `qualification.ok` separately reports whether the selected WebGL programs
|
|
56
|
+
translated and formed the required raster/compute families. It is returned
|
|
57
|
+
frozen.
|
|
58
|
+
|
|
59
|
+
Selected-only or technique/pass/stage-filtered packages still carry complete
|
|
60
|
+
version-15 source coverage, but only their selected backend programs.
|
|
61
|
+
|
|
62
|
+
Beyond those flags, `glslEffectCompleteness` runs checks that a translation can
|
|
63
|
+
be structurally valid and still be wrong. Two families are worth knowing about:
|
|
64
|
+
|
|
65
|
+
- `unlowered_local_light_family` — the recognised local-light constants
|
|
66
|
+
survived into GLSL without being lowered. It is deliberately scoped to that
|
|
67
|
+
one family: a general "every declared resource is used" rule fires on good
|
|
68
|
+
builds, because Carbon routinely describes resources a body does not read.
|
|
69
|
+
- `resource_transform_underfilled`, `_layer_gap`, `_carrier_undeclared`, and
|
|
70
|
+
`_input_still_bound` — a declared resource transform (the detail-map array is
|
|
71
|
+
the live case) did not complete. Each check is scoped to the stage the
|
|
72
|
+
transform names, and transform vocabulary is WGSL's: a transform saying
|
|
73
|
+
`fragment` applies to the WebGL `pixel` stage. Running them across every
|
|
74
|
+
stage in a pass instead produces 48 false positives.
|
|
75
|
+
|
|
76
|
+
### Measured link rate
|
|
77
|
+
|
|
78
|
+
Across all 4,833 shipped compiled effects, **9,319 of 9,321 emitted programs
|
|
79
|
+
compile and link in a real WebGL2 context.** Before the DXBC SM5.1 range-id
|
|
80
|
+
operand fix the rate was near 61%, and the failures were the lesser half of the
|
|
81
|
+
problem: shaders that *did* link were reading constant-buffer rows off the
|
|
82
|
+
register number, and in 56 of 161 multi-dimensional resource operands were
|
|
83
|
+
bound to the wrong texture entirely.
|
|
84
|
+
|
|
85
|
+
## Tier and permutation policy
|
|
86
|
+
|
|
87
|
+
For EVE shader work:
|
|
88
|
+
|
|
89
|
+
- High is `.sm_depth`.
|
|
90
|
+
- Medium is `.sm_hi`.
|
|
91
|
+
- Low is `.sm_lo`.
|
|
92
|
+
- Unpacked Quad V5 evidence must explicitly select `SOPPT_ENABLED`; the
|
|
93
|
+
default permutation is commonly PPT-off and is not representative.
|
|
94
|
+
|
|
95
|
+
Always resolve an option tuple against the current source axes. Do not persist
|
|
96
|
+
a permutation index across builds.
|
|
97
|
+
|
|
40
98
|
## Start here
|
|
41
99
|
|
|
42
100
|
```js
|
|
@@ -49,7 +107,7 @@ const packageData = CjsWebglFormat.read(packageBytes);
|
|
|
49
107
|
## Documentation map
|
|
50
108
|
|
|
51
109
|
- [Architecture and ownership](architecture.md)
|
|
52
|
-
- [
|
|
110
|
+
- [Carbon compiled-effect container](../carbon-effect-container.md)
|
|
53
111
|
- [Constant-buffer layouts](carbon-constant-layouts.md)
|
|
54
112
|
- [Declaration and I/O lowering](decl-io.md)
|
|
55
113
|
- [Structured-memory lowering](memory-structured.md)
|
|
@@ -8,37 +8,37 @@ Summary: Defines the package's compiler, container, runtime, and engine boundari
|
|
|
8
8
|
## Purpose
|
|
9
9
|
|
|
10
10
|
`format-webgl` is the transformation and package layer between compiled
|
|
11
|
-
Carbon-style effects and WebGL engine realization. It emits
|
|
12
|
-
and GLSL ES 3.00 without constructing mutable runtime shader classes or
|
|
13
|
-
objects.
|
|
11
|
+
Carbon-style effects and WebGL engine realization. It emits Carbon container
|
|
12
|
+
bytes and GLSL ES 3.00 without constructing mutable runtime shader classes or
|
|
13
|
+
WebGL objects.
|
|
14
14
|
|
|
15
15
|
## Dependency direction
|
|
16
16
|
|
|
17
17
|
```text
|
|
18
18
|
@carbonenginejs/runtime-resource/formats/hlsl
|
|
19
19
|
|
|
|
20
|
-
+---- effect parsing and
|
|
20
|
+
+---- effect parsing and permutation analysis
|
|
21
21
|
|
|
|
22
22
|
v
|
|
23
23
|
@carbonenginejs/runtime-resource/formats/webgl <---- @carbonenginejs/runtime-resource/formats/dxbc
|
|
24
24
|
| decoded DXBC
|
|
25
25
|
|
|
|
26
|
-
+----
|
|
26
|
+
+---- Carbon container bytes, metadata, GLSL
|
|
27
27
|
|
|
|
28
|
-
+---- runtime-resource ----
|
|
28
|
+
+---- runtime-resource ---- option selection + Tr2Shader
|
|
29
29
|
+---- runtime-trinity ----- effect/material facade + parameters
|
|
30
30
|
`---- WebGL engine -------- GPU realization
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Tools may call the public byte-oriented API, but the format package does not
|
|
34
|
-
import the toolchain. Runtime packages
|
|
35
|
-
|
|
34
|
+
import the toolchain. Runtime packages read the emitted container bytes
|
|
35
|
+
directly.
|
|
36
36
|
|
|
37
37
|
## Owned responsibilities
|
|
38
38
|
|
|
39
|
-
-
|
|
39
|
+
- Building the shared Carbon v15 container for the WebGL backend, with GLSL in
|
|
40
|
+
each stage's program slot.
|
|
40
41
|
- Preserving every source permutation and unique body identity.
|
|
41
|
-
- Packing complete version-15 portable reflection and exact shared bytes.
|
|
42
42
|
- Translating supported DXBC vertex, pixel, and bounded map-style compute
|
|
43
43
|
stages into GLSL ES 3.00.
|
|
44
44
|
- Preserving backend bodies, stages, programs, manifests, and render states.
|
|
@@ -46,12 +46,11 @@ an explicit adapter boundary.
|
|
|
46
46
|
|
|
47
47
|
## Ownership elsewhere
|
|
48
48
|
|
|
49
|
-
- `format-hlsl` owns compiled-effect parsing and
|
|
50
|
-
schema.
|
|
49
|
+
- `format-hlsl` owns compiled-effect parsing and permutation analysis.
|
|
51
50
|
- `format-dxbc` owns DXBC decoding.
|
|
52
|
-
- `runtime-resource` owns `Tr2EffectRes`,
|
|
53
|
-
per-permutation cache identity, canonical `Tr2Shader`, reflection
|
|
54
|
-
|
|
51
|
+
- `runtime-resource` owns `Tr2EffectRes`, the container bytes, option
|
|
52
|
+
selection, per-permutation cache identity, canonical `Tr2Shader`, reflection
|
|
53
|
+
records, and sampler setup records.
|
|
55
54
|
- `runtime-trinity` owns the mutable `Tr2Effect`/`Tr2Material` facade,
|
|
56
55
|
parameters, authored options, and sampler overrides.
|
|
57
56
|
- The WebGL engine owns program compilation, locations, layouts, resource
|
|
@@ -59,12 +58,12 @@ an explicit adapter boundary.
|
|
|
59
58
|
|
|
60
59
|
## Completeness boundary
|
|
61
60
|
|
|
62
|
-
|
|
61
|
+
A version-15 build can be source-complete while remaining backend- and
|
|
63
62
|
runtime-incomplete. Successful GLSL translation and compile/link do not prove
|
|
64
63
|
the engine's physical binding/layout contract or a rendered result.
|
|
65
64
|
|
|
66
65
|
## Related documentation
|
|
67
66
|
|
|
68
67
|
- [Package documentation](README.md)
|
|
69
|
-
- [
|
|
68
|
+
- [Carbon compiled-effect container](../carbon-effect-container.md)
|
|
70
69
|
- [Class-purpose catalog](reference/classes/README.md)
|
|
@@ -5,7 +5,7 @@ Scope: Carbon/Trinity constant-buffer layouts used by `@carbonenginejs/runtime-r
|
|
|
5
5
|
Audience: Shader translators, runtime packers, and engine integrators
|
|
6
6
|
Summary: Maps Carbon constant-buffer registers and field layouts for WebGL integration.
|
|
7
7
|
|
|
8
|
-
> Produced 2026-07-05 from ../carbonengine source (authoritative) for the
|
|
8
|
+
> Produced 2026-07-05 from ../carbonengine source (authoritative) for the Carbon WebGL
|
|
9
9
|
> per-frame/per-object packer in ccpwgl. All register offsets are in float4
|
|
10
10
|
> (vec4) units. File references are relative to
|
|
11
11
|
> `../carbonengine/trinity/trinity/`.
|
|
@@ -271,8 +271,8 @@ cascaded-shadow + froxel tail (95 regs) is absent in ccpwgl.
|
|
|
271
271
|
In Carbon DX11, cb3[26]=boneOffsets, cb3[27]=morph, cb3[28]=customData, and
|
|
272
272
|
joints live in the separate `BoneTransforms` structured buffer (69 max,
|
|
273
273
|
Float4x3). ccpwgl WebGL2 splices 58 joints inline at cb3[26..199] instead.
|
|
274
|
-
The
|
|
275
|
-
dedicated
|
|
274
|
+
The Carbon WebGL path keeps Carbon's shape: cb3 stays 29 regs, joints go to the
|
|
275
|
+
dedicated CjsSb UBO (capacity 69). Bone-count note: Carbon
|
|
276
276
|
TR2_MAX_BONES_PER_MESHAREA=69 vs ccpwgl inline 58 (likely a WebGL uniform
|
|
277
277
|
budget choice, not a Carbon constant).
|
|
278
278
|
|
|
@@ -543,7 +543,7 @@ target lowering is "emit nothing" — worth flagging clearly to the implementing
|
|
|
543
543
|
engineer so they don't go looking for a `s0` GLSL symbol; the register-stable name
|
|
544
544
|
`s0` only shows up in Carbon binding-manifest metadata (`CARBONENGINEJS-FORK.md`:
|
|
545
545
|
"`s0`" is one of the register-stable symbols this fork preserves for
|
|
546
|
-
`
|
|
546
|
+
`HlslEffectBindingManifest`), not in the GLSL source text itself.
|
|
547
547
|
|
|
548
548
|
**Confidence: high** — the Vulkan/non-Vulkan branch is unconditional and
|
|
549
549
|
unambiguous; the only judgment call is confirming this project always wants
|
|
@@ -622,7 +622,7 @@ attribute channels, including blend indices, as float vertex attributes via
|
|
|
622
622
|
`gl.vertexAttribPointer` (not `vertexAttribIPointer`)** — a real `uvec4 in_...`
|
|
623
623
|
declaration either fails to link against that float-typed buffer binding, or links
|
|
624
624
|
but silently produces garbage/invisible geometry
|
|
625
|
-
(`028-cewg-skinned-blend-index-abi-lowering.md`: "Raw
|
|
625
|
+
(`028-cewg-skinned-blend-index-abi-lowering.md`: "Raw Carbon WebGL validation can link
|
|
626
626
|
integer attributes, but ccpwgl runtime binding can still fail or produce invisible
|
|
627
627
|
geometry if the source reaches compile as `uvec4`."). The proven, validated fix
|
|
628
628
|
(`028-...md`; `TRANSPILING-GAPS.md` "Ranked helper action plan" documents the general
|
|
@@ -635,7 +635,7 @@ and bitcast at every *use* site instead: any instruction reading `in_BLENDINDICE
|
|
|
635
635
|
as an index wraps it in `floatBitsToUint(in_BLENDINDICES0)` (or, if the actual buffer
|
|
636
636
|
data was uploaded as plain float index values rather than bit-pattern-encoded uints —
|
|
637
637
|
verify per-attribute — a plain `uint(in_BLENDINDICES0.x)` truncating conversion
|
|
638
|
-
instead of a bitcast; the
|
|
638
|
+
instead of a bitcast; the Carbon WebGL lowering evidence describes casting at use sites but
|
|
639
639
|
does not pin down which of these two forms every producer used, see Confidence
|
|
640
640
|
below). This is the **general form** of the family-level "every register is a float
|
|
641
641
|
vec4" convention applied specifically to `dcl_input`: unlike the `r#` temp file
|
|
@@ -171,10 +171,18 @@ runnable WebGL2 GLSL for, restricted to the `BoneTransforms` skinning case
|
|
|
171
171
|
byteOffset" agreement check, silently no-opping the rewrite. The previous
|
|
172
172
|
worked example here was internally inconsistent with the very rewrite
|
|
173
173
|
contract it was illustrating.
|
|
174
|
-
2. A package-time rewrite pass
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
2. A package-time rewrite pass over the generated GLSL text, performing the
|
|
175
|
+
steps below **in this exact order**.
|
|
176
|
+
|
|
177
|
+
> **Superseded (2026-08-02).** This pass no longer exists. The emitter now
|
|
178
|
+
> declares vertex-stage structured buffers as `std140` UBOs when it emits the
|
|
179
|
+
> shader, with real bindings, rather than rewriting text afterwards — see
|
|
180
|
+
> `DxbcGlslEmitter.js`, the `dcl_resource_structured` vertex branch. The
|
|
181
|
+
> regex functions it describes were deleted from
|
|
182
|
+
> `scripts/packageTr2WebglEffect.js`, so the line citations below point at
|
|
183
|
+
> nothing. The section is kept because it records *why* each rewrite was
|
|
184
|
+
> needed, which the ccpwgl runtime ABI still constrains; read it as history,
|
|
185
|
+
> not as a description of the code.
|
|
178
186
|
1. Strip the `#ifdef GL_ARB_shader_storage_buffer_object` /
|
|
179
187
|
`GL_ARB_shader_image_load_store` extension guard blocks (regexes at
|
|
180
188
|
`packageTr2WebglEffect.js:832-833`).
|
|
@@ -215,7 +223,7 @@ runnable WebGL2 GLSL for, restricted to the `BoneTransforms` skinning case
|
|
|
215
223
|
place** (`packageTr2WebglEffect.js:886,890,895,898` all `return match`) —
|
|
216
224
|
this is a silent-failure edge case the implementing engineer must guard
|
|
217
225
|
against (add a diagnostic) rather than trust to fail loudly.
|
|
218
|
-
8. If any rewrite happened, inject a `//
|
|
226
|
+
8. If any rewrite happened, inject a `// Carbon WebGL: BoneTransforms lowered to cb3
|
|
219
227
|
JointMat rows.` marker comment after `#version 300 es`
|
|
220
228
|
(`packageTr2WebglEffect.js:859-861`).
|
|
221
229
|
|
|
@@ -229,8 +237,19 @@ pixel `usampler2D` data textures (see `DxbcGlslEmitter.js` `dcl_resource_structu
|
|
|
229
237
|
pixel branch), which compiles but consumes a texture unit each; on real drivers
|
|
230
238
|
the `_depth` quad variants overflow `MAX_TEXTURE_IMAGE_UNITS`(16).
|
|
231
239
|
|
|
232
|
-
**
|
|
233
|
-
|
|
240
|
+
**Superseded (2026-08-02) — the lights fit, and are kept.** The two light
|
|
241
|
+
buffers now lower to a single packed `RGBA32UI` data texture rather than one
|
|
242
|
+
texture each, which frees two units, and the `Detail1/2/3Map` textures merge into
|
|
243
|
+
one array texture, which frees one or two more. Both `.sm_depth` quad variants
|
|
244
|
+
land at or under 16 with lighting intact: `unpackedskinned_quaddetailv5` at 15,
|
|
245
|
+
`unpackedskinned_quadheatdetailv5` at 16. See
|
|
246
|
+
`/docs/contracts/webgl2-texture-budget.md`. Dropping the lights is still
|
|
247
|
+
available as `--stub-light-resources` for isolating a lighting problem, but it is
|
|
248
|
+
no longer the answer to the budget. The paragraph below describes that opt-in
|
|
249
|
+
path and remains accurate.
|
|
250
|
+
|
|
251
|
+
**Earlier resolution (2026-07-08) — stub, not rewrite.** Since Carbon WebGL does not
|
|
252
|
+
support this tiled lighting, the packager can DROP it instead of lowering it. Run
|
|
234
253
|
`packageTr2WebglEffect.js --stub-light-resources`: it resolves the light resource
|
|
235
254
|
names (`LightBuffer`, `LightIndexBuffer`, `LightProfileArray`) to `t#` registers
|
|
236
255
|
from the Carbon `.sm` reflection (RDEF is stripped, so names live only there —
|
|
@@ -239,7 +258,7 @@ sb11/sb12/s13) and passes them to `emitGlsl` as `stubResourceRegisters`. The
|
|
|
239
258
|
emitter then drops their decl+binding and lowers reads to `uintBitsToFloat(0u)`
|
|
240
259
|
(structured) / `vec4(0.0)` (sampled) — zeroing the per-tile light count makes the
|
|
241
260
|
light loop dead. The packager also strips those `resource` bindings from the
|
|
242
|
-
manifest JSON (`stripLightResourcesFromManifest`) so the
|
|
261
|
+
manifest JSON (`stripLightResourcesFromManifest`) so the Carbon WebGL runtime does not
|
|
243
262
|
synthesize a texture def (glType 0 → "Invalid shader texture definition") for the
|
|
244
263
|
now-undeclared light buffers. Opt-in, default off; every other package is
|
|
245
264
|
unchanged. A functional light constant-buffer path remains possible but was not
|
|
@@ -74,7 +74,7 @@ Ground truth: `toGLSLOperand.cpp:1738-1882` (`ResourceName`, `TextureSamplerName
|
|
|
74
74
|
`ResourceName`, when `useCombinedTextureSamplers` is true — `toGLSLInstruction.cpp:1332-1336`).
|
|
75
75
|
This is deliberate register-identity preservation per `CARBONENGINEJS-FORK.md`
|
|
76
76
|
("emitting deterministic register-stable GLSL symbols such as `cb3`, `t0`, and `s0`" /
|
|
77
|
-
"preserving enough register identity for `
|
|
77
|
+
"preserving enough register identity for `HlslEffectBindingManifest`... and eventual
|
|
78
78
|
trinityjs binding work"): the emitter must keep declaring the bare `t#` uniform even
|
|
79
79
|
though the sampling calls use the combined name, so downstream tooling can still find a
|
|
80
80
|
`t#`-named uniform to correlate against Carbon metadata.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Status: Evolving
|
|
4
4
|
Scope: `@carbonenginejs/runtime-resource/formats/webgpu`
|
|
5
5
|
Audience: Shader-tool authors, engine integrators, and maintainers
|
|
6
|
-
Summary: Explains the Carbon-record
|
|
6
|
+
Summary: Explains the Carbon-record Carbon WebGPU format, compiled-effect conversion API, and bounded DXBC-to-WGSL compiler.
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
9
9
|
|
|
@@ -26,7 +26,7 @@ translation gate. Backend and runtime completeness remain broader gates.
|
|
|
26
26
|
|
|
27
27
|
Use the WebGPU format subpath when you need to:
|
|
28
28
|
|
|
29
|
-
- inspect or build a `.
|
|
29
|
+
- inspect or build a `.carbonwebgpu` package;
|
|
30
30
|
- analyze caller-supplied compiled effect bytes;
|
|
31
31
|
- lower supported DXBC vertex and fragment programs to WGSL;
|
|
32
32
|
- build one collision-free WebGPU binding layout across a complete pass; or
|
|
@@ -79,6 +79,6 @@ For compiled-effect conversion, continue with the
|
|
|
79
79
|
- [Architecture and boundaries](architecture.md)
|
|
80
80
|
- [Effect packaging guide](guides/effect-packaging.md)
|
|
81
81
|
- [Public API reference](reference/api.md)
|
|
82
|
-
- [
|
|
82
|
+
- [Carbon WebGPU package format](formats/carbon-webgpu.md)
|
|
83
83
|
- [WGSL compatibility](reference/wgsl-compatibility.md)
|
|
84
84
|
- [Class-purpose catalog](reference/classes/README.md)
|
|
@@ -23,7 +23,7 @@ creating live GPU objects.
|
|
|
23
23
|
@carbonenginejs/runtime-resource/formats/webgpu <---- @carbonenginejs/runtime-resource/formats/dxbc
|
|
24
24
|
| decoded DXBC
|
|
25
25
|
|
|
|
26
|
-
+----
|
|
26
|
+
+---- Carbon WebGPU bytes, analysis, WGSL, canonical layouts
|
|
27
27
|
|
|
|
28
28
|
v
|
|
29
29
|
@carbonenginejs/engine-webgpu
|
|
@@ -35,7 +35,7 @@ then package data to the engine.
|
|
|
35
35
|
|
|
36
36
|
## Owned responsibilities
|
|
37
37
|
|
|
38
|
-
- Reading, inspecting, and building Carbon-record
|
|
38
|
+
- Reading, inspecting, and building Carbon-record Carbon WebGPU containers.
|
|
39
39
|
- Resolving one compiled-effect permutation and complete pass.
|
|
40
40
|
- Preserving every source permutation row and representable non-program
|
|
41
41
|
description field; non-dynamic sampler names are unrecoverable and stage
|
|
@@ -55,8 +55,7 @@ then package data to the engine.
|
|
|
55
55
|
## Ownership elsewhere
|
|
56
56
|
|
|
57
57
|
- `@carbonenginejs/runtime-resource/formats/hlsl` owns compiled-effect parsing, permutation resolution,
|
|
58
|
-
unique-body enumeration, binding-manifest interpretation
|
|
59
|
-
body-local portable reflection schema/validator.
|
|
58
|
+
unique-body enumeration, and binding-manifest interpretation.
|
|
60
59
|
- `@carbonenginejs/runtime-resource/formats/dxbc` owns DXBC container and instruction decoding.
|
|
61
60
|
- `@carbonenginejs/engine-webgpu` owns `GPUDevice`, shader-module compilation, bind groups,
|
|
62
61
|
pipelines, resource realization, device loss, and draw execution.
|
|
@@ -71,7 +70,7 @@ then package data to the engine.
|
|
|
71
70
|
|
|
72
71
|
The public class accepts `ArrayBuffer`, typed-array, and compatible byte views.
|
|
73
72
|
Its source does not read files, inspect processes, or invoke native programs.
|
|
74
|
-
This allows applications to fetch or select bytes and build
|
|
73
|
+
This allows applications to fetch or select bytes and build Carbon WebGPU data in a
|
|
75
74
|
browser.
|
|
76
75
|
|
|
77
76
|
The repository's command-line scripts are development adapters over the same
|
|
@@ -92,5 +91,5 @@ listed in [WGSL compatibility](reference/wgsl-compatibility.md).
|
|
|
92
91
|
## Related documentation
|
|
93
92
|
|
|
94
93
|
- [Package documentation](README.md)
|
|
95
|
-
- [
|
|
94
|
+
- [Carbon WebGPU package format](formats/carbon-webgpu.md)
|
|
96
95
|
- [Public API reference](reference/api.md)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Carbon WebGPU effect container
|
|
2
2
|
|
|
3
3
|
Status: Evolving
|
|
4
4
|
Scope: `@carbonenginejs/runtime-resource/formats/webgpu`
|
|
@@ -7,7 +7,7 @@ Summary: Defines the Carbon v15 record container used for WebGPU effects, its ba
|
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
9
9
|
|
|
10
|
-
A `.
|
|
10
|
+
A `.carbonwebgpu` file is a stock Carbon version-15 compiled-effect container whose
|
|
11
11
|
program slots carry WGSL instead of DXBC. It preserves every permutation row
|
|
12
12
|
and representable non-program description/reflection fields. Non-dynamic
|
|
13
13
|
sampler names are unrecoverable and stage order is canonicalized. Source-stage
|
|
@@ -15,10 +15,10 @@ programs are not stored: a translated slot contains WGSL and an untranslated slo
|
|
|
15
15
|
Each translated pass may also carry one WebGPU backend block containing
|
|
16
16
|
bind-group layouts and resource transforms.
|
|
17
17
|
|
|
18
|
-
There is no
|
|
18
|
+
There is no Carbon WebGPU-specific magic, envelope, payload tag, or container version.
|
|
19
19
|
Backend identity comes from the resource path, such as `effect.webgpu/`, just
|
|
20
20
|
as Carbon selects `effect.dx11/`, `effect.dx12/`, or `effect.metal/`.
|
|
21
|
-
`
|
|
21
|
+
`isCarbonWebgpu(bytes)` is therefore only a Carbon-v15 shape check. It cannot prove
|
|
22
22
|
that arbitrary version-15 bytes contain WGSL.
|
|
23
23
|
|
|
24
24
|
## Wire layout
|
|
@@ -34,7 +34,7 @@ outline, the file contains:
|
|
|
34
34
|
emitted-description-byte aliases sharing that body; and
|
|
35
35
|
- one optional backend block after each pass's render states.
|
|
36
36
|
|
|
37
|
-
The Carbon region is backend-invariant.
|
|
37
|
+
The Carbon region is backend-invariant. Carbon WebGPU substitutes:
|
|
38
38
|
|
|
39
39
|
- UTF-8 WGSL in each translated stage's `shaderData`;
|
|
40
40
|
- the fixed entry point `main`, which is omitted from the wire because every
|
|
@@ -48,7 +48,7 @@ remain represented without pretending WebGPU can execute them.
|
|
|
48
48
|
|
|
49
49
|
## No stored chunks
|
|
50
50
|
|
|
51
|
-
The former flat
|
|
51
|
+
The former flat Carbon WebGPU format stored `INFO`, `META`, `PGRF`, `RFLX`, `RBLB`,
|
|
52
52
|
`ANLS`, `WGSL`, and `WGSB` chunks. The current wire stores none of them.
|
|
53
53
|
|
|
54
54
|
Equivalent read surfaces are derived from the one Carbon record tree:
|
|
@@ -65,19 +65,18 @@ Equivalent read surfaces are derived from the one Carbon record tree:
|
|
|
65
65
|
|
|
66
66
|
`Read(..., { emit: "json" })` returns these compatibility views as plain data.
|
|
67
67
|
They are not independent stored documents and carry no cross-document digests.
|
|
68
|
-
`Read(..., { emit: "raw" })` returns the internal `
|
|
68
|
+
`Read(..., { emit: "raw" })` returns the internal `CarbonWebgpuContainer` reader.
|
|
69
69
|
There is no `chunks` array and no generic `Build(chunks)` API.
|
|
70
70
|
|
|
71
71
|
## Building
|
|
72
72
|
|
|
73
73
|
`BuildEffect` accepts version-15 compiled-effect bytes only. It parses the
|
|
74
74
|
complete input, resolves the requested permutation, lowers selected programs,
|
|
75
|
-
and writes a new Carbon v15 container.
|
|
76
|
-
|
|
77
|
-
source hash are not retained in the emitted wire.
|
|
75
|
+
and writes a new Carbon v15 container. Source-stage program bytes and the
|
|
76
|
+
caller's source hash are not retained in the emitted wire.
|
|
78
77
|
|
|
79
78
|
The returned build record is richer than the bytes. Its `info`, `metadata`,
|
|
80
|
-
`permutationGraph`, `
|
|
79
|
+
`permutationGraph`, `analysis`, `wgsl`, `backendBodySet`, `inspection`, and
|
|
81
80
|
`qualification` fields are build-time evidence for callers. They must not be
|
|
82
81
|
interpreted as separate records stored in the container.
|
|
83
82
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# Build a
|
|
1
|
+
# Build a Carbon WebGPU package from compiled effect bytes
|
|
2
2
|
|
|
3
3
|
Status: Evolving
|
|
4
4
|
Scope: `@carbonenginejs/runtime-resource/formats/webgpu`
|
|
5
5
|
Audience: Shader-tool authors and engine integrators
|
|
6
|
-
Summary: Shows how to translate version-15 compiled effects into Carbon-record
|
|
6
|
+
Summary: Shows how to translate version-15 compiled effects into Carbon-record Carbon WebGPU bytes.
|
|
7
7
|
|
|
8
8
|
## Purpose
|
|
9
9
|
|
|
@@ -57,8 +57,8 @@ The emitted bytes are a stock Carbon v15 effect container:
|
|
|
57
57
|
- translated passes may carry a WebGPU backend block with bind-group layouts
|
|
58
58
|
and resource transforms.
|
|
59
59
|
|
|
60
|
-
Source-stage DXBC and the original source hash are not stored in
|
|
61
|
-
|
|
60
|
+
Source-stage DXBC and the original source hash are not stored in Carbon WebGPU bytes.
|
|
61
|
+
The build result no longer carries any source-reflection document; it was removed with the intermediate format. What remains in memory is
|
|
62
62
|
`BuildEffect` result.
|
|
63
63
|
|
|
64
64
|
There are no stored `INFO`, `META`, `PGRF`, `RFLX`, `ANLS`, `WGSL`, or `WGSB`
|
|
@@ -96,12 +96,10 @@ The returned record contains build-time evidence in addition to `bytes`:
|
|
|
96
96
|
|
|
97
97
|
| Field | Purpose |
|
|
98
98
|
| --- | --- |
|
|
99
|
-
| `bytes` | Carbon v15
|
|
99
|
+
| `bytes` | Carbon v15 Carbon WebGPU bytes. |
|
|
100
100
|
| `info` | Producer, source, translation-scope, and completeness evidence. |
|
|
101
101
|
| `metadata` | Resolved selection and caller provenance. |
|
|
102
102
|
| `permutationGraph` | Complete source permutation and body-alias view. |
|
|
103
|
-
| `reflection` | Complete portable source reflection used while building. |
|
|
104
|
-
| `reflectionBlobs` | Exact portable-reflection payload bytes. |
|
|
105
103
|
| `analysis` | Selected-body diagnostic analysis. |
|
|
106
104
|
| `wgsl` | Emitted shaders, layouts, and transforms. |
|
|
107
105
|
| `backendBodySet` | All-body translation result, or `null` in selected mode. |
|
|
@@ -185,7 +183,7 @@ in-memory derived status.
|
|
|
185
183
|
|
|
186
184
|
## Related documentation
|
|
187
185
|
|
|
188
|
-
- [
|
|
186
|
+
- [Carbon WebGPU effect container](../formats/carbon-webgpu.md)
|
|
189
187
|
- [Public API reference](../reference/api.md)
|
|
190
188
|
- [WGSL compatibility](../reference/wgsl-compatibility.md)
|
|
191
189
|
- [Carbon compiled-effect container](../../carbon-effect-container.md)
|
|
@@ -39,10 +39,10 @@ const reader = new WebgpuFormat({
|
|
|
39
39
|
| `SetClass(type, Class)` | Registers or removes one constructor. |
|
|
40
40
|
| `GetClass(type)` | Returns one registered constructor. |
|
|
41
41
|
| `HasClass(type)` | Reports whether a constructor is registered. |
|
|
42
|
-
| `Read(bytes, options?)` | Reads Carbon-record
|
|
42
|
+
| `Read(bytes, options?)` | Reads Carbon-record Carbon WebGPU bytes. |
|
|
43
43
|
| `Inspect(bytes, options?)` | Returns a compact container summary. |
|
|
44
44
|
| `AnalyzeEffect(bytes, options?)` | Analyzes compiled-effect bytes without packaging. |
|
|
45
|
-
| `BuildEffect(bytes, options?)` | Translates a version-15 effect to
|
|
45
|
+
| `BuildEffect(bytes, options?)` | Translates a version-15 effect to Carbon WebGPU bytes. |
|
|
46
46
|
| `BuildShaderIr(input, options?)` | Builds validated shader IR from DXBC or decoded input. |
|
|
47
47
|
| `BuildWgsl(input, options?)` | Emits supported shader IR as WGSL. |
|
|
48
48
|
| `BuildWgslBindingPlan(programs, options?)` | Allocates one binding layout across a pass. |
|
|
@@ -56,18 +56,18 @@ not a generic chunk container.
|
|
|
56
56
|
|
|
57
57
|
| Static helper | Purpose |
|
|
58
58
|
| --- | --- |
|
|
59
|
-
| `
|
|
59
|
+
| `isCarbonWebgpu(bytes)` | Reports whether bytes have the Carbon-v15 shape. |
|
|
60
60
|
| `read(bytes, options?)` | Reads one container. |
|
|
61
61
|
| `inspect(bytes, options?)` | Inspects one container. |
|
|
62
62
|
| `analyzeEffect(bytes, options?)` | Analyzes one compiled effect. |
|
|
63
|
-
| `buildEffect(bytes, options?)` | Builds
|
|
63
|
+
| `buildEffect(bytes, options?)` | Builds Carbon WebGPU bytes from a version-15 effect. |
|
|
64
64
|
| `buildShaderIr(input, options?)` | Builds shader IR. |
|
|
65
65
|
| `buildWgsl(input, options?)` | Emits WGSL. |
|
|
66
66
|
| `buildWgslBindingPlan(programs, options?)` | Allocates a pass binding plan. |
|
|
67
67
|
| `buildWgslSet(entries)` | Builds a portable WGSL set. |
|
|
68
68
|
| `toJSON(value)` | Converts output to JSON-compatible data. |
|
|
69
69
|
|
|
70
|
-
`
|
|
70
|
+
`isCarbonWebgpu` checks the first dword for Carbon version 15. Carbon WebGPU has no private
|
|
71
71
|
magic or payload tag, so this is a shape check rather than backend identity.
|
|
72
72
|
Callers establish identity through the resource path that supplied the bytes.
|
|
73
73
|
|
|
@@ -114,11 +114,10 @@ DXBC instructions and compiler IR.
|
|
|
114
114
|
|
|
115
115
|
`BuildEffect` is narrower: current packaging requires the version-15 record
|
|
116
116
|
layout. The wire retains every permutation row and non-program description
|
|
117
|
-
field that the mapping can represent
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
is transient and is neither stored in the wire nor returned by `BuildEffect`.
|
|
117
|
+
field that the mapping can represent, including non-dynamic sampler names and
|
|
118
|
+
the file's authored pass-stage order. Source-stage DXBC and the caller's source
|
|
119
|
+
hash are not retained in the wire. Compiler IR is transient and is neither
|
|
120
|
+
stored in the wire nor returned by `BuildEffect`.
|
|
122
121
|
|
|
123
122
|
Unknown, duplicate, or unresolved permutation assertions fail closed.
|
|
124
123
|
|
|
@@ -148,7 +147,7 @@ consumer's resource path.
|
|
|
148
147
|
|
|
149
148
|
- `bytes`;
|
|
150
149
|
- build-time `info` and `metadata`;
|
|
151
|
-
- `permutationGraph
|
|
150
|
+
- `permutationGraph`;
|
|
152
151
|
- selected `analysis` and `wgsl`;
|
|
153
152
|
- `backendBodySet` for all mode;
|
|
154
153
|
- an `inspection` obtained by rereading the emitted bytes; and
|
|
@@ -192,6 +191,6 @@ points, and malformed backend blocks.
|
|
|
192
191
|
## Related documentation
|
|
193
192
|
|
|
194
193
|
- [Effect packaging guide](../guides/effect-packaging.md)
|
|
195
|
-
- [
|
|
194
|
+
- [Carbon WebGPU effect container](../formats/carbon-webgpu.md)
|
|
196
195
|
- [WGSL compatibility](wgsl-compatibility.md)
|
|
197
196
|
- [Class-purpose catalog](classes/README.md)
|
|
@@ -1273,10 +1273,10 @@ used before the Carbon-container switchover. Their corpus counts remain
|
|
|
1273
1273
|
compiler and provenance evidence; `INFO`, `META`, `PGRF`, `RFLX`, `RBLB`,
|
|
1274
1274
|
`ANLS`, and `WGSL` are no longer stored chunks. Current bytes are Carbon
|
|
1275
1275
|
version-15 records with derived compatibility views. See
|
|
1276
|
-
[
|
|
1276
|
+
[Carbon WebGPU effect container](../formats/carbon-webgpu.md).
|
|
1277
1277
|
|
|
1278
1278
|
At the 0.4.2 checkpoint, `BuildEffect` emitted selected-effect INFO schema
|
|
1279
|
-
version 2 while the binary
|
|
1279
|
+
version 2 while the binary Carbon WebGPU container remained version 1. INFO v2
|
|
1280
1280
|
recorded the WebGPU target,
|
|
1281
1281
|
backend-package and translator semantic versions, and a lower-case SHA-256
|
|
1282
1282
|
digest computed over the exact compiled-effect input byte view. A conflicting
|
|
@@ -1311,9 +1311,8 @@ are unchanged; old readers tolerate the additive chunk.
|
|
|
1311
1311
|
|
|
1312
1312
|
The 0.4.4 selected-reflection checkpoint adds complete version-15 reflection
|
|
1313
1313
|
for the selected body in `RFLX`, with every exact byte vector externalized into
|
|
1314
|
-
canonical deduplicated `RBLB` records.
|
|
1315
|
-
|
|
1316
|
-
reconstruction; package validation also reconciles INFO source identity,
|
|
1314
|
+
canonical deduplicated `RBLB` records. A body-reflection validator was rerun
|
|
1315
|
+
after reconstruction; package validation also reconciles INFO source identity,
|
|
1317
1316
|
META/PGRF body identity, and every ANLS pass/stage source record. Earlier
|
|
1318
1317
|
effect versions retain the legacy package surface. All-body reflection remains
|
|
1319
1318
|
unsupported, so source/backend/runtime completeness remain false.
|
|
@@ -1335,7 +1334,7 @@ qualified packages:
|
|
|
1335
1334
|
A packed-package Chrome smoke builds and reads a real version-15 effect in the
|
|
1336
1335
|
browser, resolves all reflected byte references, structured-clones the JSON
|
|
1337
1336
|
view, and fails closed after raw blob corruption with no console errors. The
|
|
1338
|
-
engine prepares a newly generated real `quads.sm_hi`
|
|
1337
|
+
engine prepares a newly generated real `quads.sm_hi` Carbon WebGPU package with 10
|
|
1339
1338
|
canonical bindings and zero WGSL warnings. The high-tier
|
|
1340
1339
|
`unpacked_quadv5.sm_depth` DX11 self-pair remains exhaustively qualified across
|
|
1341
1340
|
480 bodies, 4,480 emitted stage occurrences, and 2,240 ready pass occurrences;
|
|
@@ -1347,8 +1346,12 @@ reflection for every unique version-15 source body while ANLS/WGSL remain
|
|
|
1347
1346
|
selected-backend data. `GetPortableEffectReflection(permutationIndex)` exposes
|
|
1348
1347
|
any package permutation as a fresh, format-hlsl-validated document with owned
|
|
1349
1348
|
byte payloads. `runtime-resource` owns `Tr2EffectRes` selection, canonical
|
|
1350
|
-
`Tr2Shader`
|
|
1351
|
-
an engine concern.
|
|
1349
|
+
`Tr2Shader` construction, and the per-index cache; renderer-owned handles
|
|
1350
|
+
remain an engine concern.
|
|
1351
|
+
|
|
1352
|
+
That RFLX/RBLB apparatus and its accessor were removed after this checkpoint.
|
|
1353
|
+
`Tr2EffectRes` now reads the Carbon container directly; the entries above are
|
|
1354
|
+
retained as the record of what the format did at the time.
|
|
1352
1355
|
|
|
1353
1356
|
An exhaustive build-3444265 oracle retains 507 qualified, 30 unsupported, and
|
|
1354
1357
|
zero failed/unqualified results. For all 507 emitted packages, `META`, `PGRF`,
|