@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,11 +3,9 @@
3
3
  Status: Evolving
4
4
  Scope: `@carbonenginejs/runtime-resource/formats/webgpu`
5
5
  Audience: Shader-tool authors and engine integrators
6
- Summary: Lists the public `CjsWebgpuFormat` profile, one-shot helpers, options, and output contracts.
6
+ Summary: Lists the public WebGPU format profile, byte-oriented helpers, options, and output contracts.
7
7
 
8
- ## Export
9
-
10
- The package root exports `CjsWebgpuFormat` as both a named and default export:
8
+ ## Import
11
9
 
12
10
  ```js
13
11
  import CjsWebgpuFormat, {
@@ -15,15 +13,19 @@ import CjsWebgpuFormat, {
15
13
  } from "@carbonenginejs/runtime-resource/formats/webgpu";
16
14
  ```
17
15
 
16
+ The default and named exports refer to the same class.
17
+
18
18
  ## Reusable profile
19
19
 
20
- Construct a profile when several operations share output, source, permutation,
21
- schema, or class-registration options:
20
+ Construct a profile when several operations share output, source, schema, or
21
+ class-registration options. `permutation` is also reusable by `AnalyzeEffect`
22
+ and `BuildEffect`; current `Read` and `Inspect` derive the translated body or
23
+ Carbon defaults and do not consume that profile field:
22
24
 
23
25
  ```js
24
26
  const reader = new WebgpuFormat({
25
27
  emit: "json",
26
- source: "example.cewgpu",
28
+ source: "res:/graphics/effect.webgpu/example.sm_hi",
27
29
  decodeInstructions: true,
28
30
  permutation: null
29
31
  });
@@ -32,166 +34,164 @@ const reader = new WebgpuFormat({
32
34
  | Instance method | Purpose |
33
35
  | --- | --- |
34
36
  | `SetValues(options)` | Merges reusable profile defaults. |
35
- | `GetValues(options?)` | Returns effective values with optional per-call overrides. |
37
+ | `GetValues(options?)` | Returns effective values with optional overrides. |
36
38
  | `SetClasses(classes)` | Registers several package-shape constructors. |
37
39
  | `SetClass(type, Class)` | Registers or removes one constructor. |
38
40
  | `GetClass(type)` | Returns one registered constructor. |
39
41
  | `HasClass(type)` | Reports whether a constructor is registered. |
40
- | `Read(bytes, options?)` | Reads CEWGPU bytes as JSON or a raw package. |
41
- | `Inspect(bytes, options?)` | Returns a package summary. |
42
- | `Build(chunks)` | Builds CEWGPU bytes from ordered chunks. |
43
- | `AnalyzeEffect(bytes, options?)` | Builds normalized analysis from compiled effect bytes. |
44
- | `BuildEffect(bytes, options?)` | Converts one selected effect body/pass scope into CEWGPU data. |
45
- | `BuildShaderIr(input, options?)` | Builds validated shader IR from DXBC bytes or decoded input. |
46
- | `BuildWgsl(input, options?)` | Emits a supported typed shader as WGSL. |
47
- | `BuildWgslBindingPlan(programs, options?)` | Allocates one binding layout across a complete pass. |
42
+ | `Read(bytes, options?)` | Reads Carbon-record CEWGPU bytes. |
43
+ | `Inspect(bytes, options?)` | Returns a compact container summary. |
44
+ | `AnalyzeEffect(bytes, options?)` | Analyzes compiled-effect bytes without packaging. |
45
+ | `BuildEffect(bytes, options?)` | Translates a version-15 effect to CEWGPU bytes. |
46
+ | `BuildShaderIr(input, options?)` | Builds validated shader IR from DXBC or decoded input. |
47
+ | `BuildWgsl(input, options?)` | Emits supported shader IR as WGSL. |
48
+ | `BuildWgslBindingPlan(programs, options?)` | Allocates one binding layout across a pass. |
48
49
  | `BuildWgslSet(entries)` | Assembles emitted shaders and pass layouts. |
49
50
  | `ToJSON(value)` | Converts format output to JSON-compatible data. |
50
51
 
51
- `Read` currently returns plain data. Class registrations are validated and
52
- stored for forward compatibility but do not hydrate the returned package.
53
- Raw output is an internal zero-copy package view; callers must treat its chunk
54
- bytes as immutable and reread/rebuild after any byte change.
52
+ There is no `Build(chunks)` method. The current wire is a Carbon record tree,
53
+ not a generic chunk container.
55
54
 
56
- ## One-shot static helpers
57
-
58
- The static helpers use lower camel case and share the implementation of the
59
- instance methods:
55
+ ## Static helpers
60
56
 
61
57
  | Static helper | Purpose |
62
58
  | --- | --- |
63
- | `isCewgpu(bytes)` | Checks the `CWGP` package magic. |
64
- | `read(bytes, options?)` | Reads one package. |
65
- | `inspect(bytes, options?)` | Inspects one package. |
66
- | `build(chunks)` | Builds one package. |
59
+ | `isCewgpu(bytes)` | Reports whether bytes have the Carbon-v15 shape. |
60
+ | `read(bytes, options?)` | Reads one container. |
61
+ | `inspect(bytes, options?)` | Inspects one container. |
67
62
  | `analyzeEffect(bytes, options?)` | Analyzes one compiled effect. |
68
- | `buildEffect(bytes, options?)` | Builds one selected effect body/pass scope. |
63
+ | `buildEffect(bytes, options?)` | Builds CEWGPU bytes from a version-15 effect. |
69
64
  | `buildShaderIr(input, options?)` | Builds shader IR. |
70
65
  | `buildWgsl(input, options?)` | Emits WGSL. |
71
66
  | `buildWgslBindingPlan(programs, options?)` | Allocates a pass binding plan. |
72
- | `buildWgslSet(entries)` | Builds a portable shader set. |
67
+ | `buildWgslSet(entries)` | Builds a portable WGSL set. |
73
68
  | `toJSON(value)` | Converts output to JSON-compatible data. |
74
69
 
70
+ `isCewgpu` checks the first dword for Carbon version 15. CEWGPU has no private
71
+ magic or payload tag, so this is a shape check rather than backend identity.
72
+ Callers establish identity through the resource path that supplied the bytes.
73
+
75
74
  ## Profile options
76
75
 
77
76
  | Option | Meaning |
78
77
  | --- | --- |
79
- | `emit` | `"json"` by default or `"raw"` for the internal package object. |
78
+ | `emit` | `"json"` by default or `"raw"` for the internal container reader. |
80
79
  | `source` | Caller-owned diagnostic label; it is never opened. |
81
- | `decodeInstructions` | Includes decoded instruction and shader IR detail during analysis. |
82
- | `permutation` | Exact NAME=VALUE assertions as an array or `Map`. |
80
+ | `decodeInstructions` | Includes decoded instruction and IR detail during analysis. |
81
+ | `permutation` | Exact `NAME=VALUE` assertions for `AnalyzeEffect` and `BuildEffect`; ignored by current `Read` and `Inspect`. |
83
82
  | `schema` | Optional caller schema record retained by the profile. |
84
83
  | `classes` | Optional constructor registrations keyed by `CLASS_KEYS`. |
85
84
 
86
- `AnalyzeEffect` decodes real selected-body stage bytes for return-only
87
- diagnostics. `decodeInstructions: false` retains compact DXBC program metadata
88
- without instruction or IR trees. `BuildEffect` keeps those bytes transient for
89
- WGSL compilation and writes compact selected-body `ANLS` diagnostics instead.
90
- Both `AnalyzeEffect` and `BuildEffect` reject malformed, duplicate, unknown, or
91
- unresolved permutation assertions rather than silently selecting a default.
85
+ Class registrations are validated and stored for forward compatibility.
86
+ Current JSON reads return plain data rather than hydrated package classes.
87
+
88
+ Raw output is an internal reader over the same bytes. It is not a second wire
89
+ format and should not be persisted.
90
+
91
+ ## Read result
92
+
93
+ JSON `Read` returns:
94
+
95
+ - `format`, Carbon `version`, and `sourcePath`;
96
+ - derived `info` and `metadata`;
97
+ - the complete derived `permutationGraph`;
98
+ - derived `analysis`, `wgsl`, and `backendBodySet`;
99
+ - convenience `stages`, `shaders`, and `layouts` arrays.
100
+
101
+ These records are computed from the Carbon header, descriptions, WGSL program
102
+ slots, and backend blocks. They are not stored chunks. The old `chunks` field
103
+ is intentionally absent.
104
+
105
+ `Inspect` reports the source label, Carbon version, compiler-version bytes,
106
+ permutation count, distinct-body count, and resolved stage/shader/layout
107
+ counts.
108
+
109
+ ## Effect analysis
110
+
111
+ `AnalyzeEffect` accepts supported compiled-effect versions for diagnostic
112
+ analysis. It resolves exact permutation assertions and may include decoded
113
+ DXBC instructions and compiler IR.
114
+
115
+ `BuildEffect` is narrower: current packaging requires the version-15 record
116
+ layout. The wire retains every permutation row and non-program description
117
+ field that the mapping can represent; non-dynamic sampler names are
118
+ unrecoverable and stage order is canonicalized. Source-stage DXBC and the
119
+ caller's source hash are not retained in the wire. The build result retains
120
+ full portable source reflection, including source program bytes. Compiler IR
121
+ is transient and is neither stored in the wire nor returned by `BuildEffect`.
122
+
123
+ Unknown, duplicate, or unresolved permutation assertions fail closed.
92
124
 
93
125
  ## Effect-package options
94
126
 
95
- `BuildEffect` and `buildEffect` accept `mode: "selected"`, which remains the
96
- default. They resolve one permutation body and emit complete passes within the
97
- requested stage selection.
98
-
99
- `mode: "all"` additionally translates every unique source body into a `WGSB`
100
- chunk and reports `backendBodyCoverage: "all-unique"`, or `"partial"` when some
101
- body could not be lowered. It requires complete version-15 source reflection and
102
- fails closed on versions 8-14, which carry no validated body inventory. The
103
- orchestration compatibility option `allPermutations: true` selects the same
104
- mode, and `allPermutations: false` means selected mode.
105
-
106
- `CewgpuPackage.GetBackendBodyPrograms(permutationIndex)` resolves any
107
- permutation to its translated passes, defaulting to `META.bodyIndex`. It returns
108
- null when the package carries no all-body graph, and an explicitly unsupported
109
- record when that body could not be lowered.
110
-
111
- Both `GetBackendBodyPrograms` and `GetPortableEffectReflection` return null
112
- until the package has passed canonical envelope validation. Every documented
113
- read entry point validates, so this is transparent to normal consumers; it
114
- prevents a hand-assembled or tampered container from being hydrated as though
115
- it had been checked.
116
-
117
- `source` remains a caller-owned diagnostic label. An optional
118
- `sourceIdentity.logicalPath` records the canonical resource identity
119
- independently and may differ from that label. The builder records the exact
120
- source byte length and computes a lower-case SHA-256 digest over the active
121
- input byte view. A caller-supplied `sourceIdentity.sha256` is accepted only
122
- when it matches that digest.
123
-
124
- For version-15 input, `BuildEffect` emits INFO schema version 3 with explicit
125
- WebGPU target, backend-package name/version, translator provenance, and
126
- source/backend body coverage. Versions 8-14 emit INFO v2 without reflection.
127
- The CEWGPU binary container remains version 1. The reader retains legacy INFO
128
- v1, pre-PGRF INFO v2, and selected-body INFO v2/RFLX v1 support.
129
-
130
- New packages also emit a `PGRF` permutation graph and expose it as
131
- `result.permutationGraph`, JSON-read `permutationGraph`, and raw
132
- `CewgpuPackage.permutationGraph`. The graph contains every ordered axis,
133
- Cartesian permutation index, option-index tuple, source record, and
134
- package-local unique-body key/digest. `Inspect` reports `permutationCount` and
135
- `uniqueBodyCount`. This is complete source topology with identity-only bodies;
136
- it does not provide backend translation by itself.
137
-
138
- For version-15 input, new packages emit complete all-unique source reflection
139
- in RFLX v2 and exact referenced byte payloads in one shared `RBLB`. Build
140
- results expose
141
- these as `result.reflection` and `result.reflectionBlobs`. JSON reads expose
142
- `reflection` plus `reflectionBlobByteLength`; raw reads expose
143
- `CewgpuPackage.reflection`, `reflectionBlobBytes`, and
144
- `GetReflectionBlob(referenceOrKey)`. Raw reads also expose
145
- `GetPortableEffectReflection(permutationIndex)`: it performs the PGRF/RFLX
146
- join, expands every referenced payload to fresh owned `Uint8Array` values, and
147
- reruns the format-hlsl portable validator. Its optional index defaults to
148
- `META.bodyIndex`; legacy selected-body RFLX v1 accepts only its selected
149
- permutation. `GetReflectionBlob` remains the lower-level accessor and requires
150
- an object reference to match its stored key, offset, byte length, and digest
151
- exactly. `Inspect` reports reflection body/source-program/blob counts and blob
152
- byte length. The body count covers every PGRF unique body. The selector joins
153
- `META.bodyIndex -> PGRF.variants[index].bodyKey -> RFLX.bodies[].bodyKey`.
154
- Earlier source versions omit both chunks.
155
-
156
- The returned structural qualification separates preservation from execution.
157
- `packageValid` reports successful container construction. Version-15 INFO v3
158
- reports `sourceComplete: true` for the exact input's portable semantic graph
159
- while `backendComplete` and `runtimeComplete` remain false. Versions 8-14
160
- report all three completeness flags false. Source completeness does not embed
161
- raw body records, translate every body, construct a live `Tr2EffectRes`, or
162
- prove prepared pipelines/rendering. `GetPortableEffectReflection` reconstructs
163
- and validates fresh owned plain portable data; `runtime-resource`
164
- `Tr2EffectRes` performs canonical runtime-class hydration and selection. The
165
- accessor does not construct renderer-owned handles, layouts, resource sets, or
166
- stage programs.
127
+ `mode: "selected"` is the default. It translates the resolved body's
128
+ requested complete passes while keeping every permutation row and
129
+ representable non-program description fields in the container.
130
+
131
+ `mode: "all"` first lowers the resolved selection, so an unsupported resolved
132
+ body aborts the build. After that gate succeeds, unsupported later bodies
133
+ remain in the container with empty program slots and appear as unsupported in
134
+ the in-memory body-set view. `allPermutations: true` is a compatibility
135
+ spelling for all mode.
136
+
137
+ `selection` can name a technique, pass index, and complete stage list.
138
+ `bindingPolicy.sharedIdentities` may name compatible cross-stage resources
139
+ that are allowed to share one physical binding.
140
+
141
+ `source` remains a diagnostic label. `sourceIdentity` and `outputPath` are
142
+ returned build provenance; the wire's backend identity still comes from the
143
+ consumer's resource path.
144
+
145
+ ## Build result and qualification
146
+
147
+ `BuildEffect` returns:
148
+
149
+ - `bytes`;
150
+ - build-time `info` and `metadata`;
151
+ - `permutationGraph`, portable `reflection`, and `reflectionBlobs`;
152
+ - selected `analysis` and `wgsl`;
153
+ - `backendBodySet` for all mode;
154
+ - an `inspection` obtained by rereading the emitted bytes; and
155
+ - `qualification`.
156
+
157
+ The richer fields are caller evidence and are not separately stored in the
158
+ container.
159
+
160
+ `qualification.packageValid` reports structural construction. It does not
161
+ claim that every body translated, that a pipeline was prepared, or that a
162
+ draw succeeded. `backendComplete` and `runtimeComplete` retain those broader
163
+ boundaries.
164
+
165
+ ## Binding-plan and WGSL-set helpers
166
+
167
+ `BuildWgslBindingPlan` takes the complete program set for one pass.
168
+ Unshared D3D tuples receive stage-qualified `scopeIdentity` values. A tuple is
169
+ shared only when its base identity appears in `sharedIdentities` and the
170
+ declarations are compatible.
171
+
172
+ `BuildWgslSet` validates shader keys, layouts, numeric slots, and resource
173
+ transforms. Ordinary sets use version 2. A proven physical-resource
174
+ coalescing uses version 3 and carries an explicit transform recipe.
167
175
 
168
176
  ## Static metadata
169
177
 
170
- The class exposes output-mode constants, accepted class keys, media and input
171
- type metadata, implementation status, the CEWGPU format label, analysis format,
172
- and package version.
178
+ The class exposes `OUTPUT_JSON`, `OUTPUT_RAW`, `CLASS_KEYS`, `type`,
179
+ `mediaTypes`, `inputTypes`, `outputTypes`, `debugOutputTypes`,
180
+ `implementationStatus`, `format`, `analysisFormat`, and `packageVersion`.
173
181
 
174
182
  ## Errors
175
183
 
176
- Malformed package input and unsafe analysis paths throw or report a
177
- `CjsWebgpuReadError` internally. Unsupported WGSL semantics fail closed with
178
- the operation, stage, and source context needed to identify the boundary.
179
- Duplicate/non-ASCII chunk tags are rejected. A declared
180
- `tr2-effect-webgpu` package also fails closed on missing or malformed JSON
181
- chunks, unsupported document versions, or inconsistent INFO/META/ANLS/WGSL
182
- identity, counts, keys, layouts, selection, and completeness fields. Declared
183
- PGRF pointers, exact INFO-v3 chunk digests, schemas, counts, variant tuples,
184
- body references, and the selected index/options are reconciled as part of the
185
- same gate. Optional
186
- INFO/RFLX/RBLB reflection units additionally reconcile the exact RFLX digest,
187
- every PGRF body and representative, portable closed schemas, exact blob
188
- references/digests, and the selected body's ANLS pass/stage source identities.
189
- Strict effect validation is activated by the `INFO.packageKind` marker;
190
- effect-only consumers must require that marker because unmarked CEWGPU
191
- containers intentionally remain generic.
184
+ Reads fail closed on malformed Carbon records, sparse or misordered
185
+ permutation tables, out-of-range arena references, trailing record bytes, or a
186
+ program-bearing stage WebGPU cannot express.
187
+
188
+ Builds additionally fail on unsupported source versions, invalid selection,
189
+ unsupported compiler semantics, ambiguous binding plans, non-`main` entry
190
+ points, and malformed backend blocks.
192
191
 
193
192
  ## Related documentation
194
193
 
195
194
  - [Effect packaging guide](../guides/effect-packaging.md)
196
- - [CEWGPU package format](../formats/cewgpu.md)
195
+ - [CEWGPU effect container](../formats/cewgpu.md)
196
+ - [WGSL compatibility](wgsl-compatibility.md)
197
197
  - [Class-purpose catalog](classes/README.md)
@@ -1,66 +1,9 @@
1
- # Class catalog
1
+ # WebGPU class catalog
2
2
 
3
- Status: Evolving
3
+ Status: Deprecated
4
4
  Scope: `@carbonenginejs/runtime-resource/formats/webgpu` maintained classes
5
5
  Audience: Users, maintainers, and automated readers
6
- Summary: Provides one-sentence purpose descriptors for every maintained class in the WebGPU format package.
6
+ Summary: Points to the canonical package-wide class catalog after format-package consolidation.
7
7
 
8
- <!-- class:CjsWebgpuFormat -->
9
- ## `CjsWebgpuFormat`
10
-
11
- CarbonEngineJS-facing format surface for `.cewgpu` WebGPU packages, plus an offline effect-analysis helper built on `format-hlsl` and `format-dxbc`.
12
-
13
- - Export: `@carbonenginejs/runtime-resource/formats/webgpu`
14
- - Source: `src/CjsWebgpuFormat.js`
15
- - Visibility: Public
16
- - Kind: CarbonEngineJS
17
-
18
- <!-- class:CjsWebgpuReadError -->
19
- ## `CjsWebgpuReadError`
20
-
21
- Error raised when a CEWGPU package or WebGPU analysis pass cannot be completed safely.
22
-
23
- - Export: None
24
- - Source: `src/core/errors.js`
25
- - Visibility: Internal
26
- - Kind: Internal implementation
27
-
28
- <!-- class:CjsBinaryReader -->
29
- ## `CjsBinaryReader`
30
-
31
- Minimal little-endian binary reader for the flat CEWGPU chunk container.
32
-
33
- - Export: None
34
- - Source: `src/core/cewgpu/binary.js`
35
- - Visibility: Internal
36
- - Kind: Internal implementation
37
-
38
- <!-- class:CewgpuPackage -->
39
- ## `CewgpuPackage`
40
-
41
- Reader for CarbonEngineJS CEWGPU shader packages.
42
-
43
- - Export: None
44
- - Source: `src/core/cewgpu/CewgpuPackage.js`
45
- - Visibility: Internal
46
- - Kind: Internal implementation
47
-
48
- <!-- class:CewgpuPackageBuilder -->
49
- ## `CewgpuPackageBuilder`
50
-
51
- Builds CarbonEngineJS CEWGPU package bytes.
52
-
53
- - Export: None
54
- - Source: `src/core/cewgpu/CewgpuPackageBuilder.js`
55
- - Visibility: Internal
56
- - Kind: Internal implementation
57
-
58
- <!-- class:ReflectionBlobStore -->
59
- ## `ReflectionBlobStore`
60
-
61
- Builds the deterministic deduplicated byte arena for complete source reflection.
62
-
63
- - Export: None
64
- - Source: `src/core/effectReflectionPackage.js`
65
- - Visibility: Internal
66
- - Kind: Internal implementation
8
+ The maintained WebGPU entries now live in the
9
+ [package-wide formats class catalog](../../../../reference/classes/formats.md#webgpu).