@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
@@ -1,3 +1,7 @@
1
+ import { HostBitmap } from '#imageio';
2
+ import { CjsImageFormat } from '#resource/format/CjsImageFormat';
3
+ import { CjsSchema } from '#schema';
4
+ import { PixelFormat } from '#consts/render-context';
1
5
  import { CjsResource } from '#resource/CjsResource';
2
6
  import { CjsWebgpuPipelineCache, CanonicalKey, RenderPipelineKey } from './core/CjsWebgpuPipelineCache.js';
3
7
  import { AssertFormatFeature, PlanTextureUpload } from './core/textureLayout.js';
@@ -541,6 +545,68 @@ function mapRgba8TexturePayload(value, plan) {
541
545
  textures: frozenRecord([[plan.textureKey, texture]])
542
546
  };
543
547
  }
548
+
549
+ /**
550
+ * The RGBA8 texture record for a texture resource's HostBitmap.
551
+ *
552
+ * A texture resource holds Carbon's `ImageIO::HostBitmap` (TriTextureRes.cpp:606),
553
+ * not a plain payload. This path uploads one RGBA8 level, so the top mip is
554
+ * converted - block formats decoded - on a COPY: the resource keeps its own
555
+ * bitmap for other backends and for rebuilds.
556
+ *
557
+ * Colour space follows the format, as Carbon's does: an `_SRGB` format uploads
558
+ * as `rgba8unorm-srgb`, anything else as `rgba8unorm`.
559
+ *
560
+ * @param {HostBitmap} bitmap The resource's bitmap.
561
+ * @param {object} plan The realization plan.
562
+ * @returns {object} The bundle input.
563
+ */
564
+ function mapRgba8TextureBitmap(bitmap, plan) {
565
+ const label = `${plan.name} bitmap`;
566
+ if (!bitmap.IsValid()) fail(`${label} is not valid`);
567
+ const srgb = isSrgbCarbonFormat(bitmap.GetFormat());
568
+ const copy = new HostBitmap();
569
+ if (!copy.Create(bitmap.GetWidth(), bitmap.GetHeight(), 1, bitmap.GetFormat())) fail(`${label} could not be copied`);
570
+ copy.GetMipRawData(0).set(bitmap.GetMipRawData(0).subarray(0, bitmap.GetMipSize(0)));
571
+ const requested = srgb ? PixelFormat.PIXEL_FORMAT_R8G8B8A8_UNORM_SRGB : PixelFormat.PIXEL_FORMAT_R8G8B8A8_UNORM;
572
+ // Carbon's ConvertFormat reads R8G8 as luminance and alpha; a packed pair is
573
+ // two channels, so it expands to (R, G, 0, 255) here instead.
574
+ if (bitmap.GetFormat() === PixelFormat.PIXEL_FORMAT_R8G8_UNORM) expandRg8(copy);else if (!CjsImageFormat.convertImage(copy, requested)) fail(`${label} cannot be converted to RGBA8`);
575
+ const texture = {
576
+ width: copy.GetWidth(),
577
+ height: copy.GetHeight(),
578
+ format: srgb ? "rgba8unorm-srgb" : "rgba8unorm",
579
+ bytesPerRow: copy.GetMipPitch(0),
580
+ data: copy.GetMipRawData(0)
581
+ };
582
+ return {
583
+ label: plan.bundleLabel,
584
+ textures: frozenRecord([[plan.textureKey, texture]])
585
+ };
586
+ }
587
+
588
+ /** Expand an RG8 bitmap's top mip in place to RGBA8 as (R, G, 0, 255). */
589
+ function expandRg8(bitmap) {
590
+ const width = bitmap.GetWidth();
591
+ const height = bitmap.GetHeight();
592
+ const source = bitmap.GetMipRawData(0).slice();
593
+ const pitch = bitmap.GetMipPitch(0);
594
+ bitmap.Create(width, height, 1, PixelFormat.PIXEL_FORMAT_R8G8B8A8_UNORM);
595
+ const target = bitmap.GetMipRawData(0);
596
+ const targetPitch = bitmap.GetMipPitch(0);
597
+ for (let y = 0; y < height; y++) {
598
+ for (let x = 0; x < width; x++) {
599
+ target[y * targetPitch + x * 4] = source[y * pitch + x * 2];
600
+ target[y * targetPitch + x * 4 + 1] = source[y * pitch + x * 2 + 1];
601
+ target[y * targetPitch + x * 4 + 3] = 255;
602
+ }
603
+ }
604
+ }
605
+
606
+ /** Whether a Carbon pixel format is one of the `_SRGB` variants. */
607
+ function isSrgbCarbonFormat(format) {
608
+ return Object.entries(PixelFormat).some(([name, value]) => value === format && name.endsWith("_SRGB"));
609
+ }
544
610
  function mapSamplerPayload(value, plan) {
545
611
  assertPlainObject(value, `${plan.name} payload`);
546
612
  assertKeys(value, SELECTED_SAMPLER_PAYLOAD_KEYS, `${plan.name} payload`);
@@ -750,7 +816,9 @@ function resolveBindingResource(owner, entry, resource) {
750
816
  // Every dimension the texture adapter can create must be bindable, or a
751
817
  // cube map is creatable and then unusable. Multisampled textures are still
752
818
  // out: those are attachments, and the render target owns them.
753
- if (!TEXTURE_VIEW_DIMENSIONS.has(viewDimension) || multisampled || sampleType !== "float") {
819
+ // A float texture binds to either float slot; "unfilterable-float" is a
820
+ // slot only ever loaded from, which a 32-bit float texture needs.
821
+ if (!TEXTURE_VIEW_DIMENSIONS.has(viewDimension) || multisampled || sampleType !== "float" && sampleType !== "unfilterable-float") {
754
822
  fail(`${entry.identity} requires a ${multisampled ? "multisampled " : ""}${sampleType} ${viewDimension} texture,` + " which this adapter does not realize");
755
823
  }
756
824
  // The view's dimension is fixed at creation, so a layout asking for the
@@ -839,14 +907,14 @@ async function popValidationScope(device, state) {
839
907
  return device.popErrorScope();
840
908
  }
841
909
 
842
- /**
843
- * Engine-owned WebGPU device boundary. It realizes already-selected Carbon WebGPU
844
- * descriptors; format/capability policy remains with the caller.
910
+ /**
911
+ * Engine-owned WebGPU device boundary. It realizes already-selected Carbon WebGPU
912
+ * descriptors; format/capability policy remains with the caller.
845
913
  */
846
914
  class CjsWebgpuDevice {
847
- /**
848
- * Requests or accepts a WebGPU adapter and device, then returns a ready
849
- * engine boundary.
915
+ /**
916
+ * Requests or accepts a WebGPU adapter and device, then returns a ready
917
+ * engine boundary.
850
918
  */
851
919
  static async Request(options = {}) {
852
920
  const gpu = Object.prototype.hasOwnProperty.call(options, "gpu") ? options.gpu : globalThis.navigator?.gpu;
@@ -869,8 +937,8 @@ class CjsWebgpuDevice {
869
937
  });
870
938
  }
871
939
 
872
- /**
873
- * Creates a ready engine boundary around an already-acquired GPU device.
940
+ /**
941
+ * Creates a ready engine boundary around an already-acquired GPU device.
874
942
  */
875
943
  constructor(options = {}) {
876
944
  if (!options.device || typeof options.device.createShaderModule !== "function") fail("a GPUDevice is required");
@@ -900,75 +968,75 @@ class CjsWebgpuDevice {
900
968
  this._WatchDevice(this._device, this._generation);
901
969
  }
902
970
 
903
- /**
904
- * Returns the adapter associated with the boundary, when known.
971
+ /**
972
+ * Returns the adapter associated with the boundary, when known.
905
973
  */
906
974
  GetAdapter() {
907
975
  return this._adapter;
908
976
  }
909
977
 
910
- /**
911
- * Returns the ready native GPU device.
978
+ /**
979
+ * Returns the ready native GPU device.
912
980
  */
913
981
  GetDevice() {
914
982
  this._AssertReady();
915
983
  return this._device;
916
984
  }
917
985
 
918
- /**
919
- * The `GPUBufferUsage` table this device builds masks from.
920
- *
921
- * It is injectable (`options.bufferUsage`) so a test can drive buffer
922
- * creation without a real WebGPU global.
923
- *
924
- * @returns {object} The usage flags.
986
+ /**
987
+ * The `GPUBufferUsage` table this device builds masks from.
988
+ *
989
+ * It is injectable (`options.bufferUsage`) so a test can drive buffer
990
+ * creation without a real WebGPU global.
991
+ *
992
+ * @returns {object} The usage flags.
925
993
  */
926
994
  GetBufferUsage() {
927
995
  return this._bufferUsage;
928
996
  }
929
997
 
930
- /**
931
- * The `GPUTextureUsage` flags this device creates textures with; injectable
932
- * for the same reason as the buffer usage.
933
- *
934
- * @returns {object|null} The usage flags.
998
+ /**
999
+ * The `GPUTextureUsage` flags this device creates textures with; injectable
1000
+ * for the same reason as the buffer usage.
1001
+ *
1002
+ * @returns {object|null} The usage flags.
935
1003
  */
936
1004
  GetTextureUsage() {
937
1005
  return this._textureUsage;
938
1006
  }
939
1007
 
940
- /**
941
- * Returns the generation used to reject objects from earlier device
942
- * lifecycles.
1008
+ /**
1009
+ * Returns the generation used to reject objects from earlier device
1010
+ * lifecycles.
943
1011
  */
944
1012
  GetGeneration() {
945
1013
  return this._generation;
946
1014
  }
947
1015
 
948
- /**
949
- * Returns the most recently accepted device-loss record, if any.
1016
+ /**
1017
+ * Returns the most recently accepted device-loss record, if any.
950
1018
  */
951
1019
  GetLostInfo() {
952
1020
  return this._lostInfo;
953
1021
  }
954
1022
 
955
- /**
956
- * Reports whether the boundary is currently in the lost state.
1023
+ /**
1024
+ * Reports whether the boundary is currently in the lost state.
957
1025
  */
958
1026
  IsLost() {
959
1027
  return this._state === "lost";
960
1028
  }
961
1029
 
962
- /**
963
- * Reports whether the boundary currently has a usable device.
1030
+ /**
1031
+ * Reports whether the boundary currently has a usable device.
964
1032
  */
965
1033
  IsReady() {
966
1034
  return this._state === "ready";
967
1035
  }
968
1036
 
969
- /**
970
- * Compiles a Carbon WebGPU render descriptor and realizes its generation-bound
971
- * canonical pipeline layout.
1037
+ /**
1038
+ * Compiles a Carbon WebGPU render descriptor and realizes its generation-bound
1039
+ * canonical pipeline layout.
972
1040
  */
973
1041
  async PreparePipeline(pipeline, options = {}) {
974
1042
  const descriptor = normalizePipeline(pipeline, this._shaderStage);
@@ -1062,9 +1130,9 @@ class CjsWebgpuDevice {
1062
1130
  }));
1063
1131
  }
1064
1132
 
1065
- /**
1066
- * Realizes a generation-bound native render pipeline from a Carbon WebGPU
1067
- * descriptor or prepared pipeline.
1133
+ /**
1134
+ * Realizes a generation-bound native render pipeline from a Carbon WebGPU
1135
+ * descriptor or prepared pipeline.
1068
1136
  */
1069
1137
  async CreateRenderPipeline(pipelineOrPrepared, recipe) {
1070
1138
  const pipelineRecipe = validateRecipe(recipe);
@@ -1129,11 +1197,11 @@ class CjsWebgpuDevice {
1129
1197
  }));
1130
1198
  }
1131
1199
 
1132
- /**
1133
- * Upload an explicit CPU geometry payload into device-owned vertex/index
1134
- * buffers. The returned handle is opaque apart from its immutable
1135
- * caller-provided vertex layouts and lifecycle metadata; TriGeometryRes
1136
- * ownership remains outside the backend.
1200
+ /**
1201
+ * Upload an explicit CPU geometry payload into device-owned vertex/index
1202
+ * buffers. The returned handle is opaque apart from its immutable
1203
+ * caller-provided vertex layouts and lifecycle metadata; TriGeometryRes
1204
+ * ownership remains outside the backend.
1137
1205
  */
1138
1206
  async CreateGeometry(options = {}) {
1139
1207
  this._AssertReady();
@@ -1247,8 +1315,8 @@ class CjsWebgpuDevice {
1247
1315
  });
1248
1316
  }
1249
1317
 
1250
- /**
1251
- * Destroys the device buffers owned by a geometry handle.
1318
+ /**
1319
+ * Destroys the device buffers owned by a geometry handle.
1252
1320
  */
1253
1321
  DestroyGeometry(geometry) {
1254
1322
  const record = GEOMETRIES.get(geometry);
@@ -1260,9 +1328,9 @@ class CjsWebgpuDevice {
1260
1328
  }
1261
1329
  }
1262
1330
 
1263
- /**
1264
- * Upload one explicit, single-mip, uncompressed 2D CPU texture payload.
1265
- * Sampler state and resource-path policy remain separate from this handle.
1331
+ /**
1332
+ * Upload one explicit, single-mip, uncompressed 2D CPU texture payload.
1333
+ * Sampler state and resource-path policy remain separate from this handle.
1266
1334
  */
1267
1335
  async CreateTexture(options = {}) {
1268
1336
  this._AssertReady();
@@ -1404,8 +1472,8 @@ class CjsWebgpuDevice {
1404
1472
  });
1405
1473
  }
1406
1474
 
1407
- /**
1408
- * Destroys the native texture owned by a texture handle.
1475
+ /**
1476
+ * Destroys the native texture owned by a texture handle.
1409
1477
  */
1410
1478
  DestroyTexture(texture) {
1411
1479
  const record = TEXTURES.get(texture);
@@ -1415,10 +1483,10 @@ class CjsWebgpuDevice {
1415
1483
  if (typeof record.texture?.destroy === "function") record.texture.destroy();
1416
1484
  }
1417
1485
 
1418
- /**
1419
- * Normalize one explicit sampler descriptor and reuse its immutable native
1420
- * GPUSampler within this device generation. Each call receives an
1421
- * independently releasable opaque handle.
1486
+ /**
1487
+ * Normalize one explicit sampler descriptor and reuse its immutable native
1488
+ * GPUSampler within this device generation. Each call receives an
1489
+ * independently releasable opaque handle.
1422
1490
  */
1423
1491
  async CreateSampler(options = {}) {
1424
1492
  this._AssertReady();
@@ -1479,9 +1547,9 @@ class CjsWebgpuDevice {
1479
1547
  });
1480
1548
  }
1481
1549
 
1482
- /**
1483
- * Releases one logical sampler handle without destroying its shared native
1484
- * sampler.
1550
+ /**
1551
+ * Releases one logical sampler handle without destroying its shared native
1552
+ * sampler.
1485
1553
  */
1486
1554
  DestroySampler(sampler) {
1487
1555
  const record = SAMPLERS.get(sampler);
@@ -1489,10 +1557,10 @@ class CjsWebgpuDevice {
1489
1557
  record.destroyed = true;
1490
1558
  }
1491
1559
 
1492
- /**
1493
- * Atomically realize one keyed collection of already-prepared plain GPU
1494
- * payloads. Child handles remain private until every queued creation has
1495
- * settled successfully, and the returned bundle owns their cleanup.
1560
+ /**
1561
+ * Atomically realize one keyed collection of already-prepared plain GPU
1562
+ * payloads. Child handles remain private until every queued creation has
1563
+ * settled successfully, and the returned bundle owns their cleanup.
1496
1564
  */
1497
1565
  async CreateResourceBundle(options = {}) {
1498
1566
  this._AssertReady();
@@ -1553,8 +1621,8 @@ class CjsWebgpuDevice {
1553
1621
  return bundle;
1554
1622
  }
1555
1623
 
1556
- /**
1557
- * Destroys a resource bundle's child handles in reverse creation order.
1624
+ /**
1625
+ * Destroys a resource bundle's child handles in reverse creation order.
1558
1626
  */
1559
1627
  DestroyResourceBundle(bundle) {
1560
1628
  const record = RESOURCE_BUNDLES.get(bundle);
@@ -1575,39 +1643,41 @@ class CjsWebgpuDevice {
1575
1643
  }
1576
1644
  }
1577
1645
 
1578
- /**
1579
- * Realize the already-published RGBA8 CPU payload attached to one resource.
1580
- * Mapping remains synchronous and GPU-free; allocation and guarded adapter
1581
- * publication are delegated to {@link CjsWebgpuDevice#_RealizeResource}.
1582
- * Concurrent calls for the same resource and adapter key share one operation.
1583
- *
1584
- * @param {CjsResource} resource Current loaded resource exposing `GetPayload()`.
1585
- * @param {object} options Texture key, bundle label, and adapter slot.
1586
- * @param {string} options.textureKey Binding/resource identity for the texture.
1587
- * @param {string} [options.bundleLabel="prepared RGBA8 texture"] Diagnostic bundle label.
1588
- * @param {string} [options.adapterKey="webgpu"] Resource adapter slot.
1589
- * @returns {Promise<object>} Engine-owned prepared resource bundle.
1646
+ /**
1647
+ * Realize the already-published RGBA8 CPU payload attached to one resource.
1648
+ * Mapping remains synchronous and GPU-free; allocation and guarded adapter
1649
+ * publication are delegated to {@link CjsWebgpuDevice#_RealizeResource}.
1650
+ * Concurrent calls for the same resource and adapter key share one operation.
1651
+ *
1652
+ * @param {CjsResource} resource Current loaded resource exposing `GetPayload()`.
1653
+ * @param {object} options Texture key, bundle label, and adapter slot.
1654
+ * @param {string} options.textureKey Binding/resource identity for the texture.
1655
+ * @param {string} [options.bundleLabel="prepared RGBA8 texture"] Diagnostic bundle label.
1656
+ * @param {string} [options.adapterKey="webgpu"] Resource adapter slot.
1657
+ * @returns {Promise<object>} Engine-owned prepared resource bundle.
1590
1658
  */
1591
1659
  RealizeRgba8Texture(resource, options = {}) {
1592
1660
  assertRealizationResource(resource);
1593
1661
  const plan = normalizeRgba8TextureRealizationOptions(options);
1594
- const input = mapRgba8TexturePayload(resource.GetPayload(), plan);
1662
+ const payload = resource.GetPayload();
1663
+ const bitmap = CjsSchema.cast(payload, HostBitmap);
1664
+ const input = bitmap ? mapRgba8TextureBitmap(bitmap, plan) : mapRgba8TexturePayload(payload, plan);
1595
1665
  return this.RealizeResource(resource, input, {
1596
1666
  adapterKey: plan.adapterKey
1597
1667
  });
1598
1668
  }
1599
1669
 
1600
- /**
1601
- * Realize already-selected WebGPU sampler state from a published CPU payload.
1602
- * Selection and texture pairing remain caller policy; this method only maps,
1603
- * allocates, and commits the selected sampler under the requested adapter key.
1604
- *
1605
- * @param {CjsResource} resource Current loaded resource exposing `GetPayload()`.
1606
- * @param {object} options Sampler key, bundle label, and adapter slot.
1607
- * @param {string} options.samplerKey Binding/resource identity for the sampler.
1608
- * @param {string} [options.bundleLabel="prepared WebGPU sampler"] Diagnostic bundle label.
1609
- * @param {string} [options.adapterKey="webgpu"] Resource adapter slot.
1610
- * @returns {Promise<object>} Engine-owned prepared resource bundle.
1670
+ /**
1671
+ * Realize already-selected WebGPU sampler state from a published CPU payload.
1672
+ * Selection and texture pairing remain caller policy; this method only maps,
1673
+ * allocates, and commits the selected sampler under the requested adapter key.
1674
+ *
1675
+ * @param {CjsResource} resource Current loaded resource exposing `GetPayload()`.
1676
+ * @param {object} options Sampler key, bundle label, and adapter slot.
1677
+ * @param {string} options.samplerKey Binding/resource identity for the sampler.
1678
+ * @param {string} [options.bundleLabel="prepared WebGPU sampler"] Diagnostic bundle label.
1679
+ * @param {string} [options.adapterKey="webgpu"] Resource adapter slot.
1680
+ * @returns {Promise<object>} Engine-owned prepared resource bundle.
1611
1681
  */
1612
1682
  RealizeSampler(resource, options = {}) {
1613
1683
  assertRealizationResource(resource);
@@ -1618,20 +1688,20 @@ class CjsWebgpuDevice {
1618
1688
  });
1619
1689
  }
1620
1690
 
1621
- /**
1622
- * Realize one already-published CPU resource as an engine-owned WebGPU bundle.
1623
- *
1624
- * The in-flight boundary is this device session plus resource handle and
1625
- * adapter key. Candidate allocation completes before a synchronous current-
1626
- * target check and adapter commit. A stale or failed candidate is destroyed;
1627
- * a current failure restores any usable prior adapter and otherwise returns
1628
- * the resource to `LOADED` without discarding its CPU payload.
1629
- *
1630
- * @param {CjsResource} resource Current loaded resource receiving the adapter.
1631
- * @param {object} value Plain geometry/texture/sampler bundle input. When omitted, the resource payload is used.
1632
- * @param {object} [options={}] Adapter publication options.
1633
- * @param {string} [options.adapterKey="webgpu"] Resource adapter slot.
1634
- * @returns {Promise<object>} Engine-owned prepared resource bundle.
1691
+ /**
1692
+ * Realize one already-published CPU resource as an engine-owned WebGPU bundle.
1693
+ *
1694
+ * The in-flight boundary is this device session plus resource handle and
1695
+ * adapter key. Candidate allocation completes before a synchronous current-
1696
+ * target check and adapter commit. A stale or failed candidate is destroyed;
1697
+ * a current failure restores any usable prior adapter and otherwise returns
1698
+ * the resource to `LOADED` without discarding its CPU payload.
1699
+ *
1700
+ * @param {CjsResource} resource Current loaded resource receiving the adapter.
1701
+ * @param {object} value Plain geometry/texture/sampler bundle input. When omitted, the resource payload is used.
1702
+ * @param {object} [options={}] Adapter publication options.
1703
+ * @param {string} [options.adapterKey="webgpu"] Resource adapter slot.
1704
+ * @returns {Promise<object>} Engine-owned prepared resource bundle.
1635
1705
  */
1636
1706
  RealizeResource(resource, value, options = {}) {
1637
1707
  assertRealizationResource(resource);
@@ -1653,8 +1723,8 @@ class CjsWebgpuDevice {
1653
1723
  return promise;
1654
1724
  }
1655
1725
 
1656
- /**
1657
- * Allocates, publishes, and rolls back one guarded resource realization.
1726
+ /**
1727
+ * Allocates, publishes, and rolls back one guarded resource realization.
1658
1728
  */
1659
1729
  async _RealizeResource(resource, value, plan) {
1660
1730
  const stale = () => {
@@ -1724,9 +1794,9 @@ class CjsWebgpuDevice {
1724
1794
  }
1725
1795
  }
1726
1796
 
1727
- /**
1728
- * Creates generation-bound bind groups and owned uniform buffers for a live
1729
- * pipeline.
1797
+ /**
1798
+ * Creates generation-bound bind groups and owned uniform buffers for a live
1799
+ * pipeline.
1730
1800
  */
1731
1801
  CreateBindingSet(livePipeline, options = {}) {
1732
1802
  const record = assertLive(this, livePipeline);
@@ -1862,13 +1932,13 @@ class CjsWebgpuDevice {
1862
1932
  // The handle is opaque and the `GPUBuffer` stays in DEVICE_BUFFERS, matching
1863
1933
  // how geometries and binding sets are held here.
1864
1934
 
1865
- /**
1866
- * Creates a buffer whose contents the caller rewrites.
1867
- *
1868
- * @param {object} options `{ label, size, usage }` - usage is a raw
1869
- * `GPUBufferUsage` mask; COPY_DST is added because writes arrive through
1870
- * `WriteDeviceBuffer`.
1871
- * @returns {object} An opaque handle carrying `size` and `Destroy`.
1935
+ /**
1936
+ * Creates a buffer whose contents the caller rewrites.
1937
+ *
1938
+ * @param {object} options `{ label, size, usage }` - usage is a raw
1939
+ * `GPUBufferUsage` mask; COPY_DST is added because writes arrive through
1940
+ * `WriteDeviceBuffer`.
1941
+ * @returns {object} An opaque handle carrying `size` and `Destroy`.
1872
1942
  */
1873
1943
  CreateDeviceBuffer({
1874
1944
  label = "device-buffer",
@@ -1907,13 +1977,13 @@ class CjsWebgpuDevice {
1907
1977
  return handle;
1908
1978
  }
1909
1979
 
1910
- /**
1911
- * Uploads bytes into a device buffer.
1912
- *
1913
- * @param {object} handle A `CreateDeviceBuffer` handle.
1914
- * @param {ArrayBufferView} bytes The bytes to write.
1915
- * @param {number} [offset] Byte offset into the buffer.
1916
- * @returns {object} The handle.
1980
+ /**
1981
+ * Uploads bytes into a device buffer.
1982
+ *
1983
+ * @param {object} handle A `CreateDeviceBuffer` handle.
1984
+ * @param {ArrayBufferView} bytes The bytes to write.
1985
+ * @param {number} [offset] Byte offset into the buffer.
1986
+ * @returns {object} The handle.
1917
1987
  */
1918
1988
  WriteDeviceBuffer(handle, bytes, offset = 0) {
1919
1989
  const record = DEVICE_BUFFERS.get(handle);
@@ -1926,11 +1996,11 @@ class CjsWebgpuDevice {
1926
1996
  return handle;
1927
1997
  }
1928
1998
 
1929
- /**
1930
- * The `GPUBuffer` behind a handle, for binding it to a draw.
1931
- *
1932
- * @param {object} handle A `CreateDeviceBuffer` handle.
1933
- * @returns {GPUBuffer} The buffer.
1999
+ /**
2000
+ * The `GPUBuffer` behind a handle, for binding it to a draw.
2001
+ *
2002
+ * @param {object} handle A `CreateDeviceBuffer` handle.
2003
+ * @returns {GPUBuffer} The buffer.
1934
2004
  */
1935
2005
  GetDeviceBuffer(handle) {
1936
2006
  const record = DEVICE_BUFFERS.get(handle);
@@ -1938,9 +2008,9 @@ class CjsWebgpuDevice {
1938
2008
  return record.buffer;
1939
2009
  }
1940
2010
 
1941
- /**
1942
- * Validates and uploads exact-size updates to a binding set's owned uniform
1943
- * buffers.
2011
+ /**
2012
+ * Validates and uploads exact-size updates to a binding set's owned uniform
2013
+ * buffers.
1944
2014
  */
1945
2015
  UpdateBindingSet(bindingSet, uniformData) {
1946
2016
  const record = assertBindingSet(this, bindingSet);
@@ -1961,9 +2031,9 @@ class CjsWebgpuDevice {
1961
2031
  return bindingSet;
1962
2032
  }
1963
2033
 
1964
- /**
1965
- * Destroys a binding set's owned uniform buffers without releasing external
1966
- * resources.
2034
+ /**
2035
+ * Destroys a binding set's owned uniform buffers without releasing external
2036
+ * resources.
1967
2037
  */
1968
2038
  DestroyBindingSet(bindingSet) {
1969
2039
  const record = BINDING_SETS.get(bindingSet);
@@ -1975,8 +2045,8 @@ class CjsWebgpuDevice {
1975
2045
  }
1976
2046
  }
1977
2047
 
1978
- /**
1979
- * Validates and snapshots one generation-bound indexed or non-indexed draw.
2048
+ /**
2049
+ * Validates and snapshots one generation-bound indexed or non-indexed draw.
1980
2050
  */
1981
2051
  CreateDraw(livePipeline, options = {}) {
1982
2052
  const record = assertLive(this, livePipeline);
@@ -2130,17 +2200,17 @@ class CjsWebgpuDevice {
2130
2200
  return draw;
2131
2201
  }
2132
2202
 
2133
- /**
2134
- * Encodes one validated draw into a render pass.
2135
- *
2136
- * An optional `state` is a CjsWebgpuEncodeState the CALLER owns for the
2137
- * lifetime of one render pass. When supplied, a set whose value is already
2138
- * bound is skipped - Carbon's DX11 path does the same redundancy compare on
2139
- * its shader program and its three state caches. Omitting it sets
2140
- * everything, which is always correct and is what an unrelated caller gets.
2141
- *
2142
- * Deciding WHICH batches may share is not this method's business; that is
2143
- * the dispatcher's grouping. This only honours a decision already made.
2203
+ /**
2204
+ * Encodes one validated draw into a render pass.
2205
+ *
2206
+ * An optional `state` is a CjsWebgpuEncodeState the CALLER owns for the
2207
+ * lifetime of one render pass. When supplied, a set whose value is already
2208
+ * bound is skipped - Carbon's DX11 path does the same redundancy compare on
2209
+ * its shader program and its three state caches. Omitting it sets
2210
+ * everything, which is always correct and is what an unrelated caller gets.
2211
+ *
2212
+ * Deciding WHICH batches may share is not this method's business; that is
2213
+ * the dispatcher's grouping. This only honours a decision already made.
2144
2214
  */
2145
2215
  EncodeDraw(pass, draw, state = null) {
2146
2216
  const wrapper = DRAWS.get(draw);
@@ -2190,16 +2260,16 @@ class CjsWebgpuDevice {
2190
2260
  }
2191
2261
  }
2192
2262
 
2193
- /**
2194
- * Submits command buffers to the ready device queue.
2263
+ /**
2264
+ * Submits command buffers to the ready device queue.
2195
2265
  */
2196
2266
  Submit(commandBuffers) {
2197
2267
  this.GetDevice().queue.submit(commandBuffers);
2198
2268
  }
2199
2269
 
2200
- /**
2201
- * Acquires or accepts a replacement adapter/device and advances the device
2202
- * generation.
2270
+ /**
2271
+ * Acquires or accepts a replacement adapter/device and advances the device
2272
+ * generation.
2203
2273
  */
2204
2274
  async Recreate(options = {}) {
2205
2275
  if (this._state === "destroyed") fail("cannot recreate a destroyed device");
@@ -2234,9 +2304,9 @@ class CjsWebgpuDevice {
2234
2304
  return this;
2235
2305
  }
2236
2306
 
2237
- /**
2238
- * Transitions the boundary to destroyed, invalidates its generation, and
2239
- * destroys the native device.
2307
+ /**
2308
+ * Transitions the boundary to destroyed, invalidates its generation, and
2309
+ * destroys the native device.
2240
2310
  */
2241
2311
  Destroy() {
2242
2312
  if (this._state === "destroyed") return;
@@ -2252,24 +2322,24 @@ class CjsWebgpuDevice {
2252
2322
  if (typeof device?.destroy === "function") device.destroy();
2253
2323
  }
2254
2324
 
2255
- /**
2256
- * Throws unless the boundary has a ready native device.
2325
+ /**
2326
+ * Throws unless the boundary has a ready native device.
2257
2327
  */
2258
2328
  _AssertReady() {
2259
2329
  if (this._state !== "ready" || !this._device) fail(`device is ${this._state}`);
2260
2330
  }
2261
2331
 
2262
- /**
2263
- * Throws unless an object generation matches the current ready device.
2332
+ /**
2333
+ * Throws unless an object generation matches the current ready device.
2264
2334
  */
2265
2335
  _AssertGeneration(generation) {
2266
2336
  this._AssertReady();
2267
2337
  if (generation !== this._generation) fail(`object belongs to stale device generation ${generation}`);
2268
2338
  }
2269
2339
 
2270
- /**
2271
- * Queues a validation-sensitive operation after all previously queued
2272
- * operations settle.
2340
+ /**
2341
+ * Queues a validation-sensitive operation after all previously queued
2342
+ * operations settle.
2273
2343
  */
2274
2344
  _SerializeValidation(operation) {
2275
2345
  const run = this._validationTail.then(operation, operation);
@@ -2277,9 +2347,9 @@ class CjsWebgpuDevice {
2277
2347
  return run;
2278
2348
  }
2279
2349
 
2280
- /**
2281
- * Tracks loss for one device generation and accepts only a still-current
2282
- * loss event.
2350
+ /**
2351
+ * Tracks loss for one device generation and accepts only a still-current
2352
+ * loss event.
2283
2353
  */
2284
2354
  _WatchDevice(device, generation) {
2285
2355
  if (!device?.lost || typeof device.lost.then !== "function") return;