@carbonenginejs/runtime-resource 0.11.1 → 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 (211) 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 +18 -2
  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/graph.js +3 -6
  32. package/dist/formats/bnk/core/graph.js.map +1 -1
  33. package/dist/formats/bnk/core/helpers.js +62 -11
  34. package/dist/formats/bnk/core/helpers.js.map +1 -1
  35. package/dist/formats/bnk/core/nodeBase.js +532 -0
  36. package/dist/formats/bnk/core/nodeBase.js.map +1 -0
  37. package/dist/formats/bnk/core/sfxNodes.js +632 -0
  38. package/dist/formats/bnk/core/sfxNodes.js.map +1 -0
  39. package/dist/formats/bnk/core/soundbanksInfo.js +59 -51
  40. package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -1
  41. package/dist/formats/gr2/CjsGr2Format.js +256 -13
  42. package/dist/formats/gr2/CjsGr2Format.js.map +1 -1
  43. package/dist/formats/gr2/core/helpers.js +15 -15
  44. package/dist/formats/gr2/core/helpers.js.map +1 -1
  45. package/dist/formats/gr2/core/json.js +1 -1
  46. package/dist/formats/gr2/core/json.js.map +1 -1
  47. package/dist/formats/gr2/core/targets.js +1 -1
  48. package/dist/formats/gr2/core/targets.js.map +1 -1
  49. package/dist/formats/gr2/index.js +0 -1
  50. package/dist/formats/gr2/index.js.map +1 -1
  51. package/dist/formats/hlsl/core/HlslReader.js +7 -257
  52. package/dist/formats/hlsl/core/HlslReader.js.map +1 -1
  53. package/dist/formats/hlsl/core/analysis.js +1 -1
  54. package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js +781 -0
  55. package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -0
  56. package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +21 -1
  57. package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -1
  58. package/dist/formats/hlsl/index.js +1 -0
  59. package/dist/formats/hlsl/index.js.map +1 -1
  60. package/dist/formats/index.js +3 -6
  61. package/dist/formats/index.js.map +1 -1
  62. package/dist/formats/webgl/core/cewg/CewgPackage.js +2 -1
  63. package/dist/formats/webgl/core/cewg/CewgPackage.js.map +1 -1
  64. package/dist/formats/webgl/core/cewg/binary.js +11 -93
  65. package/dist/formats/webgl/core/cewg/binary.js.map +1 -1
  66. package/dist/formats/webgl/core/effectPackage.js +4 -1
  67. package/dist/formats/webgl/core/effectPackage.js.map +1 -1
  68. package/dist/formats/webgl/core/errors.js +3 -3
  69. package/dist/formats/webgl/core/errors.js.map +1 -1
  70. package/dist/formats/webgpu/CjsWebgpuFormat.js +4 -23
  71. package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  72. package/dist/formats/webgpu/core/buildCarbonEffectContainer.js +197 -0
  73. package/dist/formats/webgpu/core/buildCarbonEffectContainer.js.map +1 -0
  74. package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js +368 -0
  75. package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js.map +1 -0
  76. package/dist/formats/webgpu/core/cewgpu/containerViews.js +355 -0
  77. package/dist/formats/webgpu/core/cewgpu/containerViews.js.map +1 -0
  78. package/dist/formats/webgpu/core/cewgpu/validateContainer.js +90 -0
  79. package/dist/formats/webgpu/core/cewgpu/validateContainer.js.map +1 -0
  80. package/dist/formats/webgpu/core/effectBackendBodySet.js +21 -20
  81. package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
  82. package/dist/formats/webgpu/core/helpers.js +87 -92
  83. package/dist/formats/webgpu/core/helpers.js.map +1 -1
  84. package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js +14 -13
  85. package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js.map +1 -1
  86. package/dist/formats/webgpu/core/ir/inferValueTypes.js +10 -8
  87. package/dist/formats/webgpu/core/ir/inferValueTypes.js.map +1 -1
  88. package/dist/formats/webgpu/core/packageEffect.js +94 -9
  89. package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
  90. package/dist/formats/webgpu/core/packageMetadata.js +10 -1
  91. package/dist/formats/webgpu/core/packageMetadata.js.map +1 -1
  92. package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +17 -15
  93. package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -1
  94. package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js +13 -12
  95. package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js.map +1 -1
  96. package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +9 -8
  97. package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
  98. package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js +23 -22
  99. package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js.map +1 -1
  100. package/dist/formats/webgpu/core/wgsl/selectionPlans.js +46 -44
  101. package/dist/formats/webgpu/core/wgsl/selectionPlans.js.map +1 -1
  102. package/dist/resource/CjsResource.js +700 -684
  103. package/dist/resource/CjsResource.js.map +1 -1
  104. package/dist/resource/Tr2LightProfileRes.js +18 -27
  105. package/dist/resource/Tr2LightProfileRes.js.map +1 -1
  106. package/dist/resource/audio/CjsAudioBufferRes.js +2 -2
  107. package/dist/resource/audio/CjsAudioBufferRes.js.map +1 -1
  108. package/dist/resource/audio/CjsAudioRes.js +2 -2
  109. package/dist/resource/audio/CjsAudioRes.js.map +1 -1
  110. package/dist/resource/geometry/TriGeometryRes.js +605 -586
  111. package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
  112. package/dist/resource/geometry/granny/Tr2GrannyStateRes.js +21 -30
  113. package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -1
  114. package/dist/resource/geometry/granny/TriGrannyRes.js +21 -30
  115. package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -1
  116. package/dist/resource/shader/Tr2EffectRes.js +9 -7
  117. package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
  118. package/dist/resource/shader/Tr2MaterialArea.js +5 -3
  119. package/dist/resource/shader/Tr2MaterialArea.js.map +1 -1
  120. package/dist/resource/shader/Tr2MaterialMesh.js +4 -2
  121. package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -1
  122. package/dist/resource/shader/Tr2MaterialRes.js +5 -3
  123. package/dist/resource/shader/Tr2MaterialRes.js.map +1 -1
  124. package/dist/resource/shader/Tr2Shader.js +26 -21
  125. package/dist/resource/shader/Tr2Shader.js.map +1 -1
  126. package/dist/resource/shader/Tr2ShaderPermutation.js +8 -6
  127. package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -1
  128. package/dist/resource/shader/reflection/Tr2EffectDefine.js +5 -3
  129. package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -1
  130. package/dist/resource/shader/reflection/Tr2EffectDescription.js +5 -3
  131. package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
  132. package/dist/resource/shader/reflection/Tr2EffectLibrary.js +17 -15
  133. package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
  134. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +11 -9
  135. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
  136. package/dist/resource/shader/reflection/Tr2EffectResource.js +8 -6
  137. package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
  138. package/dist/resource/shader/reflection/Tr2EffectStageInput.js +15 -13
  139. package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
  140. package/dist/resource/shader/reflection/Tr2EffectTechnique.js +7 -5
  141. package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
  142. package/dist/resource/shader/reflection/Tr2Pass.js +11 -9
  143. package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
  144. package/dist/resource/shader/sampler/Tr2SamplerSetup.js +8 -6
  145. package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
  146. package/dist/resource/texture/CjsTextureArrayRes.js +400 -411
  147. package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
  148. package/dist/resource/texture/Tr2ImageRes.js +99 -95
  149. package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
  150. package/dist/resource/texture/TriTextureRes.js +312 -273
  151. package/dist/resource/texture/TriTextureRes.js.map +1 -1
  152. package/docs/README.md +13 -1
  153. package/docs/architecture.md +3 -3
  154. package/docs/concepts/resource-lifecycle.md +9 -2
  155. package/docs/concepts/shader-resource-model.md +114 -0
  156. package/docs/concepts/writing-an-engine-adapter.md +115 -0
  157. package/docs/formats/README.md +24 -1
  158. package/docs/formats/carbon-effect-container.md +452 -0
  159. package/docs/formats/dxbc/README.md +68 -0
  160. package/docs/formats/dxbc/architecture.md +80 -0
  161. package/docs/formats/dxbc/reference/api.md +77 -0
  162. package/docs/formats/dxbc/reference/classes/README.md +9 -0
  163. package/docs/formats/dxbc/reference/decoded-output.md +122 -0
  164. package/docs/formats/gr2.md +3 -4
  165. package/docs/formats/hlsl/README.md +54 -0
  166. package/docs/formats/hlsl/architecture.md +67 -0
  167. package/docs/formats/hlsl/guides/hydrating-json-output.md +62 -0
  168. package/docs/formats/hlsl/guides/reading-effects.md +64 -0
  169. package/docs/formats/hlsl/reference/advanced-analysis.md +66 -0
  170. package/docs/formats/hlsl/reference/api.md +98 -0
  171. package/docs/formats/hlsl/reference/classes/README.md +11 -0
  172. package/docs/formats/hlsl/reference/json-graph.md +100 -0
  173. package/docs/formats/hlsl/reference/portable-reflection.md +141 -0
  174. package/docs/formats/provenance.md +32 -17
  175. package/docs/formats/webgl/README.md +57 -0
  176. package/docs/formats/webgl/architecture.md +70 -0
  177. package/docs/formats/webgl/carbon-constant-layouts.md +326 -0
  178. package/docs/formats/webgl/decl-io.md +1234 -0
  179. package/docs/formats/webgl/effect-reflection.md +127 -0
  180. package/docs/formats/webgl/memory-structured.md +871 -0
  181. package/docs/formats/webgl/reference/classes/README.md +9 -0
  182. package/docs/formats/webgl/texture-sample.md +964 -0
  183. package/docs/formats/webgpu/README.md +84 -0
  184. package/docs/formats/webgpu/architecture.md +96 -0
  185. package/docs/formats/webgpu/formats/cewgpu.md +216 -0
  186. package/docs/formats/webgpu/guides/effect-packaging.md +191 -0
  187. package/docs/formats/webgpu/reference/api.md +197 -0
  188. package/docs/formats/webgpu/reference/classes/README.md +9 -0
  189. package/docs/formats/webgpu/reference/wgsl-compatibility.md +1543 -0
  190. package/docs/formats/wwise.md +45 -4
  191. package/docs/reference/classes/core.md +80 -0
  192. package/docs/reference/classes/formats.md +24 -34
  193. package/docs/reference/events.md +25 -0
  194. package/docs/reference/motherlode-cache.md +22 -8
  195. package/docs/reference/workers.md +5 -5
  196. package/docs/roadmap.md +61 -41
  197. package/format-notices/bnk/NOTICE +5 -4
  198. package/format-notices/webgl/NOTICE +1 -1
  199. package/package.json +2 -1
  200. package/dist/formats/gr2/core/CjsFormatGr2.js +0 -273
  201. package/dist/formats/gr2/core/CjsFormatGr2.js.map +0 -1
  202. package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js +0 -415
  203. package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js.map +0 -1
  204. package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js +0 -100
  205. package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js.map +0 -1
  206. package/dist/formats/webgpu/core/cewgpu/binary.js +0 -93
  207. package/dist/formats/webgpu/core/cewgpu/binary.js.map +0 -1
  208. package/dist/formats/webgpu/core/cewgpu/tags.js +0 -17
  209. package/dist/formats/webgpu/core/cewgpu/tags.js.map +0 -1
  210. package/dist/formats/webgpu/core/effectPackageValidation.js +0 -1078
  211. package/dist/formats/webgpu/core/effectPackageValidation.js.map +0 -1
@@ -16,20 +16,36 @@ manager behavior, or decoded-backend retention.
16
16
 
17
17
  `CjsBnkFormat.inspect()` decodes the chunk map, embedded media index, bank
18
18
  names, and the HIRC listing with version-stable typed fields (event action
19
- lists, action type/target, sound and music-track source ids; pinned against
20
- bank generator version 150). The Wwise-domain toolkit is grouped under the
21
- `CjsBnkFormat.wwise` static: the SoundbanksInfo catalog helpers, the FNV-1
22
- id hash, and event to media resolution:
19
+ lists, action type/target, sound and music-track source ids). For bank
20
+ generator version 150, recognized Event Actions additionally expose exact
21
+ scope/mode, property and range bundles, delay/transition/probability values,
22
+ fade and action flags, exceptions, and Play bank identities. The
23
+ Wwise-domain toolkit is grouped under the `CjsBnkFormat.wwise` static: the
24
+ SoundbanksInfo catalog helpers, the FNV-1 id hash, event-to-media resolution,
25
+ typed Event Actions, and typed authored-SFX nodes:
23
26
 
24
27
  ```js
25
28
  import { CjsBnkFormat } from "@carbonenginejs/runtime-resource/formats/bnk";
26
29
  import { CjsWemFormat } from "@carbonenginejs/runtime-resource/formats/wem";
27
30
 
28
31
  const inspections = bankByteArrays.map(bytes => CjsBnkFormat.inspect(bytes));
32
+ const action = CjsBnkFormat.wwise.parseEventAction(actionPayload, {
33
+ bankVersion: 150
34
+ });
29
35
  const { eventMedia } = CjsBnkFormat.wwise.eventMediaFromBanks(inspections);
30
36
  // eventMedia: Map<eventObjectId, Set<wemId>> - banks may split events from
31
37
  // their target sounds, so pass every related bank to one call.
32
38
 
39
+ const {
40
+ nodes,
41
+ nodeBases,
42
+ actorMixers,
43
+ attenuations,
44
+ events,
45
+ actions,
46
+ diagnostics
47
+ } = CjsBnkFormat.wwise.sfxNodesFromBanks(inspections);
48
+
33
49
  const ogg = CjsWemFormat.toOgg(wemBytes); // Wwise Vorbis -> Ogg (lossless)
34
50
  const pcm = CjsWemFormat.toPcm(wemBytes); // PTADPCM / 16-bit PCM -> float32
35
51
  ```
@@ -38,6 +54,31 @@ The read/inspect path stays a pure container reader;
38
54
  `wwise.eventMediaFromBanks` is graph interpretation offered for consumers
39
55
  with their own engines — the resource lifecycle never calls it.
40
56
 
57
+ The undecoded-container ID scan used by `eventMediaFromBanks` is diagnostic
58
+ reachability, not an authoritative playback program. Consumers requiring
59
+ audible correctness should use the typed `sfxNodesFromBanks` graph and fail
60
+ closed for unsupported events.
61
+
62
+ Typed authored-SFX tail decoding is deliberately pinned to bank generator
63
+ version 150. Recognized Event Actions are accepted only when the whole body
64
+ is consumed; unknown, truncated, other-version, or trailing-byte bodies retain
65
+ their shallow action type/target and raw payload, with `action: null`.
66
+ `nodes` contains playable Sound, Random/Sequence, Switch/State, and Layer
67
+ objects. The separate `nodeBases` map preserves common authored properties
68
+ and positioning facts for playable nodes and Actor-Mixers.
69
+ `actorMixers` contains HIRC type 7 hierarchy objects; they are inheritance
70
+ parents, not playable parallel containers. `attenuations` contains raw HIRC
71
+ type 14 cone data, signed curve-slot assignments, graph points, and RTPCs
72
+ without assigning application meaning to a curve.
73
+
74
+ Unsupported versions, failed exact-end anchors, ambiguities, NodeBase
75
+ failures, and duplicate object identities are reported through `diagnostics`
76
+ instead of being guessed. Consumers may resolve hierarchy and project
77
+ runtime-specific metadata from these raw facts. In particular, this format
78
+ layer does not infer a numeric maximum radius from an attenuation curve. Like
79
+ `eventMediaFromBanks`, `sfxNodesFromBanks` is consumer-facing graph
80
+ interpretation; the resource lifecycle never calls it.
81
+
41
82
  ## Related documentation
42
83
 
43
84
  - [Format subpaths](README.md)
@@ -115,6 +115,86 @@ Internal base for construction-bound readers that are created for one source and
115
115
  - Visibility: Internal
116
116
  - Kind: Internal implementation class
117
117
 
118
+ <!-- class:CjsFormatReadError -->
119
+ ## `CjsFormatReadError`
120
+
121
+ Error raised when shared binary format bytes cannot be decoded safely.
122
+
123
+ - Export: `@carbonenginejs/runtime-resource/format`
124
+ - Source: `src/format/CjsFormatError.js`
125
+ - Visibility: Public
126
+ - Kind: Original CarbonEngineJS class
127
+
128
+ <!-- class:CjsFormatWriteError -->
129
+ ## `CjsFormatWriteError`
130
+
131
+ Error raised when shared binary format bytes cannot be encoded safely.
132
+
133
+ - Export: `@carbonenginejs/runtime-resource/format`
134
+ - Source: `src/format/CjsFormatError.js`
135
+ - Visibility: Public
136
+ - Kind: Original CarbonEngineJS class
137
+
138
+ <!-- class:CjsByteReader -->
139
+ ## `CjsByteReader`
140
+
141
+ Little-endian cursor over resource bytes, with optional string-table arena resolution.
142
+
143
+ - Export: `@carbonenginejs/runtime-resource/format`
144
+ - Source: `src/format/CjsByteReader.js`
145
+ - Visibility: Public
146
+ - Kind: Original CarbonEngineJS class
147
+
148
+ <!-- class:CjsByteWriter -->
149
+ ## `CjsByteWriter`
150
+
151
+ Growable little-endian append cursor with reserve-and-patch support.
152
+
153
+ - Export: `@carbonenginejs/runtime-resource/format`
154
+ - Source: `src/format/CjsByteWriter.js`
155
+ - Visibility: Public
156
+ - Kind: Original CarbonEngineJS class
157
+
158
+ <!-- class:CjsStringTable -->
159
+ ## `CjsStringTable`
160
+
161
+ Carbon's compiled-effect string table: a deduplicated blob arena whose offsets are assigned by a bytewise sort rather than by insertion order.
162
+
163
+ - Export: `@carbonenginejs/runtime-resource/format`
164
+ - Source: `src/format/CjsStringTable.js`
165
+ - Visibility: Public
166
+ - Kind: Adapted Carbon concept
167
+
168
+ <!-- class:CjsCarbonEffectBodyReader -->
169
+ ## `CjsCarbonEffectBodyReader`
170
+
171
+ Plain byte cursor over one description blob, carrying the Carbon effect error class and message.
172
+
173
+ - Export: `@carbonenginejs/runtime-resource/format`
174
+ - Source: `src/format/carbonEffect/CjsCarbonEffectReader.js`
175
+ - Visibility: Public
176
+ - Kind: Adapted Carbon concept
177
+
178
+ <!-- class:CjsCarbonEffectReader -->
179
+ ## `CjsCarbonEffectReader`
180
+
181
+ Reader for Carbon's compiled-effect container at version 15.
182
+
183
+ - Export: `@carbonenginejs/runtime-resource/format`
184
+ - Source: `src/format/carbonEffect/CjsCarbonEffectReader.js`
185
+ - Visibility: Public
186
+ - Kind: Adapted Carbon concept
187
+
188
+ <!-- class:CjsCarbonEffectWriter -->
189
+ ## `CjsCarbonEffectWriter`
190
+
191
+ Builder for a Carbon compiled-effect container.
192
+
193
+ - Export: `@carbonenginejs/runtime-resource/format`
194
+ - Source: `src/format/carbonEffect/CjsCarbonEffectWriter.js`
195
+ - Visibility: Public
196
+ - Kind: Adapted Carbon concept
197
+
118
198
  <!-- class:CjsResourceProbe -->
119
199
  ## `CjsResourceProbe`
120
200
 
@@ -79,6 +79,26 @@ Little-endian byte cursor over HIRC payload bytes used to decode Wwise interacti
79
79
  - Visibility: Internal
80
80
  - Kind: Internal implementation class
81
81
 
82
+ <!-- class:WwiseCursor -->
83
+ ## `WwiseCursor`
84
+
85
+ Bounds-aware little-endian cursor used for exact Wwise v150 NodeBase, authored-SFX, and attenuation decoding.
86
+
87
+ - Export: `None`
88
+ - Source: `src/formats/bnk/core/nodeBase.js`
89
+ - Visibility: Internal
90
+ - Kind: Internal implementation class
91
+
92
+ <!-- class:ActionCursor -->
93
+ ## `ActionCursor`
94
+
95
+ Bounds-aware byte cursor used for exact Wwise v150 Event Action decoding.
96
+
97
+ - Export: `None`
98
+ - Source: `src/formats/bnk/core/eventAction.js`
99
+ - Visibility: Internal
100
+ - Kind: Internal implementation class
101
+
82
102
  ### cmf
83
103
 
84
104
  <!-- class:CjsCmfFormat -->
@@ -285,16 +305,6 @@ Runtime GR2/GSF format class that wraps the migrated `format-gr2` engine under c
285
305
  - Visibility: Public
286
306
  - Kind: Original CarbonEngineJS class
287
307
 
288
- <!-- class:CjsFormatGr2 -->
289
- ## `CjsFormatGr2`
290
-
291
- Migrated GR2/GSF reader that parses Granny files with section decompression, reflected type-tree walking, JSON emission, curve decompression, and caller-class hydration through its core helper modules.
292
-
293
- - Export: `@carbonenginejs/runtime-resource/formats/gr2`
294
- - Source: `src/formats/gr2/core/CjsFormatGr2.js`
295
- - Visibility: Public
296
- - Kind: Original CarbonEngineJS class
297
-
298
308
  <!-- class:Decoder -->
299
309
  ## `Decoder`
300
310
 
@@ -843,33 +853,13 @@ WebGPU shader format profile that translates compiled Carbon effects into CEWGPU
843
853
  - Visibility: Public
844
854
  - Kind: Original CarbonEngineJS class
845
855
 
846
- <!-- class:CewgpuPackage -->
847
- ## `CewgpuPackage`
848
-
849
- Reader for the flat CEWGPU container: chunk lookup, cached JSON decoding, and gated portable reflection and backend program access.
850
-
851
- - Export: `None`
852
- - Source: `src/formats/webgpu/core/cewgpu/CewgpuPackage.js`
853
- - Visibility: Internal
854
- - Kind: Internal implementation class
855
-
856
- <!-- class:CewgpuPackageBuilder -->
857
- ## `CewgpuPackageBuilder`
858
-
859
- Builds a CEWGPU container from ordered, uniquely tagged chunks.
860
-
861
- - Export: `None`
862
- - Source: `src/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js`
863
- - Visibility: Internal
864
- - Kind: Internal implementation class
865
-
866
- <!-- class:WebgpuReader -->
867
- ## `WebgpuReader`
856
+ <!-- class:CewgpuContainer -->
857
+ ## `CewgpuContainer`
868
858
 
869
- Bounded little-endian byte cursor over CEWGPU container bytes.
859
+ Reader over one WebGPU effect container.
870
860
 
871
861
  - Export: `None`
872
- - Source: `src/formats/webgpu/core/cewgpu/binary.js`
862
+ - Source: `src/formats/webgpu/core/cewgpu/CewgpuContainer.js`
873
863
  - Visibility: Internal
874
864
  - Kind: Internal implementation class
875
865
 
@@ -34,6 +34,31 @@ wildcard listener dispatch, no `family.event` or ancestor routing, and no
34
34
  event payload history. Resource classes may emit their own state or domain
35
35
  events, but the emitter does not invent a resource lifecycle contract.
36
36
 
37
+ ## Resource lifecycle events
38
+
39
+ `CjsResource.SetState()` supplies the resource-specific lifecycle contract. A
40
+ state transition emits, in order:
41
+
42
+ 1. the lowercase state name with `(resource, ...details)`;
43
+ 2. `statechange` with `(resource, nextState, previousState)`; and
44
+ 3. `completed` with `(resource, ...details)` when the new state is
45
+ `prepared` or `failed`.
46
+
47
+ `purged` is deliberately not completion. A purged handle may re-register and
48
+ reload itself into the same identity, and listeners are not cleared by purge.
49
+ A listener that remains registered for `completed` can therefore observe the
50
+ initial outcome and a later purge/reload outcome.
51
+
52
+ Raw `OnEvent()` and `OnceEvent()` never replay event history. The one
53
+ state-aware registration helper is `CjsResource.OnCompleted(listener,
54
+ source?)`: it calls the listener synchronously and stores nothing when the
55
+ resource is already complete; otherwise it registers a persistent
56
+ `completed` listener. This is the canonical check-then-subscribe operation for
57
+ late consumers. A listener satisfied synchronously will not observe a later
58
+ reload unless it explicitly subscribes again. Use `Ready()`/`GetObject()` when
59
+ the caller needs a promise for the current load operation rather than a
60
+ re-enterable lifecycle observer.
61
+
37
62
  ## Memory rules
38
63
 
39
64
  Event storage is the optional `events` member of the emitter's non-enumerable
@@ -27,6 +27,12 @@ create a hidden second resource; reset the affected identity
27
27
  (`Delete`/`Clear`) or create a new manager. A changed output contract must use
28
28
  a new tag such as `@cmf2`.
29
29
 
30
+ Do not restore a hidden execution-plan identity through function fingerprints,
31
+ arbitrary option serialization, `buildKey`, or `buildVersion`. Those details
32
+ cannot create a second canonical resource behind the same public path/output
33
+ promise. A materially different promised result requires an explicit output
34
+ tag.
35
+
30
36
  ## Ownership and replacement
31
37
 
32
38
  `CjsResMan` resolves each normalized path and promised output to one canonical
@@ -117,10 +123,16 @@ resource.ReleasePayload()
117
123
  `CjsResMan` binds resource-facing `KeepAlive()`, `KeepPayloadAlive()`,
118
124
  `Lock()`, and `Unlock()` to the resource's canonical MotherLode key.
119
125
  `SetPayload()` renews both identity and payload activity when it publishes a
120
- non-null payload. `GetPayload()`, `HasPayload()`, `IsGood()`, and other
121
- queries are pure; reading the payload does not implicitly renew its lease.
122
- Detached and purged handles retain deterministic no-op liveness methods rather
123
- than silently starting work.
126
+ non-null payload. `GetPayload()`, `HasPayload()`, `IsPrepared()`, and other
127
+ state/payload queries are pure; reading the payload does not implicitly renew
128
+ its lease. `IsGood()` is the deliberate exception: it calls `KeepAlive()`,
129
+ renewing this handle and starting its bounded reload path when it is `PURGED`.
130
+ It does not recursively traverse or renew child resources.
131
+
132
+ A handle detached by ordinary ownership removal has no live MotherLode
133
+ controller. A purged handle retains the reload hook needed to re-register and
134
+ refill that exact handle, so `IsGood()`/`KeepAlive()` can recover it as
135
+ described under [Ownership and replacement](#ownership-and-replacement).
124
136
 
125
137
  A released CPU payload retains only the small request needed to reconstruct
126
138
  that same path/output from its source and `sourceRevision`. The retained
@@ -249,10 +261,12 @@ operation is still active. Lock release is conditional on the same captured
249
261
  ownership generation, so stale work cannot decrement a newly rebound handle's
250
262
  lock. Scheduling and active-work protection do not fetch or reload data.
251
263
 
252
- Cache trimming and automatic inactivity sweeps retain the strict no-reload
253
- rule. Application retention defaults, automatic resource/payload byte
254
- estimation, separate CPU/adapter budgets, and purged-resource/device-loss
255
- recovery policy are future work; see the [roadmap](../roadmap.md).
264
+ Cache trimming and automatic inactivity sweeps never fetch or reload as part
265
+ of the sweep itself. A later `IsGood()`/`KeepAlive()` call may recover the
266
+ purged handle through its bounded reload path. Application retention defaults,
267
+ automatic resource/payload byte estimation, and separate CPU/adapter budgets
268
+ remain future work; backend device-loss recovery belongs to the engine
269
+ realization contract. See the [roadmap](../roadmap.md).
256
270
 
257
271
  ## Related documentation
258
272
 
@@ -82,10 +82,10 @@ invent offset semantics.
82
82
  A clone-safe format opts in with a static worker declaration:
83
83
 
84
84
  ```js
85
- static worker = Object.freeze({
85
+ static worker = {
86
86
  module: import.meta.url,
87
87
  exportName: "CjsExampleFormat"
88
- });
88
+ };
89
89
  ```
90
90
 
91
91
  The worker dynamically imports that exact module and invokes its static
@@ -98,12 +98,12 @@ their class identity.
98
98
  A declaration may restrict clone-safe outputs:
99
99
 
100
100
  ```js
101
- static worker = Object.freeze({
101
+ static worker = {
102
102
  module: import.meta.url,
103
103
  exportName: "CjsExampleFormat",
104
- outputTypes: Object.freeze([ "json", "payload" ]),
104
+ outputTypes: [ "json", "payload" ],
105
105
  defaultOutput: "json"
106
- });
106
+ };
107
107
  ```
108
108
 
109
109
  Format options containing functions, symbols, non-plain instances, cycles, or
package/docs/roadmap.md CHANGED
@@ -3,9 +3,10 @@
3
3
  Status: Evolving
4
4
  Scope: `@carbonenginejs/runtime-resource`
5
5
  Audience: Integrators and maintainers
6
- Summary: Records approved future direction and open design questions; nothing on this page is implemented.
6
+ Summary: Records approved future direction, open design questions, and the current shader-format boundary needed to interpret that direction.
7
7
 
8
- Everything below is future work. Current behavior is documented in the
8
+ Unless a section is explicitly marked **Current**, everything below is future
9
+ work. Current behavior is documented in the
9
10
  [reference pages](reference/motherlode-cache.md); where this page and a
10
11
  reference page disagree, the reference page describes the shipped package.
11
12
 
@@ -23,16 +24,18 @@ resource preparation abstraction:
23
24
  - automatic resource/payload byte estimation and separate CPU/adapter
24
25
  budgets;
25
26
  - additional browser-source response types and configurable worker-pool
26
- concurrency;
27
- - purged-resource/device-loss recovery policy (backend device-loss recovery
28
- belongs to the engine's realization operation).
27
+ concurrency.
29
28
 
30
29
  ## Browser shader formats
31
30
 
32
- The HLSL, DXBC, WebGL, and WebGPU format packages are expected to migrate into
33
- runtime-resource as independently exported format entry points. HLSL and DXBC
34
- remain directly usable; WebGL and WebGPU may compose them to read DX11/DX12
35
- effect inputs and translate them in the browser.
31
+ **Current:** HLSL, DXBC, WebGL, and WebGPU are consolidated into
32
+ runtime-resource and exposed as independently importable
33
+ `@carbonenginejs/runtime-resource/formats/<name>` entry points. HLSL and DXBC
34
+ remain directly usable; WebGL and WebGPU compose them to read DX11/DX12 effect
35
+ inputs and translate them.
36
+
37
+ **Planned:** Browser delivery and fallback policy still needs a stable
38
+ application-facing contract.
36
39
 
37
40
  Browser-targeted production modules must not import or require Node-only
38
41
  shader libraries. A format package may use local Node libraries as development
@@ -41,7 +44,7 @@ those libraries must not ship and must not be runtime dependencies.
41
44
 
42
45
  ccpwgl currently preserves an authored `.fx` path while `Tw2Device` maps it to
43
46
  a backend-specific remote namespace such as `effect.gles2` or `effect.webgl2`
44
- and appends the selected shader-model extension. The migrated resource/format
47
+ and appends the selected shader-model extension. The resource/format
45
48
  contract must retain both use cases:
46
49
 
47
50
  - resolve and load a pretranslated backend artifact from a remote resource
@@ -52,32 +55,52 @@ The authored effect path should remain the stable identity. Backend profile,
52
55
  shader model, translated cache path, and translation capabilities are
53
56
  resolution facts rather than changes a caller must make to its source path.
54
57
 
55
- ## Pre-adoption lifecycle API cleanup (approved, not implemented)
56
-
57
- No released consumer currently depends on the ccpwgl-compatible liveness
58
- names; the known ccpwgl format integrations are migration targets rather than
59
- a reason to preserve them. Before runtime-core or another public consumer
60
- adopts this contract, remove `KeepAlive()` and `KeepPayloadAlive()` instead
61
- of retaining or deprecating compatibility aliases.
62
-
63
- The public lifecycle should express caller intent directly:
64
-
65
- - `Ready()` obtains or reconstructs the CPU payload;
66
- - `AcquireLock()` returns a scoped hard-retention token;
67
- - `ReleasePayload()` explicitly drops the CPU payload; and
68
- - state queries remain pure.
69
-
70
- ResMan should update identity activity when a canonical resource is acquired
71
- and payload activity when it publishes or returns a ready payload. Those
72
- timestamps are cache-policy implementation details, not calls consumers
73
- should have to make. Cache admission and promotion must also be explicit
74
- manager operations: merely accessing a resource must not permanently move it
75
- from the byte-budget candidate set into an unbudgeted live set.
76
-
77
- Do not add `TouchIdentity()` or `TouchPayload()` to the initial public API
78
- unless a concrete soft-retention consumer appears. A consumer that needs a
79
- residency guarantee should acquire a lock; one that merely uses a resource
80
- should call `Ready()` and allow the configured cache policy to operate.
58
+ ## Format buffer ownership and destination reuse
59
+
60
+ **Current:** The CMF, DDS, FBX, GIF, glTF, JPEG, MP3, MP4, Ogg, PNG, STL,
61
+ TGA, WAV, WebM, and WebP byte normalizers preserve an existing `Uint8Array`.
62
+ `ArrayBuffer` and other byte-addressable views are exposed through a
63
+ `Uint8Array` view over the same backing storage rather than copied merely for
64
+ input normalization. Decode operations that produce new pixel, sample,
65
+ geometry, or decompression payloads currently allocate those result arrays
66
+ internally. Resource payload references are shared read-only by default;
67
+ [MotherLode retention](reference/motherlode-cache.md) defines the cases where
68
+ a consumer must make an explicit copy.
69
+
70
+ **Planned:** Known-size decode and transform operations should gain
71
+ format-specific optional destination-array seams. Omitting the destination
72
+ must preserve the convenient allocating call. Supplying a valid destination
73
+ must fill and return that exact object. Each seam must:
74
+
75
+ - require the correct typed-array kind and sufficient capacity before writing;
76
+ - support non-zero-offset input and destination views;
77
+ - leave input unchanged unless the operation explicitly documents an
78
+ in-place transform;
79
+ - produce the same bytes and typed-array kind as the allocating form; and
80
+ - behave deterministically when one destination is reused across sequential
81
+ calls.
82
+
83
+ The first candidates are CMF decompression, FBX inflate and packed-array
84
+ helpers, DDS block and uncompressed decoders, PNG row/RGBA decode, JPEG
85
+ component and final RGBA output, TGA RGBA decode, GIF compositing canvas, WAV
86
+ PCM decode, and glTF data-URI decode. Decoder workspaces such as JPEG
87
+ coefficient blocks, cached lookup tables, CRC tables, and small fixed scratch
88
+ arrays remain implementation-owned rather than becoming public output
89
+ arguments.
90
+
91
+ Some copies remain necessary: mutation of otherwise shared data,
92
+ `ArrayBuffer` transfer/detachment, compacting a small retained range out of a
93
+ large backing buffer, immutable frame history, and platform APIs that expose
94
+ no destination seam. Those copies should stay explicit at the owning call
95
+ site. This direction does not introduce a generic deep-copy operation for
96
+ payload objects or typed-array bundles.
97
+
98
+ ## Scoped lock token
99
+
100
+ **Planned:** add `AcquireLock()` as an async-safe wrapper around the current
101
+ `Lock()`/`Unlock()` contract. Existing `KeepAlive()` and
102
+ `KeepPayloadAlive()` behavior remains current package API; this roadmap does
103
+ not propose removing it.
81
104
 
82
105
  Raw `Lock()` / `Unlock()` is easy to mis-pair across asynchronous success,
83
106
  failure, cancellation, and disposal. Prefer a JS-only acquired-lock API:
@@ -118,11 +141,8 @@ built from explicit tokens, not an implicit default on every loaded resource.
118
141
  buffers?
119
142
  - Should manually attached/dynamic resources default to locked, like ccpwgl's
120
143
  manual shader resources use `doNotPurge`?
121
- - What explicit `Reload()`/reconstruction API should restore purged resources
122
- without introducing surprising browser or network work?
123
- - A resource-level `Purge()`/`Reload()` vocabulary remains future policy
124
- work, as does whether `Unload()` should release engine adapter resources
125
- and optionally CPU payloads.
144
+ - Should a resource-level `Purge()` complement the existing automatic and
145
+ MotherLode-level eviction operations?
126
146
 
127
147
  ## Related documentation
128
148
 
@@ -9,10 +9,11 @@ Wwise and the Wwise soundbank format are property of Audiokinetic Inc.
9
9
 
10
10
  This reader is original CarbonEngineJS code authored directly in
11
11
  runtime-resource; no legacy package was copied. The soundbank chunk layout,
12
- HIRC object field layouts, and the event-graph resolution exposed as
13
- `eventMediaFromBanks` were implemented from publicly documented community
14
- knowledge of the format (ww2ogg, vgmstream, wwiser documentation) and
15
- independently verified by hexdump against EVE Online soundbanks (bank
12
+ HIRC object field layouts, the event-graph resolution exposed as
13
+ `eventMediaFromBanks`, and the typed version-150 authored-SFX node tails
14
+ exposed as `sfxNodesFromBanks` were implemented from publicly documented
15
+ community knowledge of the format (ww2ogg, vgmstream, wwiser documentation)
16
+ and independently verified by hexdump against EVE Online soundbanks (bank
16
17
  generator version 150); no code was copied from those projects and no
17
18
  Audiokinetic SDK material was used.
18
19
  Audiokinetic, CarbonEngine, and Fenris Creations (CCP Games) are mentioned for
@@ -9,7 +9,7 @@ Contains no Microsoft, CarbonEngine, or Fenris Creations (CCP Games) code. The C
9
9
  four-byte-tagged chunk layout: `INFO`/`META`/`GLSL`/...) is a CarbonEngineJS
10
10
  invention, not a Microsoft, CarbonEngine, or Fenris Creations (CCP Games) one. The DXBC token-stream layout follows
11
11
  Microsoft's public d3d11TokenizedProgramFormat documentation (consumed here
12
- only through `@carbonenginejs/format-dxbc`'s public format; this package
12
+ only through the sibling `formats/dxbc` public format; this format
13
13
  decodes no DXBC bytes itself). Unity Technologies' HLSLcc (MIT) was used as
14
14
  a behavioral reference while auditing the GLSL lowering rules this emitter
15
15
  implements; no HLSLcc source is included in this repository.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carbonenginejs/runtime-resource",
3
- "version": "0.11.1",
3
+ "version": "0.12.1",
4
4
  "description": "CarbonEngineJS resource lifecycle, cache, source, and object loading contracts.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -12,6 +12,7 @@
12
12
  "./resource/shader": "./dist/resource/shader/index.js",
13
13
  "./resource/texture": "./dist/resource/texture/index.js",
14
14
  "./worker": "./dist/worker/CjsResManWorker.js",
15
+ "./format": "./dist/format/index.js",
15
16
  "./formats": "./dist/formats/index.js",
16
17
  "./formats/black": "./dist/formats/black/index.js",
17
18
  "./formats/black/schema": "./dist/formats/black/core/blackSchema.js",