@carbonenginejs/runtime-resource 0.12.0 → 0.12.1

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.
Files changed (170) hide show
  1. package/dist/CjsResMan.js +4 -4
  2. package/dist/CjsResMan.js.map +1 -1
  3. package/dist/_virtual/_rollupPluginBabelHelpers.js +1 -4
  4. package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
  5. package/dist/format/CjsByteReader.js +310 -0
  6. package/dist/format/CjsByteReader.js.map +1 -0
  7. package/dist/format/CjsByteWriter.js +242 -0
  8. package/dist/format/CjsByteWriter.js.map +1 -0
  9. package/dist/format/CjsFormatError.js +41 -0
  10. package/dist/format/CjsFormatError.js.map +1 -0
  11. package/dist/format/CjsStringTable.js +268 -0
  12. package/dist/format/CjsStringTable.js.map +1 -0
  13. package/dist/format/carbonEffect/CjsCarbonEffectReader.js +361 -0
  14. package/dist/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -0
  15. package/dist/format/carbonEffect/CjsCarbonEffectWriter.js +373 -0
  16. package/dist/format/carbonEffect/CjsCarbonEffectWriter.js.map +1 -0
  17. package/dist/format/carbonEffect/carbonDescriptionFromPortable.js +372 -0
  18. package/dist/format/carbonEffect/carbonDescriptionFromPortable.js.map +1 -0
  19. package/dist/format/carbonEffect/carbonEffectBackendBlock.js +427 -0
  20. package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -0
  21. package/dist/format/carbonEffect/carbonEffectRecords.js +955 -0
  22. package/dist/format/carbonEffect/carbonEffectRecords.js.map +1 -0
  23. package/dist/format/compareUtf8.js +36 -0
  24. package/dist/format/compareUtf8.js.map +1 -0
  25. package/dist/format/index.js +11 -0
  26. package/dist/format/index.js.map +1 -0
  27. package/dist/formats/bnk/CjsBnkFormat.js +10 -4
  28. package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
  29. package/dist/formats/bnk/core/eventAction.js +305 -0
  30. package/dist/formats/bnk/core/eventAction.js.map +1 -0
  31. package/dist/formats/bnk/core/helpers.js +11 -2
  32. package/dist/formats/bnk/core/helpers.js.map +1 -1
  33. package/dist/formats/bnk/core/nodeBase.js +532 -0
  34. package/dist/formats/bnk/core/nodeBase.js.map +1 -0
  35. package/dist/formats/bnk/core/sfxNodes.js +252 -152
  36. package/dist/formats/bnk/core/sfxNodes.js.map +1 -1
  37. package/dist/formats/hlsl/core/HlslReader.js +7 -257
  38. package/dist/formats/hlsl/core/HlslReader.js.map +1 -1
  39. package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js +781 -0
  40. package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -0
  41. package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +21 -1
  42. package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -1
  43. package/dist/formats/index.js +1 -1
  44. package/dist/formats/webgl/core/cewg/CewgPackage.js +2 -1
  45. package/dist/formats/webgl/core/cewg/CewgPackage.js.map +1 -1
  46. package/dist/formats/webgl/core/cewg/binary.js +11 -93
  47. package/dist/formats/webgl/core/cewg/binary.js.map +1 -1
  48. package/dist/formats/webgl/core/effectPackage.js +1 -1
  49. package/dist/formats/webgpu/CjsWebgpuFormat.js +4 -23
  50. package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  51. package/dist/formats/webgpu/core/buildCarbonEffectContainer.js +197 -0
  52. package/dist/formats/webgpu/core/buildCarbonEffectContainer.js.map +1 -0
  53. package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js +368 -0
  54. package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js.map +1 -0
  55. package/dist/formats/webgpu/core/cewgpu/containerViews.js +355 -0
  56. package/dist/formats/webgpu/core/cewgpu/containerViews.js.map +1 -0
  57. package/dist/formats/webgpu/core/cewgpu/validateContainer.js +90 -0
  58. package/dist/formats/webgpu/core/cewgpu/validateContainer.js.map +1 -0
  59. package/dist/formats/webgpu/core/effectBackendBodySet.js +21 -20
  60. package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
  61. package/dist/formats/webgpu/core/helpers.js +87 -92
  62. package/dist/formats/webgpu/core/helpers.js.map +1 -1
  63. package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js +14 -13
  64. package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js.map +1 -1
  65. package/dist/formats/webgpu/core/ir/inferValueTypes.js +10 -8
  66. package/dist/formats/webgpu/core/ir/inferValueTypes.js.map +1 -1
  67. package/dist/formats/webgpu/core/packageEffect.js +94 -9
  68. package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
  69. package/dist/formats/webgpu/core/packageMetadata.js +10 -1
  70. package/dist/formats/webgpu/core/packageMetadata.js.map +1 -1
  71. package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +17 -15
  72. package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -1
  73. package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js +13 -12
  74. package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js.map +1 -1
  75. package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +9 -8
  76. package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
  77. package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js +23 -22
  78. package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js.map +1 -1
  79. package/dist/formats/webgpu/core/wgsl/selectionPlans.js +46 -44
  80. package/dist/formats/webgpu/core/wgsl/selectionPlans.js.map +1 -1
  81. package/dist/resource/CjsResource.js +700 -684
  82. package/dist/resource/CjsResource.js.map +1 -1
  83. package/dist/resource/Tr2LightProfileRes.js +18 -27
  84. package/dist/resource/Tr2LightProfileRes.js.map +1 -1
  85. package/dist/resource/audio/CjsAudioBufferRes.js +2 -2
  86. package/dist/resource/audio/CjsAudioBufferRes.js.map +1 -1
  87. package/dist/resource/audio/CjsAudioRes.js +2 -2
  88. package/dist/resource/audio/CjsAudioRes.js.map +1 -1
  89. package/dist/resource/geometry/TriGeometryRes.js +605 -586
  90. package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
  91. package/dist/resource/geometry/granny/Tr2GrannyStateRes.js +21 -30
  92. package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -1
  93. package/dist/resource/geometry/granny/TriGrannyRes.js +21 -30
  94. package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -1
  95. package/dist/resource/shader/Tr2EffectRes.js +9 -7
  96. package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
  97. package/dist/resource/shader/Tr2MaterialArea.js +5 -3
  98. package/dist/resource/shader/Tr2MaterialArea.js.map +1 -1
  99. package/dist/resource/shader/Tr2MaterialMesh.js +4 -2
  100. package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -1
  101. package/dist/resource/shader/Tr2MaterialRes.js +5 -3
  102. package/dist/resource/shader/Tr2MaterialRes.js.map +1 -1
  103. package/dist/resource/shader/Tr2Shader.js +26 -21
  104. package/dist/resource/shader/Tr2Shader.js.map +1 -1
  105. package/dist/resource/shader/Tr2ShaderPermutation.js +8 -6
  106. package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -1
  107. package/dist/resource/shader/reflection/Tr2EffectDefine.js +5 -3
  108. package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -1
  109. package/dist/resource/shader/reflection/Tr2EffectDescription.js +5 -3
  110. package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
  111. package/dist/resource/shader/reflection/Tr2EffectLibrary.js +17 -15
  112. package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
  113. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +11 -9
  114. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
  115. package/dist/resource/shader/reflection/Tr2EffectResource.js +8 -6
  116. package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
  117. package/dist/resource/shader/reflection/Tr2EffectStageInput.js +15 -13
  118. package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
  119. package/dist/resource/shader/reflection/Tr2EffectTechnique.js +7 -5
  120. package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
  121. package/dist/resource/shader/reflection/Tr2Pass.js +11 -9
  122. package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
  123. package/dist/resource/shader/sampler/Tr2SamplerSetup.js +8 -6
  124. package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
  125. package/dist/resource/texture/CjsTextureArrayRes.js +400 -411
  126. package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
  127. package/dist/resource/texture/Tr2ImageRes.js +99 -95
  128. package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
  129. package/dist/resource/texture/TriTextureRes.js +312 -273
  130. package/dist/resource/texture/TriTextureRes.js.map +1 -1
  131. package/docs/README.md +13 -1
  132. package/docs/architecture.md +3 -3
  133. package/docs/concepts/resource-lifecycle.md +9 -2
  134. package/docs/concepts/shader-resource-model.md +114 -0
  135. package/docs/concepts/writing-an-engine-adapter.md +115 -0
  136. package/docs/formats/README.md +24 -1
  137. package/docs/formats/carbon-effect-container.md +452 -0
  138. package/docs/formats/dxbc/reference/classes/README.md +5 -72
  139. package/docs/formats/hlsl/reference/api.md +5 -4
  140. package/docs/formats/hlsl/reference/classes/README.md +6 -11
  141. package/docs/formats/provenance.md +23 -13
  142. package/docs/formats/webgl/reference/classes/README.md +5 -92
  143. package/docs/formats/webgpu/README.md +19 -16
  144. package/docs/formats/webgpu/architecture.md +15 -12
  145. package/docs/formats/webgpu/formats/cewgpu.md +175 -438
  146. package/docs/formats/webgpu/guides/effect-packaging.md +132 -140
  147. package/docs/formats/webgpu/reference/api.md +131 -131
  148. package/docs/formats/webgpu/reference/classes/README.md +5 -62
  149. package/docs/formats/webgpu/reference/wgsl-compatibility.md +146 -45
  150. package/docs/formats/wwise.md +34 -8
  151. package/docs/reference/classes/core.md +80 -0
  152. package/docs/reference/classes/formats.md +18 -28
  153. package/docs/reference/events.md +25 -0
  154. package/docs/reference/motherlode-cache.md +22 -8
  155. package/docs/reference/workers.md +5 -5
  156. package/docs/roadmap.md +61 -41
  157. package/package.json +2 -1
  158. package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js +0 -415
  159. package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js.map +0 -1
  160. package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js +0 -100
  161. package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js.map +0 -1
  162. package/dist/formats/webgpu/core/cewgpu/binary.js +0 -93
  163. package/dist/formats/webgpu/core/cewgpu/binary.js.map +0 -1
  164. package/dist/formats/webgpu/core/cewgpu/tags.js +0 -17
  165. package/dist/formats/webgpu/core/cewgpu/tags.js.map +0 -1
  166. package/dist/formats/webgpu/core/effectPackageValidation.js +0 -1078
  167. package/dist/formats/webgpu/core/effectPackageValidation.js.map +0 -1
  168. package/docs/formats/hlsl/reference/classes/carbon-compatibility.md +0 -66
  169. package/docs/formats/hlsl/reference/classes/public-api.md +0 -26
  170. package/docs/formats/hlsl/reference/classes/tr2-effect-model.md +0 -150
@@ -3,30 +3,18 @@
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 package the complete supported pass scope of one selected compiled-effect body as CEWGPU data.
6
+ Summary: Shows how to translate version-15 compiled effects into Carbon-record CEWGPU bytes.
7
7
 
8
8
  ## Purpose
9
9
 
10
- Use `buildEffect` when an application or build tool already has compiled
11
- effect bytes and needs one structurally valid CEWGPU package for a selected
12
- effect body. The operation performs effect analysis, exact selection,
13
- DXBC-to-IR lowering, pass-global binding allocation, WGSL emission, package
14
- assembly, and structural qualification.
10
+ Use `buildEffect` when a caller already has version-15 compiled-effect bytes
11
+ and needs a WebGPU-targeted effect container. The operation parses the complete
12
+ input, resolves a permutation, lowers supported DXBC, allocates pass-global
13
+ bindings, emits WGSL, writes a Carbon v15 container, and validates the result.
15
14
 
16
- ## Prerequisites
15
+ The method is byte-oriented and does not open files or resource paths.
17
16
 
18
- - Caller-supplied compiled `.sm_*` effect bytes.
19
- - An exact technique, pass index, and complete stage list when deterministic
20
- selection matters.
21
- - Permutation assertions for every axis whose value must not depend on effect
22
- defaults.
23
- - A complete, internally consistent source permutation header: every ordered
24
- axis must have valid names/options/defaults, and every Cartesian permutation
25
- must have one correctly indexed, in-bounds body record. PGRF construction
26
- validates the whole header even though only one body is translated. The
27
- synchronous builder accepts at most 65,536 Cartesian permutations.
28
-
29
- ## Build one pass
17
+ ## Build selected passes
30
18
 
31
19
  ```js
32
20
  import { CjsWebgpuFormat } from "@carbonenginejs/runtime-resource/formats/webgpu";
@@ -48,119 +36,111 @@ const packageBytes = result.bytes;
48
36
  const emittedShaders = result.wgsl;
49
37
  ```
50
38
 
51
- The `source` value is diagnostic provenance only. The method does not open
52
- that path. Callers may separately provide `sourceIdentity` with a canonical
53
- `logicalPath` plus optional `game`, `client`, `build`, `md5`, and `sha256`
54
- fields. Its logical path need not equal the diagnostic label. `BuildEffect`
55
- always computes the lower-case SHA-256 digest over the exact input byte view;
56
- when a caller supplies `sha256`, the build fails if it does not match.
57
-
58
- Version-15 packages use INFO schema version 3 while the binary CEWGPU
59
- container remains version 1. INFO v3 identifies the `webgpu` target, the
60
- producing `@carbonenginejs/runtime-resource/formats/webgpu` package version, and the
61
- `dxbc-js-wgsl` translator version. Versions 8-14 use INFO v2 without
62
- reflection. The reader continues to accept legacy INFO v1 packages, INFO v2
63
- packages without PGRF, and INFO v2 packages with selected-body RFLX v1.
64
-
65
- Every new selected-effect package also includes a complete source permutation
66
- graph in `PGRF`. This preserves every axis, Cartesian permutation index,
67
- option-index tuple, compiler alias, and unique raw body identity even though
68
- only one selected body's WGSL is currently packaged. INFO v3 binds the exact
69
- PGRF bytes with SHA-256.
70
-
71
- For version-15 input, the package also includes complete portable reflection
72
- for every unique source body in RFLX v2 and its exact immutable byte payloads
73
- in one shared `RBLB`. These include authored parameter/resource metadata,
74
- constant defaults, stage/library source programs, signatures, static samplers,
75
- annotations, and the opaque native source hash. Earlier source versions keep
76
- the legacy package surface because portable reflection version 1 is
77
- intentionally version-15-only.
78
-
79
- ## Result
80
-
81
- The returned record contains:
39
+ `source` is a caller-owned diagnostic label. An optional `sourceIdentity`
40
+ records build provenance in the returned result; it does not change the wire
41
+ identity, which belongs to the resource path used to load the emitted bytes.
42
+ When `sourceIdentity.sha256` is supplied, the build checks it against the exact
43
+ input bytes.
44
+
45
+ ## What the bytes contain
46
+
47
+ The emitted bytes are a stock Carbon v15 effect container:
48
+
49
+ - every source permutation remains in the dense offset table;
50
+ - each distinct emitted description body is stored once, based on exact emitted
51
+ bytes rather than the source alias partition;
52
+ - representable non-program description/reflection fields remain in the Carbon
53
+ tree; non-dynamic sampler names are unrecoverable and stage order is
54
+ canonicalized;
55
+ - translated stage program slots contain UTF-8 WGSL;
56
+ - untranslated or unsupported stage program slots have zero length; and
57
+ - translated passes may carry a WebGPU backend block with bind-group layouts
58
+ and resource transforms.
59
+
60
+ Source-stage DXBC and the original source hash are not stored in CEWGPU bytes.
61
+ Full portable source reflection remains available only in the in-memory
62
+ `BuildEffect` result.
63
+
64
+ There are no stored `INFO`, `META`, `PGRF`, `RFLX`, `ANLS`, `WGSL`, or `WGSB`
65
+ chunks. The read API derives compatible JSON views from the Carbon records.
66
+
67
+ ## Translation modes
68
+
69
+ ### Selected
70
+
71
+ `mode: "selected"` is the default. It translates the resolved body's requested
72
+ complete passes. Every permutation row and representable non-program
73
+ description fields remain in the container, but untranslated program slots are
74
+ empty.
75
+
76
+ Selected mode does not discard permutations. It narrows backend translation.
77
+
78
+ ### All
79
+
80
+ `mode: "all"` first lowers the resolved selection; an unsupported resolved body
81
+ aborts the build. Once that precondition succeeds, later bodies that lower
82
+ successfully carry WGSL and backend blocks. A later body outside the compiler's
83
+ current boundary remains present with non-program description fields and empty
84
+ program slots. The in-memory body-set view records its reason; a reread can
85
+ report only that it carries no translated programs.
86
+
87
+ Passes, rather than individual stages, are the translation unit because a pass
88
+ owns one binding plan and resource-transform plan.
89
+
90
+ The compatibility option `allPermutations: true` selects all mode.
91
+ `allPermutations: false` selects the requested `mode` or the selected default.
92
+
93
+ ## Build result
94
+
95
+ The returned record contains build-time evidence in addition to `bytes`:
82
96
 
83
97
  | Field | Purpose |
84
98
  | --- | --- |
85
- | `bytes` | Encoded CEWGPU package bytes. |
86
- | `info` | Translator and package information. |
87
- | `metadata` | Selection and caller provenance. |
88
- | `permutationGraph` | Complete source permutation topology and identity-only body table. |
89
- | `reflection` | Complete all-unique portable source reflection for version-15 input, otherwise `null`. |
90
- | `reflectionBlobs` | Exact RBLB bytes for reflected programs/defaults/native hash, otherwise `null`. |
91
- | `analysis` | Compact selected-body diagnostic binding/stage data; not lossless effect reflection. |
92
- | `wgsl` | Portable shader set and pass layouts. |
93
- | `inspection` | Summary produced by reading the built package. |
94
- | `qualification` | Structural conversion outcome. |
95
-
96
- `mode: "selected"` is the default and currently the only supported backend
97
- body mode. The package retains normalized analysis for that resolved body while
98
- emitting WGSL for the selected complete passes. PGRF retains the complete
99
- source permutation graph and RFLX/RBLB retain every unique version-15 body's
100
- portable source reflection. `META.bodyIndex` selects a PGRF variant; its
101
- `bodyKey` selects the matching RFLX body. A raw reader exposes that join as
102
- `GetPortableEffectReflection(permutationIndex)`, returning a freshly owned,
103
- format-hlsl-validated single-body document with every byte reference expanded
104
- to `Uint8Array`. `runtime-resource` `Tr2EffectRes` consumes that document,
105
- hydrates a canonical device-free `Tr2Shader`, and caches it by selected body
106
- index. Engines still own prepared pipelines and GPU realization.
107
-
108
- `mode: "all"` additionally packages translated programs, layouts, and resource
109
- transforms for every unique body in a `WGSB` chunk, and
110
- `GetBackendBodyPrograms(permutationIndex)` resolves any permutation to them.
111
- Because one pass of one body is the translation unit, bodies whose pass is
112
- byte-identical share a single stored unit rather than duplicating its WGSL.
113
- Bodies the compiler cannot lower stay in the package as explicitly unsupported
114
- records with a reason, and never remove that body's source reflection.
115
-
116
- JSON `Read` output exposes `reflection` with byte references and
117
- `reflectionBlobByteLength`. Consumers that need exact defaults or source
118
- program bytes use `Read(bytes, { emit: "raw" })`, then call
119
- `GetPortableEffectReflection(permutationIndex)`. Omit the index to use
120
- `META.bodyIndex`. For individual payload access,
121
- `GetReflectionBlob(referenceOrKey)` returns an owned `Uint8Array`; an object
122
- reference must exactly match its RFLX inventory entry.
123
-
124
- Raw stage bytecode, decoded DXBC instruction trees, and compiler IR are
125
- transient build inputs and are not embedded in `ANLS`. Use `AnalyzeEffect`
126
- when return-only DXBC/IR diagnostics are required.
127
-
128
- The qualification record distinguishes structural package validity from
129
- broader completeness. `packageValid` means only that the selected CEWGPU
130
- container passed required-chunk, schema, cross-document, key, layout, and
131
- selection reconciliation. Version-15 INFO v3 reports `sourceComplete: true`
132
- because PGRF plus RFLX/RBLB cover every unique body's portable reflection and
133
- immutable exact defaults for that exact input file. This does not embed raw
134
- body records or make CEWGPU an archive of the original `.sm_*` bytes.
135
- `backendComplete` would additionally require every required translated
136
- program, layout, and transform. `runtimeComplete` would require
137
- complete-resource hydration and selection. None of these fields is
138
- prepared-pipeline or rendered evidence. The same four booleans are retained
139
- under `INFO.completeness` in the package.
140
-
141
- Shader-tier and permutation evidence remain orthogonal to source reflection.
142
- High is `.sm_depth`; Medium is `.sm_hi`; Low is `.sm_lo`. Source completeness
143
- applies only to the exact input tier. For unpacked Quad ship gates, explicitly
144
- select `SPACE_OBJECT_PPT_ENABLED=SOPPT_ENABLED`: an all-unique RFLX does not
145
- turn a PPT-disabled selected WGSL body into PPT-on backend evidence.
146
-
147
- When exact semantic metadata and shader use prove an allowed physical resource
148
- coalescing, the returned WGSL document is a `CJS_WGSL_SET` version 3 record.
149
- Its `resourceTransforms` recipes are required runtime work, not optional
150
- diagnostics: the consumer must build the described resource and bind it through
151
- the matching transformed layout entry. See the package-format contract before
152
- passing version 3 output to an engine. Packages without transforms remain WGSL
153
- set version 2.
99
+ | `bytes` | Carbon v15 CEWGPU bytes. |
100
+ | `info` | Producer, source, translation-scope, and completeness evidence. |
101
+ | `metadata` | Resolved selection and caller provenance. |
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
+ | `analysis` | Selected-body diagnostic analysis. |
106
+ | `wgsl` | Emitted shaders, layouts, and transforms. |
107
+ | `backendBodySet` | All-body translation result, or `null` in selected mode. |
108
+ | `inspection` | Summary obtained by rereading the emitted bytes. |
109
+ | `qualification` | Structural build outcome and translation counts. |
110
+
111
+ These fields are returned data. They are not separate documents stored beside
112
+ the Carbon records.
113
+
114
+ `qualification.packageValid` means the emitted container passed structural
115
+ validation. It is not prepared-pipeline or rendered evidence.
116
+ `backendComplete` and `runtimeComplete` remain false until the broader compiler,
117
+ resource-hydration, selection, and execution gates are satisfied.
118
+
119
+ ## Read the result
154
120
 
155
- ## Binding scope
121
+ ```js
122
+ const summary = CjsWebgpuFormat.inspect(packageBytes, {
123
+ source: "res:/graphics/effect.webgpu/example.sm_hi"
124
+ });
125
+
126
+ const data = CjsWebgpuFormat.read(packageBytes, {
127
+ source: "res:/graphics/effect.webgpu/example.sm_hi"
128
+ });
129
+ ```
130
+
131
+ The JSON read derives `info`, `metadata`, `permutationGraph`, `analysis`,
132
+ `wgsl`, and `backendBodySet` views from the one record tree. It also exposes
133
+ convenience `stages`, `shaders`, and `layouts` arrays.
156
134
 
157
- A D3D resource tuple is stage-local unless the caller has authoritative
158
- metadata proving that the vertex and fragment declarations name one compatible
159
- resource. Build one binding plan from the complete stage set; do not build
160
- independent stage plans and combine them afterward.
135
+ Raw reads return the internal container reader. That surface is useful for
136
+ current package integration but is not a second artifact and should not be
137
+ persisted as a replacement wire format.
138
+
139
+ ## Binding scope
161
140
 
162
- When compatible sharing is proven, pass the base binding identity through
163
- `sharedIdentities`:
141
+ A D3D resource tuple is stage-local unless authoritative metadata proves that
142
+ the vertex and fragment declarations name one compatible resource. Build one
143
+ binding plan from the complete stage set.
164
144
 
165
145
  ```js
166
146
  const plan = CjsWebgpuFormat.buildWgslBindingPlan(
@@ -169,31 +149,43 @@ const plan = CjsWebgpuFormat.buildWgslBindingPlan(
169
149
  );
170
150
  ```
171
151
 
172
- Unshared identities receive distinct `@vertex` or `@fragment` scopes and
173
- numeric binding slots.
152
+ Unshared identities receive separate `@vertex` or `@fragment`
153
+ `scopeIdentity` values and numeric slots. Shared identities retain one bare
154
+ scope with combined visibility.
155
+
156
+ ## Resource transforms
157
+
158
+ When semantic metadata proves that several logical textures may be represented
159
+ by one physical array texture, the derived WGSL set uses version 3 and carries
160
+ a `texture-2d-array` transform recipe.
161
+
162
+ The consumer must assemble the named layers, match size/mips/sample
163
+ type/format, and bind the resulting array through the transformed layout.
164
+ Missing layers fail closed. A version-3 document is not executable evidence by
165
+ itself.
174
166
 
175
167
  ## Errors
176
168
 
177
169
  Conversion fails explicitly when:
178
170
 
171
+ - the source is not a version-15 compiled effect;
179
172
  - a permutation assertion is unknown or unresolved;
180
- - any axis/default/option or positional body record in the complete source
181
- permutation header is malformed, out of bounds, partially overlapping, or
182
- inconsistent, even when the selected body itself is translatable;
183
- - the Cartesian permutation product exceeds the 65,536-entry synchronous-build
184
- limit;
173
+ - the permutation table is sparse, misordered, out of bounds, or malformed;
185
174
  - the technique, pass, or requested stage does not exist;
186
- - the requested stage list is incomplete or duplicated;
175
+ - the requested stage list is duplicated or incomplete;
187
176
  - the selected shader uses unsupported semantics;
188
- - resource declarations cannot form one unambiguous pass layout; or
189
- - emitted package records fail structural validation.
177
+ - resource declarations cannot form one unambiguous pass layout;
178
+ - a lowerer emits an entry point other than `main`; or
179
+ - the emitted Carbon records or backend block fail structural validation.
190
180
 
191
- An unsupported requested shader aborts selected-pass packaging; no partially
192
- translated pass is emitted. This fail-closed behavior does not imply
193
- whole-effect completeness.
181
+ Unsupported selected programs abort selected-mode packaging and also abort the
182
+ initial selection gate in all mode. After that gate succeeds, an unsupported
183
+ later body remains represented with empty program slots and an explicit
184
+ in-memory derived status.
194
185
 
195
186
  ## Related documentation
196
187
 
188
+ - [CEWGPU effect container](../formats/cewgpu.md)
197
189
  - [Public API reference](../reference/api.md)
198
- - [CEWGPU package format](../formats/cewgpu.md)
199
190
  - [WGSL compatibility](../reference/wgsl-compatibility.md)
191
+ - [Carbon compiled-effect container](../../carbon-effect-container.md)