@carbonenginejs/runtime 0.1.0-alpha.4 → 0.1.0-alpha.5

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 (384) hide show
  1. package/dist/global/blue/BlueClasses.js +200 -0
  2. package/dist/global/blue/BlueClasses.js.map +1 -0
  3. package/dist/global/blue/IBlueClasses.js +79 -0
  4. package/dist/global/blue/IBlueClasses.js.map +1 -0
  5. package/dist/global/blue/IBlueDynamicResourceConstructor.js +16 -0
  6. package/dist/global/blue/IBlueDynamicResourceConstructor.js.map +1 -1
  7. package/dist/global/blue/blue.js +8 -2
  8. package/dist/global/blue/blue.js.map +1 -1
  9. package/dist/global/blue/index.js +2 -0
  10. package/dist/global/blue/index.js.map +1 -1
  11. package/dist/global/consts/index.js +0 -1
  12. package/dist/global/consts/index.js.map +1 -1
  13. package/dist/global/consts/renderContext/formats.js +26 -25
  14. package/dist/global/consts/renderContext/formats.js.map +1 -1
  15. package/dist/{trinityal/Tr2BitmapDimensions.js → global/imageio/BitmapDimensions.js} +19 -15
  16. package/dist/global/imageio/BitmapDimensions.js.map +1 -0
  17. package/dist/global/imageio/Cutout.js +28 -0
  18. package/dist/global/imageio/Cutout.js.map +1 -0
  19. package/dist/global/imageio/HostBitmap.js +1106 -0
  20. package/dist/global/imageio/HostBitmap.js.map +1 -0
  21. package/dist/global/imageio/ImageIOResult.js +99 -0
  22. package/dist/global/imageio/ImageIOResult.js.map +1 -0
  23. package/dist/global/imageio/ImageUtility.js +205 -0
  24. package/dist/global/imageio/ImageUtility.js.map +1 -0
  25. package/dist/global/imageio/LoadParameters.js +86 -0
  26. package/dist/global/imageio/LoadParameters.js.map +1 -0
  27. package/dist/global/imageio/Metadata.js +22 -0
  28. package/dist/global/imageio/Metadata.js.map +1 -0
  29. package/dist/global/imageio/index.js +8 -0
  30. package/dist/global/{consts/webgpu → imageio}/index.js.map +1 -1
  31. package/dist/global/index.js +2 -1
  32. package/dist/global/index.js.map +1 -1
  33. package/dist/global/math/color.js +1 -1
  34. package/dist/global/math/color.js.map +1 -1
  35. package/dist/global/schema/CjsSchema.js +8 -0
  36. package/dist/global/schema/CjsSchema.js.map +1 -1
  37. package/dist/index.js +12 -4
  38. package/dist/index.js.map +1 -1
  39. package/dist/resource/CjsResMan.js +47 -7
  40. package/dist/resource/CjsResMan.js.map +1 -1
  41. package/dist/resource/Tr2LightProfileRes.js +37 -0
  42. package/dist/resource/Tr2LightProfileRes.js.map +1 -1
  43. package/dist/resource/format/CjsByteWriter.js +46 -46
  44. package/dist/resource/format/CjsByteWriter.js.map +1 -1
  45. package/dist/resource/format/CjsFormat.js +7 -8
  46. package/dist/resource/format/CjsFormat.js.map +1 -1
  47. package/dist/resource/format/CjsFormatStore.js +8 -8
  48. package/dist/resource/format/CjsFormatStore.js.map +1 -1
  49. package/dist/resource/format/CjsGeometryFormat.js +114 -0
  50. package/dist/resource/format/CjsGeometryFormat.js.map +1 -0
  51. package/dist/resource/format/CjsImageFormat.js +282 -0
  52. package/dist/resource/format/CjsImageFormat.js.map +1 -0
  53. package/dist/resource/format/CjsResourceProbe.js +12 -48
  54. package/dist/resource/format/CjsResourceProbe.js.map +1 -1
  55. package/dist/resource/format/CjsStringTable.js +37 -37
  56. package/dist/resource/format/CjsStringTable.js.map +1 -1
  57. package/dist/resource/format/carbonEffect/CjsCarbonEffectReader.js +10 -10
  58. package/dist/resource/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -1
  59. package/dist/resource/format/carbonEffect/CjsCarbonEffectWriter.js +37 -37
  60. package/dist/resource/format/carbonEffect/CjsCarbonEffectWriter.js.map +1 -1
  61. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js +35 -7
  62. package/dist/resource/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
  63. package/dist/resource/format/index.js +3 -1
  64. package/dist/resource/format/index.js.map +1 -1
  65. package/dist/resource/formats/black/CjsBlackFormat.js +130 -137
  66. package/dist/resource/formats/black/CjsBlackFormat.js.map +1 -1
  67. package/dist/resource/formats/bnk/CjsBnkFormat.js +12 -19
  68. package/dist/resource/formats/bnk/CjsBnkFormat.js.map +1 -1
  69. package/dist/resource/formats/bnk/core/helpers.js +1 -3
  70. package/dist/resource/formats/bnk/core/helpers.js.map +1 -1
  71. package/dist/resource/formats/cmf/CjsCmfFormat.js +19 -82
  72. package/dist/resource/formats/cmf/CjsCmfFormat.js.map +1 -1
  73. package/dist/resource/formats/cmf/core/constants.js +1 -2
  74. package/dist/resource/formats/cmf/core/constants.js.map +1 -1
  75. package/dist/resource/formats/{stl/core/targets.js → cmf/core/flatShared.js} +9 -8
  76. package/dist/resource/formats/cmf/core/flatShared.js.map +1 -0
  77. package/dist/resource/formats/cmf/core/helpers.js +13 -13
  78. package/dist/resource/formats/cmf/core/helpers.js.map +1 -1
  79. package/dist/resource/formats/cmf/core/writer.js +24 -24
  80. package/dist/resource/formats/cmf/core/writer.js.map +1 -1
  81. package/dist/resource/formats/dds/CjsDdsFormat.js +134 -17
  82. package/dist/resource/formats/dds/CjsDdsFormat.js.map +1 -1
  83. package/dist/resource/formats/dds/core/helpers.js +125 -40
  84. package/dist/resource/formats/dds/core/helpers.js.map +1 -1
  85. package/dist/resource/formats/dxbc/CjsDxbcFormat.js +14 -16
  86. package/dist/resource/formats/dxbc/CjsDxbcFormat.js.map +1 -1
  87. package/dist/resource/formats/dxbc/core/{container.js → DxbcContainer.js} +2 -2
  88. package/dist/resource/formats/dxbc/core/DxbcContainer.js.map +1 -0
  89. package/dist/resource/formats/dxbc/core/{errors.js → DxbcReadError.js} +1 -1
  90. package/dist/resource/formats/dxbc/core/DxbcReadError.js.map +1 -0
  91. package/dist/resource/formats/dxbc/core/DxbcReader.js +1 -1
  92. package/dist/resource/formats/dxbc/core/DxbcReader.js.map +1 -1
  93. package/dist/resource/formats/dxbc/core/{program.js → DxbcShaderProgram.js} +2 -2
  94. package/dist/resource/formats/dxbc/core/DxbcShaderProgram.js.map +1 -0
  95. package/dist/resource/formats/dxbc/core/{signature.js → DxbcSignatureChunk.js} +2 -2
  96. package/dist/resource/formats/dxbc/core/DxbcSignatureChunk.js.map +1 -0
  97. package/dist/resource/formats/dxbc/core/decoder.js +2 -2
  98. package/dist/resource/formats/dxbc/core/decoder.js.map +1 -1
  99. package/dist/resource/formats/dxbc/core/helpers.js +3 -3
  100. package/dist/resource/formats/dxbc/core/helpers.js.map +1 -1
  101. package/dist/resource/formats/fbx/CjsFbxFormat.js +18 -20
  102. package/dist/resource/formats/fbx/CjsFbxFormat.js.map +1 -1
  103. package/dist/resource/formats/flac/CjsFlacFormat.js +7 -13
  104. package/dist/resource/formats/flac/CjsFlacFormat.js.map +1 -1
  105. package/dist/resource/formats/fsd/32/CjsFsd32Format.js +29 -29
  106. package/dist/resource/formats/fsd/32/CjsFsd32Format.js.map +1 -1
  107. package/dist/resource/formats/fsd/64/CjsFsd64Format.js +3 -3
  108. package/dist/resource/formats/fsd/64/CjsFsd64Format.js.map +1 -1
  109. package/dist/resource/formats/fsd/64/core/CjsFsd64Binary.js +23 -23
  110. package/dist/resource/formats/fsd/64/core/CjsFsd64Binary.js.map +1 -1
  111. package/dist/resource/formats/fsd/64/core/CjsFsd64Reader.js +8 -8
  112. package/dist/resource/formats/fsd/64/core/CjsFsd64Reader.js.map +1 -1
  113. package/dist/resource/formats/fsd/CjsFsdFormat.js +23 -23
  114. package/dist/resource/formats/fsd/CjsFsdFormat.js.map +1 -1
  115. package/dist/resource/formats/gif/CjsGifFormat.js +24 -15
  116. package/dist/resource/formats/gif/CjsGifFormat.js.map +1 -1
  117. package/dist/resource/formats/gltf/CjsGltfFormat.js +33 -98
  118. package/dist/resource/formats/gltf/CjsGltfFormat.js.map +1 -1
  119. package/dist/resource/formats/gltf/core/helpers.js +3 -12
  120. package/dist/resource/formats/gltf/core/helpers.js.map +1 -1
  121. package/dist/resource/formats/gr2/CjsGr2Format.js +27 -91
  122. package/dist/resource/formats/gr2/CjsGr2Format.js.map +1 -1
  123. package/dist/resource/formats/hlsl/CjsHlslFormat.js +22 -25
  124. package/dist/resource/formats/hlsl/CjsHlslFormat.js.map +1 -1
  125. package/dist/resource/formats/hlsl/core/carbonDescriptionToRuntime.js +1 -1
  126. package/dist/resource/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -1
  127. package/dist/resource/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js +3 -3
  128. package/dist/resource/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js.map +1 -1
  129. package/dist/resource/formats/ies/CjsIESFormat.js +29 -29
  130. package/dist/resource/formats/ies/CjsIESFormat.js.map +1 -1
  131. package/dist/resource/formats/jpeg/CjsJpegFormat.js +24 -15
  132. package/dist/resource/formats/jpeg/CjsJpegFormat.js.map +1 -1
  133. package/dist/resource/formats/jpeg/core/helpers.js +3 -5
  134. package/dist/resource/formats/jpeg/core/helpers.js.map +1 -1
  135. package/dist/resource/formats/jpeg/core/jpeg.js +58 -58
  136. package/dist/resource/formats/jpeg/core/jpeg.js.map +1 -1
  137. package/dist/resource/formats/jsonl/CjsJsonlFormat.js +3 -3
  138. package/dist/resource/formats/jsonl/CjsJsonlFormat.js.map +1 -1
  139. package/dist/resource/formats/mp3/CjsMp3Format.js +7 -14
  140. package/dist/resource/formats/mp3/CjsMp3Format.js.map +1 -1
  141. package/dist/resource/formats/mp3/core/helpers.js +3 -5
  142. package/dist/resource/formats/mp3/core/helpers.js.map +1 -1
  143. package/dist/resource/formats/mp4/CjsMp4Format.js +7 -13
  144. package/dist/resource/formats/mp4/CjsMp4Format.js.map +1 -1
  145. package/dist/resource/formats/mp4/core/helpers.js +3 -5
  146. package/dist/resource/formats/mp4/core/helpers.js.map +1 -1
  147. package/dist/resource/formats/obj/CjsObjFormat.js +92 -157
  148. package/dist/resource/formats/obj/CjsObjFormat.js.map +1 -1
  149. package/dist/resource/formats/obj/core/helpers.js +5 -113
  150. package/dist/resource/formats/obj/core/helpers.js.map +1 -1
  151. package/dist/resource/formats/ogg/CjsOggFormat.js +7 -14
  152. package/dist/resource/formats/ogg/CjsOggFormat.js.map +1 -1
  153. package/dist/resource/formats/pickle/CjsPickleFormat.js +7 -12
  154. package/dist/resource/formats/pickle/CjsPickleFormat.js.map +1 -1
  155. package/dist/resource/formats/pickle/core/CjsPickleProtocol0Reader.js +7 -7
  156. package/dist/resource/formats/pickle/core/CjsPickleProtocol0Reader.js.map +1 -1
  157. package/dist/resource/formats/pickle/core/CjsPickleProtocol4Reader.js +7 -7
  158. package/dist/resource/formats/pickle/core/CjsPickleProtocol4Reader.js.map +1 -1
  159. package/dist/resource/formats/png/CjsPngFormat.js +40 -15
  160. package/dist/resource/formats/png/CjsPngFormat.js.map +1 -1
  161. package/dist/resource/formats/png/core/helpers.js +4 -6
  162. package/dist/resource/formats/png/core/helpers.js.map +1 -1
  163. package/dist/resource/formats/red/CjsRedFormat.js +22 -28
  164. package/dist/resource/formats/red/CjsRedFormat.js.map +1 -1
  165. package/dist/resource/formats/schemabound/CjsSchemaBoundFormat.js +3 -7
  166. package/dist/resource/formats/schemabound/CjsSchemaBoundFormat.js.map +1 -1
  167. package/dist/resource/formats/schemabound/core/schemaBoundValues.js +5 -0
  168. package/dist/resource/formats/schemabound/core/schemaBoundValues.js.map +1 -1
  169. package/dist/resource/formats/sqlite/CjsSqliteFormat.js +4 -9
  170. package/dist/resource/formats/sqlite/CjsSqliteFormat.js.map +1 -1
  171. package/dist/resource/formats/static/CjsStaticFormat.js +4 -4
  172. package/dist/resource/formats/static/CjsStaticFormat.js.map +1 -1
  173. package/dist/resource/formats/stl/CjsStlFormat.js +39 -104
  174. package/dist/resource/formats/stl/CjsStlFormat.js.map +1 -1
  175. package/dist/resource/formats/stl/core/helpers.js +5 -19
  176. package/dist/resource/formats/stl/core/helpers.js.map +1 -1
  177. package/dist/resource/formats/tga/CjsTgaFormat.js +26 -15
  178. package/dist/resource/formats/tga/CjsTgaFormat.js.map +1 -1
  179. package/dist/resource/formats/tga/core/helpers.js +3 -5
  180. package/dist/resource/formats/tga/core/helpers.js.map +1 -1
  181. package/dist/resource/formats/vta/CjsVtaFormat.js +8 -15
  182. package/dist/resource/formats/vta/CjsVtaFormat.js.map +1 -1
  183. package/dist/resource/formats/wav/CjsWavFormat.js +7 -14
  184. package/dist/resource/formats/wav/CjsWavFormat.js.map +1 -1
  185. package/dist/resource/formats/wav/core/helpers.js +3 -5
  186. package/dist/resource/formats/wav/core/helpers.js.map +1 -1
  187. package/dist/resource/formats/webgl/CjsWebglFormat.js +103 -105
  188. package/dist/resource/formats/webgl/CjsWebglFormat.js.map +1 -1
  189. package/dist/resource/formats/webgl/core/{errors.js → WebglReadError.js} +1 -1
  190. package/dist/resource/formats/webgl/core/WebglReadError.js.map +1 -0
  191. package/dist/resource/formats/webgl/core/effectPackage.js +1 -1
  192. package/dist/resource/formats/webgl/core/effectPackage.js.map +1 -1
  193. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +3 -3
  194. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  195. package/dist/resource/formats/webgl/core/glsl/{DxbcGlslHelpers.js → DxbcGlslHelperRegistry.js} +2 -2
  196. package/dist/resource/formats/webgl/core/glsl/DxbcGlslHelperRegistry.js.map +1 -0
  197. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +1 -1
  198. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
  199. package/dist/resource/formats/webgl/core/glslBackendBlock.js +1 -1
  200. package/dist/resource/formats/webgl/core/glslBackendBlock.js.map +1 -1
  201. package/dist/resource/formats/webgl/core/helpers.js.map +1 -1
  202. package/dist/resource/formats/webgpu/CjsWebgpuFormat.js +28 -29
  203. package/dist/resource/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  204. package/dist/resource/formats/webgpu/core/{errors.js → WebgpuReadError.js} +1 -1
  205. package/dist/resource/formats/webgpu/core/WebgpuReadError.js.map +1 -0
  206. package/dist/resource/formats/webgpu/core/carbonWebgpu/validateContainer.js +1 -1
  207. package/dist/resource/formats/webgpu/core/carbonWebgpu/validateContainer.js.map +1 -1
  208. package/dist/resource/formats/webgpu/core/helpers.js +1 -1
  209. package/dist/resource/formats/webgpu/core/helpers.js.map +1 -1
  210. package/dist/resource/formats/webgpu/core/ir/lowerDxbcToIr.js +1 -1
  211. package/dist/resource/formats/webgpu/core/ir/lowerDxbcToIr.js.map +1 -1
  212. package/dist/resource/formats/webgpu/core/wgsl/buildWgslSet.js +18 -6
  213. package/dist/resource/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
  214. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js +39 -13
  215. package/dist/resource/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -1
  216. package/dist/resource/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js +16 -14
  217. package/dist/resource/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js.map +1 -1
  218. package/dist/resource/formats/webm/CjsWebmFormat.js +8 -13
  219. package/dist/resource/formats/webm/CjsWebmFormat.js.map +1 -1
  220. package/dist/resource/formats/webm/core/helpers.js +3 -5
  221. package/dist/resource/formats/webm/core/helpers.js.map +1 -1
  222. package/dist/resource/formats/webp/CjsWebpFormat.js +8 -12
  223. package/dist/resource/formats/webp/CjsWebpFormat.js.map +1 -1
  224. package/dist/resource/formats/wem/CjsWemFormat.js +9 -17
  225. package/dist/resource/formats/wem/CjsWemFormat.js.map +1 -1
  226. package/dist/resource/formats/wem/core/bitStream.js +35 -35
  227. package/dist/resource/formats/wem/core/bitStream.js.map +1 -1
  228. package/dist/resource/formats/wem/core/helpers.js +1 -3
  229. package/dist/resource/formats/wem/core/helpers.js.map +1 -1
  230. package/dist/resource/formats/yaml/CjsYamlFormat.js +28 -37
  231. package/dist/resource/formats/yaml/CjsYamlFormat.js.map +1 -1
  232. package/dist/resource/imageio/ImageIO.js +142 -0
  233. package/dist/resource/imageio/ImageIO.js.map +1 -0
  234. package/dist/resource/imageio/index.js +17 -0
  235. package/dist/resource/imageio/index.js.map +1 -0
  236. package/dist/resource/index.js +7 -0
  237. package/dist/resource/index.js.map +1 -1
  238. package/dist/resource/shader/reflection/Tr2EffectResource.js +24 -2
  239. package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
  240. package/dist/resource/shader/reflection/Tr2Pass.js +76 -5
  241. package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
  242. package/dist/resource/texture/CjsTextureArrayConstructor.js +97 -0
  243. package/dist/resource/texture/CjsTextureArrayConstructor.js.map +1 -0
  244. package/dist/resource/texture/CjsTexturePackConstructor.js +160 -0
  245. package/dist/resource/texture/CjsTexturePackConstructor.js.map +1 -0
  246. package/dist/resource/texture/CjsTexturePipelineStepArray.js +72 -0
  247. package/dist/resource/texture/CjsTexturePipelineStepArray.js.map +1 -0
  248. package/dist/resource/texture/CjsTexturePipelineStepConvert.js +73 -0
  249. package/dist/resource/texture/CjsTexturePipelineStepConvert.js.map +1 -0
  250. package/dist/resource/texture/CjsTexturePipelineStepPack.js +71 -0
  251. package/dist/resource/texture/CjsTexturePipelineStepPack.js.map +1 -0
  252. package/dist/resource/texture/CjsTexturePipelineStepResize.js +123 -0
  253. package/dist/resource/texture/CjsTexturePipelineStepResize.js.map +1 -0
  254. package/dist/resource/texture/SolidColorTextureConstructor.js +11 -1
  255. package/dist/resource/texture/SolidColorTextureConstructor.js.map +1 -1
  256. package/dist/resource/texture/Tr2ImageRes.js +100 -68
  257. package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
  258. package/dist/resource/texture/Tr2TexturePipeline.js +45 -25
  259. package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -1
  260. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js +34 -1
  261. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -1
  262. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js +30 -3
  263. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -1
  264. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js +81 -1
  265. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -1
  266. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js +36 -1
  267. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -1
  268. package/dist/resource/texture/Tr2TexturePipelineStepPack.js +146 -24
  269. package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -1
  270. package/dist/resource/texture/TriTextureRes.js +151 -29
  271. package/dist/resource/texture/TriTextureRes.js.map +1 -1
  272. package/dist/resource/texture/index.js +7 -0
  273. package/dist/resource/texture/index.js.map +1 -1
  274. package/dist/resource/texture/registerTextureResources.js +83 -0
  275. package/dist/resource/texture/registerTextureResources.js.map +1 -0
  276. package/dist/resource/texture/solidColorTexture.js +10 -19
  277. package/dist/resource/texture/solidColorTexture.js.map +1 -1
  278. package/dist/sof/EveSOF.js +39 -7
  279. package/dist/sof/EveSOF.js.map +1 -1
  280. package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js +2 -2
  281. package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js.map +1 -1
  282. package/dist/trinity/core/Tr2ImageIOHelpers.js +80 -17
  283. package/dist/trinity/core/Tr2ImageIOHelpers.js.map +1 -1
  284. package/dist/trinity/core/Tr2RenderUtils.js +1 -1
  285. package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js +49 -62
  286. package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js.map +1 -1
  287. package/dist/trinity/core/Tr2TextureReference.js +114 -0
  288. package/dist/trinity/core/Tr2TextureReference.js.map +1 -0
  289. package/dist/trinity/core/device/Tr2DepthStencil.js +2 -2
  290. package/dist/trinity/core/device/Tr2DepthStencil.js.map +1 -1
  291. package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBuffer.js +1 -1
  292. package/dist/trinity/core/index.js +1 -0
  293. package/dist/trinity/core/index.js.map +1 -1
  294. package/dist/trinity/core/lighting/Tr2LightManager.js +5 -4
  295. package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
  296. package/dist/trinity/core/procedural/GradientTextureConstructor.js +5 -4
  297. package/dist/trinity/core/procedural/GradientTextureConstructor.js.map +1 -1
  298. package/dist/trinity/core/procedural/gradientTexture.js +10 -13
  299. package/dist/trinity/core/procedural/gradientTexture.js.map +1 -1
  300. package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js +1 -1
  301. package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js.map +1 -1
  302. package/dist/trinity/eve/EveImpactOverlay.js +102 -50
  303. package/dist/trinity/eve/EveImpactOverlay.js.map +1 -1
  304. package/dist/trinity/eve/EveModularObjectModifier.js +9 -18
  305. package/dist/trinity/eve/EveModularObjectModifier.js.map +1 -1
  306. package/dist/trinity/eve/attachment/turrets/EveTurretSet.js +175 -157
  307. package/dist/trinity/eve/attachment/turrets/EveTurretSet.js.map +1 -1
  308. package/dist/trinity/eve/attachment/turrets/EveTurretTarget.js +100 -83
  309. package/dist/trinity/eve/attachment/turrets/EveTurretTarget.js.map +1 -1
  310. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js +26 -20
  311. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js.map +1 -1
  312. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js +368 -179
  313. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js.map +1 -1
  314. package/dist/trinity/eve/child/EveChildMesh.js +242 -234
  315. package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
  316. package/dist/trinity/eve/child/EveChildTurret.js +57 -16
  317. package/dist/trinity/eve/child/EveChildTurret.js.map +1 -1
  318. package/dist/trinity/eve/child/EveSpaceObjectChild.js +28 -1
  319. package/dist/trinity/eve/child/EveSpaceObjectChild.js.map +1 -1
  320. package/dist/trinity/eve/index.js +2 -2
  321. package/dist/trinity/eve/overlays/EveDamageOverlay.js +5 -1
  322. package/dist/trinity/eve/overlays/EveDamageOverlay.js.map +1 -1
  323. package/dist/trinity/eve/scene/EveSpaceScene.js +234 -233
  324. package/dist/trinity/eve/scene/EveSpaceScene.js.map +1 -1
  325. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js +2 -0
  326. package/dist/trinity/eve/scene/EveSpaceSceneRenderDriver.js.map +1 -1
  327. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +492 -437
  328. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
  329. package/dist/trinity/generated/index.js +0 -1
  330. package/dist/trinity/generated/index.js.map +1 -1
  331. package/dist/trinity/generated/trinityCore/index.js +0 -1
  332. package/dist/trinity/generated/trinityCore/index.js.map +1 -1
  333. package/dist/trinity/index.js +3 -3
  334. package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js +10 -1
  335. package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js.map +1 -1
  336. package/dist/trinity/shader/Tr2DataTextureManager.js +152 -66
  337. package/dist/trinity/shader/Tr2DataTextureManager.js.map +1 -1
  338. package/dist/trinity/shader/Tr2Material.js +1 -1
  339. package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js +5 -5
  340. package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js.map +1 -1
  341. package/dist/trinityal/index.js +1 -1
  342. package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js +2 -2
  343. package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js.map +1 -1
  344. package/dist/trinityal/stub/Tr2SwapChainALStub.js +45 -45
  345. package/dist/trinityal/stub/Tr2SwapChainALStub.js.map +1 -1
  346. package/dist/trinityal/stub/Tr2TextureALStub.js +170 -170
  347. package/dist/trinityal/stub/Tr2TextureALStub.js.map +1 -1
  348. package/dist/trinityal/webgpu/CjsWebgpuDevice.js +234 -164
  349. package/dist/trinityal/webgpu/CjsWebgpuDevice.js.map +1 -1
  350. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +7 -0
  351. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
  352. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +78 -14
  353. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
  354. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js +94 -0
  355. package/dist/trinityal/webgpu/core/CjsWebgpuUtils.js.map +1 -0
  356. package/dist/trinityal/webgpu/internal.js +1 -0
  357. package/dist/trinityal/webgpu/internal.js.map +1 -1
  358. package/docs/global/reference/classes/README.md +90 -0
  359. package/docs/resource/concepts/format-capabilities.md +3 -3
  360. package/docs/resource/formats/README.md +1 -1
  361. package/docs/resource/reference/classes/core.md +31 -1
  362. package/docs/resource/reference/classes/formats.md +7 -7
  363. package/docs/resource/reference/classes/resources.md +76 -16
  364. package/docs/trinity/reference/classes/generated.md +0 -10
  365. package/docs/trinity/reference/classes/trinity-core.md +1692 -1682
  366. package/docs/trinityal/reference/classes/README.md +0 -10
  367. package/docs/trinityal/webgpu/reference/classes/README.md +276 -266
  368. package/package.json +4 -3
  369. package/dist/global/consts/webgpu/index.js +0 -2
  370. package/dist/global/consts/webgpu/textureFormats.js +0 -180
  371. package/dist/global/consts/webgpu/textureFormats.js.map +0 -1
  372. package/dist/resource/formats/dxbc/core/container.js.map +0 -1
  373. package/dist/resource/formats/dxbc/core/errors.js.map +0 -1
  374. package/dist/resource/formats/dxbc/core/program.js.map +0 -1
  375. package/dist/resource/formats/dxbc/core/signature.js.map +0 -1
  376. package/dist/resource/formats/stl/core/targets.js.map +0 -1
  377. package/dist/resource/formats/webgl/core/errors.js.map +0 -1
  378. package/dist/resource/formats/webgl/core/glsl/DxbcGlslHelpers.js.map +0 -1
  379. package/dist/resource/formats/webgpu/core/errors.js.map +0 -1
  380. package/dist/resource/texture/texturePipelineBehavior.js +0 -332
  381. package/dist/resource/texture/texturePipelineBehavior.js.map +0 -1
  382. package/dist/trinity/generated/trinityCore/Tr2TextureReference.js +0 -40
  383. package/dist/trinity/generated/trinityCore/Tr2TextureReference.js.map +0 -1
  384. package/dist/trinityal/Tr2BitmapDimensions.js.map +0 -1
@@ -61,6 +61,12 @@ export { CARBON_BACKEND_TRANSFORM_FAMILY, DETAIL_MAP_ARRAY_DEFAULTS } from './ca
61
61
  */
62
62
  const CARBON_BACKEND_RESOURCE_KIND = Object.freeze(["uniform-buffer", "sampled-resource", "sampler", "storage-resource"]);
63
63
 
64
+ /**
65
+ * A texture binding's sample type, ordered so the wire value is stable. The
66
+ * first is the default and what every non-texture binding writes.
67
+ */
68
+ const CARBON_BACKEND_TEXTURE_SAMPLE_TYPE = Object.freeze(["float", "unfilterable-float"]);
69
+
64
70
  /** Shader stages, as a bit position in the visibility mask. */
65
71
  const CARBON_BACKEND_VISIBILITY = Object.freeze(["vertex", "fragment", "compute"]);
66
72
 
@@ -113,6 +119,11 @@ function unpackVisibility(mask) {
113
119
  * buffer and a compute typed buffer, and the structure stride separates them:
114
120
  * structured always carries one, typed never does.
115
121
  *
122
+ * One texture fact is not in the WGSL type and is stored: its sample type.
123
+ * `texture_2d<f32>` is the same declaration whether the layout says `float` or
124
+ * `unfilterable-float`, and only the lowering, which sees the instructions,
125
+ * knows a texture is only ever loaded.
126
+ *
116
127
  * @param {object} binding Decoded binding record.
117
128
  * @returns {object} The descriptor fragment, as one `{buffer|texture|sampler}` key.
118
129
  */
@@ -144,7 +155,8 @@ function deriveBindingDescriptor(binding) {
144
155
  const texture = TEXTURE_DESCRIPTORS[binding.type];
145
156
  if (texture) return {
146
157
  texture: {
147
- ...texture
158
+ ...texture,
159
+ sampleType: binding.textureSampleType
148
160
  }
149
161
  };
150
162
  return {
@@ -232,10 +244,10 @@ function assertDerivedBindingFieldsAgree(binding, group) {
232
244
  }
233
245
  }
234
246
 
235
- /**
236
- * Encode one canonical backend binding and transform block.
237
- * @param {object} block Backend block record.
238
- * @returns {Uint8Array} Encoded backend bytes.
247
+ /**
248
+ * Encode one canonical backend binding and transform block.
249
+ * @param {object} block Backend block record.
250
+ * @returns {Uint8Array} Encoded backend bytes.
239
251
  */
240
252
  function writeBackendBlock(block) {
241
253
  const bindGroups = block.bindGroups ?? [];
@@ -261,6 +273,13 @@ function writeBackendBlock(block) {
261
273
  writer.u32(binding.registerIndex);
262
274
  writer.u32(binding.structureStride ?? ABSENT);
263
275
  writer.u8(binding.arrayLayerCount ?? 0);
276
+ const sampleType = CARBON_BACKEND_TEXTURE_SAMPLE_TYPE.indexOf(binding.texture?.sampleType ?? "float");
277
+ if (sampleType < 0) {
278
+ throw new CjsFormatWriteError(`Unknown texture sample type "${binding.texture.sampleType}"`, {
279
+ sampleType: binding.texture.sampleType
280
+ });
281
+ }
282
+ writer.u8(sampleType);
264
283
  writeInlineString(writer, binding.type);
265
284
  writeInlineString(writer, binding.generatedSymbol);
266
285
  // A binding either carries a transform id or it does not; an empty
@@ -301,6 +320,12 @@ function readBackendBlock(bytes, options = {}) {
301
320
  const registerIndex = reader.ReadUint32();
302
321
  const structureStride = reader.ReadUint32();
303
322
  const arrayLayerCount = reader.ReadUint8();
323
+ const textureSampleType = CARBON_BACKEND_TEXTURE_SAMPLE_TYPE[reader.ReadUint8()];
324
+ if (!textureSampleType) {
325
+ throw new CjsFormatReadError("Backend block binding has an unknown texture sample type", {
326
+ source: options.source ?? "backend block"
327
+ });
328
+ }
304
329
  const type = readInlineString(reader);
305
330
  const generatedSymbol = readInlineString(reader);
306
331
  const transformId = readInlineString(reader);
@@ -328,7 +353,10 @@ function readBackendBlock(bytes, options = {}) {
328
353
  };
329
354
  bindings.push({
330
355
  ...record,
331
- ...deriveBindingDescriptor(record)
356
+ ...deriveBindingDescriptor({
357
+ ...record,
358
+ textureSampleType
359
+ })
332
360
  });
333
361
  }
334
362
  bindGroups.push({
@@ -360,5 +388,5 @@ function readBackendBlock(bytes, options = {}) {
360
388
  };
361
389
  }
362
390
 
363
- export { CARBON_BACKEND_RESOURCE_KIND, CARBON_BACKEND_VISIBILITY, readBackendBlock, writeBackendBlock };
391
+ export { CARBON_BACKEND_RESOURCE_KIND, CARBON_BACKEND_TEXTURE_SAMPLE_TYPE, CARBON_BACKEND_VISIBILITY, readBackendBlock, writeBackendBlock };
364
392
  //# sourceMappingURL=carbonEffectBackendBlock.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"carbonEffectBackendBlock.js","sources":["../../../../../src/resource/format/carbonEffect/carbonEffectBackendBlock.js"],"sourcesContent":["import { CjsByteWriter } from \"../CjsByteWriter.js\";\r\nimport { CjsByteReader } from \"../CjsByteReader.js\";\r\nimport { CjsFormatReadError, CjsFormatWriteError } from \"../CjsFormatError.js\";\r\nimport {\r\n CARBON_BACKEND_ENGINE_ID,\r\n readBackendEngineId\r\n} from \"./backendEngineId.js\";\r\nimport {\r\n CARBON_BACKEND_TRANSFORM_FAMILY,\r\n DETAIL_MAP_ARRAY_DEFAULTS,\r\n readInlineString,\r\n readTransformSection,\r\n writeInlineString,\r\n writeTransformSection\r\n} from \"./carbonEffectResourceTransform.js\";\r\n\r\n/**\r\n * The WebGPU pass block: bind-group layouts plus the shared resource-transform\r\n * section.\r\n *\r\n * Neither is derivable from Carbon reflection. Carbon's `registers[]` is the D3D\r\n * binding model, while `(group, binding, visibility, generatedSymbol)` comes from\r\n * the *lowered IR's* bindings. So this is the port's only genuine invention, and\r\n * it is built entirely from Carbon's own techniques: count-prefixed fixed-width\r\n * records inside a blob referenced by `{u32 size, u32 offset}`, exactly like\r\n * program source.\r\n *\r\n * Both sections share **one** block rather than occupying two, because the\r\n * invariant worth keeping is \"the Carbon region is backend-invariant, with\r\n * exactly one optional trailing block\". They are also mutually required — a\r\n * transform needs a carrier binding in the same pass's layout and a transformed\r\n * binding needs a recipe — so one unit is the honest shape.\r\n *\r\n * ## Why the block is self-contained\r\n *\r\n * The block lives in the arena so that identical layouts dedupe across bodies the\r\n * way program source does; measured sharing is 30.5:1 at `(body, pass)`\r\n * granularity, 22 distinct blocks across 672 pairs.\r\n *\r\n * That forces one design consequence: **the block cannot contain arena offsets.**\r\n * An offset is only known after the arena's content sort, and the sort depends on\r\n * every blob's bytes — including this one. A block referencing the arena would\r\n * have to be interned before its own contents could be computed. Carbon never\r\n * meets this because no Carbon arena blob refers to the arena.\r\n *\r\n * So strings are inline here, length-prefixed, not interned. The cost is real but\r\n * small: a repeated `\"t11\"` inside 22 distinct blocks rather than one shared copy.\r\n * The block itself is what dedupes, and it dedupes 30x.\r\n */\r\n\r\n/**\r\n * The leading byte is the TARGET ENGINE IDENTIFIER, not a version.\r\n *\r\n * It was called CARBON_EFFECT_BACKEND_BLOCK_VERSION and emitted 1, while the\r\n * WebGL2 writer also emitted 1 meaning something unrelated - so the byte could\r\n * not do the one job it was there for. Renamed to what it is, and given a\r\n * distinct value per backend, it identifies the block.\r\n *\r\n * Carbon container version remains the only version. Nothing stores this block:\r\n * a consumer builds one and reads it back in the same process, so a block from\r\n * a different build is caught by the trailing-byte check at the end of the read.\r\n *\r\n * The identifier is shared with the WebGL2 block rather than duplicated, so the\r\n * two cannot drift into meaning the same number again.\r\n */\r\n\r\n/**\r\n * Resource kinds, ordered so the wire value is stable\r\n * (`buildWgslSet.js:117-122`).\r\n */\r\nexport const CARBON_BACKEND_RESOURCE_KIND = Object.freeze([\r\n \"uniform-buffer\",\r\n \"sampled-resource\",\r\n \"sampler\",\r\n \"storage-resource\"\r\n]);\r\n\r\n/** Shader stages, as a bit position in the visibility mask. */\r\nexport const CARBON_BACKEND_VISIBILITY = Object.freeze([ \"vertex\", \"fragment\", \"compute\" ]);\r\n\r\n// The transform section is shared with the GLSL block; both re-export the\r\n// family enum and defaults so a consumer of either codec sees them.\r\nexport { CARBON_BACKEND_TRANSFORM_FAMILY, DETAIL_MAP_ARRAY_DEFAULTS };\r\n\r\n/** Marks an absent optional `u32`. Carbon's null-reference value. */\r\nconst ABSENT = 0xffffffff;\r\n\r\n/**\r\n * Encodes a visibility list as a bit mask.\r\n *\r\n * @param {string[]} visibility Stage names.\r\n * @returns {number} Bit mask.\r\n */\r\nfunction packVisibility(visibility)\r\n{\r\n let mask = 0;\r\n for (const stage of visibility ?? [])\r\n {\r\n const bit = CARBON_BACKEND_VISIBILITY.indexOf(stage);\r\n if (bit < 0)\r\n {\r\n throw new CjsFormatWriteError(`Unknown binding visibility \"${stage}\"`, { stage });\r\n }\r\n mask |= 1 << bit;\r\n }\r\n return mask;\r\n}\r\n\r\n/**\r\n * Decodes a visibility bit mask, in the canonical stage order.\r\n *\r\n * @param {number} mask Bit mask.\r\n * @returns {string[]} Stage names.\r\n */\r\nfunction unpackVisibility(mask)\r\n{\r\n const stages = [];\r\n for (let bit = 0; bit < CARBON_BACKEND_VISIBILITY.length; bit += 1)\r\n {\r\n if (mask & (1 << bit)) stages.push(CARBON_BACKEND_VISIBILITY[bit]);\r\n }\r\n return stages;\r\n}\r\n\r\n/**\r\n * Rebuilds a binding's WebGPU descriptor from what the block does store.\r\n *\r\n * The descriptor — `buffer`, `texture` or `sampler` — is not on the wire because\r\n * it is a pure function of the WGSL type, the resource kind and the structure\r\n * stride, all three of which are. `lowerBindingLayout.js` derives it from the\r\n * same three inputs on the way out; this derives it back on the way in.\r\n *\r\n * The pairs that could collide do not. `array<u32>` reaches both a structured\r\n * buffer and a compute typed buffer, and the structure stride separates them:\r\n * structured always carries one, typed never does.\r\n *\r\n * @param {object} binding Decoded binding record.\r\n * @returns {object} The descriptor fragment, as one `{buffer|texture|sampler}` key.\r\n */\r\nfunction deriveBindingDescriptor(binding)\r\n{\r\n const stride = binding.structureStride;\r\n\r\n if (binding.resourceKind === \"sampler\")\r\n {\r\n return { sampler: { type: \"filtering\" } };\r\n }\r\n\r\n if (binding.resourceKind === \"uniform-buffer\")\r\n {\r\n const vec4Count = /^array<vec4<f32>, (\\d+)>$/u.exec(binding.type)?.[1];\r\n if (!vec4Count)\r\n {\r\n throw new CjsFormatReadError(\r\n `Backend block uniform binding has untranslatable type \"${binding.type}\"`,\r\n { type: binding.type }\r\n );\r\n }\r\n return {\r\n buffer: {\r\n type: \"uniform\",\r\n hasDynamicOffset: false,\r\n minBindingSize: Number(vec4Count) * 16\r\n }\r\n };\r\n }\r\n\r\n if (binding.resourceKind === \"sampled-resource\")\r\n {\r\n const texture = TEXTURE_DESCRIPTORS[binding.type];\r\n if (texture) return { texture: { ...texture } };\r\n\r\n return {\r\n buffer: {\r\n type: \"read-only-storage\",\r\n hasDynamicOffset: false,\r\n minBindingSize: stride === undefined ? 4 : stride\r\n }\r\n };\r\n }\r\n\r\n return {\r\n buffer: {\r\n type: \"storage\",\r\n hasDynamicOffset: false,\r\n minBindingSize: stride === undefined ? 4 : stride\r\n }\r\n };\r\n}\r\n\r\n/** Texture descriptors by WGSL type (`lowerBindingLayout.js:90-95`). */\r\nconst TEXTURE_DESCRIPTORS = Object.freeze({\r\n \"texture_2d<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"2d\", multisampled: false }),\r\n \"texture_cube<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"cube\", multisampled: false }),\r\n \"texture_3d<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"3d\", multisampled: false }),\r\n \"texture_2d_array<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"2d-array\", multisampled: false })\r\n});\r\n\r\n/**\r\n * Serialises one pass's backend block.\r\n *\r\n * @param {object} block Block contents.\r\n * @param {object[]} [block.bindGroups] Bind groups with their bindings.\r\n * @param {object[]} [block.transforms] Resource transforms.\r\n * @returns {Uint8Array} Self-contained block bytes.\r\n */\r\n/**\r\n * Refuses a binding whose derived fields disagree with what the reader rebuilds.\r\n *\r\n * `identity`, `scopeIdentity` and the per-binding `group` are not stored: the\r\n * reader recomputes them from the register triple, the visibility mask and the\r\n * enclosing group. A binding that carries a different value therefore does not\r\n * fail - it round-trips into a different binding, and the engine matches on\r\n * exactly these strings.\r\n *\r\n * `scopeIdentity` deserves the sharpest check, because the wire cannot preserve\r\n * what it is derived from. Visibility is stored as a **bitmask**, so it is a\r\n * set; `scopeIdentity` is built from `visibility[0]`, so it depends on an\r\n * order. A binding written as `[fragment, vertex]` reads back as\r\n * `[vertex, fragment]` and its scope silently moves from `@fragment` to\r\n * `@vertex`. Canonical order is the only order the format can represent, so a\r\n * producer must write it.\r\n *\r\n * @param {object} binding Binding record.\r\n * @param {object} group Enclosing bind group.\r\n */\r\nfunction assertDerivedBindingFieldsAgree(binding, group)\r\n{\r\n const identity = `${binding.resourceKind}:${binding.registerSpace}:${binding.registerIndex}`;\r\n const canonical = unpackVisibility(packVisibility(binding.visibility));\r\n const derived = [\r\n [ \"identity\", binding.identity, identity ],\r\n [ \"scopeIdentity\", binding.scopeIdentity, `${identity}@${canonical[0]}` ],\r\n [ \"group\", binding.group, group.group ]\r\n ];\r\n\r\n for (const [ field, actual, expected ] of derived)\r\n {\r\n if (actual === undefined || actual === null) continue;\r\n if (actual === expected) continue;\r\n\r\n throw new CjsFormatWriteError(\r\n `Binding ${identity} sets ${field} to ${JSON.stringify(actual)}, but the reader rebuilds`\r\n + ` ${JSON.stringify(expected)}. The value is not stored, so writing this would silently`\r\n + ` change the binding.`,\r\n { identity, field, actual, expected }\r\n );\r\n }\r\n}\r\n\r\n/**\n * Encode one canonical backend binding and transform block.\n * @param {object} block Backend block record.\n * @returns {Uint8Array} Encoded backend bytes.\n */\nexport function writeBackendBlock(block)\n{\r\n const bindGroups = block.bindGroups ?? [];\r\n const transforms = block.transforms ?? [];\r\n const writer = new CjsByteWriter(256);\r\n\r\n writer.u8(CARBON_BACKEND_ENGINE_ID.webgpu);\r\n\r\n writer.u8(bindGroups.length);\r\n for (const group of bindGroups)\r\n {\r\n writer.u8(group.group);\r\n writer.u8(group.bindings.length);\r\n for (const binding of group.bindings)\r\n {\r\n const kind = CARBON_BACKEND_RESOURCE_KIND.indexOf(binding.resourceKind);\r\n if (kind < 0)\r\n {\r\n throw new CjsFormatWriteError(`Unknown resource kind \"${binding.resourceKind}\"`, {\r\n resourceKind: binding.resourceKind\r\n });\r\n }\r\n assertDerivedBindingFieldsAgree(binding, group);\r\n writer.u8(kind);\r\n writer.u8(binding.registerSpace);\r\n writer.u8(binding.binding);\r\n writer.u8(packVisibility(binding.visibility));\r\n writer.u32(binding.registerIndex);\r\n writer.u32(binding.structureStride ?? ABSENT);\r\n writer.u8(binding.arrayLayerCount ?? 0);\r\n writeInlineString(writer, binding.type);\r\n writeInlineString(writer, binding.generatedSymbol);\r\n // A binding either carries a transform id or it does not; an empty\r\n // string is not a legal id, so length zero encodes absence.\r\n writeInlineString(writer, binding.transformId ?? \"\");\r\n }\r\n }\r\n\r\n writeTransformSection(writer, transforms);\r\n\r\n return writer.toBytes();\r\n}\r\n\r\n/**\r\n * Parses one pass's backend block, restoring every derived field.\r\n *\r\n * @param {ArrayBuffer|ArrayBufferView|Uint8Array} bytes Block bytes.\r\n * @param {object} [options] Read options.\r\n * @param {string} [options.layoutKey] Enclosing pass key, restored onto records.\r\n * @param {string} [options.source] Source name for error details.\r\n * @returns {object} Block contents with derived fields restored.\r\n */\r\nexport function readBackendBlock(bytes, options = {})\r\n{\r\n const reader = new CjsByteReader(bytes, { source: options.source ?? \"backend block\" });\r\n const layoutKey = options.layoutKey ?? null;\r\n\r\n readBackendEngineId(reader, CARBON_BACKEND_ENGINE_ID.webgpu, options.source ?? \"backend block\");\r\n\r\n const bindGroups = [];\r\n const groupCount = reader.ReadUint8();\r\n for (let groupIndex = 0; groupIndex < groupCount; groupIndex += 1)\r\n {\r\n const group = reader.ReadUint8();\r\n const bindings = [];\r\n const bindingCount = reader.ReadUint8();\r\n for (let index = 0; index < bindingCount; index += 1)\r\n {\r\n const resourceKind = CARBON_BACKEND_RESOURCE_KIND[reader.ReadUint8()];\r\n const registerSpace = reader.ReadUint8();\r\n const binding = reader.ReadUint8();\r\n const visibility = unpackVisibility(reader.ReadUint8());\r\n const registerIndex = reader.ReadUint32();\r\n const structureStride = reader.ReadUint32();\r\n const arrayLayerCount = reader.ReadUint8();\r\n const type = readInlineString(reader);\r\n const generatedSymbol = readInlineString(reader);\r\n const transformId = readInlineString(reader);\r\n\r\n const identity = `${resourceKind}:${registerSpace}:${registerIndex}`;\r\n const record = {\r\n group,\r\n binding,\r\n resourceKind,\r\n registerSpace,\r\n registerIndex,\r\n visibility,\r\n type,\r\n generatedSymbol,\r\n identity,\r\n scopeIdentity: `${identity}@${visibility[0]}`,\r\n ...(structureStride === ABSENT ? {} : { structureStride }),\r\n ...(arrayLayerCount === 0 ? {} : { arrayLayerCount }),\r\n ...(transformId === \"\" ? {} : { transformId })\r\n };\r\n bindings.push({ ...record, ...deriveBindingDescriptor(record) });\r\n }\r\n bindGroups.push({ group, bindings });\r\n }\r\n\r\n const transforms = readTransformSection(reader, layoutKey);\r\n\r\n // A sized record must land exactly on its declared end. Trailing bytes mean\r\n // the writer knew fields this reader does not, which with no version byte is\r\n // the ONLY signal that a block came from a different build - so this check is\r\n // load-bearing rather than defensive.\r\n // This is the only surviving form of a closed-schema check: under a record\r\n // layout a field either exists at its offset or the read fails, so there is\r\n // nothing per-field left to assert, but exhaustiveness is still checkable and\r\n // is exactly what a silently-discarded tail would violate.\r\n if (reader.remaining !== 0)\r\n {\r\n throw new CjsFormatReadError(\r\n `Backend block has ${reader.remaining} unparsed trailing byte(s); rebuild the effect package`,\r\n { source: options.source ?? \"backend block\", trailingBytes: reader.remaining }\r\n );\r\n }\r\n\r\n return {\r\n layoutKey,\r\n bindGroups,\r\n transforms,\r\n trailingBytes: 0\r\n };\r\n}\r\n"],"names":["CARBON_BACKEND_RESOURCE_KIND","Object","freeze","CARBON_BACKEND_VISIBILITY","ABSENT","packVisibility","visibility","mask","stage","bit","indexOf","CjsFormatWriteError","unpackVisibility","stages","length","push","deriveBindingDescriptor","binding","stride","structureStride","resourceKind","sampler","type","vec4Count","exec","CjsFormatReadError","buffer","hasDynamicOffset","minBindingSize","Number","texture","TEXTURE_DESCRIPTORS","undefined","sampleType","viewDimension","multisampled","assertDerivedBindingFieldsAgree","group","identity","registerSpace","registerIndex","canonical","derived","scopeIdentity","field","actual","expected","JSON","stringify","writeBackendBlock","block","bindGroups","transforms","writer","CjsByteWriter","u8","CARBON_BACKEND_ENGINE_ID","webgpu","bindings","kind","u32","arrayLayerCount","writeInlineString","generatedSymbol","transformId","writeTransformSection","toBytes","readBackendBlock","bytes","options","reader","CjsByteReader","source","layoutKey","readBackendEngineId","groupCount","ReadUint8","groupIndex","bindingCount","index","ReadUint32","readInlineString","record","readTransformSection","remaining","trailingBytes"],"mappings":";;;;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;MACaA,4BAA4B,GAAGC,MAAM,CAACC,MAAM,CAAC,CACtD,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,kBAAkB,CACrB;;AAED;AACO,MAAMC,yBAAyB,GAAGF,MAAM,CAACC,MAAM,CAAC,CAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAE;;AAM1F;AACA,MAAME,MAAM,GAAG,UAAU;;AAEzB;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,cAAcA,CAACC,UAAU,EAClC;EACI,IAAIC,IAAI,GAAG,CAAC;AACZ,EAAA,KAAK,MAAMC,KAAK,IAAIF,UAAU,IAAI,EAAE,EACpC;AACI,IAAA,MAAMG,GAAG,GAAGN,yBAAyB,CAACO,OAAO,CAACF,KAAK,CAAC;IACpD,IAAIC,GAAG,GAAG,CAAC,EACX;AACI,MAAA,MAAM,IAAIE,mBAAmB,CAAC,CAAA,4BAAA,EAA+BH,KAAK,GAAG,EAAE;AAAEA,QAAAA;AAAM,OAAC,CAAC;AACr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Ae;QACfzB,QAAQ;QACRK,aAAa,EAAE,GAAGL,QAAQ,CAAA,CAAA,EAAIhC,UAAU,CAAC,CAAC,CAAC,CAAA,CAAE;AAC7C,QAAA,IAAIa,eAAe,KAAKf,MAAM,GAAG,EAAE,GAAG;AAAEe,UAAAA;AAAgB,SAAC,CAAC;AAC1D,QAAA,IAAI0C,eAAe,KAAK,CAAC,GAAG,EAAE,GAAG;AAAEA,UAAAA;AAAgB,SAAC,CAAC;AACrD,QAAA,IAAIG,WAAW,KAAK,EAAE,GAAG,EAAE,GAAG;AAAEA,UAAAA;SAAa;OAChD;MACDN,QAAQ,CAAC3C,IAAI,CAAC;AAAE,QAAA,GAAGmE,MAAM;QAAE,GAAGlE,uBAAuB,CAACkE,MAAM;AAAE,OAAC,CAAC;AACpE,IAAA;IACA/B,UAAU,CAACpC,IAAI,CAAC;MAAEsB,KAAK;AAAEqB,MAAAA;AAAS,KAAC,CAAC;AACxC,EAAA;AAEA,EAAA,MAAMN,UAAU,GAAG+B,oBAAoB,CAACb,MAAM,EAAEG,SAAS,CAAC;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,IAAIH,MAAM,CAACc,SAAS,KAAK,CAAC,EAC1B;IACI,MAAM,IAAI3D,kBAAkB,CACxB,CAAA,kBAAA,EAAqB6C,MAAM,CAACc,SAAS,wDAAwD,EAC7F;AAAEZ,MAAAA,MAAM,EAAEH,OAAO,CAACG,MAAM,IAAI,eAAe;MAAEa,aAAa,EAAEf,MAAM,CAACc;AAAU,KACjF,CAAC;AACL,EAAA;EAEA,OAAO;IACHX,SAAS;IACTtB,UAAU;IACVC,UAAU;AACViC,IAAAA,aAAa,EAAE;GAClB;AACL;;;;"}
1
+ {"version":3,"file":"carbonEffectBackendBlock.js","sources":["../../../../../src/resource/format/carbonEffect/carbonEffectBackendBlock.js"],"sourcesContent":["import { CjsByteWriter } from \"../CjsByteWriter.js\";\r\nimport { CjsByteReader } from \"../CjsByteReader.js\";\r\nimport { CjsFormatReadError, CjsFormatWriteError } from \"../CjsFormatError.js\";\r\nimport {\r\n CARBON_BACKEND_ENGINE_ID,\r\n readBackendEngineId\r\n} from \"./backendEngineId.js\";\r\nimport {\r\n CARBON_BACKEND_TRANSFORM_FAMILY,\r\n DETAIL_MAP_ARRAY_DEFAULTS,\r\n readInlineString,\r\n readTransformSection,\r\n writeInlineString,\r\n writeTransformSection\r\n} from \"./carbonEffectResourceTransform.js\";\r\n\r\n/**\r\n * The WebGPU pass block: bind-group layouts plus the shared resource-transform\r\n * section.\r\n *\r\n * Neither is derivable from Carbon reflection. Carbon's `registers[]` is the D3D\r\n * binding model, while `(group, binding, visibility, generatedSymbol)` comes from\r\n * the *lowered IR's* bindings. So this is the port's only genuine invention, and\r\n * it is built entirely from Carbon's own techniques: count-prefixed fixed-width\r\n * records inside a blob referenced by `{u32 size, u32 offset}`, exactly like\r\n * program source.\r\n *\r\n * Both sections share **one** block rather than occupying two, because the\r\n * invariant worth keeping is \"the Carbon region is backend-invariant, with\r\n * exactly one optional trailing block\". They are also mutually required — a\r\n * transform needs a carrier binding in the same pass's layout and a transformed\r\n * binding needs a recipe — so one unit is the honest shape.\r\n *\r\n * ## Why the block is self-contained\r\n *\r\n * The block lives in the arena so that identical layouts dedupe across bodies the\r\n * way program source does; measured sharing is 30.5:1 at `(body, pass)`\r\n * granularity, 22 distinct blocks across 672 pairs.\r\n *\r\n * That forces one design consequence: **the block cannot contain arena offsets.**\r\n * An offset is only known after the arena's content sort, and the sort depends on\r\n * every blob's bytes — including this one. A block referencing the arena would\r\n * have to be interned before its own contents could be computed. Carbon never\r\n * meets this because no Carbon arena blob refers to the arena.\r\n *\r\n * So strings are inline here, length-prefixed, not interned. The cost is real but\r\n * small: a repeated `\"t11\"` inside 22 distinct blocks rather than one shared copy.\r\n * The block itself is what dedupes, and it dedupes 30x.\r\n */\r\n\r\n/**\r\n * The leading byte is the TARGET ENGINE IDENTIFIER, not a version.\r\n *\r\n * It was called CARBON_EFFECT_BACKEND_BLOCK_VERSION and emitted 1, while the\r\n * WebGL2 writer also emitted 1 meaning something unrelated - so the byte could\r\n * not do the one job it was there for. Renamed to what it is, and given a\r\n * distinct value per backend, it identifies the block.\r\n *\r\n * Carbon container version remains the only version. Nothing stores this block:\r\n * a consumer builds one and reads it back in the same process, so a block from\r\n * a different build is caught by the trailing-byte check at the end of the read.\r\n *\r\n * The identifier is shared with the WebGL2 block rather than duplicated, so the\r\n * two cannot drift into meaning the same number again.\r\n */\r\n\r\n/**\r\n * Resource kinds, ordered so the wire value is stable\r\n * (`buildWgslSet.js:117-122`).\r\n */\r\nexport const CARBON_BACKEND_RESOURCE_KIND = Object.freeze([\r\n \"uniform-buffer\",\r\n \"sampled-resource\",\r\n \"sampler\",\r\n \"storage-resource\"\r\n]);\r\n\r\n/**\r\n * A texture binding's sample type, ordered so the wire value is stable. The\r\n * first is the default and what every non-texture binding writes.\r\n */\r\nexport const CARBON_BACKEND_TEXTURE_SAMPLE_TYPE = Object.freeze([ \"float\", \"unfilterable-float\" ]);\r\n\r\n/** Shader stages, as a bit position in the visibility mask. */\r\nexport const CARBON_BACKEND_VISIBILITY = Object.freeze([ \"vertex\", \"fragment\", \"compute\" ]);\r\n\r\n// The transform section is shared with the GLSL block; both re-export the\r\n// family enum and defaults so a consumer of either codec sees them.\r\nexport { CARBON_BACKEND_TRANSFORM_FAMILY, DETAIL_MAP_ARRAY_DEFAULTS };\r\n\r\n/** Marks an absent optional `u32`. Carbon's null-reference value. */\r\nconst ABSENT = 0xffffffff;\r\n\r\n/**\r\n * Encodes a visibility list as a bit mask.\r\n *\r\n * @param {string[]} visibility Stage names.\r\n * @returns {number} Bit mask.\r\n */\r\nfunction packVisibility(visibility)\r\n{\r\n let mask = 0;\r\n for (const stage of visibility ?? [])\r\n {\r\n const bit = CARBON_BACKEND_VISIBILITY.indexOf(stage);\r\n if (bit < 0)\r\n {\r\n throw new CjsFormatWriteError(`Unknown binding visibility \"${stage}\"`, { stage });\r\n }\r\n mask |= 1 << bit;\r\n }\r\n return mask;\r\n}\r\n\r\n/**\r\n * Decodes a visibility bit mask, in the canonical stage order.\r\n *\r\n * @param {number} mask Bit mask.\r\n * @returns {string[]} Stage names.\r\n */\r\nfunction unpackVisibility(mask)\r\n{\r\n const stages = [];\r\n for (let bit = 0; bit < CARBON_BACKEND_VISIBILITY.length; bit += 1)\r\n {\r\n if (mask & (1 << bit)) stages.push(CARBON_BACKEND_VISIBILITY[bit]);\r\n }\r\n return stages;\r\n}\r\n\r\n/**\r\n * Rebuilds a binding's WebGPU descriptor from what the block does store.\r\n *\r\n * The descriptor — `buffer`, `texture` or `sampler` — is not on the wire because\r\n * it is a pure function of the WGSL type, the resource kind and the structure\r\n * stride, all three of which are. `lowerBindingLayout.js` derives it from the\r\n * same three inputs on the way out; this derives it back on the way in.\r\n *\r\n * The pairs that could collide do not. `array<u32>` reaches both a structured\r\n * buffer and a compute typed buffer, and the structure stride separates them:\r\n * structured always carries one, typed never does.\r\n *\r\n * One texture fact is not in the WGSL type and is stored: its sample type.\r\n * `texture_2d<f32>` is the same declaration whether the layout says `float` or\r\n * `unfilterable-float`, and only the lowering, which sees the instructions,\r\n * knows a texture is only ever loaded.\r\n *\r\n * @param {object} binding Decoded binding record.\r\n * @returns {object} The descriptor fragment, as one `{buffer|texture|sampler}` key.\r\n */\r\nfunction deriveBindingDescriptor(binding)\r\n{\r\n const stride = binding.structureStride;\r\n\r\n if (binding.resourceKind === \"sampler\")\r\n {\r\n return { sampler: { type: \"filtering\" } };\r\n }\r\n\r\n if (binding.resourceKind === \"uniform-buffer\")\r\n {\r\n const vec4Count = /^array<vec4<f32>, (\\d+)>$/u.exec(binding.type)?.[1];\r\n if (!vec4Count)\r\n {\r\n throw new CjsFormatReadError(\r\n `Backend block uniform binding has untranslatable type \"${binding.type}\"`,\r\n { type: binding.type }\r\n );\r\n }\r\n return {\r\n buffer: {\r\n type: \"uniform\",\r\n hasDynamicOffset: false,\r\n minBindingSize: Number(vec4Count) * 16\r\n }\r\n };\r\n }\r\n\r\n if (binding.resourceKind === \"sampled-resource\")\r\n {\r\n const texture = TEXTURE_DESCRIPTORS[binding.type];\r\n if (texture) return { texture: { ...texture, sampleType: binding.textureSampleType } };\r\n\r\n return {\r\n buffer: {\r\n type: \"read-only-storage\",\r\n hasDynamicOffset: false,\r\n minBindingSize: stride === undefined ? 4 : stride\r\n }\r\n };\r\n }\r\n\r\n return {\r\n buffer: {\r\n type: \"storage\",\r\n hasDynamicOffset: false,\r\n minBindingSize: stride === undefined ? 4 : stride\r\n }\r\n };\r\n}\r\n\r\n/** Texture descriptors by WGSL type (`lowerBindingLayout.js:90-95`). */\r\nconst TEXTURE_DESCRIPTORS = Object.freeze({\r\n \"texture_2d<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"2d\", multisampled: false }),\r\n \"texture_cube<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"cube\", multisampled: false }),\r\n \"texture_3d<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"3d\", multisampled: false }),\r\n \"texture_2d_array<f32>\": Object.freeze({ sampleType: \"float\", viewDimension: \"2d-array\", multisampled: false })\r\n});\r\n\r\n/**\r\n * Serialises one pass's backend block.\r\n *\r\n * @param {object} block Block contents.\r\n * @param {object[]} [block.bindGroups] Bind groups with their bindings.\r\n * @param {object[]} [block.transforms] Resource transforms.\r\n * @returns {Uint8Array} Self-contained block bytes.\r\n */\r\n/**\r\n * Refuses a binding whose derived fields disagree with what the reader rebuilds.\r\n *\r\n * `identity`, `scopeIdentity` and the per-binding `group` are not stored: the\r\n * reader recomputes them from the register triple, the visibility mask and the\r\n * enclosing group. A binding that carries a different value therefore does not\r\n * fail - it round-trips into a different binding, and the engine matches on\r\n * exactly these strings.\r\n *\r\n * `scopeIdentity` deserves the sharpest check, because the wire cannot preserve\r\n * what it is derived from. Visibility is stored as a **bitmask**, so it is a\r\n * set; `scopeIdentity` is built from `visibility[0]`, so it depends on an\r\n * order. A binding written as `[fragment, vertex]` reads back as\r\n * `[vertex, fragment]` and its scope silently moves from `@fragment` to\r\n * `@vertex`. Canonical order is the only order the format can represent, so a\r\n * producer must write it.\r\n *\r\n * @param {object} binding Binding record.\r\n * @param {object} group Enclosing bind group.\r\n */\r\nfunction assertDerivedBindingFieldsAgree(binding, group)\r\n{\r\n const identity = `${binding.resourceKind}:${binding.registerSpace}:${binding.registerIndex}`;\r\n const canonical = unpackVisibility(packVisibility(binding.visibility));\r\n const derived = [\r\n [ \"identity\", binding.identity, identity ],\r\n [ \"scopeIdentity\", binding.scopeIdentity, `${identity}@${canonical[0]}` ],\r\n [ \"group\", binding.group, group.group ]\r\n ];\r\n\r\n for (const [ field, actual, expected ] of derived)\r\n {\r\n if (actual === undefined || actual === null) continue;\r\n if (actual === expected) continue;\r\n\r\n throw new CjsFormatWriteError(\r\n `Binding ${identity} sets ${field} to ${JSON.stringify(actual)}, but the reader rebuilds`\r\n + ` ${JSON.stringify(expected)}. The value is not stored, so writing this would silently`\r\n + ` change the binding.`,\r\n { identity, field, actual, expected }\r\n );\r\n }\r\n}\r\n\r\n/**\r\n * Encode one canonical backend binding and transform block.\r\n * @param {object} block Backend block record.\r\n * @returns {Uint8Array} Encoded backend bytes.\r\n */\r\nexport function writeBackendBlock(block)\r\n{\r\n const bindGroups = block.bindGroups ?? [];\r\n const transforms = block.transforms ?? [];\r\n const writer = new CjsByteWriter(256);\r\n\r\n writer.u8(CARBON_BACKEND_ENGINE_ID.webgpu);\r\n\r\n writer.u8(bindGroups.length);\r\n for (const group of bindGroups)\r\n {\r\n writer.u8(group.group);\r\n writer.u8(group.bindings.length);\r\n for (const binding of group.bindings)\r\n {\r\n const kind = CARBON_BACKEND_RESOURCE_KIND.indexOf(binding.resourceKind);\r\n if (kind < 0)\r\n {\r\n throw new CjsFormatWriteError(`Unknown resource kind \"${binding.resourceKind}\"`, {\r\n resourceKind: binding.resourceKind\r\n });\r\n }\r\n assertDerivedBindingFieldsAgree(binding, group);\r\n writer.u8(kind);\r\n writer.u8(binding.registerSpace);\r\n writer.u8(binding.binding);\r\n writer.u8(packVisibility(binding.visibility));\r\n writer.u32(binding.registerIndex);\r\n writer.u32(binding.structureStride ?? ABSENT);\r\n writer.u8(binding.arrayLayerCount ?? 0);\r\n const sampleType = CARBON_BACKEND_TEXTURE_SAMPLE_TYPE.indexOf(binding.texture?.sampleType ?? \"float\");\r\n if (sampleType < 0)\r\n {\r\n throw new CjsFormatWriteError(`Unknown texture sample type \"${binding.texture.sampleType}\"`, {\r\n sampleType: binding.texture.sampleType\r\n });\r\n }\r\n writer.u8(sampleType);\r\n writeInlineString(writer, binding.type);\r\n writeInlineString(writer, binding.generatedSymbol);\r\n // A binding either carries a transform id or it does not; an empty\r\n // string is not a legal id, so length zero encodes absence.\r\n writeInlineString(writer, binding.transformId ?? \"\");\r\n }\r\n }\r\n\r\n writeTransformSection(writer, transforms);\r\n\r\n return writer.toBytes();\r\n}\r\n\r\n/**\r\n * Parses one pass's backend block, restoring every derived field.\r\n *\r\n * @param {ArrayBuffer|ArrayBufferView|Uint8Array} bytes Block bytes.\r\n * @param {object} [options] Read options.\r\n * @param {string} [options.layoutKey] Enclosing pass key, restored onto records.\r\n * @param {string} [options.source] Source name for error details.\r\n * @returns {object} Block contents with derived fields restored.\r\n */\r\nexport function readBackendBlock(bytes, options = {})\r\n{\r\n const reader = new CjsByteReader(bytes, { source: options.source ?? \"backend block\" });\r\n const layoutKey = options.layoutKey ?? null;\r\n\r\n readBackendEngineId(reader, CARBON_BACKEND_ENGINE_ID.webgpu, options.source ?? \"backend block\");\r\n\r\n const bindGroups = [];\r\n const groupCount = reader.ReadUint8();\r\n for (let groupIndex = 0; groupIndex < groupCount; groupIndex += 1)\r\n {\r\n const group = reader.ReadUint8();\r\n const bindings = [];\r\n const bindingCount = reader.ReadUint8();\r\n for (let index = 0; index < bindingCount; index += 1)\r\n {\r\n const resourceKind = CARBON_BACKEND_RESOURCE_KIND[reader.ReadUint8()];\r\n const registerSpace = reader.ReadUint8();\r\n const binding = reader.ReadUint8();\r\n const visibility = unpackVisibility(reader.ReadUint8());\r\n const registerIndex = reader.ReadUint32();\r\n const structureStride = reader.ReadUint32();\r\n const arrayLayerCount = reader.ReadUint8();\r\n const textureSampleType = CARBON_BACKEND_TEXTURE_SAMPLE_TYPE[reader.ReadUint8()];\r\n if (!textureSampleType)\r\n {\r\n throw new CjsFormatReadError(\"Backend block binding has an unknown texture sample type\", {\r\n source: options.source ?? \"backend block\"\r\n });\r\n }\r\n const type = readInlineString(reader);\r\n const generatedSymbol = readInlineString(reader);\r\n const transformId = readInlineString(reader);\r\n\r\n const identity = `${resourceKind}:${registerSpace}:${registerIndex}`;\r\n const record = {\r\n group,\r\n binding,\r\n resourceKind,\r\n registerSpace,\r\n registerIndex,\r\n visibility,\r\n type,\r\n generatedSymbol,\r\n identity,\r\n scopeIdentity: `${identity}@${visibility[0]}`,\r\n ...(structureStride === ABSENT ? {} : { structureStride }),\r\n ...(arrayLayerCount === 0 ? {} : { arrayLayerCount }),\r\n ...(transformId === \"\" ? {} : { transformId })\r\n };\r\n bindings.push({ ...record, ...deriveBindingDescriptor({ ...record, textureSampleType }) });\r\n }\r\n bindGroups.push({ group, bindings });\r\n }\r\n\r\n const transforms = readTransformSection(reader, layoutKey);\r\n\r\n // A sized record must land exactly on its declared end. Trailing bytes mean\r\n // the writer knew fields this reader does not, which with no version byte is\r\n // the ONLY signal that a block came from a different build - so this check is\r\n // load-bearing rather than defensive.\r\n // This is the only surviving form of a closed-schema check: under a record\r\n // layout a field either exists at its offset or the read fails, so there is\r\n // nothing per-field left to assert, but exhaustiveness is still checkable and\r\n // is exactly what a silently-discarded tail would violate.\r\n if (reader.remaining !== 0)\r\n {\r\n throw new CjsFormatReadError(\r\n `Backend block has ${reader.remaining} unparsed trailing byte(s); rebuild the effect package`,\r\n { source: options.source ?? \"backend block\", trailingBytes: reader.remaining }\r\n );\r\n }\r\n\r\n return {\r\n layoutKey,\r\n bindGroups,\r\n transforms,\r\n trailingBytes: 0\r\n };\r\n}\r\n"],"names":["CARBON_BACKEND_RESOURCE_KIND","Object","freeze","CARBON_BACKEND_TEXTURE_SAMPLE_TYPE","CARBON_BACKEND_VISIBILITY","ABSENT","packVisibility","visibility","mask","stage","bit","indexOf","CjsFormatWriteError","unpackVisibility","stages","length","push","deriveBindingDescriptor","binding","stride","structureStride","resourceKind","sampler","type","vec4Count","exec","CjsFormatReadError","buffer","hasDynamicOffset","minBindingSize","Number","texture","TEXTURE_DESCRIPTORS","sampleType","textureSampleType","undefined","viewDimension","multisampled","assertDerivedBindingFieldsAgree","group","identity","registerSpace","registerIndex","canonical","derived","scopeIdentity","field","actual","expected","JSON","stringify","writeBackendBlock","block","bindGroups","transforms","writer","CjsByteWriter","u8","CARBON_BACKEND_ENGINE_ID","webgpu","bindings","kind","u32","arrayLayerCount","writeInlineString","generatedSymbol","transformId","writeTransformSection","toBytes","readBackendBlock","bytes","options","reader","CjsByteReader","source","layoutKey","readBackendEngineId","groupCount","ReadUint8","groupIndex","bindingCount","index","ReadUint32","readInlineString","record","readTransformSection","remaining","trailingBytes"],"mappings":";;;;;;;AAgBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;MACaA,4BAA4B,GAAGC,MAAM,CAACC,MAAM,CAAC,CACtD,gBAAgB,EAChB,kBAAkB,EAClB,SAAS,EACT,kBAAkB,CACrB;;AAED;AACA;AACA;AACA;AACO,MAAMC,kCAAkC,GAAGF,MAAM,CAACC,MAAM,CAAC,CAAE,OAAO,EAAE,oBAAoB,CAAE;;AAEjG;AACO,MAAME,yBAAyB,GAAGH,MAAM,CAACC,MAAM,CAAC,CAAE,QAAQ,EA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AAIjC,UAAU,CAAC,CAAC,CAAC,CAAA,CAAE;AAC7C,QAAA,IAAIa,eAAe,KAAKf,MAAM,GAAG,EAAE,GAAG;AAAEe,UAAAA;AAAgB,SAAC,CAAC;AAC1D,QAAA,IAAI2C,eAAe,KAAK,CAAC,GAAG,EAAE,GAAG;AAAEA,UAAAA;AAAgB,SAAC,CAAC;AACrD,QAAA,IAAIG,WAAW,KAAK,EAAE,GAAG,EAAE,GAAG;AAAEA,UAAAA;SAAa;OAChD;MACDN,QAAQ,CAAC5C,IAAI,CAAC;AAAE,QAAA,GAAGoE,MAAM;AAAE,QAAA,GAAGnE,uBAAuB,CAAC;AAAE,UAAA,GAAGmE,MAAM;AAAElD,UAAAA;SAAmB;AAAE,OAAC,CAAC;AAC9F,IAAA;IACAmB,UAAU,CAACrC,IAAI,CAAC;MAAEuB,KAAK;AAAEqB,MAAAA;AAAS,KAAC,CAAC;AACxC,EAAA;AAEA,EAAA,MAAMN,UAAU,GAAG+B,oBAAoB,CAACb,MAAM,EAAEG,SAAS,CAAC;;AAE1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,IAAIH,MAAM,CAACc,SAAS,KAAK,CAAC,EAC1B;IACI,MAAM,IAAI5D,kBAAkB,CACxB,CAAA,kBAAA,EAAqB8C,MAAM,CAACc,SAAS,wDAAwD,EAC7F;AAAEZ,MAAAA,MAAM,EAAEH,OAAO,CAACG,MAAM,IAAI,eAAe;MAAEa,aAAa,EAAEf,MAAM,CAACc;AAAU,KACjF,CAAC;AACL,EAAA;EAEA,OAAO;IACHX,SAAS;IACTtB,UAAU;IACVC,UAAU;AACViC,IAAAA,aAAa,EAAE;GAClB;AACL;;;;"}
@@ -5,10 +5,12 @@ export { CjsBitReader, readBitAt, readBitsAt } from './CjsBitReader.js';
5
5
  export { CjsByteWriter } from './CjsByteWriter.js';
6
6
  export { CJS_STRING_TABLE_NULL_REFERENCE, CjsStringTable, compareTableBlobs } from './CjsStringTable.js';
7
7
  export { CARBON_ANNOTATION_TYPE, CARBON_EFFECT_COUNT_CAPS, CARBON_EFFECT_DATA_VERSION, CARBON_EFFECT_MIN_DATA_VERSION, CARBON_EFFECT_WRITE_VERSIONS, CARBON_SHADER_CONSTANTS_MAX, collectArena, compareAnnotationNames, internArena, passthroughArena, readEffectDescription, resolveWriteVersion, writeEffectDescription } from './carbonEffect/carbonEffectRecords.js';
8
- export { CARBON_BACKEND_RESOURCE_KIND, CARBON_BACKEND_VISIBILITY, readBackendBlock, writeBackendBlock } from './carbonEffect/carbonEffectBackendBlock.js';
8
+ export { CARBON_BACKEND_RESOURCE_KIND, CARBON_BACKEND_TEXTURE_SAMPLE_TYPE, CARBON_BACKEND_VISIBILITY, readBackendBlock, writeBackendBlock } from './carbonEffect/carbonEffectBackendBlock.js';
9
9
  export { CARBON_EFFECT_RECORD_BYTES, CARBON_EFFECT_SOURCE_HASH_BYTES, CjsCarbonEffectBodyReader, CjsCarbonEffectReader, looksLikeCarbonEffectContainer } from './carbonEffect/CjsCarbonEffectReader.js';
10
10
  export { CjsCarbonEffectWriter, writeCarbonEffectFile } from './carbonEffect/CjsCarbonEffectWriter.js';
11
11
  export { CjsFormat, CjsFormatOutputRole, CjsFormatReadMode } from './CjsFormat.js';
12
+ export { CjsImageFormat } from './CjsImageFormat.js';
13
+ export { CjsGeometryFormat } from './CjsGeometryFormat.js';
12
14
  export { CjsFormatRoute, CjsFormatStore } from './CjsFormatStore.js';
13
15
  export { ResourcePayloadType, ResourcePayloadValues, validateAudioPayload, validateRgbaPayload, validateTexturePayload, validateVideoPayload } from './payloadContract.js';
14
16
  export { CARBON_BACKEND_TRANSFORM_FAMILY, DETAIL_MAP_ARRAY_DEFAULTS } from './carbonEffect/carbonEffectResourceTransform.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
@@ -1,16 +1,16 @@
1
1
  import { CjsFormat } from '../../format/CjsFormat.js';
2
2
  import { CLASS_KEYS } from './core/schema.js';
3
3
  import { DEFAULT_VALUES, OUTPUT_JSON, OUTPUT_PAYLOAD, normalizeValues, validateClassKey, validateClass, toJsonValue, OUTPUT_DOCUMENT, OUTPUT_RAW, OUTPUT_RUNTIME } from './core/helpers.js';
4
- import { CJS_BLACK_FOURCC, CJS_BLACK_FORMAT_ID, CJS_BLACK_EXTENSION, CJS_BLACK_VERSION } from './core/blackConstants.js';
4
+ import { CJS_BLACK_FOURCC, CJS_BLACK_EXTENSION, CJS_BLACK_VERSION } from './core/blackConstants.js';
5
5
  import { CjsBlackReader } from './core/CjsBlackReader.js';
6
6
 
7
7
  const FORMAT_NAME = "CjsBlackFormat";
8
8
 
9
- /**
10
- * CarbonEngineJS-facing Black format profile.
11
- *
12
- * This package reads public-facing `.black` payload data using CarbonEngineJS
13
- * canonical schemas or source-shape registries.
9
+ /**
10
+ * CarbonEngineJS-facing Black format profile.
11
+ *
12
+ * This package reads public-facing `.black` payload data using CarbonEngineJS
13
+ * canonical schemas or source-shape registries.
14
14
  */
15
15
  class CjsBlackFormat extends CjsFormat {
16
16
  #emit = DEFAULT_VALUES.emit;
@@ -18,33 +18,33 @@ class CjsBlackFormat extends CjsFormat {
18
18
  #readerOptions = {};
19
19
  #classes = {};
20
20
 
21
- /**
22
- * Plain payload outputs can be decoded in a browser worker. Document and
23
- * runtime outputs retain class identity and therefore stay on the caller
24
- * thread.
21
+ /**
22
+ * Plain payload outputs can be decoded in a browser worker. Document and
23
+ * runtime outputs retain class identity and therefore stay on the caller
24
+ * thread.
25
25
  */
26
- static worker = Object.freeze({
26
+ static worker = {
27
27
  module: import.meta.url,
28
28
  exportName: "CjsBlackFormat",
29
29
  outputTypes: Object.freeze([OUTPUT_JSON, OUTPUT_PAYLOAD]),
30
30
  defaultOutput: OUTPUT_JSON
31
- });
31
+ };
32
32
 
33
- /**
34
- * Create a reusable format profile.
35
- *
36
- * @param {object} [options] Default format values.
33
+ /**
34
+ * Create a reusable format profile.
35
+ *
36
+ * @param {object} [options] Default format values.
37
37
  */
38
38
  constructor(options = {}) {
39
39
  super();
40
40
  this.SetValues(options);
41
41
  }
42
42
 
43
- /**
44
- * Set format values for this reusable profile.
45
- *
46
- * @param {object} [options] Values to merge into the profile.
47
- * @returns {CjsBlackFormat} This format profile.
43
+ /**
44
+ * Set format values for this reusable profile.
45
+ *
46
+ * @param {object} [options] Values to merge into the profile.
47
+ * @returns {CjsBlackFormat} This format profile.
48
48
  */
49
49
  SetValues(options = {}) {
50
50
  const values = normalizeValues(this.GetValues(), options, CLASS_KEYS, FORMAT_NAME);
@@ -55,11 +55,11 @@ class CjsBlackFormat extends CjsFormat {
55
55
  return this;
56
56
  }
57
57
 
58
- /**
59
- * Get this profile's current values, optionally with per-call overrides.
60
- *
61
- * @param {object} [options] Optional values to merge into a copy.
62
- * @returns {object} A copy of the effective values.
58
+ /**
59
+ * Get this profile's current values, optionally with per-call overrides.
60
+ *
61
+ * @param {object} [options] Optional values to merge into a copy.
62
+ * @returns {object} A copy of the effective values.
63
63
  */
64
64
  GetValues(options = {}) {
65
65
  return normalizeValues({
@@ -70,11 +70,11 @@ class CjsBlackFormat extends CjsFormat {
70
70
  }, options, CLASS_KEYS, FORMAT_NAME);
71
71
  }
72
72
 
73
- /**
74
- * Set multiple runtime class constructors for this profile.
75
- *
76
- * @param {object} [classes] Map of Black class names to constructors.
77
- * @returns {CjsBlackFormat} This format profile.
73
+ /**
74
+ * Set multiple runtime class constructors for this profile.
75
+ *
76
+ * @param {object} [classes] Map of Black class names to constructors.
77
+ * @returns {CjsBlackFormat} This format profile.
78
78
  */
79
79
  SetClasses(classes = {}) {
80
80
  return this.SetValues({
@@ -82,12 +82,12 @@ class CjsBlackFormat extends CjsFormat {
82
82
  });
83
83
  }
84
84
 
85
- /**
86
- * Set one node-class constructor for this profile.
87
- *
88
- * @param {string} type Black class name.
89
- * @param {Function|null|undefined} Class Constructor to use, or nullish to delete.
90
- * @returns {CjsBlackFormat} This format profile.
85
+ /**
86
+ * Set one node-class constructor for this profile.
87
+ *
88
+ * @param {string} type Black class name.
89
+ * @param {Function|null|undefined} Class Constructor to use, or nullish to delete.
90
+ * @returns {CjsBlackFormat} This format profile.
91
91
  */
92
92
  SetClass(type, Class) {
93
93
  validateClassKey(CLASS_KEYS, type, FORMAT_NAME);
@@ -103,98 +103,98 @@ class CjsBlackFormat extends CjsFormat {
103
103
  return this;
104
104
  }
105
105
 
106
- /**
107
- * Get a configured runtime class constructor.
108
- *
109
- * @param {string} type Black class name.
110
- * @returns {Function|undefined} The registered constructor, if any.
106
+ /**
107
+ * Get a configured runtime class constructor.
108
+ *
109
+ * @param {string} type Black class name.
110
+ * @returns {Function|undefined} The registered constructor, if any.
111
111
  */
112
112
  GetClass(type) {
113
113
  validateClassKey(CLASS_KEYS, type, FORMAT_NAME);
114
114
  return this.#classes[type];
115
115
  }
116
116
 
117
- /**
118
- * Whether this format profile has a constructor registered for a node key.
119
- *
120
- * @param {string} type Node class key.
121
- * @returns {boolean} True when a constructor is registered.
117
+ /**
118
+ * Whether this format profile has a constructor registered for a node key.
119
+ *
120
+ * @param {string} type Node class key.
121
+ * @returns {boolean} True when a constructor is registered.
122
122
  */
123
123
  HasClass(type) {
124
124
  return !!this.GetClass(type);
125
125
  }
126
126
 
127
- /**
128
- * Read Black data with this profile's values.
129
- *
130
- * @param {unknown} input Black format input.
131
- * @param {object} [options] Per-call value overrides.
132
- * @returns {object} Public payload output by default.
127
+ /**
128
+ * Read Black data with this profile's values.
129
+ *
130
+ * @param {unknown} input Black format input.
131
+ * @param {object} [options] Per-call value overrides.
132
+ * @returns {object} Public payload output by default.
133
133
  */
134
134
  Read(input, options = {}) {
135
135
  return CjsBlackFormat.read(input, this.GetValues(options));
136
136
  }
137
137
 
138
- /**
139
- * Read Black data as a neutral document graph for diagnostics.
140
- *
141
- * @param {unknown} input Black format input.
142
- * @param {object} [options] Per-call value overrides.
143
- * @returns {object} CarbonEngineJS document graph.
138
+ /**
139
+ * Read Black data as a neutral document graph for diagnostics.
140
+ *
141
+ * @param {unknown} input Black format input.
142
+ * @param {object} [options] Per-call value overrides.
143
+ * @returns {object} CarbonEngineJS document graph.
144
144
  */
145
145
  ReadDocument(input, options = {}) {
146
146
  return CjsBlackFormat.readDocument(input, this.GetValues(options));
147
147
  }
148
148
 
149
- /**
150
- * Read Black data as runtime objects or plain source-shaped objects.
151
- *
152
- * @param {unknown} input Black format input.
153
- * @param {object} [options] Per-call value overrides.
154
- * @returns {object} Runtime read result.
149
+ /**
150
+ * Read Black data as runtime objects or plain source-shaped objects.
151
+ *
152
+ * @param {unknown} input Black format input.
153
+ * @param {object} [options] Per-call value overrides.
154
+ * @returns {object} Runtime read result.
155
155
  */
156
156
  ReadRuntime(input, options = {}) {
157
157
  return CjsBlackFormat.readRuntime(input, this.GetValues(options));
158
158
  }
159
159
 
160
- /**
161
- * Read Black data as compact public payload JSON.
162
- *
163
- * @param {unknown} input Black format input.
164
- * @param {object} [options] Per-call value overrides.
165
- * @returns {object} Public payload output.
160
+ /**
161
+ * Read Black data as compact public payload JSON.
162
+ *
163
+ * @param {unknown} input Black format input.
164
+ * @param {object} [options] Per-call value overrides.
165
+ * @returns {object} Public payload output.
166
166
  */
167
167
  ReadPayload(input, options = {}) {
168
168
  return CjsBlackFormat.readPayload(input, this.GetValues(options));
169
169
  }
170
170
 
171
- /**
172
- * Inspect Black data with this profile's values.
173
- *
174
- * @param {unknown} input Black format input.
175
- * @param {object} [options] Per-call value overrides.
176
- * @returns {object} Plain summary data.
171
+ /**
172
+ * Inspect Black data with this profile's values.
173
+ *
174
+ * @param {unknown} input Black format input.
175
+ * @param {object} [options] Per-call value overrides.
176
+ * @returns {object} Plain summary data.
177
177
  */
178
178
  Inspect(input, options = {}) {
179
179
  return CjsBlackFormat.inspect(input, this.GetValues(options));
180
180
  }
181
181
 
182
- /**
183
- * Convert format output to JSON-compatible data.
184
- *
185
- * @param {any} value Format output to convert.
186
- * @returns {any} Plain JSON-compatible data.
182
+ /**
183
+ * Convert format output to JSON-compatible data.
184
+ *
185
+ * @param {any} value Format output to convert.
186
+ * @returns {any} Plain JSON-compatible data.
187
187
  */
188
188
  ToJSON(value) {
189
189
  return toJsonValue(value);
190
190
  }
191
191
 
192
- /**
193
- * Static one-shot read. Static methods use camelCase by convention.
194
- *
195
- * @param {unknown} input Black format input.
196
- * @param {object} [options] Format values.
197
- * @returns {object} Format output.
192
+ /**
193
+ * Static one-shot read. Static methods use camelCase by convention.
194
+ *
195
+ * @param {unknown} input Black format input.
196
+ * @param {object} [options] Format values.
197
+ * @returns {object} Format output.
198
198
  */
199
199
  static read(input, options = {}) {
200
200
  const values = normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME);
@@ -203,89 +203,82 @@ class CjsBlackFormat extends CjsFormat {
203
203
  return CjsBlackFormat.readPayload(input, values);
204
204
  }
205
205
 
206
- /**
207
- * Static one-shot document read.
208
- *
209
- * @param {unknown} input Black format input.
210
- * @param {object} [options] Format values.
211
- * @returns {object} CarbonEngineJS document graph.
206
+ /**
207
+ * Static one-shot document read.
208
+ *
209
+ * @param {unknown} input Black format input.
210
+ * @param {object} [options] Format values.
211
+ * @returns {object} CarbonEngineJS document graph.
212
212
  */
213
213
  static readDocument(input, options = {}) {
214
214
  return new CjsBlackReader(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME)).ReadDocument();
215
215
  }
216
216
 
217
- /**
218
- * Static one-shot runtime read.
219
- *
220
- * @param {unknown} input Black format input.
221
- * @param {object} [options] Format values.
222
- * @returns {object} Runtime read result.
217
+ /**
218
+ * Static one-shot runtime read.
219
+ *
220
+ * @param {unknown} input Black format input.
221
+ * @param {object} [options] Format values.
222
+ * @returns {object} Runtime read result.
223
223
  */
224
224
  static readRuntime(input, options = {}) {
225
225
  return new CjsBlackReader(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME)).ReadRuntime();
226
226
  }
227
227
 
228
- /**
229
- * Static one-shot public payload read.
230
- *
231
- * @param {unknown} input Black format input.
232
- * @param {object} [options] Format values.
233
- * @returns {object} Public payload output.
228
+ /**
229
+ * Static one-shot public payload read.
230
+ *
231
+ * @param {unknown} input Black format input.
232
+ * @param {object} [options] Format values.
233
+ * @returns {object} Public payload output.
234
234
  */
235
235
  static readPayload(input, options = {}) {
236
236
  return new CjsBlackReader(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME)).ReadPayload();
237
237
  }
238
238
 
239
- /**
240
- * Static one-shot inspection.
241
- *
242
- * @param {unknown} input Black format input.
243
- * @param {object} [options] Format values.
244
- * @returns {object} Plain summary data.
239
+ /**
240
+ * Static one-shot inspection.
241
+ *
242
+ * @param {unknown} input Black format input.
243
+ * @param {object} [options] Format values.
244
+ * @returns {object} Plain summary data.
245
245
  */
246
246
  static inspect(input, options = {}) {
247
247
  return new CjsBlackReader(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME)).Inspect();
248
248
  }
249
249
 
250
- /**
251
- * Static JSON-compatible conversion.
252
- *
253
- * @param {any} value Format output to convert.
254
- * @returns {any} Plain JSON-compatible data.
250
+ /**
251
+ * Static JSON-compatible conversion.
252
+ *
253
+ * @param {any} value Format output to convert.
254
+ * @returns {any} Plain JSON-compatible data.
255
255
  */
256
256
  static toJSON(value) {
257
257
  return toJsonValue(value);
258
258
  }
259
259
 
260
- /**
261
- * Performs the bounded Black content discriminator used by ordered object
262
- * routes. Magic selects the Black reader; version and body failures remain
263
- * that reader's errors and are never reinterpreted as Red/YAML.
264
- *
265
- * @param {ArrayBuffer|ArrayBufferView} input Candidate source bytes.
266
- * @returns {boolean} True when the little-endian Black magic is present.
260
+ /**
261
+ * Performs the bounded Black content discriminator used by ordered object
262
+ * routes. Magic selects the Black reader; version and body failures remain
263
+ * that reader's errors and are never reinterpreted as Red/YAML.
264
+ *
265
+ * @param {ArrayBuffer|ArrayBufferView} input Candidate source bytes.
266
+ * @returns {boolean} True when the little-endian Black magic is present.
267
267
  */
268
268
  static probeSupport(input) {
269
269
  const view = getBlackProbeView(input);
270
270
  return Boolean(view && view.byteLength >= 4 && view.getUint32(0, true) === CJS_BLACK_FOURCC);
271
271
  }
272
272
 
273
- /**
274
- * Emit targets for this format (canonical frozen enum).
273
+ /**
274
+ * Emit targets for this format (canonical frozen enum).
275
275
  */
276
- static Output = Object.freeze({
277
- JSON: OUTPUT_JSON,
278
- RAW: OUTPUT_RAW,
279
- DOCUMENT: OUTPUT_DOCUMENT,
280
- PAYLOAD: OUTPUT_PAYLOAD,
281
- RUNTIME: OUTPUT_RUNTIME
282
- });
283
- static CLASS_KEYS = CLASS_KEYS;
284
- static id = CJS_BLACK_FORMAT_ID;
285
- static extensions = Object.freeze([CJS_BLACK_EXTENSION]);
276
+ static classKeys = CLASS_KEYS;
277
+ static id = "CjsBlackFormat";
278
+ static extensions = [CJS_BLACK_EXTENSION];
286
279
  static fourCC = CJS_BLACK_FOURCC;
287
280
  static version = CJS_BLACK_VERSION;
288
- static mediaTypes = Object.freeze(["data"]);
281
+ static mediaTypes = ["data"];
289
282
  static outputs = CjsFormat.defineOutputs({
290
283
  json: {
291
284
  default: true,