@carbonenginejs/runtime 0.1.0-alpha.0 → 0.1.0-alpha.2

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 (935) hide show
  1. package/README.md +58 -125
  2. package/dist/audio/index.js +8 -1
  3. package/dist/audio/index.js.map +1 -1
  4. package/dist/audio/trinity/audio/AudActionLog/AudActionLogCB.js +84 -0
  5. package/dist/audio/trinity/audio/AudActionLog/AudActionLogCB.js.map +1 -0
  6. package/dist/audio/trinity/audio/AudActionLog/AudActionRecord.js +14 -0
  7. package/dist/audio/trinity/audio/AudActionLog/AudActionRecord.js.map +1 -0
  8. package/dist/audio/trinity/audio/AudActionLog/AudActionRecordExecuteActionOnPlayingID.js +26 -0
  9. package/dist/audio/trinity/audio/AudActionLog/AudActionRecordExecuteActionOnPlayingID.js.map +1 -0
  10. package/dist/audio/trinity/audio/AudActionLog/AudActionRecordPostEvent.js +27 -0
  11. package/dist/audio/trinity/audio/AudActionLog/AudActionRecordPostEvent.js.map +1 -0
  12. package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetRTPC.js +27 -0
  13. package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetRTPC.js.map +1 -0
  14. package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetState.js +25 -0
  15. package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetState.js.map +1 -0
  16. package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetSwitch.js +26 -0
  17. package/dist/audio/trinity/audio/AudActionLog/AudActionRecordSetSwitch.js.map +1 -0
  18. package/dist/audio/trinity/audio/AudActionLog/IAudActionLog.js +58 -0
  19. package/dist/audio/trinity/audio/AudActionLog/IAudActionLog.js.map +1 -0
  20. package/dist/audio/trinity/audio/AudManager.js +1 -1
  21. package/dist/audio/trinity/audio/AudManager.js.map +1 -1
  22. package/dist/audio/trinity/audio/{AudObstructionOcclusion.js → AudObstructionOcclusion/AudObstructionOcclusion.js} +8 -52
  23. package/dist/audio/trinity/audio/AudObstructionOcclusion/AudObstructionOcclusion.js.map +1 -0
  24. package/dist/audio/trinity/audio/AudObstructionOcclusion/EmitterState.js +17 -0
  25. package/dist/audio/trinity/audio/AudObstructionOcclusion/EmitterState.js.map +1 -0
  26. package/dist/audio/trinity/audio/AudObstructionOcclusion/FadingValue.js +46 -0
  27. package/dist/audio/trinity/audio/AudObstructionOcclusion/FadingValue.js.map +1 -0
  28. package/dist/audio/trinity/index.js +8 -1
  29. package/dist/audio/trinity/index.js.map +1 -1
  30. package/dist/character/CjsCharacterAppearanceConstruction.js +5 -0
  31. package/dist/character/CjsCharacterAppearanceConstruction.js.map +1 -1
  32. package/dist/character/CjsCharacterAppearanceManager.js +14 -0
  33. package/dist/character/CjsCharacterAppearanceManager.js.map +1 -1
  34. package/dist/character/CjsCharacterFoundationConstruction.js +5 -0
  35. package/dist/character/CjsCharacterFoundationConstruction.js.map +1 -1
  36. package/dist/character/CjsCharacterTexturePolicy.js +5 -0
  37. package/dist/character/CjsCharacterTexturePolicy.js.map +1 -1
  38. package/dist/character/gles/CjsCharacterGlesAppearanceAL.js +17 -0
  39. package/dist/character/gles/CjsCharacterGlesAppearanceAL.js.map +1 -1
  40. package/dist/character/gles/CjsCharacterGlesAtlasRenderer.js +2 -0
  41. package/dist/character/gles/CjsCharacterGlesAtlasRenderer.js.map +1 -1
  42. package/dist/character/gles/CjsCharacterGlesFoundationTranslator.js +5 -0
  43. package/dist/character/gles/CjsCharacterGlesFoundationTranslator.js.map +1 -1
  44. package/dist/character/gles/CjsCharacterGlesLegacyConstructionTranslator.js +5 -0
  45. package/dist/character/gles/CjsCharacterGlesLegacyConstructionTranslator.js.map +1 -1
  46. package/dist/character/gles/CjsCharacterGlesMorphDeformation.js +2 -0
  47. package/dist/character/gles/CjsCharacterGlesMorphDeformation.js.map +1 -1
  48. package/dist/character/gles/CjsCharacterGlesPaletteCompatibility.js +5 -0
  49. package/dist/character/gles/CjsCharacterGlesPaletteCompatibility.js.map +1 -1
  50. package/dist/character/gles/CjsCharacterGlesTriangleCoverage.js +5 -0
  51. package/dist/character/gles/CjsCharacterGlesTriangleCoverage.js.map +1 -1
  52. package/dist/character/webgl2/CjsCharacterWebgl2EffectRouter.js +9 -0
  53. package/dist/character/webgl2/CjsCharacterWebgl2EffectRouter.js.map +1 -1
  54. package/dist/global/blue/CjsScriptCallback.js +142 -0
  55. package/dist/global/blue/CjsScriptCallback.js.map +1 -0
  56. package/dist/global/blue/index.js +2 -0
  57. package/dist/global/blue/index.js.map +1 -0
  58. package/dist/global/consts/renderContext/formats.js +51 -1
  59. package/dist/global/consts/renderContext/formats.js.map +1 -1
  60. package/dist/global/consts/renderContext/index.js +2 -2
  61. package/dist/global/consts/renderContext/renderStates.js +16 -1
  62. package/dist/global/consts/renderContext/renderStates.js.map +1 -1
  63. package/dist/global/contracts/index.js +0 -1
  64. package/dist/global/contracts/index.js.map +1 -1
  65. package/dist/global/index.js +4 -3
  66. package/dist/global/index.js.map +1 -1
  67. package/dist/global/math/index.js +2 -0
  68. package/dist/global/math/index.js.map +1 -1
  69. package/dist/global/math/mesh.js +70 -16
  70. package/dist/global/math/mesh.js.map +1 -1
  71. package/dist/global/math/noise.js +47 -68
  72. package/dist/global/math/noise.js.map +1 -1
  73. package/dist/global/math/pool.js +18 -3
  74. package/dist/global/math/pool.js.map +1 -1
  75. package/dist/global/math/random.js +52 -0
  76. package/dist/global/math/random.js.map +1 -0
  77. package/dist/global/math/tri3.js +18 -4
  78. package/dist/global/math/tri3.js.map +1 -1
  79. package/dist/global/schema/CjsSchema.js +20 -2
  80. package/dist/global/schema/CjsSchema.js.map +1 -1
  81. package/dist/global/schema/hydration.js +14 -0
  82. package/dist/global/schema/hydration.js.map +1 -1
  83. package/dist/global/utils/bytes.js +22 -4
  84. package/dist/global/utils/bytes.js.map +1 -1
  85. package/dist/global/utils/checksum.js +80 -0
  86. package/dist/global/utils/checksum.js.map +1 -0
  87. package/dist/global/utils/errors/CjsCancellationError.js +36 -0
  88. package/dist/global/utils/errors/CjsCancellationError.js.map +1 -0
  89. package/dist/global/utils/errors/CjsError.js +21 -52
  90. package/dist/global/utils/errors/CjsError.js.map +1 -1
  91. package/dist/global/utils/errors/abort.js +1 -1
  92. package/dist/global/utils/errors/abort.js.map +1 -1
  93. package/dist/global/utils/errors/index.js +2 -1
  94. package/dist/global/utils/errors/index.js.map +1 -1
  95. package/dist/global/utils/index.js +4 -2
  96. package/dist/global/utils/index.js.map +1 -1
  97. package/dist/index.js +95 -35
  98. package/dist/index.js.map +1 -1
  99. package/dist/input/Tr2MainWindow.js +7 -9
  100. package/dist/input/Tr2MainWindow.js.map +1 -1
  101. package/dist/resource/CjsResMan.js +33 -39
  102. package/dist/resource/CjsResMan.js.map +1 -1
  103. package/dist/resource/CjsResource.js +19 -5
  104. package/dist/resource/CjsResource.js.map +1 -1
  105. package/dist/resource/audio/AudioGeometryResData.js +22 -27
  106. package/dist/resource/audio/AudioGeometryResData.js.map +1 -1
  107. package/dist/resource/audio/CjsAudioRes.js +4 -5
  108. package/dist/resource/audio/CjsAudioRes.js.map +1 -1
  109. package/dist/resource/format/CjsBitReader.js +263 -0
  110. package/dist/resource/format/CjsBitReader.js.map +1 -0
  111. package/dist/resource/format/CjsByteReader.js +130 -125
  112. package/dist/resource/format/CjsByteReader.js.map +1 -1
  113. package/dist/resource/format/CjsFormat.js +11 -4
  114. package/dist/resource/format/CjsFormat.js.map +1 -1
  115. package/dist/resource/format/CjsFormatError.js +37 -1
  116. package/dist/resource/format/CjsFormatError.js.map +1 -1
  117. package/dist/resource/format/CjsResourceProbe.js +41 -37
  118. package/dist/resource/format/CjsResourceProbe.js.map +1 -1
  119. package/dist/resource/format/carbonRecordGuard.js +33 -0
  120. package/dist/resource/format/carbonRecordGuard.js.map +1 -0
  121. package/dist/resource/format/imageSignatures.js +202 -0
  122. package/dist/resource/format/imageSignatures.js.map +1 -0
  123. package/dist/resource/format/index.js +2 -1
  124. package/dist/resource/format/index.js.map +1 -1
  125. package/dist/resource/format/jsonPolicies.js +180 -0
  126. package/dist/resource/format/jsonPolicies.js.map +1 -0
  127. package/dist/resource/formats/black/core/helpers.js +18 -29
  128. package/dist/resource/formats/black/core/helpers.js.map +1 -1
  129. package/dist/resource/formats/bnk/CjsBnkFormat.js +4 -3
  130. package/dist/resource/formats/bnk/CjsBnkFormat.js.map +1 -1
  131. package/dist/resource/formats/bnk/core/WwiseCursor.js +218 -0
  132. package/dist/resource/formats/bnk/core/WwiseCursor.js.map +1 -0
  133. package/dist/resource/formats/bnk/core/busNodes.js +2 -1
  134. package/dist/resource/formats/bnk/core/busNodes.js.map +1 -1
  135. package/dist/resource/formats/bnk/core/effectNodes.js +2 -1
  136. package/dist/resource/formats/bnk/core/effectNodes.js.map +1 -1
  137. package/dist/resource/formats/bnk/core/eventAction.js +15 -93
  138. package/dist/resource/formats/bnk/core/eventAction.js.map +1 -1
  139. package/dist/resource/formats/bnk/core/globalSettings.js +19 -94
  140. package/dist/resource/formats/bnk/core/globalSettings.js.map +1 -1
  141. package/dist/resource/formats/bnk/core/helpers.js +2 -48
  142. package/dist/resource/formats/bnk/core/helpers.js.map +1 -1
  143. package/dist/resource/formats/bnk/core/musicNodes.js +42 -134
  144. package/dist/resource/formats/bnk/core/musicNodes.js.map +1 -1
  145. package/dist/resource/formats/bnk/core/nodeBase.js +20 -111
  146. package/dist/resource/formats/bnk/core/nodeBase.js.map +1 -1
  147. package/dist/resource/formats/bnk/core/sfxNodes.js +2 -1
  148. package/dist/resource/formats/bnk/core/sfxNodes.js.map +1 -1
  149. package/dist/resource/formats/cmf/CjsCmfFormat.js +242 -228
  150. package/dist/resource/formats/cmf/CjsCmfFormat.js.map +1 -1
  151. package/dist/resource/formats/cmf/core/binary.js +54 -60
  152. package/dist/resource/formats/cmf/core/binary.js.map +1 -1
  153. package/dist/resource/formats/dds/CjsDdsFormat.js +5 -3
  154. package/dist/resource/formats/dds/CjsDdsFormat.js.map +1 -1
  155. package/dist/resource/formats/dds/core/bc6h.js +16 -18
  156. package/dist/resource/formats/dds/core/bc6h.js.map +1 -1
  157. package/dist/resource/formats/dds/core/bc7.js +28 -24
  158. package/dist/resource/formats/dds/core/bc7.js.map +1 -1
  159. package/dist/resource/formats/dds/core/helpers.js +7 -133
  160. package/dist/resource/formats/dds/core/helpers.js.map +1 -1
  161. package/dist/resource/formats/dxbc/CjsDxbcFormat.js +3 -2
  162. package/dist/resource/formats/dxbc/CjsDxbcFormat.js.map +1 -1
  163. package/dist/resource/formats/dxbc/core/helpers.js +4 -32
  164. package/dist/resource/formats/dxbc/core/helpers.js.map +1 -1
  165. package/dist/resource/formats/fbx/CjsFbxFormat.js +11 -0
  166. package/dist/resource/formats/fbx/CjsFbxFormat.js.map +1 -1
  167. package/dist/resource/formats/fbx/core/helpers.js +18 -12
  168. package/dist/resource/formats/fbx/core/helpers.js.map +1 -1
  169. package/dist/resource/formats/flac/CjsFlacFormat.js +4 -9
  170. package/dist/resource/formats/flac/CjsFlacFormat.js.map +1 -1
  171. package/dist/resource/formats/flac/core/helpers.js +1 -62
  172. package/dist/resource/formats/flac/core/helpers.js.map +1 -1
  173. package/dist/resource/formats/gif/CjsGifFormat.js +4 -9
  174. package/dist/resource/formats/gif/CjsGifFormat.js.map +1 -1
  175. package/dist/resource/formats/gif/core/helpers.js +1 -63
  176. package/dist/resource/formats/gif/core/helpers.js.map +1 -1
  177. package/dist/resource/formats/gltf/CjsGltfFormat.js +4 -3
  178. package/dist/resource/formats/gltf/CjsGltfFormat.js.map +1 -1
  179. package/dist/resource/formats/gltf/core/helpers.js +3 -19
  180. package/dist/resource/formats/gltf/core/helpers.js.map +1 -1
  181. package/dist/resource/formats/gr2/CjsGr2Format.js +105 -92
  182. package/dist/resource/formats/gr2/CjsGr2Format.js.map +1 -1
  183. package/dist/resource/formats/gr2/core/container.js +1 -10
  184. package/dist/resource/formats/gr2/core/container.js.map +1 -1
  185. package/dist/resource/formats/gr2/core/helpers.js +24 -35
  186. package/dist/resource/formats/gr2/core/helpers.js.map +1 -1
  187. package/dist/resource/formats/gr2/core/shared.js +193 -189
  188. package/dist/resource/formats/gr2/core/shared.js.map +1 -1
  189. package/dist/resource/formats/hlsl/CjsHlslFormat.js +4 -3
  190. package/dist/resource/formats/hlsl/CjsHlslFormat.js.map +1 -1
  191. package/dist/resource/formats/hlsl/core/helpers.js +1 -30
  192. package/dist/resource/formats/hlsl/core/helpers.js.map +1 -1
  193. package/dist/resource/formats/jpeg/CjsJpegFormat.js +5 -3
  194. package/dist/resource/formats/jpeg/CjsJpegFormat.js.map +1 -1
  195. package/dist/resource/formats/jpeg/core/helpers.js +7 -134
  196. package/dist/resource/formats/jpeg/core/helpers.js.map +1 -1
  197. package/dist/resource/formats/mp3/CjsMp3Format.js +4 -9
  198. package/dist/resource/formats/mp3/CjsMp3Format.js.map +1 -1
  199. package/dist/resource/formats/mp3/core/helpers.js +1 -64
  200. package/dist/resource/formats/mp3/core/helpers.js.map +1 -1
  201. package/dist/resource/formats/mp4/CjsMp4Format.js +4 -9
  202. package/dist/resource/formats/mp4/CjsMp4Format.js.map +1 -1
  203. package/dist/resource/formats/mp4/core/helpers.js +1 -73
  204. package/dist/resource/formats/mp4/core/helpers.js.map +1 -1
  205. package/dist/resource/formats/obj/CjsObjFormat.js +4 -3
  206. package/dist/resource/formats/obj/CjsObjFormat.js.map +1 -1
  207. package/dist/resource/formats/obj/core/helpers.js +93 -115
  208. package/dist/resource/formats/obj/core/helpers.js.map +1 -1
  209. package/dist/resource/formats/ogg/CjsOggFormat.js +4 -3
  210. package/dist/resource/formats/ogg/CjsOggFormat.js.map +1 -1
  211. package/dist/resource/formats/ogg/core/helpers.js +1 -15
  212. package/dist/resource/formats/ogg/core/helpers.js.map +1 -1
  213. package/dist/resource/formats/ogg/core/vorbis.js +138 -144
  214. package/dist/resource/formats/ogg/core/vorbis.js.map +1 -1
  215. package/dist/resource/formats/pickle/CjsPickleFormat.js +83 -114
  216. package/dist/resource/formats/pickle/CjsPickleFormat.js.map +1 -1
  217. package/dist/resource/formats/png/CjsPngFormat.js +5 -3
  218. package/dist/resource/formats/png/CjsPngFormat.js.map +1 -1
  219. package/dist/resource/formats/png/core/helpers.js +13 -152
  220. package/dist/resource/formats/png/core/helpers.js.map +1 -1
  221. package/dist/resource/formats/png/core/writer.js +3 -27
  222. package/dist/resource/formats/png/core/writer.js.map +1 -1
  223. package/dist/resource/formats/red/core/helpers.js +19 -29
  224. package/dist/resource/formats/red/core/helpers.js.map +1 -1
  225. package/dist/resource/formats/stl/CjsStlFormat.js +158 -147
  226. package/dist/resource/formats/stl/CjsStlFormat.js.map +1 -1
  227. package/dist/resource/formats/stl/core/helpers.js +44 -66
  228. package/dist/resource/formats/stl/core/helpers.js.map +1 -1
  229. package/dist/resource/formats/tga/CjsTgaFormat.js +5 -3
  230. package/dist/resource/formats/tga/CjsTgaFormat.js.map +1 -1
  231. package/dist/resource/formats/tga/core/helpers.js +7 -153
  232. package/dist/resource/formats/tga/core/helpers.js.map +1 -1
  233. package/dist/resource/formats/vta/CjsVtaFormat.js +4 -3
  234. package/dist/resource/formats/vta/CjsVtaFormat.js.map +1 -1
  235. package/dist/resource/formats/vta/core/helpers.js +1 -17
  236. package/dist/resource/formats/vta/core/helpers.js.map +1 -1
  237. package/dist/resource/formats/wav/CjsWavFormat.js +4 -3
  238. package/dist/resource/formats/wav/CjsWavFormat.js.map +1 -1
  239. package/dist/resource/formats/wav/core/helpers.js +1 -15
  240. package/dist/resource/formats/wav/core/helpers.js.map +1 -1
  241. package/dist/resource/formats/webgl/CjsWebglFormat.js +4 -3
  242. package/dist/resource/formats/webgl/CjsWebglFormat.js.map +1 -1
  243. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +69 -9
  244. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  245. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +12 -3
  246. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
  247. package/dist/resource/formats/webgl/core/helpers.js +39 -68
  248. package/dist/resource/formats/webgl/core/helpers.js.map +1 -1
  249. package/dist/resource/formats/webgpu/CjsWebgpuFormat.js +4 -3
  250. package/dist/resource/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  251. package/dist/resource/formats/webgpu/core/helpers.js +4 -30
  252. package/dist/resource/formats/webgpu/core/helpers.js.map +1 -1
  253. package/dist/resource/formats/webm/CjsWebmFormat.js +4 -9
  254. package/dist/resource/formats/webm/CjsWebmFormat.js.map +1 -1
  255. package/dist/resource/formats/webm/core/helpers.js +1 -73
  256. package/dist/resource/formats/webm/core/helpers.js.map +1 -1
  257. package/dist/resource/formats/webp/CjsWebpFormat.js +4 -9
  258. package/dist/resource/formats/webp/CjsWebpFormat.js.map +1 -1
  259. package/dist/resource/formats/webp/core/helpers.js +1 -62
  260. package/dist/resource/formats/webp/core/helpers.js.map +1 -1
  261. package/dist/resource/formats/wem/CjsWemFormat.js +4 -3
  262. package/dist/resource/formats/wem/CjsWemFormat.js.map +1 -1
  263. package/dist/resource/formats/wem/core/bitStream.js +83 -106
  264. package/dist/resource/formats/wem/core/bitStream.js.map +1 -1
  265. package/dist/resource/formats/wem/core/codebookLibrary.js +52 -52
  266. package/dist/resource/formats/wem/core/codebookLibrary.js.map +1 -1
  267. package/dist/resource/formats/wem/core/helpers.js +1 -15
  268. package/dist/resource/formats/wem/core/helpers.js.map +1 -1
  269. package/dist/resource/formats/wem/core/wemToOgg.js +67 -67
  270. package/dist/resource/formats/wem/core/wemToOgg.js.map +1 -1
  271. package/dist/resource/geometry/MeshDecalData.js +23 -25
  272. package/dist/resource/geometry/MeshDecalData.js.map +1 -1
  273. package/dist/resource/geometry/MeshDecalLodData.js +14 -23
  274. package/dist/resource/geometry/MeshDecalLodData.js.map +1 -1
  275. package/dist/resource/geometry/TriGeometryRes.js +299 -284
  276. package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
  277. package/dist/resource/geometry/TriGeometryResAreaData.js +30 -31
  278. package/dist/resource/geometry/TriGeometryResAreaData.js.map +1 -1
  279. package/dist/resource/geometry/TriGeometryResJointData.js +16 -24
  280. package/dist/resource/geometry/TriGeometryResJointData.js.map +1 -1
  281. package/dist/resource/geometry/TriGeometryResLodData.js +50 -41
  282. package/dist/resource/geometry/TriGeometryResLodData.js.map +1 -1
  283. package/dist/resource/geometry/TriGeometryResMeshData.js +32 -32
  284. package/dist/resource/geometry/TriGeometryResMeshData.js.map +1 -1
  285. package/dist/resource/geometry/TriGeometryResSkeletonData.js +14 -23
  286. package/dist/resource/geometry/TriGeometryResSkeletonData.js.map +1 -1
  287. package/dist/resource/geometry/TriJointBinding.js +16 -24
  288. package/dist/resource/geometry/TriJointBinding.js.map +1 -1
  289. package/dist/resource/geometry/TriMorphTargetGeometryConstants.js +22 -27
  290. package/dist/resource/geometry/TriMorphTargetGeometryConstants.js.map +1 -1
  291. package/dist/resource/geometry/TriRtGeometryConstants.js +50 -41
  292. package/dist/resource/geometry/TriRtGeometryConstants.js.map +1 -1
  293. package/dist/resource/geometry/granny/GStateBindingCallbackData.js +12 -22
  294. package/dist/resource/geometry/granny/GStateBindingCallbackData.js.map +1 -1
  295. package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js +30 -31
  296. package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js.map +1 -1
  297. package/dist/resource/index.js +1 -1
  298. package/dist/resource/shader/reflection/Tr2EffectConstant.js +16 -17
  299. package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -1
  300. package/dist/resource/shader/reflection/Tr2EffectDescription.js +26 -28
  301. package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
  302. package/dist/resource/shader/reflection/Tr2EffectLibrary.js +24 -25
  303. package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
  304. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +21 -22
  305. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
  306. package/dist/resource/shader/reflection/Tr2EffectResource.js +25 -26
  307. package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
  308. package/dist/resource/shader/reflection/Tr2EffectStageInput.js +69 -72
  309. package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
  310. package/dist/resource/shader/reflection/Tr2EffectTechnique.js +17 -18
  311. package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
  312. package/dist/resource/shader/reflection/Tr2Pass.js +42 -43
  313. package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
  314. package/dist/resource/shader/reflection/Tr2RenderStateSetup.js +26 -5
  315. package/dist/resource/shader/reflection/Tr2RenderStateSetup.js.map +1 -1
  316. package/dist/resource/shader/reflection/carbonRecordFields.js +87 -90
  317. package/dist/resource/shader/reflection/carbonRecordFields.js.map +1 -1
  318. package/dist/resource/shader/sampler/Tr2SamplerSetup.js +32 -34
  319. package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
  320. package/dist/resource/texture/CjsTextureArrayRes.js +1 -6
  321. package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
  322. package/dist/resource/texture/Tr2TextureLodManager.js +35 -27
  323. package/dist/resource/texture/Tr2TextureLodManager.js.map +1 -1
  324. package/dist/resource/texture/Tr2TextureLodUpdateRequest.js +16 -24
  325. package/dist/resource/texture/Tr2TextureLodUpdateRequest.js.map +1 -1
  326. package/dist/resource/texture/Tr2TexturePackChannel.js +16 -24
  327. package/dist/resource/texture/Tr2TexturePackChannel.js.map +1 -1
  328. package/dist/resource/texture/Tr2TexturePipeline.js +24 -20
  329. package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -1
  330. package/dist/resource/texture/Tr2TexturePipelineParams.js +14 -23
  331. package/dist/resource/texture/Tr2TexturePipelineParams.js.map +1 -1
  332. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js +18 -25
  333. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -1
  334. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js +11 -16
  335. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -1
  336. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js +14 -23
  337. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -1
  338. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js +12 -22
  339. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -1
  340. package/dist/resource/texture/Tr2TexturePipelineStepPack.js +38 -26
  341. package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -1
  342. package/dist/resource/worker/CjsResManMainThreadLoader.js +2 -5
  343. package/dist/resource/worker/CjsResManMainThreadLoader.js.map +1 -1
  344. package/dist/resource/worker/CjsResManWorkerLoader.js +6 -7
  345. package/dist/resource/worker/CjsResManWorkerLoader.js.map +1 -1
  346. package/dist/resource/worker/protocol.js +18 -1
  347. package/dist/resource/worker/protocol.js.map +1 -1
  348. package/dist/sof/EveSOF.js +2 -222
  349. package/dist/sof/EveSOF.js.map +1 -1
  350. package/dist/sof/SofDocumentBuilder.js +205 -0
  351. package/dist/sof/SofDocumentBuilder.js.map +1 -0
  352. package/dist/sof/faction/ErrSOFFactionColorSetTypeNotFound.js +16 -0
  353. package/dist/sof/faction/ErrSOFFactionColorSetTypeNotFound.js.map +1 -0
  354. package/dist/sof/faction/ErrSOFFactionColorSetTypeUnknown.js +16 -0
  355. package/dist/sof/faction/ErrSOFFactionColorSetTypeUnknown.js.map +1 -0
  356. package/dist/sof/faction/EveSOFDataFactionColorSet.js +3 -27
  357. package/dist/sof/faction/EveSOFDataFactionColorSet.js.map +1 -1
  358. package/dist/sof/faction/index.js +3 -1
  359. package/dist/sof/faction/index.js.map +1 -1
  360. package/dist/sof/generic/ErrSOFAreaShaderNotFound.js +18 -0
  361. package/dist/sof/generic/ErrSOFAreaShaderNotFound.js.map +1 -0
  362. package/dist/sof/generic/ErrSOFDecalShaderNotFound.js +18 -0
  363. package/dist/sof/generic/ErrSOFDecalShaderNotFound.js.map +1 -0
  364. package/dist/sof/generic/ErrSOFMaterialPrefixNotFound.js +21 -0
  365. package/dist/sof/generic/ErrSOFMaterialPrefixNotFound.js.map +1 -0
  366. package/dist/sof/generic/ErrSOFPatternMaterialPrefixNotFound.js +21 -0
  367. package/dist/sof/generic/ErrSOFPatternMaterialPrefixNotFound.js.map +1 -0
  368. package/dist/sof/generic/EveSOFDataGeneric.js +5 -69
  369. package/dist/sof/generic/EveSOFDataGeneric.js.map +1 -1
  370. package/dist/sof/generic/index.js +5 -1
  371. package/dist/sof/generic/index.js.map +1 -1
  372. package/dist/sof/index.js +23 -7
  373. package/dist/sof/index.js.map +1 -1
  374. package/dist/sof/pattern/ErrSOFProjectionNotFound.js +20 -0
  375. package/dist/sof/pattern/ErrSOFProjectionNotFound.js.map +1 -0
  376. package/dist/sof/pattern/EveSOFDataPattern.js +2 -17
  377. package/dist/sof/pattern/EveSOFDataPattern.js.map +1 -1
  378. package/dist/sof/pattern/index.js +2 -1
  379. package/dist/sof/pattern/index.js.map +1 -1
  380. package/dist/sof/shared/ErrSOFAreaTypeNotFound.js +16 -0
  381. package/dist/sof/shared/ErrSOFAreaTypeNotFound.js.map +1 -0
  382. package/dist/sof/shared/ErrSOFLogoSetTypeNotFound.js +16 -0
  383. package/dist/sof/shared/ErrSOFLogoSetTypeNotFound.js.map +1 -0
  384. package/dist/sof/shared/ErrSOFLogoSetTypeUnknown.js +16 -0
  385. package/dist/sof/shared/ErrSOFLogoSetTypeUnknown.js.map +1 -0
  386. package/dist/sof/shared/EveSOFDataArea.js +2 -13
  387. package/dist/sof/shared/EveSOFDataArea.js.map +1 -1
  388. package/dist/sof/shared/EveSOFDataLogoSet.js +3 -27
  389. package/dist/sof/shared/EveSOFDataLogoSet.js.map +1 -1
  390. package/dist/sof/shared/EveSOFDataParameter.js +2 -146
  391. package/dist/sof/shared/EveSOFDataParameter.js.map +1 -1
  392. package/dist/sof/shared/EveSOFDataParameterBool.js +40 -0
  393. package/dist/sof/shared/EveSOFDataParameterBool.js.map +1 -0
  394. package/dist/sof/shared/EveSOFDataParameterColor.js +36 -0
  395. package/dist/sof/shared/EveSOFDataParameterColor.js.map +1 -0
  396. package/dist/sof/shared/EveSOFDataParameterFloat.js +37 -0
  397. package/dist/sof/shared/EveSOFDataParameterFloat.js.map +1 -0
  398. package/dist/sof/shared/EveSOFDataParameterInt.js +37 -0
  399. package/dist/sof/shared/EveSOFDataParameterInt.js.map +1 -0
  400. package/dist/sof/shared/EveSOFDataParameterVector2.js +37 -0
  401. package/dist/sof/shared/EveSOFDataParameterVector2.js.map +1 -0
  402. package/dist/sof/shared/EveSOFDataParameterVector3.js +37 -0
  403. package/dist/sof/shared/EveSOFDataParameterVector3.js.map +1 -0
  404. package/dist/sof/shared/{EveSOFDataSpotlightAttachment.js → EveSOFDataSpotLightAttachment.js} +1 -1
  405. package/dist/sof/shared/{EveSOFDataSpotlightAttachment.js.map → EveSOFDataSpotLightAttachment.js.map} +1 -1
  406. package/dist/sof/shared/index.js +13 -4
  407. package/dist/sof/shared/index.js.map +1 -1
  408. package/dist/sof/sofDocumentValues.js +33 -0
  409. package/dist/sof/sofDocumentValues.js.map +1 -0
  410. package/dist/trinity/controllers/ITr2Controller/ITr2ActionController.js +168 -0
  411. package/dist/trinity/controllers/ITr2Controller/ITr2ActionController.js.map +1 -0
  412. package/dist/trinity/controllers/{ITr2Controller.js → ITr2Controller/ITr2Controller.js} +2 -134
  413. package/dist/trinity/controllers/ITr2Controller/ITr2Controller.js.map +1 -0
  414. package/dist/trinity/controllers/Tr2Controller.js +2 -1
  415. package/dist/trinity/controllers/Tr2Controller.js.map +1 -1
  416. package/dist/trinity/controllers/Tr2ControllerReference.js +2 -1
  417. package/dist/trinity/controllers/Tr2ControllerReference.js.map +1 -1
  418. package/dist/trinity/controllers/action/ITr2ControllerAction.js +2 -1
  419. package/dist/trinity/controllers/action/ITr2ControllerAction.js.map +1 -1
  420. package/dist/trinity/controllers/action/Tr2ActionSpawnParticles.js +10 -9
  421. package/dist/trinity/controllers/action/Tr2ActionSpawnParticles.js.map +1 -1
  422. package/dist/trinity/controllers/expression/CjsControllerExpressionCompileError.js +26 -0
  423. package/dist/trinity/controllers/expression/CjsControllerExpressionCompileError.js.map +1 -0
  424. package/dist/trinity/controllers/expression/CjsControllerExpressionEvaluateError.js +24 -0
  425. package/dist/trinity/controllers/expression/CjsControllerExpressionEvaluateError.js.map +1 -0
  426. package/dist/trinity/controllers/expression/CjsControllerExpressionParser.js +387 -0
  427. package/dist/trinity/controllers/expression/CjsControllerExpressionParser.js.map +1 -0
  428. package/dist/trinity/controllers/expression/CjsControllerExpressionProgram.js +4 -1011
  429. package/dist/trinity/controllers/expression/CjsControllerExpressionProgram.js.map +1 -1
  430. package/dist/trinity/controllers/expression/expressionRuntime.js +605 -0
  431. package/dist/trinity/controllers/expression/expressionRuntime.js.map +1 -0
  432. package/dist/trinity/controllers/index.js +5 -2
  433. package/dist/trinity/controllers/index.js.map +1 -1
  434. package/dist/trinity/controllers/state/ITr2StateMachineStateFinalizer.js +2 -1
  435. package/dist/trinity/controllers/state/ITr2StateMachineStateFinalizer.js.map +1 -1
  436. package/dist/trinity/controllers/timeline/Tr2TimelineController.js +2 -1
  437. package/dist/trinity/controllers/timeline/Tr2TimelineController.js.map +1 -1
  438. package/dist/trinity/core/ITr2Updateable.js +2 -1
  439. package/dist/trinity/core/ITr2Updateable.js.map +1 -1
  440. package/dist/trinity/core/Tr2Blitter.js +6 -3
  441. package/dist/trinity/core/Tr2Blitter.js.map +1 -1
  442. package/dist/trinity/core/Tr2Denoiser.js +256 -0
  443. package/dist/trinity/core/Tr2Denoiser.js.map +1 -0
  444. package/dist/trinity/core/Tr2GpuResourcePool/GpuResourceHandle.js +115 -0
  445. package/dist/trinity/core/Tr2GpuResourcePool/GpuResourceHandle.js.map +1 -0
  446. package/dist/trinity/core/Tr2GpuResourcePool/TextureSize2D.js +79 -0
  447. package/dist/trinity/core/Tr2GpuResourcePool/TextureSize2D.js.map +1 -0
  448. package/dist/trinity/core/{Tr2GpuResourcePool.js → Tr2GpuResourcePool/Tr2GpuResourcePool.js} +63 -151
  449. package/dist/trinity/core/Tr2GpuResourcePool/Tr2GpuResourcePool.js.map +1 -0
  450. package/dist/trinity/core/{Tr2QuadRenderer.js → Tr2QuadRenderer/Tr2QuadRenderer.js} +8 -30
  451. package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRenderer.js.map +1 -0
  452. package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRendererEffectRecord.js +38 -0
  453. package/dist/trinity/core/Tr2QuadRenderer/Tr2QuadRendererEffectRecord.js.map +1 -0
  454. package/dist/trinity/core/Tr2RenderUtils.js +20 -3
  455. package/dist/trinity/core/Tr2RenderUtils.js.map +1 -1
  456. package/dist/trinity/core/Tr2Renderer.js +146 -1
  457. package/dist/trinity/core/Tr2Renderer.js.map +1 -1
  458. package/dist/trinity/core/Tr2ShadowMap.js +135 -14
  459. package/dist/trinity/core/Tr2ShadowMap.js.map +1 -1
  460. package/dist/trinity/core/{Tr2TextureArray.js → Tr2TextureArray/Tr2TextureArray.js} +3 -58
  461. package/dist/trinity/core/Tr2TextureArray/Tr2TextureArray.js.map +1 -0
  462. package/dist/trinity/core/Tr2TextureArray/Tr2TextureArrayElement.js +61 -0
  463. package/dist/trinity/core/Tr2TextureArray/Tr2TextureArrayElement.js.map +1 -0
  464. package/dist/trinity/core/batch/TriRenderBatch/DefaultKeyGenerator.js +26 -0
  465. package/dist/trinity/core/batch/TriRenderBatch/DefaultKeyGenerator.js.map +1 -0
  466. package/dist/trinity/core/batch/TriRenderBatch/EffectKeyGenerator.js +29 -0
  467. package/dist/trinity/core/batch/TriRenderBatch/EffectKeyGenerator.js.map +1 -0
  468. package/dist/trinity/core/batch/{ITriRenderBatchAccumulator.js → TriRenderBatch/ITriRenderBatchAccumulator.js} +30 -30
  469. package/dist/trinity/core/batch/TriRenderBatch/ITriRenderBatchAccumulator.js.map +1 -0
  470. package/dist/trinity/core/batch/{Tr2RenderBatch.js → TriRenderBatch/Tr2RenderBatch.js} +81 -154
  471. package/dist/trinity/core/batch/TriRenderBatch/Tr2RenderBatch.js.map +1 -0
  472. package/dist/trinity/core/batch/{TriRenderBatchAccumulator.js → TriRenderBatch/TriRenderBatchAccumulator.js} +7 -38
  473. package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAccumulator.js.map +1 -0
  474. package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlock.js +61 -0
  475. package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlock.js.map +1 -0
  476. package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlocksWithSharedMaterial.js +40 -0
  477. package/dist/trinity/core/batch/TriRenderBatch/TriRenderBatchAreaBlocksWithSharedMaterial.js.map +1 -0
  478. package/dist/trinity/core/batch/TriRenderBatchMap.js +6 -1
  479. package/dist/trinity/core/batch/TriRenderBatchMap.js.map +1 -1
  480. package/dist/trinity/core/context/Tr2RenderContext.js +75 -57
  481. package/dist/trinity/core/context/Tr2RenderContext.js.map +1 -1
  482. package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityEvent.js +67 -0
  483. package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityEvent.js.map +1 -0
  484. package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityResults.js +50 -0
  485. package/dist/trinity/core/context/Tr2VisibilityResults/Tr2VisibilityResults.js.map +1 -0
  486. package/dist/trinity/core/device/Tr2DepthStencil.js +186 -13
  487. package/dist/trinity/core/device/Tr2DepthStencil.js.map +1 -1
  488. package/dist/trinity/core/device/{Tr2RingBuffer.js → Tr2RingBuffer/Tr2RingBuffer.js} +27 -79
  489. package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBuffer.js.map +1 -0
  490. package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBufferOffsets.js +114 -0
  491. package/dist/trinity/core/device/Tr2RingBuffer/Tr2RingBufferOffsets.js.map +1 -0
  492. package/dist/trinity/core/device/{Tr2SuballocatedBuffer.js → Tr2SuballocatedBuffer/Tr2SuballocatedBuffer.js} +5 -59
  493. package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBuffer.js.map +1 -0
  494. package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBufferAllocation.js +80 -0
  495. package/dist/trinity/core/device/Tr2SuballocatedBuffer/Tr2SuballocatedBufferAllocation.js.map +1 -0
  496. package/dist/trinity/core/index.js +42 -15
  497. package/dist/trinity/core/index.js.map +1 -1
  498. package/dist/trinity/core/lighting/Tr2LightManager.js +6 -1
  499. package/dist/trinity/core/lighting/Tr2LightManager.js.map +1 -1
  500. package/dist/trinity/core/mesh/{ITr2ImpostorSource.js → ITr2ImpostorSource/ITr2ImpostorSource.js} +6 -28
  501. package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSource.js.map +1 -0
  502. package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSourceImpostorHash.js +32 -0
  503. package/dist/trinity/core/mesh/ITr2ImpostorSource/ITr2ImpostorSourceImpostorHash.js.map +1 -0
  504. package/dist/trinity/core/mesh/{ITr2InstanceData.js → ITr2InstanceData/ITr2InstanceData.js} +5 -29
  505. package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceData.js.map +1 -0
  506. package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceDataInstanceData.js +33 -0
  507. package/dist/trinity/core/mesh/ITr2InstanceData/ITr2InstanceDataInstanceData.js.map +1 -0
  508. package/dist/trinity/core/mesh/Tr2DirectInstanceData.js +2 -1
  509. package/dist/trinity/core/mesh/Tr2DirectInstanceData.js.map +1 -1
  510. package/dist/trinity/core/mesh/Tr2MeshBase.js +7 -1
  511. package/dist/trinity/core/mesh/Tr2MeshBase.js.map +1 -1
  512. package/dist/trinity/core/mesh/Tr2RuntimeInstanceData.js +2 -1
  513. package/dist/trinity/core/mesh/Tr2RuntimeInstanceData.js.map +1 -1
  514. package/dist/trinity/core/mesh/TriGeometryResAllocations.js +6 -2
  515. package/dist/trinity/core/mesh/TriGeometryResAllocations.js.map +1 -1
  516. package/dist/trinity/core/rawData/CjsConstantLayout.js +196 -0
  517. package/dist/trinity/core/rawData/CjsConstantLayout.js.map +1 -0
  518. package/dist/trinity/core/rawData/CjsPerFrameLayouts.js +8 -3
  519. package/dist/trinity/core/rawData/CjsPerFrameLayouts.js.map +1 -1
  520. package/dist/trinity/core/rawData/CjsPerObjectLayouts.js +40 -732
  521. package/dist/trinity/core/rawData/CjsPerObjectLayouts.js.map +1 -1
  522. package/dist/trinity/core/rawData/layouts/CjsEveBasicLayout.js +34 -0
  523. package/dist/trinity/core/rawData/layouts/CjsEveBasicLayout.js.map +1 -0
  524. package/dist/trinity/core/rawData/layouts/CjsEveBoosterSetLayout.js +69 -0
  525. package/dist/trinity/core/rawData/layouts/CjsEveBoosterSetLayout.js.map +1 -0
  526. package/dist/trinity/core/rawData/layouts/CjsEveChildBoosterSetLayout.js +59 -0
  527. package/dist/trinity/core/rawData/layouts/CjsEveChildBoosterSetLayout.js.map +1 -0
  528. package/dist/trinity/core/rawData/layouts/CjsEveChildBulletStormLayout.js +37 -0
  529. package/dist/trinity/core/rawData/layouts/CjsEveChildBulletStormLayout.js.map +1 -0
  530. package/dist/trinity/core/rawData/layouts/CjsEveChildSpherePinLayout.js +44 -0
  531. package/dist/trinity/core/rawData/layouts/CjsEveChildSpherePinLayout.js.map +1 -0
  532. package/dist/trinity/core/rawData/layouts/CjsEveLensflareLayout.js +31 -0
  533. package/dist/trinity/core/rawData/layouts/CjsEveLensflareLayout.js.map +1 -0
  534. package/dist/trinity/core/rawData/layouts/CjsEveMissileWarheadLayout.js +29 -0
  535. package/dist/trinity/core/rawData/layouts/CjsEveMissileWarheadLayout.js.map +1 -0
  536. package/dist/trinity/core/rawData/layouts/CjsEvePerObjectLayout.js +39 -0
  537. package/dist/trinity/core/rawData/layouts/CjsEvePerObjectLayout.js.map +1 -0
  538. package/dist/trinity/core/rawData/layouts/CjsEveSceneStaticParticlesLayout.js +30 -0
  539. package/dist/trinity/core/rawData/layouts/CjsEveSceneStaticParticlesLayout.js.map +1 -0
  540. package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectDecalLayout.js +78 -0
  541. package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectDecalLayout.js.map +1 -0
  542. package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectLayout.js +169 -0
  543. package/dist/trinity/core/rawData/layouts/CjsEveSpaceObjectLayout.js.map +1 -0
  544. package/dist/trinity/core/rawData/layouts/CjsEveSpacePerObjectLayout.js +107 -0
  545. package/dist/trinity/core/rawData/layouts/CjsEveSpacePerObjectLayout.js.map +1 -0
  546. package/dist/trinity/core/rawData/layouts/CjsEveSpherePinLayout.js +44 -0
  547. package/dist/trinity/core/rawData/layouts/CjsEveSpherePinLayout.js.map +1 -0
  548. package/dist/trinity/core/rawData/layouts/CjsEveStretch2Layout.js +34 -0
  549. package/dist/trinity/core/rawData/layouts/CjsEveStretch2Layout.js.map +1 -0
  550. package/dist/trinity/core/rawData/layouts/CjsEveTurretSetLayout.js +82 -0
  551. package/dist/trinity/core/rawData/layouts/CjsEveTurretSetLayout.js.map +1 -0
  552. package/dist/trinity/core/rawData/layouts/CjsTr2PerObjectLayout.js +42 -0
  553. package/dist/trinity/core/rawData/layouts/CjsTr2PerObjectLayout.js.map +1 -0
  554. package/dist/trinity/core/rawData/perObjectData/EveBasicPerObjectData.js +55 -0
  555. package/dist/trinity/core/rawData/perObjectData/EveBasicPerObjectData.js.map +1 -0
  556. package/dist/trinity/core/rawData/perObjectData/EveBoosterSetPerObjectData.js +59 -0
  557. package/dist/trinity/core/rawData/perObjectData/EveBoosterSetPerObjectData.js.map +1 -0
  558. package/dist/trinity/core/rawData/perObjectData/EveChildBoosterSetPerObjectData.js +59 -0
  559. package/dist/trinity/core/rawData/perObjectData/EveChildBoosterSetPerObjectData.js.map +1 -0
  560. package/dist/trinity/core/rawData/perObjectData/EveChildBulletStormPerObjectData.js +55 -0
  561. package/dist/trinity/core/rawData/perObjectData/EveChildBulletStormPerObjectData.js.map +1 -0
  562. package/dist/trinity/core/rawData/perObjectData/EveChildSpherePinPerObjectData.js +55 -0
  563. package/dist/trinity/core/rawData/perObjectData/EveChildSpherePinPerObjectData.js.map +1 -0
  564. package/dist/trinity/core/rawData/perObjectData/EveDecalPerObjectData.js +59 -0
  565. package/dist/trinity/core/rawData/perObjectData/EveDecalPerObjectData.js.map +1 -0
  566. package/dist/trinity/core/rawData/perObjectData/EveLensflarePerObjectData.js +55 -0
  567. package/dist/trinity/core/rawData/perObjectData/EveLensflarePerObjectData.js.map +1 -0
  568. package/dist/trinity/core/rawData/perObjectData/EveMissileWarheadPerObjectData.js +55 -0
  569. package/dist/trinity/core/rawData/perObjectData/EveMissileWarheadPerObjectData.js.map +1 -0
  570. package/dist/trinity/core/rawData/perObjectData/EveSceneStaticParticlesPerObjectData.js +55 -0
  571. package/dist/trinity/core/rawData/perObjectData/EveSceneStaticParticlesPerObjectData.js.map +1 -0
  572. package/dist/trinity/core/rawData/perObjectData/EveSpherePinPerObjectData.js +55 -0
  573. package/dist/trinity/core/rawData/perObjectData/EveSpherePinPerObjectData.js.map +1 -0
  574. package/dist/trinity/core/rawData/perObjectData/EveTurretSetPerObjectData.js +59 -0
  575. package/dist/trinity/core/rawData/perObjectData/EveTurretSetPerObjectData.js.map +1 -0
  576. package/dist/trinity/core/rawData/perObjectData/StretchPerObjectData.js +55 -0
  577. package/dist/trinity/core/rawData/perObjectData/StretchPerObjectData.js.map +1 -0
  578. package/dist/trinity/core/rawData/{Tr2PerObjectData.js → perObjectData/Tr2PerObjectData.js} +110 -62
  579. package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectData.js.map +1 -0
  580. package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataPSBuffer.js +104 -0
  581. package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataPSBuffer.js.map +1 -0
  582. package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataStandard.js +87 -0
  583. package/dist/trinity/core/rawData/perObjectData/Tr2PerObjectDataStandard.js.map +1 -0
  584. package/dist/trinity/core/variable/TriVariable.js +83 -83
  585. package/dist/trinity/core/variable/TriVariable.js.map +1 -1
  586. package/dist/trinity/core/vertex/{Tr2VertexDefinition.js → Tr2VertexDefinition/Tr2VertexDefinition.js} +4 -20
  587. package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinition.js.map +1 -0
  588. package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinitionItem.js +29 -0
  589. package/dist/trinity/core/vertex/Tr2VertexDefinition/Tr2VertexDefinitionItem.js.map +1 -0
  590. package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js +116 -36
  591. package/dist/trinity/core/volumetrics/Tr2VolumetricsRenderer.js.map +1 -1
  592. package/dist/trinity/curves/curve/Tr2CurveRandomAxisRotation.js +50 -92
  593. package/dist/trinity/curves/curve/Tr2CurveRandomAxisRotation.js.map +1 -1
  594. package/dist/trinity/eve/EveModularObjectModifier.js +9 -5
  595. package/dist/trinity/eve/EveModularObjectModifier.js.map +1 -1
  596. package/dist/trinity/eve/IEveInheritPropertiesOwner.js +2 -1
  597. package/dist/trinity/eve/IEveInheritPropertiesOwner.js.map +1 -1
  598. package/dist/trinity/eve/IEveSpaceObject2.js +2 -1
  599. package/dist/trinity/eve/IEveSpaceObject2.js.map +1 -1
  600. package/dist/trinity/eve/IEveTransform.js +2 -1
  601. package/dist/trinity/eve/IEveTransform.js.map +1 -1
  602. package/dist/trinity/eve/attachment/banner/EveBannerSet.js +2 -2
  603. package/dist/trinity/eve/attachment/banner/EveBannerSet.js.map +1 -1
  604. package/dist/trinity/eve/attachment/booster/EveBoosterSet2.js +109 -133
  605. package/dist/trinity/eve/attachment/booster/EveBoosterSet2.js.map +1 -1
  606. package/dist/trinity/eve/attachment/booster/EveBoosterSet2Item.js +40 -0
  607. package/dist/trinity/eve/attachment/booster/EveBoosterSet2Item.js.map +1 -0
  608. package/dist/trinity/eve/attachment/booster/EveBoosterSet2Renderable.js +1 -1
  609. package/dist/trinity/eve/attachment/booster/EveBoosterSet2Renderable.js.map +1 -1
  610. package/dist/trinity/eve/attachment/decal/DecalMeshCache.js +2 -14
  611. package/dist/trinity/eve/attachment/decal/DecalMeshCache.js.map +1 -1
  612. package/dist/trinity/eve/attachment/decal/DecalMeshCacheMeshBuffers.js +18 -0
  613. package/dist/trinity/eve/attachment/decal/DecalMeshCacheMeshBuffers.js.map +1 -0
  614. package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js +1 -1
  615. package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js.map +1 -1
  616. package/dist/trinity/eve/attachment/haze/EveHazeSet.js +1 -1
  617. package/dist/trinity/eve/attachment/haze/EveHazeSet.js.map +1 -1
  618. package/dist/trinity/eve/attachment/plane/EvePlaneSet.js +1 -1
  619. package/dist/trinity/eve/attachment/plane/EvePlaneSet.js.map +1 -1
  620. package/dist/trinity/eve/attachment/spotlight/EveSpotlightSet.js +2 -2
  621. package/dist/trinity/eve/attachment/spotlight/EveSpotlightSet.js.map +1 -1
  622. package/dist/trinity/eve/attachment/sprite/EveSpriteLineSet.js +1 -1
  623. package/dist/trinity/eve/attachment/sprite/EveSpriteLineSet.js.map +1 -1
  624. package/dist/trinity/eve/attachment/sprite/EveSpriteSet.js +4 -2
  625. package/dist/trinity/eve/attachment/sprite/EveSpriteSet.js.map +1 -1
  626. package/dist/trinity/eve/attachment/turrets/EveTurretSet.js +143 -139
  627. package/dist/trinity/eve/attachment/turrets/EveTurretSet.js.map +1 -1
  628. package/dist/trinity/eve/camera/EveCamera.js +1 -1
  629. package/dist/trinity/eve/camera/EveCamera.js.map +1 -1
  630. package/dist/trinity/eve/child/EveChildBoosterSet.js +12 -1
  631. package/dist/trinity/eve/child/EveChildBoosterSet.js.map +1 -1
  632. package/dist/trinity/eve/child/EveChildCloud2.js +178 -151
  633. package/dist/trinity/eve/child/EveChildCloud2.js.map +1 -1
  634. package/dist/trinity/eve/child/EveChildContainer.js +141 -141
  635. package/dist/trinity/eve/child/EveChildContainer.js.map +1 -1
  636. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js +87 -0
  637. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMesh.js.map +1 -0
  638. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshArea.js +46 -0
  639. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshArea.js.map +1 -0
  640. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshInstance.js +35 -0
  641. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshInstance.js.map +1 -0
  642. package/dist/trinity/eve/child/{EveChildInstancedMeshes.js → EveChildInstancedMeshes/EveChildInstancedMeshes.js} +42 -163
  643. package/dist/trinity/eve/child/EveChildInstancedMeshes/EveChildInstancedMeshes.js.map +1 -0
  644. package/dist/trinity/eve/child/EveChildMesh.js +218 -218
  645. package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
  646. package/dist/trinity/eve/child/EveChildPartData/EveChildPartData.js +53 -0
  647. package/dist/trinity/eve/child/EveChildPartData/EveChildPartData.js.map +1 -0
  648. package/dist/trinity/eve/child/{EveChildPartData.js → EveChildPartData/EveChildPartDataPartData.js} +9 -45
  649. package/dist/trinity/eve/child/EveChildPartData/EveChildPartDataPartData.js.map +1 -0
  650. package/dist/trinity/eve/child/EveChildParticleSystem.js +30 -29
  651. package/dist/trinity/eve/child/EveChildParticleSystem.js.map +1 -1
  652. package/dist/trinity/eve/child/EveChildTransform.js +5 -0
  653. package/dist/trinity/eve/child/EveChildTransform.js.map +1 -1
  654. package/dist/trinity/eve/child/EveChildTurret.js +7 -0
  655. package/dist/trinity/eve/child/EveChildTurret.js.map +1 -1
  656. package/dist/trinity/eve/index.js +10 -4
  657. package/dist/trinity/eve/index.js.map +1 -1
  658. package/dist/trinity/eve/lights/Tr2Light.js +5 -0
  659. package/dist/trinity/eve/lights/Tr2Light.js.map +1 -1
  660. package/dist/trinity/eve/overlays/overlayBatches.js +6 -1
  661. package/dist/trinity/eve/overlays/overlayBatches.js.map +1 -1
  662. package/dist/trinity/eve/particles/static/EveSceneStaticParticles.js +4 -4
  663. package/dist/trinity/eve/particles/static/EveSceneStaticParticles.js.map +1 -1
  664. package/dist/trinity/eve/renderable/stretch/EveStretch2.js +76 -71
  665. package/dist/trinity/eve/renderable/stretch/EveStretch2.js.map +1 -1
  666. package/dist/trinity/eve/renderable/stretch/EveStretch3.js +1 -1
  667. package/dist/trinity/eve/renderable/stretch/EveStretch3.js.map +1 -1
  668. package/dist/trinity/eve/spaceObject/EveShip2.js +3 -3
  669. package/dist/trinity/eve/spaceObject/EveShip2.js.map +1 -1
  670. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +408 -407
  671. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
  672. package/dist/trinity/eve/ui/EveTacticalOverlay.js +1 -1
  673. package/dist/trinity/eve/ui/EveTacticalOverlay.js.map +1 -1
  674. package/dist/trinity/eve/ui/lines/EveCurveLineSet.js +9 -9
  675. package/dist/trinity/eve/ui/lines/EveCurveLineSet.js.map +1 -1
  676. package/dist/trinity/eve/ui/lines/EveLineSet.js +27 -25
  677. package/dist/trinity/eve/ui/lines/EveLineSet.js.map +1 -1
  678. package/dist/trinity/eve/ui/tacticalOverlay/EveTacticalTrails.js +3 -2
  679. package/dist/trinity/eve/ui/tacticalOverlay/EveTacticalTrails.js.map +1 -1
  680. package/dist/trinity/generated/index.js +0 -1
  681. package/dist/trinity/generated/index.js.map +1 -1
  682. package/dist/trinity/generated/trinityCore/index.js +0 -1
  683. package/dist/trinity/generated/trinityCore/index.js.map +1 -1
  684. package/dist/trinity/index.js +59 -23
  685. package/dist/trinity/index.js.map +1 -1
  686. package/dist/trinity/particle/{ITr2GenericEmitter.js → ITr2GenericEmitter/ITr2GenericEmitter.js} +4 -32
  687. package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitter.js.map +1 -0
  688. package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitterUpdateArguments.js +36 -0
  689. package/dist/trinity/particle/ITr2GenericEmitter/ITr2GenericEmitterUpdateArguments.js.map +1 -0
  690. package/dist/trinity/particle/Tr2ParticleSystem.js +4 -2
  691. package/dist/trinity/particle/Tr2ParticleSystem.js.map +1 -1
  692. package/dist/trinity/particle/element/Tr2ParticleElementData.js +15 -4
  693. package/dist/trinity/particle/element/Tr2ParticleElementData.js.map +1 -1
  694. package/dist/trinity/particle/emitter/Tr2DynamicEmitter.js +21 -20
  695. package/dist/trinity/particle/emitter/Tr2DynamicEmitter.js.map +1 -1
  696. package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js +23 -22
  697. package/dist/trinity/particle/emitter/Tr2GpuSharedEmitter.js.map +1 -1
  698. package/dist/trinity/particle/emitter/Tr2StaticEmitter.js +14 -13
  699. package/dist/trinity/particle/emitter/Tr2StaticEmitter.js.map +1 -1
  700. package/dist/trinity/particle/index.js +2 -1
  701. package/dist/trinity/particle/index.js.map +1 -1
  702. package/dist/trinity/renderJob/step/TriStepPushRenderTarget.js +7 -1
  703. package/dist/trinity/renderJob/step/TriStepPushRenderTarget.js.map +1 -1
  704. package/dist/trinity/shader/Tr2Effect.js +131 -58
  705. package/dist/trinity/shader/Tr2Effect.js.map +1 -1
  706. package/dist/trinity/shader/Tr2EffectStateManager.js +17 -5
  707. package/dist/trinity/shader/Tr2EffectStateManager.js.map +1 -1
  708. package/dist/trinity/shader/Tr2Material.js +21 -4
  709. package/dist/trinity/shader/Tr2Material.js.map +1 -1
  710. package/dist/trinity/shader/material/Tr2EffectPassParameters.js +4 -1
  711. package/dist/trinity/shader/material/Tr2EffectPassParameters.js.map +1 -1
  712. package/dist/trinity/shader/parameter/Tr2GeometryBufferParameter.js +2 -2
  713. package/dist/trinity/shader/parameter/Tr2GeometryBufferParameter.js.map +1 -1
  714. package/dist/trinityal/Tr2BufferAL/Tr2BufferDescriptionAL.js +79 -0
  715. package/dist/trinityal/Tr2BufferAL/Tr2BufferDescriptionAL.js.map +1 -0
  716. package/dist/trinityal/{Tr2DeviceResourceAL.js → Tr2DeviceResourceAL/Tr2BaseDeviceResourceAL.js} +77 -79
  717. package/dist/trinityal/Tr2DeviceResourceAL/Tr2BaseDeviceResourceAL.js.map +1 -0
  718. package/dist/trinityal/Tr2DeviceResourceAL/Tr2DeviceResourceAL.js +24 -0
  719. package/dist/trinityal/Tr2DeviceResourceAL/Tr2DeviceResourceAL.js.map +1 -0
  720. package/dist/trinityal/Tr2DrawUPHelper.js +2 -1
  721. package/dist/trinityal/Tr2DrawUPHelper.js.map +1 -1
  722. package/dist/trinityal/Tr2HalHelperStructures/Tr2MsaaDesc.js +45 -0
  723. package/dist/trinityal/Tr2HalHelperStructures/Tr2MsaaDesc.js.map +1 -0
  724. package/dist/trinityal/Tr2HalHelperStructures/Tr2SamplerDescription.js +154 -0
  725. package/dist/trinityal/Tr2HalHelperStructures/Tr2SamplerDescription.js.map +1 -0
  726. package/dist/trinityal/Tr2HalHelperStructures/Tr2SubresourceData.js +48 -0
  727. package/dist/trinityal/Tr2HalHelperStructures/Tr2SubresourceData.js.map +1 -0
  728. package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureCoordBox.js +75 -0
  729. package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureCoordBox.js.map +1 -0
  730. package/dist/trinityal/{Tr2HalHelperStructures.js → Tr2HalHelperStructures/Tr2TextureSubresource.js} +11 -115
  731. package/dist/trinityal/Tr2HalHelperStructures/Tr2TextureSubresource.js.map +1 -0
  732. package/dist/trinityal/Tr2HalHelperStructures/Tr2Viewport.js +51 -0
  733. package/dist/trinityal/Tr2HalHelperStructures/Tr2Viewport.js.map +1 -0
  734. package/dist/trinityal/{Tr2RenderPassAL.js → Tr2RenderPassAL/Tr2ColorAttachment.js} +5 -28
  735. package/dist/trinityal/Tr2RenderPassAL/Tr2ColorAttachment.js.map +1 -0
  736. package/dist/trinityal/Tr2RenderPassAL/Tr2DepthAttachment.js +38 -0
  737. package/dist/trinityal/Tr2RenderPassAL/Tr2DepthAttachment.js.map +1 -0
  738. package/dist/trinityal/Tr2ResourceSetAL/Tr2RegisterMapAL.js +80 -0
  739. package/dist/trinityal/Tr2ResourceSetAL/Tr2RegisterMapAL.js.map +1 -0
  740. package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetAL.js +76 -0
  741. package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetAL.js.map +1 -0
  742. package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetALStub.js +96 -0
  743. package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetALStub.js.map +1 -0
  744. package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetDescriptionAL.js +196 -0
  745. package/dist/trinityal/Tr2ResourceSetAL/Tr2ResourceSetDescriptionAL.js.map +1 -0
  746. package/dist/trinityal/index.js +22 -9
  747. package/dist/trinityal/index.js.map +1 -1
  748. package/dist/trinityal/stub/Tr2BufferALStub.js +86 -141
  749. package/dist/trinityal/stub/Tr2BufferALStub.js.map +1 -1
  750. package/dist/trinityal/stub/Tr2CapsALStub.js +17 -0
  751. package/dist/trinityal/stub/Tr2CapsALStub.js.map +1 -1
  752. package/dist/trinityal/stub/Tr2ConstantBufferALStub.js +57 -41
  753. package/dist/trinityal/stub/Tr2ConstantBufferALStub.js.map +1 -1
  754. package/dist/trinityal/stub/Tr2FenceALStub.js +18 -2
  755. package/dist/trinityal/stub/Tr2FenceALStub.js.map +1 -1
  756. package/dist/trinityal/stub/Tr2GpuTimerALStub.js +97 -0
  757. package/dist/trinityal/stub/Tr2GpuTimerALStub.js.map +1 -0
  758. package/dist/trinityal/stub/Tr2OcclusionQueryALStub.js +124 -0
  759. package/dist/trinityal/stub/Tr2OcclusionQueryALStub.js.map +1 -0
  760. package/dist/trinityal/stub/Tr2PipelineStatsQueryALStub/Tr2PipelineStatsQueryALStub.js +146 -0
  761. package/dist/trinityal/stub/Tr2PipelineStatsQueryALStub/Tr2PipelineStatsQueryALStub.js.map +1 -0
  762. package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2BindlessResourcesAL.js +28 -0
  763. package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2BindlessResourcesAL.js.map +1 -0
  764. package/dist/trinityal/stub/{Tr2RenderContextALStub.js → Tr2RenderContextALStub/Tr2RenderContextALStub.js} +70 -75
  765. package/dist/trinityal/stub/Tr2RenderContextALStub/Tr2RenderContextALStub.js.map +1 -0
  766. package/dist/trinityal/stub/Tr2SamplerStateALStub.js +47 -31
  767. package/dist/trinityal/stub/Tr2SamplerStateALStub.js.map +1 -1
  768. package/dist/trinityal/stub/Tr2ShaderALStub.js +61 -45
  769. package/dist/trinityal/stub/Tr2ShaderALStub.js.map +1 -1
  770. package/dist/trinityal/stub/Tr2ShaderProgramALStub.js +51 -33
  771. package/dist/trinityal/stub/Tr2ShaderProgramALStub.js.map +1 -1
  772. package/dist/trinityal/stub/Tr2SwapChainALStub.js +61 -45
  773. package/dist/trinityal/stub/Tr2SwapChainALStub.js.map +1 -1
  774. package/dist/trinityal/stub/Tr2TextureALStub.js +188 -171
  775. package/dist/trinityal/stub/Tr2TextureALStub.js.map +1 -1
  776. package/dist/trinityal/stub/Tr2VertexLayoutALStub.js +43 -27
  777. package/dist/trinityal/stub/Tr2VertexLayoutALStub.js.map +1 -1
  778. package/dist/trinityal/stub/{Tr2VideoAdapterInfoALStub.js → Tr2VideoAdapterInfoStub.js} +16 -1
  779. package/dist/trinityal/stub/Tr2VideoAdapterInfoStub.js.map +1 -0
  780. package/dist/trinityal/stub/index.js +8 -4
  781. package/dist/trinityal/stub/index.js.map +1 -1
  782. package/dist/trinityal/vertexLayoutMatch.js +2 -2
  783. package/dist/trinityal/vertexLayoutMatch.js.map +1 -1
  784. package/dist/trinityal/webgpu/CjsWebgpuBufferAL.js +105 -90
  785. package/dist/trinityal/webgpu/CjsWebgpuBufferAL.js.map +1 -1
  786. package/dist/trinityal/webgpu/CjsWebgpuCapsAL.js +17 -0
  787. package/dist/trinityal/webgpu/CjsWebgpuCapsAL.js.map +1 -1
  788. package/dist/trinityal/webgpu/CjsWebgpuConstantBufferAL.js +15 -0
  789. package/dist/trinityal/webgpu/CjsWebgpuConstantBufferAL.js.map +1 -1
  790. package/dist/trinityal/webgpu/CjsWebgpuDevice.js +2 -2
  791. package/dist/trinityal/webgpu/CjsWebgpuDevice.js.map +1 -1
  792. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js +900 -938
  793. package/dist/trinityal/webgpu/CjsWebgpuRenderContextAL.js.map +1 -1
  794. package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js +56 -60
  795. package/dist/trinityal/webgpu/CjsWebgpuResourceSetAL.js.map +1 -1
  796. package/dist/trinityal/webgpu/CjsWebgpuSamplerStateAL.js +16 -1
  797. package/dist/trinityal/webgpu/CjsWebgpuSamplerStateAL.js.map +1 -1
  798. package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js +100 -379
  799. package/dist/trinityal/webgpu/CjsWebgpuShaderAL.js.map +1 -1
  800. package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js +330 -0
  801. package/dist/trinityal/webgpu/CjsWebgpuShaderProgramAL.js.map +1 -0
  802. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js +15 -0
  803. package/dist/trinityal/webgpu/CjsWebgpuTextureAL.js.map +1 -1
  804. package/dist/trinityal/webgpu/core/{constantArena.js → CjsWebgpuConstantArena.js} +1 -1
  805. package/dist/trinityal/webgpu/core/CjsWebgpuConstantArena.js.map +1 -0
  806. package/dist/trinityal/webgpu/core/{batchGroups.js → CjsWebgpuEncodeState.js} +1 -1
  807. package/dist/trinityal/webgpu/core/CjsWebgpuEncodeState.js.map +1 -0
  808. package/dist/trinityal/webgpu/core/{perFrameSource.js → CjsWebgpuPerFrameSource.js} +1 -1
  809. package/dist/trinityal/webgpu/core/CjsWebgpuPerFrameSource.js.map +1 -0
  810. package/dist/trinityal/webgpu/core/{pipelineCache.js → CjsWebgpuPipelineCache.js} +1 -1
  811. package/dist/trinityal/webgpu/core/CjsWebgpuPipelineCache.js.map +1 -0
  812. package/dist/trinityal/webgpu/core/{psoDescription.js → CjsWebgpuPsoDescription.js} +2 -2
  813. package/dist/trinityal/webgpu/core/CjsWebgpuPsoDescription.js.map +1 -0
  814. package/dist/trinityal/webgpu/core/{renderTarget.js → CjsWebgpuRenderTarget.js} +1 -1
  815. package/dist/trinityal/webgpu/core/CjsWebgpuRenderTarget.js.map +1 -0
  816. package/dist/trinityal/webgpu/core/{samplerSource.js → CjsWebgpuSamplerSource.js} +1 -1
  817. package/dist/trinityal/webgpu/core/CjsWebgpuSamplerSource.js.map +1 -0
  818. package/dist/trinityal/webgpu/core/{textureSource.js → CjsWebgpuTextureSource.js} +1 -1
  819. package/dist/trinityal/webgpu/core/CjsWebgpuTextureSource.js.map +1 -0
  820. package/dist/trinityal/webgpu/core/{trinityBatchDispatcher.js → CjsWebgpuTrinityBatchDispatcher.js} +4 -4
  821. package/dist/trinityal/webgpu/core/CjsWebgpuTrinityBatchDispatcher.js.map +1 -0
  822. package/dist/trinityal/webgpu/core/{trinityBatchResolver.js → CjsWebgpuTrinityBatchResolver.js} +81 -81
  823. package/dist/trinityal/webgpu/core/CjsWebgpuTrinityBatchResolver.js.map +1 -0
  824. package/dist/trinityal/webgpu/core/{trinityPassEncoder.js → CjsWebgpuTrinityPassEncoder.js} +2 -2
  825. package/dist/trinityal/webgpu/core/CjsWebgpuTrinityPassEncoder.js.map +1 -0
  826. package/dist/trinityal/webgpu/core/{workQueue.js → CjsWebgpuWorkQueue.js} +1 -1
  827. package/dist/trinityal/webgpu/core/CjsWebgpuWorkQueue.js.map +1 -0
  828. package/dist/trinityal/webgpu/internal.js +12 -11
  829. package/dist/trinityal/webgpu/internal.js.map +1 -1
  830. package/docs/audio/reference/classes/trinity.md +44 -34
  831. package/docs/character/architecture.md +276 -0
  832. package/docs/character/reference/character-appearance-plans.md +30 -66
  833. package/docs/character/reference/prepared-libraries.md +14 -30
  834. package/docs/global/reference/api.md +2 -1
  835. package/docs/global/reference/classes/README.md +53 -71
  836. package/docs/global/reference/classes/dropped.md +16 -0
  837. package/docs/resource/README.md +19 -15
  838. package/docs/resource/architecture.md +9 -2
  839. package/docs/resource/concepts/format-capabilities.md +124 -80
  840. package/docs/resource/concepts/shared-format-helpers.md +94 -0
  841. package/docs/resource/formats/README.md +230 -224
  842. package/docs/resource/formats/bitknit2.md +221 -0
  843. package/docs/resource/formats/carbon-effect-container.md +184 -269
  844. package/docs/resource/formats/gr2.md +6 -1
  845. package/docs/resource/formats/schemabound.md +28 -48
  846. package/docs/resource/formats/static.md +70 -97
  847. package/docs/resource/formats/webgl/carbon-constant-layouts.md +8 -8
  848. package/docs/resource/formats/webgl/decl-io.md +165 -256
  849. package/docs/resource/formats/webgl/memory-structured.md +64 -142
  850. package/docs/resource/formats/webgl/texture-sample.md +109 -138
  851. package/docs/resource/formats/webgpu/formats/carbon-webgpu.md +38 -69
  852. package/docs/resource/formats/webgpu/guides/effect-packaging.md +54 -116
  853. package/docs/resource/formats/webgpu/reference/api.md +64 -67
  854. package/docs/resource/formats/webgpu/reference/wgsl-compatibility.md +158 -345
  855. package/docs/resource/reference/classes/core.md +256 -236
  856. package/docs/resource/reference/classes/formats.md +1668 -1672
  857. package/docs/resource/reference/workers.md +4 -2
  858. package/docs/sof/reference/classes/core.md +1 -1
  859. package/docs/sof/reference/classes/faction.md +2 -2
  860. package/docs/sof/reference/classes/generic.md +4 -4
  861. package/docs/sof/reference/classes/pattern.md +1 -1
  862. package/docs/sof/reference/classes/shared.md +10 -10
  863. package/docs/trinity/architecture.md +55 -44
  864. package/docs/trinity/concepts/generated-class-lifecycle.md +10 -15
  865. package/docs/trinity/reference/classes/curves-and-utilities.md +496 -506
  866. package/docs/trinity/reference/classes/dropped.md +0 -189
  867. package/docs/trinity/reference/classes/eve-runtime.md +8 -8
  868. package/docs/trinity/reference/classes/generated.md +0 -10
  869. package/docs/trinity/reference/classes/particle.md +2 -2
  870. package/docs/trinity/reference/classes/trinity-core.md +1554 -1256
  871. package/docs/trinity/reference/implementation-status.md +50 -75
  872. package/docs/trinity/reference/main-semantic-extraction.md +13 -17
  873. package/docs/trinityal/reference/classes/README.md +77 -27
  874. package/docs/trinityal/reference/classes/dropped.md +92 -0
  875. package/docs/trinityal/webgpu/README.md +3 -1
  876. package/docs/trinityal/webgpu/architecture.md +121 -228
  877. package/docs/trinityal/webgpu/reference/api.md +5 -5
  878. package/docs/trinityal/webgpu/reference/classes/README.md +13 -13
  879. package/format-notices/gr2/NOTICE +18 -12
  880. package/format-notices/gr2/THIRD-PARTY-NOTICES.md +5 -5
  881. package/package.json +4 -1
  882. package/dist/audio/trinity/audio/AudActionLog.js +0 -173
  883. package/dist/audio/trinity/audio/AudActionLog.js.map +0 -1
  884. package/dist/audio/trinity/audio/AudObstructionOcclusion.js.map +0 -1
  885. package/dist/global/contracts/CjsScriptCallback.js +0 -94
  886. package/dist/global/contracts/CjsScriptCallback.js.map +0 -1
  887. package/dist/trinity/controllers/ITr2Controller.js.map +0 -1
  888. package/dist/trinity/core/Tr2GpuResourcePool.js.map +0 -1
  889. package/dist/trinity/core/Tr2QuadRenderer.js.map +0 -1
  890. package/dist/trinity/core/Tr2TextureArray.js.map +0 -1
  891. package/dist/trinity/core/batch/ITriRenderBatchAccumulator.js.map +0 -1
  892. package/dist/trinity/core/batch/Tr2RenderBatch.js.map +0 -1
  893. package/dist/trinity/core/batch/TriRenderBatchAccumulator.js.map +0 -1
  894. package/dist/trinity/core/context/CjsShadowMapExecutor.js +0 -43
  895. package/dist/trinity/core/context/CjsShadowMapExecutor.js.map +0 -1
  896. package/dist/trinity/core/context/CjsVolumetricsExecutor.js +0 -64
  897. package/dist/trinity/core/context/CjsVolumetricsExecutor.js.map +0 -1
  898. package/dist/trinity/core/context/Tr2VisibilityResults.js +0 -109
  899. package/dist/trinity/core/context/Tr2VisibilityResults.js.map +0 -1
  900. package/dist/trinity/core/device/Tr2RingBuffer.js.map +0 -1
  901. package/dist/trinity/core/device/Tr2SuballocatedBuffer.js.map +0 -1
  902. package/dist/trinity/core/mesh/ITr2ImpostorSource.js.map +0 -1
  903. package/dist/trinity/core/mesh/ITr2InstanceData.js.map +0 -1
  904. package/dist/trinity/core/rawData/Tr2PerObjectData.js.map +0 -1
  905. package/dist/trinity/core/rawData/constantLayout.js +0 -175
  906. package/dist/trinity/core/rawData/constantLayout.js.map +0 -1
  907. package/dist/trinity/core/vertex/Tr2VertexDefinition.js.map +0 -1
  908. package/dist/trinity/eve/child/EveChildInstancedMeshes.js.map +0 -1
  909. package/dist/trinity/eve/child/EveChildPartData.js.map +0 -1
  910. package/dist/trinity/generated/trinityCore/Tr2Denoiser.js +0 -47
  911. package/dist/trinity/generated/trinityCore/Tr2Denoiser.js.map +0 -1
  912. package/dist/trinity/particle/ITr2GenericEmitter.js.map +0 -1
  913. package/dist/trinityal/Tr2DeviceResourceAL.js.map +0 -1
  914. package/dist/trinityal/Tr2HalHelperStructures.js.map +0 -1
  915. package/dist/trinityal/Tr2RenderPassAL.js.map +0 -1
  916. package/dist/trinityal/Tr2ResourceSetAL.js +0 -419
  917. package/dist/trinityal/Tr2ResourceSetAL.js.map +0 -1
  918. package/dist/trinityal/Tr2SamplerDescription.js +0 -72
  919. package/dist/trinityal/Tr2SamplerDescription.js.map +0 -1
  920. package/dist/trinityal/stub/Tr2QueryALStub.js +0 -326
  921. package/dist/trinityal/stub/Tr2QueryALStub.js.map +0 -1
  922. package/dist/trinityal/stub/Tr2RenderContextALStub.js.map +0 -1
  923. package/dist/trinityal/stub/Tr2VideoAdapterInfoALStub.js.map +0 -1
  924. package/dist/trinityal/webgpu/core/batchGroups.js.map +0 -1
  925. package/dist/trinityal/webgpu/core/constantArena.js.map +0 -1
  926. package/dist/trinityal/webgpu/core/perFrameSource.js.map +0 -1
  927. package/dist/trinityal/webgpu/core/pipelineCache.js.map +0 -1
  928. package/dist/trinityal/webgpu/core/psoDescription.js.map +0 -1
  929. package/dist/trinityal/webgpu/core/renderTarget.js.map +0 -1
  930. package/dist/trinityal/webgpu/core/samplerSource.js.map +0 -1
  931. package/dist/trinityal/webgpu/core/textureSource.js.map +0 -1
  932. package/dist/trinityal/webgpu/core/trinityBatchDispatcher.js.map +0 -1
  933. package/dist/trinityal/webgpu/core/trinityBatchResolver.js.map +0 -1
  934. package/dist/trinityal/webgpu/core/trinityPassEncoder.js.map +0 -1
  935. package/dist/trinityal/webgpu/core/workQueue.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CjsWebgpuTextureAL.js","sources":["../../../../src/trinityal/webgpu/CjsWebgpuTextureAL.js"],"sourcesContent":["// Source: trinity/trinityal/include/Tr2TextureAL.h\n// trinity/trinityal/metal/Tr2TextureALMetal.mm\n// trinity/trinityal/stub/Tr2TextureALStub.cpp\n//\n// A `Tr2TextureAL` holding a real `GPUTexture`.\n//\n// CREATED WITH ITS DATA, NEVER UPDATED INTO. Carbon's texture resource creates\n// its texture from the decoded bitmap with one `Tr2SubresourceData` per\n// (mip, layer), indexed `mip + layer * mipCount`\n// (`Tr2ImageIOHelpers.cpp:104-128`), and Metal uploads them one\n// `replaceRegion` per (slice, mip) (`Tr2TextureALMetal.mm:140-268`). This does\n// the same with one `writeTexture` per subresource.\n//\n// THE sRGB VIEW IS A FORMAT-REINTERPRETING VIEW, as Metal's is: `MetalContext.mm:342-357`\n// makes `newTextureViewWithPixelFormat:` of the sRGB sibling for RGBA8, BGRA8,\n// BC1, BC2, BC3 and BC7, and `GetSRGBViewMetalTexture()` is what a\n// `COLOR_SPACE_SRGB` SRV binds. WebGPU needs the sibling declared in\n// `viewFormats` at creation, so it is.\n//\n// FIELDS ARE PUBLIC AND CARBON-NAMED, for the reason recorded on `CjsWebgpuShaderAL`.\nimport { ALResult, Tr2ALMemoryType, Tr2MsaaDesc } from \"#trinityal\";\nimport { PixelFormat, TextureType, Tr2CpuUsage, Tr2GpuUsage, HasFlag } from \"#consts/render-context\";\nimport { CarbonPixelFormatToWebGpu, SrgbSiblingOf } from \"../../global/consts/webgpu/textureFormats.js\";\nimport { RenderContextALOf } from \"../renderContextAL.js\";\n\nconst NO_HEAP_INDEX = 0xffffffff;\n\n/** Carbon texture type to WebGPU's view dimension for the texture as a whole. */\nconst VIEW_DIMENSION_OF_TYPE = Object.freeze({\n [TextureType.TEX_TYPE_2D]: \"2d\",\n [TextureType.TEX_TYPE_CUBE]: \"cube\",\n [TextureType.TEX_TYPE_3D]: \"3d\"\n});\n\n\n/**\n * A `Tr2TextureAL` backed by a WebGPU `GPUTexture`, created with all of its data.\n */\nexport class CjsWebgpuTextureAL\n{\n /** m_desc, a `Tr2BitmapDimensions`. */\n m_desc = null;\n\n m_msaa = new Tr2MsaaDesc();\n\n m_gpuUsage = Tr2GpuUsage.NONE;\n\n m_cpuUsage = Tr2CpuUsage.NONE;\n\n /** The `GPUTexture`, or null before Create. */\n m_texture = null;\n\n /** The `GPUTextureFormat` it was created with. */\n m_format = null;\n\n /** The sRGB sibling format, when the format has one and a view of it exists. */\n m_srgbFormat = null;\n\n /** Views by `dimension:colorSpace`, made on first request. */\n m_views = new Map();\n\n m_webgpu = null;\n\n m_name = \"\";\n\n /**\n * Creates the texture and uploads its initial data.\n *\n * @param {object} desc A `Tr2BitmapDimensions`.\n * @param {object} options `{ gpuUsage, cpuUsage, msaa, initialData }`;\n * `initialData` is an array of `{ sysMem, sysMemPitch, sysMemSlicePitch }`\n * indexed `mip + layer * mipCount`, as Carbon's is.\n * @param {object} renderContext The render context, Trinity's or the AL.\n * @returns {number} An `ALResult` value.\n */\n Create(desc, options, renderContext)\n {\n this.Destroy();\n\n const { gpuUsage = Tr2GpuUsage.NONE, cpuUsage = Tr2CpuUsage.NONE, msaa = new Tr2MsaaDesc(), initialData = null } = options ?? {};\n const al = RenderContextALOf(renderContext);\n\n if (!al || !al.IsValid()) return ALResult.E_FAIL;\n if (!desc || desc.GetWidth() === 0 || desc.GetHeight() === 0) return ALResult.E_INVALIDARG;\n if (msaa.samples > 1) return ALResult.E_INVALIDARG;\n\n const type = desc.GetType();\n const dimension = VIEW_DIMENSION_OF_TYPE[type];\n\n if (!dimension) return ALResult.E_INVALIDARG;\n if (type === TextureType.TEX_TYPE_CUBE && desc.GetArraySize() % 6 !== 0) return ALResult.E_INVALIDARG;\n\n // Carbon's own rule (the stub's last check): a texture nothing can ever\n // write that arrives with no pixels samples black forever. Refused.\n const writable = HasFlag(gpuUsage, Tr2GpuUsage.RENDER_TARGET) || HasFlag(gpuUsage, Tr2GpuUsage.UNORDERED_ACCESS)\n || HasFlag(gpuUsage, Tr2GpuUsage.DEPTH_STENCIL) || HasFlag(cpuUsage, Tr2CpuUsage.WRITE);\n\n if (!writable && !initialData) return ALResult.E_INVALIDARG;\n\n const format = CarbonPixelFormatToWebGpu[desc.GetFormat()] ?? null;\n\n if (!format) return ALResult.E_INVALIDARG;\n\n const webgpu = al.GetWebgpu();\n if (!webgpu) return ALResult.E_INVALIDCALL;\n\n const device = webgpu.GetDevice();\n const usageFlags = webgpu.GetTextureUsage();\n const srgbFormat = SrgbSiblingOf(format);\n const mipCount = Math.max(1, desc.GetTrueMipCount());\n const layers = type === TextureType.TEX_TYPE_3D ? Math.max(1, desc.GetDepth()) : Math.max(1, desc.GetArraySize());\n let usage = usageFlags.TEXTURE_BINDING | usageFlags.COPY_DST;\n\n if (HasFlag(gpuUsage, Tr2GpuUsage.RENDER_TARGET) || HasFlag(gpuUsage, Tr2GpuUsage.DEPTH_STENCIL))\n {\n usage |= usageFlags.RENDER_ATTACHMENT ?? 0;\n }\n\n this.m_texture = device.createTexture({\n label: this.m_name || \"Tr2TextureAL\",\n size: { width: desc.GetWidth(), height: desc.GetHeight(), depthOrArrayLayers: layers },\n mipLevelCount: mipCount,\n sampleCount: 1,\n dimension: type === TextureType.TEX_TYPE_3D ? \"3d\" : \"2d\",\n format,\n usage,\n ...(srgbFormat ? { viewFormats: [ srgbFormat ] } : {})\n });\n this.m_format = format;\n this.m_srgbFormat = srgbFormat;\n this.m_desc = desc;\n this.m_msaa = msaa;\n this.m_gpuUsage = gpuUsage;\n this.m_cpuUsage = cpuUsage;\n this.m_webgpu = webgpu;\n\n if (initialData) this._Upload(initialData, mipCount, type);\n\n return ALResult.S_OK;\n }\n\n /** One `writeTexture` per subresource, Carbon's `mip + layer * mipCount` order. */\n _Upload(initialData, mipCount, type)\n {\n const desc = this.m_desc;\n const queue = this.m_webgpu.GetDevice().queue;\n const layerCount = type === TextureType.TEX_TYPE_3D ? 1 : Math.max(1, desc.GetArraySize());\n\n for (let layer = 0; layer < layerCount; layer += 1)\n {\n for (let mip = 0; mip < mipCount; mip += 1)\n {\n const subresource = initialData[mip + layer * mipCount];\n\n if (!subresource || !subresource.sysMem) continue;\n\n const bytes = subresource.sysMem;\n const pitch = subresource.sysMemPitch;\n const slicePitch = subresource.sysMemSlicePitch || bytes.byteLength;\n const depth = type === TextureType.TEX_TYPE_3D ? Math.max(1, desc.GetMipDepth(mip)) : 1;\n\n queue.writeTexture(\n { texture: this.m_texture, mipLevel: mip, origin: { x: 0, y: 0, z: layer } },\n bytes,\n { offset: 0, bytesPerRow: pitch, rowsPerImage: pitch ? Math.max(1, Math.floor(slicePitch / pitch)) : undefined },\n { width: desc.GetMipWidth(mip), height: desc.GetMipHeight(mip), depthOrArrayLayers: depth }\n );\n }\n }\n }\n\n /**\n * The view a resource set binds: linear or sRGB, in the layout's dimension.\n *\n * Metal's `GetMetalTexture()` / `GetSRGBViewMetalTexture()`\n * (`Tr2TextureALMetal.h:49-54`), with the dimension added because a WebGPU\n * view must name it and a cube texture is legitimately bound as a 2d-array.\n *\n * @param {string} [viewDimension] A `GPUTextureViewDimension`.\n * @param {number} [colorSpace] A `Tr2ColorSpace`; non-zero means sRGB.\n * @returns {object|null} A `GPUTextureView`, or null before Create.\n */\n GetDeviceTextureView(viewDimension = VIEW_DIMENSION_OF_TYPE[this.m_desc?.GetType()] ?? \"2d\", colorSpace = 0)\n {\n if (!this.m_texture) return null;\n\n const srgb = colorSpace !== 0 && this.m_srgbFormat !== null;\n const key = `${viewDimension}:${srgb ? \"srgb\" : \"linear\"}`;\n let view = this.m_views.get(key) ?? null;\n\n if (!view)\n {\n view = this.m_texture.createView({\n label: `${this.m_name || \"Tr2TextureAL\"} ${key}`,\n dimension: viewDimension,\n ...(srgb ? { format: this.m_srgbFormat } : {})\n });\n this.m_views.set(key, view);\n }\n\n return view;\n }\n\n /** The `GPUTexture`; Metal's `GetMetalTexture` under this backend's name. */\n GetDeviceTexture()\n {\n return this.m_texture;\n }\n\n /** Whether the texture holds a `GPUTexture`. */\n IsValid()\n {\n return this.m_texture !== null;\n }\n\n /** Shared textures need a native handle WebGPU does not expose; always fails. */\n OpenShared()\n {\n return ALResult.E_FAIL;\n }\n\n /** The `Tr2BitmapDimensions` this texture was created from, or null. */\n GetDesc()\n {\n return this.m_desc;\n }\n\n /** The multisample description; this backend creates single-sampled textures. */\n GetMsaaDesc()\n {\n return this.m_msaa;\n }\n\n /** The `Tr2GpuUsage` flags it was created with. */\n GetGpuUsage()\n {\n return this.m_gpuUsage;\n }\n\n /** The `Tr2CpuUsage` flags it was created with. */\n GetCpuUsage()\n {\n return this.m_cpuUsage;\n }\n\n /** Width in texels of mip zero, or zero before Create. */\n GetWidth()\n {\n return this.m_desc ? this.m_desc.GetWidth() : 0;\n }\n\n /** Height in texels of mip zero, or zero before Create. */\n GetHeight()\n {\n return this.m_desc ? this.m_desc.GetHeight() : 0;\n }\n\n /** Depth in texels of mip zero, which is one unless the texture is 3D. */\n GetDepth()\n {\n return this.m_desc ? this.m_desc.GetDepth() : 0;\n }\n\n /** The mip count requested at creation, which may be zero for a full chain. */\n GetMipCount()\n {\n return this.m_desc ? this.m_desc.GetMipCount() : 0;\n }\n\n /** The mip count actually created, with a requested zero resolved. */\n GetTrueMipCount()\n {\n return this.m_desc ? this.m_desc.GetTrueMipCount() : 0;\n }\n\n /** The Carbon `PixelFormat`, or `PIXEL_FORMAT_UNKNOWN` before Create. */\n GetFormat()\n {\n return this.m_desc ? this.m_desc.GetFormat() : PixelFormat.PIXEL_FORMAT_UNKNOWN;\n }\n\n /** The Carbon `TextureType`, or `TEX_TYPE_INVALID` before Create. */\n GetType()\n {\n return this.m_desc ? this.m_desc.GetType() : TextureType.TEX_TYPE_INVALID;\n }\n\n /** The layer count, which for a cube counts its six faces. */\n GetArraySize()\n {\n return this.m_desc ? this.m_desc.GetArraySize() : 0;\n }\n\n /**\n * The byte size of one mip across all layers.\n *\n * @param {number} level The mip level.\n * @returns {number} Its size in bytes, or zero before Create.\n */\n GetMipSize(level)\n {\n return this.m_desc ? this.m_desc.GetMipSize(level) : 0;\n }\n\n /** Reading back needs a staging buffer and an await; refused by name. */\n MapForReading(_region, _synchronize, _renderContext)\n {\n return { result: ALResult.E_FAIL, data: null, pitch: 0 };\n }\n\n /** Paired with `MapForReading`, which this backend refuses. */\n UnmapForReading(_renderContext)\n {\n return ALResult.E_FAIL;\n }\n\n /** Carbon's immutable texture cannot be mapped for writing either. */\n MapForWriting(_region, _renderContext)\n {\n return { result: ALResult.E_FAIL, data: null, pitch: 0 };\n }\n\n /** Paired with `MapForWriting`, which this backend refuses. */\n UnmapForWriting(_renderContext)\n {\n return ALResult.E_FAIL;\n }\n\n /**\n * Replaces one mip of one slice, Carbon's `UpdateSubresource`.\n *\n * @param {object} region A `Tr2TextureSubresource` naming one mip and slice.\n * @param {ArrayBufferView} source The texels.\n * @param {number} pitch Bytes per row.\n * @param {number} slicePitch Bytes per slice.\n * @returns {number} An `ALResult` value.\n */\n UpdateSubresource(region, source, pitch, slicePitch, _renderContext)\n {\n if (!this.IsValid()) return ALResult.E_INVALIDCALL;\n if (!region || !source) return ALResult.E_INVALIDARG;\n\n const mip = region.m_startMipLevel ?? 0;\n const layer = region.m_startFace ?? 0;\n\n this.m_webgpu.GetDevice().queue.writeTexture(\n { texture: this.m_texture, mipLevel: mip, origin: { x: 0, y: 0, z: layer } },\n source,\n { offset: 0, bytesPerRow: pitch, rowsPerImage: pitch ? Math.max(1, Math.floor((slicePitch || source.byteLength) / pitch)) : undefined },\n { width: this.m_desc.GetMipWidth(mip), height: this.m_desc.GetMipHeight(mip), depthOrArrayLayers: 1 }\n );\n\n return ALResult.S_OK;\n }\n\n /** Needs a command encoder the AL is not handed here; refused by name. */\n CopySubresourceRegion()\n {\n return ALResult.E_FAIL;\n }\n\n /** WebGPU has no mip generator; a full chain is uploaded at creation instead. */\n GenerateMipMaps()\n {\n return ALResult.E_FAIL;\n }\n\n /** Multisample resolve, which this backend has no multisampled textures for. */\n Resolve()\n {\n return ALResult.E_FAIL;\n }\n\n /** The native shared handle, which WebGPU does not expose. */\n GetSharedHandle()\n {\n return null;\n }\n\n /** The descriptor-heap slot, which only the D3D12 backend has. */\n GetSrvIndexInHeap()\n {\n return NO_HEAP_INDEX;\n }\n\n /** The descriptor-heap slot, which only the D3D12 backend has. */\n GetUavIndexInHeap()\n {\n return NO_HEAP_INDEX;\n }\n\n /** Releases the `GPUTexture` and its views, leaving the AL invalid. */\n Destroy()\n {\n this.m_texture?.destroy?.();\n this.m_texture = null;\n this.m_views = new Map();\n this.m_desc = null;\n this.m_format = null;\n this.m_srgbFormat = null;\n this.m_webgpu = null;\n this.m_gpuUsage = Tr2GpuUsage.NONE;\n this.m_cpuUsage = Tr2CpuUsage.NONE;\n }\n\n /** Where the texture lives, which for this backend is always video memory. */\n GetMemoryClass()\n {\n return Tr2ALMemoryType.AL_MEMORY_VIDEO;\n }\n\n /**\n * Fills in what this AL knows for a memory report.\n *\n * @param {object} description The description to fill in.\n * @returns {object} The same description.\n */\n Describe(description)\n {\n if (!description) return description;\n\n description.memoryClass = this.GetMemoryClass();\n\n return description;\n }\n\n /**\n * Names the texture, which reaches the `GPUTexture` label for debugging.\n *\n * @param {string} name The name.\n * @returns {number} An `ALResult` value.\n */\n SetName(name)\n {\n this.m_name = String(name ?? \"\");\n\n if (this.m_texture) this.m_texture.label = this.m_name;\n\n return ALResult.S_OK;\n }\n\n /** The name given by `SetName`. */\n GetName()\n {\n return this.m_name;\n }\n}\n"],"names":["NO_HEAP_INDEX","VIEW_DIMENSION_OF_TYPE","Object","freeze","TextureType","TEX_TYPE_2D","TEX_TYPE_CUBE","TEX_TYPE_3D","CjsWebgpuTextureAL","m_desc","m_msaa","Tr2MsaaDesc","m_gpuUsage","Tr2GpuUsage","NONE","m_cpuUsage","Tr2CpuUsage","m_texture","m_format","m_srgbFormat","m_views","Map","m_webgpu","m_name","Create","desc","options","renderContext","Destroy","gpuUsage","cpuUsage","msaa","initialData","al","RenderContextALOf","IsValid","ALResult","E_FAIL","GetWidth","GetHeight","E_INVALIDARG","samples","type","GetType","dimension","GetArraySize","writable","HasFlag","RENDER_TARGET","UNORDERED_ACCESS","DEPTH_STENCIL","WRITE","format","CarbonPixelFormatToWebGpu","GetFormat","webgpu","GetWebgpu","E_INVALIDCALL","device","GetDevice","usageFlags","GetTextureUsage","srgbFormat","SrgbSiblingOf","mipCount","Math","max","GetTrueMipCount","layers","GetDepth","usage","TEXTURE_BINDING","COPY_DST","RENDER_ATTACHMENT","createTexture","label","size","width","height","depthOrArrayLayers","mipLevelCount","sampleCount","viewFormats","_Upload","S_OK","queue","layerCount","layer","mip","subresource","sysMem","bytes","pitch","sysMemPitch","slicePitch","sysMemSlicePitch","byteLength","depth","GetMipDepth","writeTexture","texture","mipLevel","origin","x","y","z","offset","bytesPerRow","rowsPerImage","floor","undefined","GetMipWidth","GetMipHeight","GetDeviceTextureView","viewDimension","colorSpace","srgb","key","view","get","createView","set","GetDeviceTexture","OpenShared","GetDesc","GetMsaaDesc","GetGpuUsage","GetCpuUsage","GetMipCount","PixelFormat","PIXEL_FORMAT_UNKNOWN","TEX_TYPE_INVALID","GetMipSize","level","MapForReading","_region","_synchronize","_renderContext","result","data","UnmapForReading","MapForWriting","UnmapForWriting","UpdateSubresource","region","source","m_startMipLevel","m_startFace","CopySubresourceRegion","GenerateMipMaps","Resolve","GetSharedHandle","GetSrvIndexInHeap","GetUavIndexInHeap","destroy","GetMemoryClass","Tr2ALMemoryType","AL_MEMORY_VIDEO","Describe","description","memoryClass","SetName","name","String","GetName"],"mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA,MAAMA,aAAa,GAAG,UAAU;;AAEhC;AACA,MAAMC,sBAAsB,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC3C,EAAA,CAACC,WAAW,CAACC,WAAW,GAAG,IAAI;AAC/B,EAAA,CAACD,WAAW,CAACE,aAAa,GAAG,MAAM;EACnC,CAACF,WAAW,CAACG,WAAW,GAAG;AAC7B,CAAC,CAAC;;AAGF;AACA;AACA;AACO,MAAMC,kBAAkB,CAC/B;AACE;AACAC,EAAAA,MAAM,GAAG,IAAI;AAEbC,EAAAA,MAAM,GAAG,IAAIC,WAAW,EAAE;EAE1BC,UAAU,GAAGC,WAAW,CAACC,IAAI;EAE7BC,UAAU,GAAGC,WAAW,CAACF,IAAI;;AAE7B;AACAG,EAAAA,SAAS,GAAG,IAAI;;AAEhB;AACAC,EAAAA,QAAQ,GAAG,IAAI;;AAEf;AACAC,EAAAA,YAAY,GAAG,IAAI;;AAEnB;AACAC,EAAAA,OAAO,GAAG,IAAIC,GAAG,EAAE;AAEnBC,EAAAA,QAAQ,GAAG,IAAI;AAEfC,EAAAA,MAAM,GAAG,EAAE;;AAEX;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,MAAMA,CAACC,IAAI,EAAEC,OAAO,EAAEC,aAAa,EACnC;IACE,IAAI,CAACC,OAAO,EAAE;IAEd,MAAM;MAAEC,QAAQ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AACjJ,SAAS,EAAE,IAAI,CAACA,SAAS,CAAC0D,KAAK,GAAG,IAAI,CAACpD,MAAM;IAEtD,OAAOa,QAAQ,CAACgD,IAAI;AACtB,EAAA;;AAEA;AACAgF,EAAAA,OAAOA,GACP;IACE,OAAO,IAAI,CAAC7I,MAAM;AACpB,EAAA;AACF;;;;"}
1
+ {"version":3,"file":"CjsWebgpuTextureAL.js","sources":["../../../../src/trinityal/webgpu/CjsWebgpuTextureAL.js"],"sourcesContent":["// Source: trinity/trinityal/include/Tr2TextureAL.h\n// trinity/trinityal/metal/Tr2TextureALMetal.mm\n// trinity/trinityal/stub/Tr2TextureALStub.cpp\n//\n// A `Tr2TextureAL` holding a real `GPUTexture`.\n//\n// CREATED WITH ITS DATA, NEVER UPDATED INTO. Carbon's texture resource creates\n// its texture from the decoded bitmap with one `Tr2SubresourceData` per\n// (mip, layer), indexed `mip + layer * mipCount`\n// (`Tr2ImageIOHelpers.cpp:104-128`), and Metal uploads them one\n// `replaceRegion` per (slice, mip) (`Tr2TextureALMetal.mm:140-268`). This does\n// the same with one `writeTexture` per subresource.\n//\n// THE sRGB VIEW IS A FORMAT-REINTERPRETING VIEW, as Metal's is: `MetalContext.mm:342-357`\n// makes `newTextureViewWithPixelFormat:` of the sRGB sibling for RGBA8, BGRA8,\n// BC1, BC2, BC3 and BC7, and `GetSRGBViewMetalTexture()` is what a\n// `COLOR_SPACE_SRGB` SRV binds. WebGPU needs the sibling declared in\n// `viewFormats` at creation, so it is.\n//\n// FIELDS ARE PUBLIC AND CARBON-NAMED, for the reason recorded on `CjsWebgpuShaderAL`.\nimport { CjsSchema } from \"#schema\";\nimport { ALResult, Tr2ALMemoryType, Tr2MsaaDesc } from \"#trinityal\";\nimport { PixelFormat, TextureType, Tr2CpuUsage, Tr2GpuUsage, HasFlag } from \"#consts/render-context\";\nimport { CarbonPixelFormatToWebGpu, SrgbSiblingOf } from \"../../global/consts/webgpu/textureFormats.js\";\nimport { RenderContextALOf } from \"../renderContextAL.js\";\n\nconst NO_HEAP_INDEX = 0xffffffff;\n\n/** Carbon texture type to WebGPU's view dimension for the texture as a whole. */\nconst VIEW_DIMENSION_OF_TYPE = Object.freeze({\n [TextureType.TEX_TYPE_2D]: \"2d\",\n [TextureType.TEX_TYPE_CUBE]: \"cube\",\n [TextureType.TEX_TYPE_3D]: \"3d\"\n});\n\n\n/**\n * A `Tr2TextureAL` backed by a WebGPU `GPUTexture`, created with all of its data.\n */\nexport class CjsWebgpuTextureAL\n{\n /** m_desc, a `Tr2BitmapDimensions`. */\n m_desc = null;\n\n m_msaa = new Tr2MsaaDesc();\n\n m_gpuUsage = Tr2GpuUsage.NONE;\n\n m_cpuUsage = Tr2CpuUsage.NONE;\n\n /** The `GPUTexture`, or null before Create. */\n m_texture = null;\n\n /** The `GPUTextureFormat` it was created with. */\n m_format = null;\n\n /** The sRGB sibling format, when the format has one and a view of it exists. */\n m_srgbFormat = null;\n\n /** Views by `dimension:colorSpace`, made on first request. */\n m_views = new Map();\n\n m_webgpu = null;\n\n m_name = \"\";\n\n /**\n * Creates the texture and uploads its initial data.\n *\n * @param {object} desc A `Tr2BitmapDimensions`.\n * @param {object} options `{ gpuUsage, cpuUsage, msaa, initialData }`;\n * `initialData` is an array of `{ sysMem, sysMemPitch, sysMemSlicePitch }`\n * indexed `mip + layer * mipCount`, as Carbon's is.\n * @param {object} renderContext The render context, Trinity's or the AL.\n * @returns {number} An `ALResult` value.\n */\n Create(desc, options, renderContext)\n {\n this.Destroy();\n\n const { gpuUsage = Tr2GpuUsage.NONE, cpuUsage = Tr2CpuUsage.NONE, msaa = new Tr2MsaaDesc(), initialData = null } = options ?? {};\n const al = RenderContextALOf(renderContext);\n\n if (!al || !al.IsValid()) return ALResult.E_FAIL;\n if (!desc || desc.GetWidth() === 0 || desc.GetHeight() === 0) return ALResult.E_INVALIDARG;\n if (msaa.samples > 1) return ALResult.E_INVALIDARG;\n\n const type = desc.GetType();\n const dimension = VIEW_DIMENSION_OF_TYPE[type];\n\n if (!dimension) return ALResult.E_INVALIDARG;\n if (type === TextureType.TEX_TYPE_CUBE && desc.GetArraySize() % 6 !== 0) return ALResult.E_INVALIDARG;\n\n // Carbon's own rule (the stub's last check): a texture nothing can ever\n // write that arrives with no pixels samples black forever. Refused.\n const writable = HasFlag(gpuUsage, Tr2GpuUsage.RENDER_TARGET) || HasFlag(gpuUsage, Tr2GpuUsage.UNORDERED_ACCESS)\n || HasFlag(gpuUsage, Tr2GpuUsage.DEPTH_STENCIL) || HasFlag(cpuUsage, Tr2CpuUsage.WRITE);\n\n if (!writable && !initialData) return ALResult.E_INVALIDARG;\n\n const format = CarbonPixelFormatToWebGpu[desc.GetFormat()] ?? null;\n\n if (!format) return ALResult.E_INVALIDARG;\n\n const webgpu = al.GetWebgpu();\n if (!webgpu) return ALResult.E_INVALIDCALL;\n\n const device = webgpu.GetDevice();\n const usageFlags = webgpu.GetTextureUsage();\n const srgbFormat = SrgbSiblingOf(format);\n const mipCount = Math.max(1, desc.GetTrueMipCount());\n const layers = type === TextureType.TEX_TYPE_3D ? Math.max(1, desc.GetDepth()) : Math.max(1, desc.GetArraySize());\n let usage = usageFlags.TEXTURE_BINDING | usageFlags.COPY_DST;\n\n if (HasFlag(gpuUsage, Tr2GpuUsage.RENDER_TARGET) || HasFlag(gpuUsage, Tr2GpuUsage.DEPTH_STENCIL))\n {\n usage |= usageFlags.RENDER_ATTACHMENT ?? 0;\n }\n\n this.m_texture = device.createTexture({\n label: this.m_name || \"Tr2TextureAL\",\n size: { width: desc.GetWidth(), height: desc.GetHeight(), depthOrArrayLayers: layers },\n mipLevelCount: mipCount,\n sampleCount: 1,\n dimension: type === TextureType.TEX_TYPE_3D ? \"3d\" : \"2d\",\n format,\n usage,\n ...(srgbFormat ? { viewFormats: [ srgbFormat ] } : {})\n });\n this.m_format = format;\n this.m_srgbFormat = srgbFormat;\n this.m_desc = desc;\n this.m_msaa = msaa;\n this.m_gpuUsage = gpuUsage;\n this.m_cpuUsage = cpuUsage;\n this.m_webgpu = webgpu;\n\n if (initialData) this._Upload(initialData, mipCount, type);\n\n return ALResult.S_OK;\n }\n\n /** One `writeTexture` per subresource, Carbon's `mip + layer * mipCount` order. */\n _Upload(initialData, mipCount, type)\n {\n const desc = this.m_desc;\n const queue = this.m_webgpu.GetDevice().queue;\n const layerCount = type === TextureType.TEX_TYPE_3D ? 1 : Math.max(1, desc.GetArraySize());\n\n for (let layer = 0; layer < layerCount; layer += 1)\n {\n for (let mip = 0; mip < mipCount; mip += 1)\n {\n const subresource = initialData[mip + layer * mipCount];\n\n if (!subresource || !subresource.sysMem) continue;\n\n const bytes = subresource.sysMem;\n const pitch = subresource.sysMemPitch;\n const slicePitch = subresource.sysMemSlicePitch || bytes.byteLength;\n const depth = type === TextureType.TEX_TYPE_3D ? Math.max(1, desc.GetMipDepth(mip)) : 1;\n\n queue.writeTexture(\n { texture: this.m_texture, mipLevel: mip, origin: { x: 0, y: 0, z: layer } },\n bytes,\n { offset: 0, bytesPerRow: pitch, rowsPerImage: pitch ? Math.max(1, Math.floor(slicePitch / pitch)) : undefined },\n { width: desc.GetMipWidth(mip), height: desc.GetMipHeight(mip), depthOrArrayLayers: depth }\n );\n }\n }\n }\n\n /**\n * The view a resource set binds: linear or sRGB, in the layout's dimension.\n *\n * Metal's `GetMetalTexture()` / `GetSRGBViewMetalTexture()`\n * (`Tr2TextureALMetal.h:49-54`), with the dimension added because a WebGPU\n * view must name it and a cube texture is legitimately bound as a 2d-array.\n *\n * @param {string} [viewDimension] A `GPUTextureViewDimension`.\n * @param {number} [colorSpace] A `Tr2ColorSpace`; non-zero means sRGB.\n * @returns {object|null} A `GPUTextureView`, or null before Create.\n */\n GetDeviceTextureView(viewDimension = VIEW_DIMENSION_OF_TYPE[this.m_desc?.GetType()] ?? \"2d\", colorSpace = 0)\n {\n if (!this.m_texture) return null;\n\n const srgb = colorSpace !== 0 && this.m_srgbFormat !== null;\n const key = `${viewDimension}:${srgb ? \"srgb\" : \"linear\"}`;\n let view = this.m_views.get(key) ?? null;\n\n if (!view)\n {\n view = this.m_texture.createView({\n label: `${this.m_name || \"Tr2TextureAL\"} ${key}`,\n dimension: viewDimension,\n ...(srgb ? { format: this.m_srgbFormat } : {})\n });\n this.m_views.set(key, view);\n }\n\n return view;\n }\n\n /** The `GPUTexture`; Metal's `GetMetalTexture` under this backend's name. */\n GetDeviceTexture()\n {\n return this.m_texture;\n }\n\n /** Whether the texture holds a `GPUTexture`. */\n IsValid()\n {\n return this.m_texture !== null;\n }\n\n /** Shared textures need a native handle WebGPU does not expose; always fails. */\n OpenShared()\n {\n return ALResult.E_FAIL;\n }\n\n /** The `Tr2BitmapDimensions` this texture was created from, or null. */\n GetDesc()\n {\n return this.m_desc;\n }\n\n /** The multisample description; this backend creates single-sampled textures. */\n GetMsaaDesc()\n {\n return this.m_msaa;\n }\n\n /** The `Tr2GpuUsage` flags it was created with. */\n GetGpuUsage()\n {\n return this.m_gpuUsage;\n }\n\n /** The `Tr2CpuUsage` flags it was created with. */\n GetCpuUsage()\n {\n return this.m_cpuUsage;\n }\n\n /** Width in texels of mip zero, or zero before Create. */\n GetWidth()\n {\n return this.m_desc ? this.m_desc.GetWidth() : 0;\n }\n\n /** Height in texels of mip zero, or zero before Create. */\n GetHeight()\n {\n return this.m_desc ? this.m_desc.GetHeight() : 0;\n }\n\n /** Depth in texels of mip zero, which is one unless the texture is 3D. */\n GetDepth()\n {\n return this.m_desc ? this.m_desc.GetDepth() : 0;\n }\n\n /** The mip count requested at creation, which may be zero for a full chain. */\n GetMipCount()\n {\n return this.m_desc ? this.m_desc.GetMipCount() : 0;\n }\n\n /** The mip count actually created, with a requested zero resolved. */\n GetTrueMipCount()\n {\n return this.m_desc ? this.m_desc.GetTrueMipCount() : 0;\n }\n\n /** The Carbon `PixelFormat`, or `PIXEL_FORMAT_UNKNOWN` before Create. */\n GetFormat()\n {\n return this.m_desc ? this.m_desc.GetFormat() : PixelFormat.PIXEL_FORMAT_UNKNOWN;\n }\n\n /** The Carbon `TextureType`, or `TEX_TYPE_INVALID` before Create. */\n GetType()\n {\n return this.m_desc ? this.m_desc.GetType() : TextureType.TEX_TYPE_INVALID;\n }\n\n /** The layer count, which for a cube counts its six faces. */\n GetArraySize()\n {\n return this.m_desc ? this.m_desc.GetArraySize() : 0;\n }\n\n /**\n * The byte size of one mip across all layers.\n *\n * @param {number} level The mip level.\n * @returns {number} Its size in bytes, or zero before Create.\n */\n GetMipSize(level)\n {\n return this.m_desc ? this.m_desc.GetMipSize(level) : 0;\n }\n\n /** Reading back needs a staging buffer and an await; refused by name. */\n MapForReading(_region, _synchronize, _renderContext)\n {\n return { result: ALResult.E_FAIL, data: null, pitch: 0 };\n }\n\n /** Paired with `MapForReading`, which this backend refuses. */\n UnmapForReading(_renderContext)\n {\n return ALResult.E_FAIL;\n }\n\n /** Carbon's immutable texture cannot be mapped for writing either. */\n MapForWriting(_region, _renderContext)\n {\n return { result: ALResult.E_FAIL, data: null, pitch: 0 };\n }\n\n /** Paired with `MapForWriting`, which this backend refuses. */\n UnmapForWriting(_renderContext)\n {\n return ALResult.E_FAIL;\n }\n\n /**\n * Replaces one mip of one slice, Carbon's `UpdateSubresource`.\n *\n * @param {object} region A `Tr2TextureSubresource` naming one mip and slice.\n * @param {ArrayBufferView} source The texels.\n * @param {number} pitch Bytes per row.\n * @param {number} slicePitch Bytes per slice.\n * @returns {number} An `ALResult` value.\n */\n UpdateSubresource(region, source, pitch, slicePitch, _renderContext)\n {\n if (!this.IsValid()) return ALResult.E_INVALIDCALL;\n if (!region || !source) return ALResult.E_INVALIDARG;\n\n const mip = region.m_startMipLevel ?? 0;\n const layer = region.m_startFace ?? 0;\n\n this.m_webgpu.GetDevice().queue.writeTexture(\n { texture: this.m_texture, mipLevel: mip, origin: { x: 0, y: 0, z: layer } },\n source,\n { offset: 0, bytesPerRow: pitch, rowsPerImage: pitch ? Math.max(1, Math.floor((slicePitch || source.byteLength) / pitch)) : undefined },\n { width: this.m_desc.GetMipWidth(mip), height: this.m_desc.GetMipHeight(mip), depthOrArrayLayers: 1 }\n );\n\n return ALResult.S_OK;\n }\n\n /** Needs a command encoder the AL is not handed here; refused by name. */\n CopySubresourceRegion()\n {\n return ALResult.E_FAIL;\n }\n\n /** WebGPU has no mip generator; a full chain is uploaded at creation instead. */\n GenerateMipMaps()\n {\n return ALResult.E_FAIL;\n }\n\n /** Multisample resolve, which this backend has no multisampled textures for. */\n Resolve()\n {\n return ALResult.E_FAIL;\n }\n\n /** The native shared handle, which WebGPU does not expose. */\n GetSharedHandle()\n {\n return null;\n }\n\n /** The descriptor-heap slot, which only the D3D12 backend has. */\n GetSrvIndexInHeap()\n {\n return NO_HEAP_INDEX;\n }\n\n /** The descriptor-heap slot, which only the D3D12 backend has. */\n GetUavIndexInHeap()\n {\n return NO_HEAP_INDEX;\n }\n\n /** Releases the `GPUTexture` and its views, leaving the AL invalid. */\n Destroy()\n {\n this.m_texture?.destroy?.();\n this.m_texture = null;\n this.m_views = new Map();\n this.m_desc = null;\n this.m_format = null;\n this.m_srgbFormat = null;\n this.m_webgpu = null;\n this.m_gpuUsage = Tr2GpuUsage.NONE;\n this.m_cpuUsage = Tr2CpuUsage.NONE;\n }\n\n /** Where the texture lives, which for this backend is always video memory. */\n GetMemoryClass()\n {\n return Tr2ALMemoryType.AL_MEMORY_VIDEO;\n }\n\n /**\n * Fills in what this AL knows for a memory report.\n *\n * @param {object} description The description to fill in.\n * @returns {object} The same description.\n */\n Describe(description)\n {\n if (!description) return description;\n\n description.memoryClass = this.GetMemoryClass();\n\n return description;\n }\n\n /**\n * Names the texture, which reaches the `GPUTexture` label for debugging.\n *\n * @param {string} name The name.\n * @returns {number} An `ALResult` value.\n */\n SetName(name)\n {\n this.m_name = String(name ?? \"\");\n\n if (this.m_texture) this.m_texture.label = this.m_name;\n\n return ALResult.S_OK;\n }\n\n /** The name given by `SetName`. */\n GetName()\n {\n return this.m_name;\n }\n}\n\n// DECLARED AS A CALL, NOT A DECORATOR, for the reason recorded in\n// Tr2BitmapDimensions.js: the layer is imported straight from source by its\n// tests and raw Node cannot parse decorator syntax.\n//\n// The donor is NAMED rather than left to be derived from this class's name.\n// Carbon calls every backend's class the same thing and carries the backend in\n// the FILE name, because only one backend compiles at a time; we ship them\n// together, so the backend moves onto the class name. That divergence is the\n// author's to declare, never a checker's to guess.\nCjsSchema.define(CjsWebgpuTextureAL, { className: \"CjsWebgpuTextureAL\", carbon: \"Tr2TextureAL\" });\n"],"names":["NO_HEAP_INDEX","VIEW_DIMENSION_OF_TYPE","Object","freeze","TextureType","TEX_TYPE_2D","TEX_TYPE_CUBE","TEX_TYPE_3D","CjsWebgpuTextureAL","m_desc","m_msaa","Tr2MsaaDesc","m_gpuUsage","Tr2GpuUsage","NONE","m_cpuUsage","Tr2CpuUsage","m_texture","m_format","m_srgbFormat","m_views","Map","m_webgpu","m_name","Create","desc","options","renderContext","Destroy","gpuUsage","cpuUsage","msaa","initialData","al","RenderContextALOf","IsValid","ALResult","E_FAIL","GetWidth","GetHeight","E_INVALIDARG","samples","type","GetType","dimension","GetArraySize","writable","HasFlag","RENDER_TARGET","UNORDERED_ACCESS","DEPTH_STENCIL","WRITE","format","CarbonPixelFormatToWebGpu","GetFormat","webgpu","GetWebgpu","E_INVALIDCALL","device","GetDevice","usageFlags","GetTextureUsage","srgbFormat","SrgbSiblingOf","mipCount","Math","max","GetTrueMipCount","layers","GetDepth","usage","TEXTURE_BINDING","COPY_DST","RENDER_ATTACHMENT","createTexture","label","size","width","height","depthOrArrayLayers","mipLevelCount","sampleCount","viewFormats","_Upload","S_OK","queue","layerCount","layer","mip","subresource","sysMem","bytes","pitch","sysMemPitch","slicePitch","sysMemSlicePitch","byteLength","depth","GetMipDepth","writeTexture","texture","mipLevel","origin","x","y","z","offset","bytesPerRow","rowsPerImage","floor","undefined","GetMipWidth","GetMipHeight","GetDeviceTextureView","viewDimension","colorSpace","srgb","key","view","get","createView","set","GetDeviceTexture","OpenShared","GetDesc","GetMsaaDesc","GetGpuUsage","GetCpuUsage","GetMipCount","PixelFormat","PIXEL_FORMAT_UNKNOWN","TEX_TYPE_INVALID","GetMipSize","level","MapForReading","_region","_synchronize","_renderContext","result","data","UnmapForReading","MapForWriting","UnmapForWriting","UpdateSubresource","region","source","m_startMipLevel","m_startFace","CopySubresourceRegion","GenerateMipMaps","Resolve","GetSharedHandle","GetSrvIndexInHeap","GetUavIndexInHeap","destroy","GetMemoryClass","Tr2ALMemoryType","AL_MEMORY_VIDEO","Describe","description","memoryClass","SetName","name","String","GetName","CjsSchema","define","className","carbon"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA,MAAMA,aAAa,GAAG,UAAU;;AAEhC;AACA,MAAMC,sBAAsB,GAAGC,MAAM,CAACC,MAAM,CAAC;AAC3C,EAAA,CAACC,WAAW,CAACC,WAAW,GAAG,IAAI;AAC/B,EAAA,CAACD,WAAW,CAACE,aAAa,GAAG,MAAM;EACnC,CAACF,WAAW,CAACG,WAAW,GAAG;AAC7B,CAAC,CAAC;;AAGF;AACA;AACA;AACO,MAAMC,kBAAkB,CAC/B;AACE;AACAC,EAAAA,MAAM,GAAG,IAAI;AAEbC,EAAAA,MAAM,GAAG,IAAIC,WAAW,EAAE;EAE1BC,UAAU,GAAGC,WAAW,CAACC,IAAI;EAE7BC,UAAU,GAAGC,WAAW,CAACF,IAAI;;AAE7B;AACAG,EAAAA,SAAS,GAAG,IAAI;;AAEhB;AACAC,EAAAA,QAAQ,GAAG,IAAI;;AAEf;AACAC,EAAAA,YAAY,GAAG,IAAI;;AAEnB;AACAC,EAAAA,OAAO,GAAG,IAAIC,GAAG,EAAE;AAEnBC,EAAAA,QAAQ,GAAG,IAAI;AAEfC,EAAAA,MAAM,GAAG,EAAE;;AAEX;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,MAAMA,CAACC,IAAI,EAAEC,OAAO,E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,GAAG4I,MAAM,CAACD,IAAI,IAAI,EAAE,CAAC;AAEhC,IAAA,IAAI,IAAI,CAACjJ,SAAS,EAAE,IAAI,CAACA,SAAS,CAAC0D,KAAK,GAAG,IAAI,CAACpD,MAAM;IAEtD,OAAOa,QAAQ,CAACgD,IAAI;AACtB,EAAA;;AAEA;AACAgF,EAAAA,OAAOA,GACP;IACE,OAAO,IAAI,CAAC7I,MAAM;AACpB,EAAA;AACF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA8I,SAAS,CAACC,MAAM,CAAC9J,kBAAkB,EAAE;AAAE+J,EAAAA,SAAS,EAAE,oBAAoB;AAAEC,EAAAA,MAAM,EAAE;AAAe,CAAC,CAAC;;;;"}
@@ -152,4 +152,4 @@ CjsSchema.define(CjsWebgpuConstantArena, {
152
152
  });
153
153
 
154
154
  export { CONST_ALIGNMENT, CONST_PAGE_SIZE, CjsWebgpuConstantArena };
155
- //# sourceMappingURL=constantArena.js.map
155
+ //# sourceMappingURL=CjsWebgpuConstantArena.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsWebgpuConstantArena.js","sources":["../../../../../src/trinityal/webgpu/core/CjsWebgpuConstantArena.js"],"sourcesContent":["// Source: trinity/trinityal/metal/MetalUtils.h\n// trinity/trinityal/metal/MetalUtils.mm:375-440\n//\n// Carbon's per-frame constant arena. Metal's `SetConstants` does not write into\n// a buffer the constant buffer owns; it copies the bytes into a page of this\n// allocator and binds `(page, offset)` (`MetalWorkQueue.mm:2396-2440`), and the\n// allocator is reset at the start of every frame (`MetalContext.mm:473`). That\n// is what gives each draw its own snapshot: a buffer locked three times and\n// drawn three times lands in three regions, and the three draws read three\n// different offsets.\n//\n// WHY THIS IS NOT OPTIONAL HERE. `queue.writeBuffer` into one GPUBuffer per\n// constant buffer executes before the frame's command buffer is submitted, so\n// every draw recorded in the frame would read the LAST write - every object\n// drawn with the last object's transform. The arena is the fix Carbon already\n// has, and the bind is a dynamic offset, which is WebGPU's spelling of Metal's\n// `setVertexBufferOffset:` (`MetalWorkQueue.mm:2656-2659`).\n//\n// Pages are 2 MiB, as Carbon's are, and allocations are aligned to the larger\n// of Carbon's 256 and the device's `minUniformBufferOffsetAlignment`, which a\n// dynamic offset must be a multiple of.\n\n\nimport { CjsSchema } from \"#schema\";\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuConstantArena: ${message}`);\n error.code = \"CJS_WEBGPU_CONSTANT_ARENA_INVALID\";\n throw error;\n}\n\n\n/** `CONST_PAGE_SIZE` */\nexport const CONST_PAGE_SIZE = 2 * 1024 * 1024;\n\n/** `CONST_ALIGNMENT` */\nexport const CONST_ALIGNMENT = 256;\n\n\n/**\n * A per-frame arena of `GPUBuffer` pages that constant buffers are suballocated\n * into when they are bound.\n */\nexport class CjsWebgpuConstantArena\n{\n /** m_pages: one `GPUBuffer` per page, created on first use. */\n m_pages = [];\n\n /** The current page index and the offset the next allocation takes. */\n m_page = 0;\n\n m_offset = 0;\n\n /** m_totalUploadedSize, for a stats line. */\n m_totalUploadedSize = 0;\n\n m_webgpu = null;\n\n m_alignment = CONST_ALIGNMENT;\n\n /**\n * @param {object} webgpu The `CjsWebgpuDevice`.\n */\n constructor(webgpu)\n {\n if (!webgpu) fail(\"a device is required\");\n\n this.m_webgpu = webgpu;\n\n const limit = webgpu.GetDevice()?.limits?.minUniformBufferOffsetAlignment;\n\n if (Number.isInteger(limit) && limit > CONST_ALIGNMENT) this.m_alignment = limit;\n }\n\n /** Carbon's `Reset`: the next frame starts at page zero, offset zero. */\n Reset()\n {\n this.m_page = 0;\n this.m_offset = 0;\n this.m_totalUploadedSize = 0;\n }\n\n /**\n * Copies bytes into the arena and says where they landed.\n *\n * @param {Uint8Array} bytes The constants; may be shorter than `size`.\n * @param {number} size Bytes to reserve, at least the bytes' length.\n * @returns {{page: number, offset: number, size: number}} The region.\n */\n Allocate(bytes, size = bytes.byteLength)\n {\n const reserved = Math.ceil(Math.max(size, bytes.byteLength, 1) / this.m_alignment) * this.m_alignment;\n\n if (reserved > CONST_PAGE_SIZE) fail(`a constant buffer of ${size} bytes does not fit a ${CONST_PAGE_SIZE}-byte page`);\n\n if (this.m_offset + reserved > CONST_PAGE_SIZE)\n {\n this.m_totalUploadedSize += this.m_offset;\n this.m_page += 1;\n this.m_offset = 0;\n }\n\n const page = this.GetPage(this.m_page);\n const offset = this.m_offset;\n\n this.m_offset += reserved;\n\n // `writeBuffer` wants a four-byte-aligned length; the reserve is.\n this.m_webgpu.GetDevice().queue.writeBuffer(page, offset, bytes, 0, bytes.byteLength & ~3);\n\n return { page: this.m_page, offset, size: reserved };\n }\n\n /**\n * The `GPUBuffer` for a page, created on first use.\n *\n * @param {number} page The page index.\n * @returns {object} The buffer.\n */\n GetPage(page)\n {\n if (!this.m_pages[page]) this._CreatePage(page);\n\n return this.m_pages[page];\n }\n\n /**\n * Allocates one page's `GPUBuffer`, Carbon's `CreatePage`\n * (`MetalUtils.mm:432-439`).\n *\n * Carbon calls it from `Allocate` when the offset runs past the page and the\n * next page has never been made; ours is reached through `GetPage`, which is\n * the same \"make it if it is not there\" with one caller instead of two.\n *\n * @param {number} index The page index.\n * @returns {void}\n */\n _CreatePage(index)\n {\n const usage = this.m_webgpu.GetBufferUsage();\n\n this.m_pages[index] = this.m_webgpu.GetDevice().createBuffer({\n label: `Constant buffer page ${index}`,\n size: CONST_PAGE_SIZE,\n usage: usage.UNIFORM | usage.COPY_DST\n });\n }\n\n /** Bytes allocated this frame so far. */\n GetTotalUploadedSize()\n {\n return this.m_totalUploadedSize + this.m_offset;\n }\n\n /** Releases every page. */\n Destroy()\n {\n for (const page of this.m_pages) page?.destroy?.();\n\n this.m_pages = [];\n this.Reset();\n }\n}\n\n\n// DECLARED AS A CALL, NOT A DECORATOR. The abstraction layer is imported\n// straight from source by its tests - `#trinityal/...` resolves to `src/` - and\n// raw Node cannot parse decorator syntax, so a decorator here breaks every test\n// that reaches this file without a build first. `CjsSchema.define` is the same\n// metadata through the door the schema already provides for exactly this, and\n// it keeps the layer free of the decorator chain it has never carried.\nCjsSchema.define(CjsWebgpuConstantArena, { className: \"CjsWebgpuConstantArena\", carbon: \"ConstantBufferAllocator\" });\n"],"names":["fail","message","error","Error","code","CONST_PAGE_SIZE","CONST_ALIGNMENT","CjsWebgpuConstantArena","m_pages","m_page","m_offset","m_totalUploadedSize","m_webgpu","m_alignment","constructor","webgpu","limit","GetDevice","limits","minUniformBufferOffsetAlignment","Number","isInteger","Reset","Allocate","bytes","size","byteLength","reserved","Math","ceil","max","page","GetPage","offset","queue","writeBuffer","_CreatePage","index","usage","GetBufferUsage","createBuffer","label","UNIFORM","COPY_DST","GetTotalUploadedSize","Destroy","destroy","CjsSchema","define","className","carbon"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,wBAAA,EAA2BF,OAAO,EAAE,CAAC;EAC7DC,KAAK,CAACE,IAAI,GAAG,mCAAmC;AAChD,EAAA,MAAMF,KAAK;AACb;;AAGA;MACaG,eAAe,GAAG,CAAC,GAAG,IAAI,GAAG;;AAE1C;AACO,MAAMC,eAAe,GAAG;;AAG/B;AACA;AACA;AACA;AACO,MAAMC,sBAAsB,CACnC;AACE;AACAC,EAAAA,OAAO,GAAG,EAAE;;AAEZ;AACAC,EAAAA,MAAM,GAAG,CAAC;AAEVC,EAAAA,QAAQ,GAAG,CAAC;;AAEZ;AACAC,EAAAA,mBAAmB,GAAG,CAAC;AAEvBC,EAAAA,QAAQ,GAAG,IAAI;AAEfC,EAAAA,WAAW,GAAGP,eAAe;;AAE7B;AACF;AACA;EACEQ,WAAWA,CAACC,MAAM,EAClB;AACE,IAAA,IAAI,CAACA,MAAM,EAAEf,IAAI,CAAC,sBAAsB,CAAC;IAEzC,IAAI,CAACY,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AAK,EAAE;AACd,EAAA;AACF;;AAGA;AACA;AACA;AACA;AACA;AACA;AACAyB,SAAS,CAACC,MAAM,CAACzC,sBAAsB,EAAE;AAAE0C,EAAAA,SAAS,EAAE,wBAAwB;AAAEC,EAAAA,MAAM,EAAE;AAA0B,CAAC,CAAC;;;;"}
@@ -178,4 +178,4 @@ CjsSchema.define(CjsWebgpuEncodeState, {
178
178
  });
179
179
 
180
180
  export { CanShareBindings, CjsWebgpuEncodeState, DeriveBatchGroups };
181
- //# sourceMappingURL=batchGroups.js.map
181
+ //# sourceMappingURL=CjsWebgpuEncodeState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsWebgpuEncodeState.js","sources":["../../../../../src/trinityal/webgpu/core/CjsWebgpuEncodeState.js"],"sourcesContent":["// Source: trinity/trinity/Tr2RenderContext.cpp:462-537\n// `RenderBatchGroup` is a METHOD, so this file is MODELLED ON the class that\n// declares it rather than replicating one: what it ports is the state that\n// method keeps across a group - what the encoder already has bound - and\n// there is no class surface to compare against.\n// Source: trinity/trinity/TriRenderBatch.cpp (CanBeBinned)\n//\n// Carbon hoists per GROUP what does not change across a run of batches -\n// standard states for the rendering mode, the shader state interface taken from\n// the MATERIAL rather than the batch's own shader pointer, technique index,\n// pass count, vertex declaration, both stream sources and the index buffer -\n// then applies the pass, then does only material constants, per-object\n// constants, topology and the draw per batch. This dispatcher did all of it per\n// batch, which is what made groupCount and the GDPR partition mean nothing.\n//\n// TWO DELIBERATE DEVIATIONS FROM CARBON, both from the engine-backends plan's\n// decision 3.\n//\n// 1. THE INDEX BUFFER IS PART OF THE PREDICATE. Carbon's CanBeBinned compares\n// shader, vertex declaration, index stride, both vertex streams and\n// rendering mode - and NOT the index buffer - while RenderBatchGroup then\n// binds and branches on the FIRST batch's index buffer. That is sound only\n// because all Carbon geometry is suballocated from one process-global\n// buffer, so any two binnable batches necessarily share it. An engine that\n// gives each geometry its own buffer breaks it SILENTLY, drawing the first\n// batch's indices for every batch in the run. We are that engine.\n//\n// 2. RUNS ARE DERIVED HERE, NOT CONSUMED FROM A PRECOMPUTED PARTITION. Carbon\n// stamps groupCount during Finalize; its split loop advances past the\n// boundary element without re-checking it, and its correctness depends on\n// the sort order and the equivalence predicate agreeing with nothing\n// validating that they do. Deriving runs from the batches actually being\n// encoded cannot disagree with itself.\n//\n// Ordering is never changed here. Sorting belongs to Trinity, and reordering at\n// encode time would break the golden-image comparison the two engines are meant\n// to be judged by. This only finds runs of ADJACENT batches that already agree.\n//\n// The WebGPU translation of Carbon's group key: a render pipeline already folds\n// the shader program, render states, vertex layout and topology into one\n// object, so pipeline identity carries most of CanBeBinned by construction.\n// What it does not carry is which buffers are bound, so the vertex buffers and\n// the index buffer are compared explicitly. Bind groups stay per batch: they\n// are where per-object data lives, and that is exactly what varies within a\n// group.\n\nimport { CjsSchema } from \"#schema\";\n\n/**\n * Whether two prepared draws may share one hoisted binding run.\n *\n * Compares only what a run hoists. Anything set per batch - bind groups, draw\n * arguments - is deliberately absent, because differing there is the normal\n * case inside a group rather than a reason to split one.\n */\nexport function CanShareBindings(first, second)\n{\n if (!first || !second) return false;\n if (first === second) return true;\n if (first.livePipeline !== second.livePipeline) return false;\n if (first.indexed !== second.indexed) return false;\n if (!sameVertexBuffers(first.vertexBuffers, second.vertexBuffers)) return false;\n\n // Decision 3's correction. Two batches on the same pipeline and vertex\n // streams still draw different indices, and Carbon's own predicate would\n // have said yes here.\n return sameIndexBuffer(first.indexed, first.indexBuffer, second.indexBuffer);\n}\n\n\n/**\n * Derives runs of adjacent prepared batches that share hoistable state.\n *\n * Returns one entry per run with its start, end and length, in encode order.\n * Every batch appears in exactly one run, and a run of one is normal - it means\n * that batch shares nothing with its neighbours, not that grouping failed.\n */\nexport function DeriveBatchGroups(batches, resolveDraw = handle => handle?.draw)\n{\n const groups = [];\n const list = batches ?? [];\n let start = 0;\n\n for (let index = 1; index <= list.length; index += 1)\n {\n const isEnd = index === list.length;\n const shares = !isEnd && CanShareBindings(resolveDraw(list[index - 1]), resolveDraw(list[index]));\n\n if (isEnd || !shares)\n {\n if (index > start) groups.push({ start, end: index, length: index - start });\n start = index;\n }\n }\n\n return groups;\n}\n\n\n/**\n * A per-pass record of what is already bound, so a run's second and later\n * batches skip the sets their first batch performed.\n *\n * Bound to ONE pass encoder and fails loudly if reused with another: WebGPU\n * pass state does not survive a pass boundary, so a state object leaking\n * across passes would silently skip a set that genuinely had to happen. That\n * failure would appear as geometry drawn with a previous pass's buffers, which\n * is exactly the class of bug this file exists to prevent.\n */\nexport class CjsWebgpuEncodeState\n{\n _pass = null;\n\n _pipeline = null;\n\n _vertexBuffers = null;\n\n _indexBuffer = null;\n\n _bindGroups = [];\n\n /** Binds this state to a pass, rejecting a second one. */\n Require(pass)\n {\n if (this._pass === null) this._pass = pass;\n else if (this._pass !== pass)\n {\n const error = new Error(\"CjsWebgpuEncodeState: encode state belongs to another render pass\");\n error.code = \"CJS_WEBGPU_ENCODE_STATE_INVALID\";\n throw error;\n }\n return this;\n }\n\n /** Whether the pipeline needs setting, recording it when it does. */\n NeedsPipeline(pipeline)\n {\n if (this._pipeline === pipeline) return false;\n this._pipeline = pipeline;\n return true;\n }\n\n /** Whether the vertex buffers need setting, recording them when they do. */\n NeedsVertexBuffers(entries)\n {\n if (sameVertexBuffers(this._vertexBuffers, entries)) return false;\n this._vertexBuffers = entries;\n return true;\n }\n\n /** Whether the index buffer needs setting, recording it when it does. */\n NeedsIndexBuffer(entry)\n {\n if (sameIndexBuffer(true, this._indexBuffer, entry)) return false;\n this._indexBuffer = entry;\n return true;\n }\n\n /** Whether one bind group needs setting, recording it when it does. */\n NeedsBindGroup(index, bindGroup)\n {\n if (this._bindGroups[index] === bindGroup) return false;\n this._bindGroups[index] = bindGroup;\n return true;\n }\n}\n\n\nfunction sameVertexBuffers(first, second)\n{\n if (first === second) return true;\n if (!first || !second || first.length !== second.length) return false;\n\n for (let index = 0; index < first.length; index += 1)\n {\n const a = first[index];\n const b = second[index];\n if (a.slot !== b.slot || a.buffer !== b.buffer) return false;\n if ((a.offset ?? 0) !== (b.offset ?? 0) || a.size !== b.size) return false;\n }\n\n return true;\n}\n\n\nfunction sameIndexBuffer(indexed, first, second)\n{\n if (!indexed) return true;\n if (first === second) return true;\n if (!first || !second) return false;\n\n return first.buffer === second.buffer\n && first.format === second.format\n && (first.offset ?? 0) === (second.offset ?? 0)\n && first.size === second.size;\n}\n\n\n// DECLARED AS A CALL, NOT A DECORATOR. The abstraction layer is imported\n// straight from source by its tests - `#trinityal/...` resolves to `src/` - and\n// raw Node cannot parse decorator syntax, so a decorator here breaks every test\n// that reaches this file without a build first. `CjsSchema.define` is the same\n// metadata through the door the schema already provides for exactly this, and\n// it keeps the layer free of the decorator chain it has never carried.\nCjsSchema.define(CjsWebgpuEncodeState, { className: \"CjsWebgpuEncodeState\", modelledOn: \"Tr2RenderContextBase\" });\n"],"names":["CanShareBindings","first","second","livePipeline","indexed","sameVertexBuffers","vertexBuffers","sameIndexBuffer","indexBuffer","DeriveBatchGroups","batches","resolveDraw","handle","draw","groups","list","start","index","length","isEnd","shares","push","end","CjsWebgpuEncodeState","_pass","_pipeline","_vertexBuffers","_indexBuffer","_bindGroups","Require","pass","error","Error","code","NeedsPipeline","pipeline","NeedsVertexBuffers","entries","NeedsIndexBuffer","entry","NeedsBindGroup","bindGroup","a","b","slot","buffer","offset","size","format","CjsSchema","define","className","modelledOn"],"mappings":";;AAAA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,gBAAgBA,CAACC,KAAK,EAAEC,MAAM,EAC9C;AACE,EAAA,IAAI,CAACD,KAAK,IAAI,CAACC,MAAM,EAAE,OAA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IAAIH,KAAK,KAAKC,MAAM,EAAE,OAAO,IAAI;AACjC,EAAA,IAAI,CAACD,KAAK,IAAI,CAACC,MAAM,EAAE,OAAO,KAAK;AAEnC,EAAA,OAAOD,KAAK,CAAC4C,MAAM,KAAK3C,MAAM,CAAC2C,MAAM,IAChC5C,KAAK,CAAC+C,MAAM,KAAK9C,MAAM,CAAC8C,MAAM,IAC9B,CAAC/C,KAAK,CAAC6C,MAAM,IAAI,CAAC,OAAO5C,MAAM,CAAC4C,MAAM,IAAI,CAAC,CAAC,IAC5C7C,KAAK,CAAC8C,IAAI,KAAK7C,MAAM,CAAC6C,IAAI;AACjC;;AAGA;AACA;AACA;AACA;AACA;AACA;AACAE,SAAS,CAACC,MAAM,CAAC3B,oBAAoB,EAAE;AAAE4B,EAAAA,SAAS,EAAE,sBAAsB;AAAEC,EAAAA,UAAU,EAAE;AAAuB,CAAC,CAAC;;;;"}
@@ -65,4 +65,4 @@ class CjsWebgpuPerFrameSource {
65
65
  }
66
66
 
67
67
  export { CjsWebgpuPerFrameSource };
68
- //# sourceMappingURL=perFrameSource.js.map
68
+ //# sourceMappingURL=CjsWebgpuPerFrameSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsWebgpuPerFrameSource.js","sources":["../../../../../src/trinityal/webgpu/core/CjsWebgpuPerFrameSource.js"],"sourcesContent":["// The scene's per-frame constants, for the two registers Carbon reserves.\n//\n// Short because everything it needs already exists. EveSpaceScene owns the two\n// records (`m_perFrameVS`/`m_perFramePS`), EveSpaceSceneRenderDriver already\n// fills them each frame in Carbon's order - PS then VS - and RawData extends\n// CjsConstantPayload, so the packed bytes are one call away. What was missing\n// was only the join: nothing carried them from the scene to a binding.\n//\n// b1 and b2 are not optional decoration. Every v5 shader binds both, so a hull\n// cannot be drawn without them, which is why the resolver refuses rather than\n// leaving them empty.\n//\n// The records are PERSISTENT and scene-owned, not leased per draw\n// (`RawData.create`), so this hands back a live view rather than a copy: two\n// batches in one frame read the same bytes, which is the point of a per-frame\n// buffer.\nimport { PER_FRAME_PS, PER_FRAME_VS } from \"#trinity/core/Tr2Renderer\";\n\n\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuPerFrameSource: ${message}`);\n error.code = \"CJS_WEBGPU_PER_FRAME_SOURCE_INVALID\";\n throw error;\n}\n\n\n/** Supplies the per-frame constant registers from one scene. */\nexport class CjsWebgpuPerFrameSource\n{\n _scene;\n\n /**\n * @param {object} scene Scene owning the per-frame records.\n */\n constructor(scene)\n {\n if (!scene) fail(\"a scene is required; nothing else owns per-frame data\");\n\n this._scene = scene;\n }\n\n /**\n * The packed bytes for one per-frame register.\n *\n * @param {number} slot Constant-buffer register, 1 or 2.\n * @returns {ArrayBufferView} The scene's packed record.\n */\n Resolve(slot)\n {\n // A scene HAS both accessors; only the slot number is in question.\n const record = slot === PER_FRAME_VS\n ? this._scene.GetPerFrameVSData()\n : (slot === PER_FRAME_PS ? this._scene.GetPerFramePSData() : null);\n\n if (!record)\n {\n fail(`b${slot} is not a per-frame register, or the scene holds no record for it`);\n }\n\n const data = record.GetData();\n\n // A record that packs to nothing would bind an empty buffer and draw a\n // black frame, which reads as a lighting bug rather than a missing upload.\n if (!ArrayBuffer.isView(data)) fail(`the scene's b${slot} record did not pack to a typed array`);\n\n return data;\n }\n\n /**\n * A resolver hook bound to this source.\n *\n * @returns {Function} `(slot) => ArrayBufferView`\n */\n ResolvePerFrame()\n {\n return (slot) => this.Resolve(slot);\n }\n}\n"],"names":["fail","message","error","Error","code","CjsWebgpuPerFrameSource","_scene","constructor","scene","Resolve","slot","record","PER_FRAME_VS","GetPerFrameVSData","PER_FRAME_PS","GetPerFramePSData","data","GetData","ArrayBuffer","isView","ResolvePerFrame"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAASA,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,yBAAA,EAA4BF,OAAO,EAAE,CAAC;EAC9DC,KAAK,CAACE,IAAI,GAAG,qCAAqC;AAClD,EAAA,MAAMF,KAAK;AACb;;AAGA;AACO,MAAMG,uBAAuB,CACpC;EACEC,MAAM;;AAEN;AACF;AACA;EACEC,WAAWA,CAACC,KAAK,EACjB;AACE,IAAA,IAAI,CAACA,KAAK,EAAER,IAAI,CAAC,uDAAuD,CAAC;IAEzE,IAAI,CAACM,MAAM,GAAGE,KAAK;AACrB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACEC,OAAOA,CAACC,IAAI,EACZ;AACE;IACA,MAAMC,MAAM,GAAGD,IAAI,KAAKE,YAAY,GAChC,IAAI,CAACN,MAAM,CAACO,iBAAiB,EAAE,GAC9BH,IAAI,KAAKI,YAAY,GAAG,IAAI,CAACR,MAAM,CAACS,iBAAiB,EAAE,GAAG,IAAK;IAEpE,IAAI,CAACJ,MAAM,EACX;AACEX,MAAAA,IAAI,CAAC,CAAA,CAAA,EAAIU,IAAI,CAAA,iEAAA,CAAmE,CAAC;AACnF,IAAA;AAEA,IAAA,MAAMM,IAAI,GAAGL,MAAM,CAACM,OAAO,EAAE;;AAE7B;AACA;AACA,IAAA,IAAI,CAACC,WAAW,CAACC,MAAM,CAACH,IAAI,CAAC,EAAEhB,IAAI,CAAC,CAAA,aAAA,EAAgBU,IAAI,uCAAuC,CAAC;AAEhG,IAAA,OAAOM,IAAI;AACb,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACEI,EAAAA,eAAeA,GACf;AACE,IAAA,OAAQV,IAAI,IAAK,IAAI,CAACD,OAAO,CAACC,IAAI,CAAC;AACrC,EAAA;AACF;;;;"}
@@ -147,4 +147,4 @@ function RenderPipelineKey(programIdentity, recipe) {
147
147
  }
148
148
 
149
149
  export { CanonicalKey, CjsWebgpuPipelineCache, RenderPipelineKey };
150
- //# sourceMappingURL=pipelineCache.js.map
150
+ //# sourceMappingURL=CjsWebgpuPipelineCache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsWebgpuPipelineCache.js","sources":["../../../../../src/trinityal/webgpu/core/CjsWebgpuPipelineCache.js"],"sourcesContent":["// The Stage B pipeline cache, which this engine did not have.\r\n//\r\n// The engine-backends plan splits effect realization the way Carbon splits it.\r\n// Stage A is program identity and dedup, backend-independent, and\r\n// The runtime resource layer already has it in `passUnitSignature` and `unit.sha256`.\r\n// Stage B is the pipeline object itself, backend-owned, and its key differs per\r\n// backend: DX12 keys an ID3D12PipelineState on a dirty-tracked PSODescription,\r\n// Metal on a combined hash of device, functions, vertex descriptor and\r\n// attachments, and DX11 has no monolithic object but four caches including an\r\n// input-layout cache keyed on the vertex shader's input signature.\r\n//\r\n// This device had none. Every PreparePipeline call created fresh shader\r\n// modules, bind-group layouts and a pipeline layout, and recorded the result in\r\n// a WeakMap keyed by the handle object it had just made - which caches nothing,\r\n// because a fresh handle never hits.\r\n//\r\n// KEYS ARE EXACT, NOT HASHED. Carbon's Metal cache is keyed on a hash value\r\n// with no equality recheck, so a collision silently returns the WRONG pipeline;\r\n// DX12 rechecks. Rather than hash and recheck, the key here is the canonical\r\n// serialization itself, so two different pipelines cannot collide in the first\r\n// place and there is nothing to recheck. That is only affordable because a\r\n// recipe is a small POD block; it is why the program half is named by the\r\n// caller instead.\r\n//\r\n// A CALLER THAT CANNOT NAME ITS PROGRAM GETS NO CACHE. Shader source is far too\r\n// large to serialize into a key on every call, and this package has no\r\n// dependency to hash it with. So the identity is supplied - the composed path\r\n// already has one from the runtime resource layer - and an unnamed pipeline is prepared\r\n// uncached, which is never wrong, only slower. Guessing an identity from the\r\n// descriptor's `key` would be worse than no cache: \"Main.pass0\" is the most\r\n// common pass name in the corpus and never dedupes across effects, so it would\r\n// hand back another effect's pipeline.\r\n//\r\n// EVERYTHING IS GENERATION-BOUND. Carbon's registry handles are indices that go\r\n// stale wholesale on device reset. Ours are garbage-collected objects, so a\r\n// stale entry would keep a dead device's pipeline alive and hand it out; each\r\n// entry records the generation it was built for and a mismatch misses.\r\n\r\nfunction fail(message)\r\n{\r\n const error = new Error(`CjsWebgpuPipelineCache: ${message}`);\r\n error.code = \"CJS_WEBGPU_PIPELINE_CACHE_INVALID\";\r\n throw error;\r\n}\r\n\r\n\r\n/**\r\n * Canonically serializes a value so two structurally equal inputs produce the\r\n * same string regardless of property order.\r\n *\r\n * Object key order is normalized because a recipe assembled by different code\r\n * paths is the same recipe, and treating `{topology, cullMode}` as different\r\n * from `{cullMode, topology}` would miss every such hit.\r\n */\r\nexport function CanonicalKey(value)\r\n{\r\n if (value === null || value === undefined) return String(value);\r\n if (typeof value !== \"object\") return `${typeof value}:${String(value)}`;\r\n if (Array.isArray(value)) return `[${value.map(CanonicalKey).join(\",\")}]`;\r\n\r\n const entries = Object.keys(value)\r\n .filter(name => value[name] !== undefined)\r\n .sort()\r\n .map(name => `${name}=${CanonicalKey(value[name])}`);\r\n\r\n return `{${entries.join(\",\")}}`;\r\n}\r\n\r\n\r\n/**\r\n * A generation-bound cache of asynchronously built pipeline objects.\r\n *\r\n * In-flight builds are cached as promises, so two callers racing for the same\r\n * pipeline share one build rather than each creating a GPU object and one\r\n * silently winning. That matters more here than in Carbon: pipeline creation is\r\n * asynchronous on this backend and a frame legitimately prepares many at once.\r\n */\r\nexport class CjsWebgpuPipelineCache\r\n{\r\n _entries = new Map();\r\n\r\n /** How many entries are held, for diagnostics and tests. */\r\n get size()\r\n {\r\n return this._entries.size;\r\n }\r\n\r\n /**\r\n * Returns the cached value for a key, building it when absent.\r\n *\r\n * `key` must be a stable exact identity; `null` or `undefined` bypasses the\r\n * cache entirely and simply builds, which is what an unnamed pipeline gets.\r\n * A failed build is not retained, so a transient device error does not\r\n * poison the key forever.\r\n */\r\n async Resolve(key, generation, build)\r\n {\r\n if (typeof build !== \"function\") fail(\"a build function is required\");\r\n if (key === null || key === undefined) return build();\r\n\r\n const entry = this._entries.get(key);\r\n if (entry)\r\n {\r\n if (entry.generation === generation) return entry.value;\r\n // A pipeline built for a device that is gone is not repairable, and\r\n // handing it back would use a dead GPU object.\r\n this._entries.delete(key);\r\n }\r\n\r\n const value = build();\r\n this._entries.set(key, { generation, value });\r\n\r\n try\r\n {\r\n return await value;\r\n }\r\n catch (error)\r\n {\r\n if (this._entries.get(key)?.value === value) this._entries.delete(key);\r\n throw error;\r\n }\r\n }\r\n\r\n /** Drops entries not built for the given generation. */\r\n Prune(generation)\r\n {\r\n for (const [ key, entry ] of this._entries)\r\n {\r\n if (entry.generation !== generation) this._entries.delete(key);\r\n }\r\n return this;\r\n }\r\n\r\n /** Drops every entry, as a device reset requires. */\r\n Clear()\r\n {\r\n this._entries.clear();\r\n return this;\r\n }\r\n}\r\n\r\n\r\n/**\r\n * The Stage B key for a render pipeline: the prepared program's identity plus\r\n * the recipe's POD block.\r\n *\r\n * Returns null when the program has no identity, which is how an unnamed\r\n * pipeline declines the cache rather than being keyed on its recipe alone -\r\n * two different programs share a recipe constantly.\r\n */\r\nexport function RenderPipelineKey(programIdentity, recipe)\r\n{\r\n if (programIdentity === null || programIdentity === undefined) return null;\r\n\r\n const identity = CanonicalKey(programIdentity);\r\n\r\n // AN OBJECT THAT CANONICALISES TO NOTHING IS NOT AN IDENTITY. `Object.keys`\r\n // does not see private fields, so a class instance whose state is entirely\r\n // private - `CjsWebgpuShaderProgramAL` is exactly that - yields `{}` and\r\n // passes the null guard above. Every such program would then key\r\n // IDENTICALLY, which is the collision the comment above says must not\r\n // happen: two different programs share a recipe constantly.\r\n //\r\n // Declining the cache is the documented behaviour for a program with no\r\n // identity, so that is what this does rather than inventing one. A backend\r\n // that wants its pipelines cached gives its programs a real identity.\r\n if (identity === \"{}\") return null;\r\n\r\n return `${identity}|${CanonicalKey(recipe ?? null)}`;\r\n}\r\n"],"names":["fail","message","error","Error","code","CanonicalKey","value","undefined","String","Array","isArray","map","join","entries","Object","keys","filter","name","sort","CjsWebgpuPipelineCache","_entries","Map","size","Resolve","key","generation","build","entry","get","delete","set","Prune","Clear","clear","RenderPipelineKey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B;IACE,KAAK,MAAM,CAAED,GAAG,EAAEG,KAAK,CAAE,IAAI,IAAI,CAACP,QAAQ,EAC1C;AACE,MAAA,IAAIO,KAAK,CAACF,UAAU,KAAKA,UAAU,EAAE,IAAI,CAACL,QAAQ,CAACS,MAAM,CAACL,GAAG,CAAC;AAChE,IAAA;AACA,IAAA,OAAO,IAAI;AACb,EAAA;;AAEA;AACAQ,EAAAA,KAAKA,GACL;AACE,IAAA,IAAI,CAACZ,QAAQ,CAACa,KAAK,EAAE;AACrB,IAAA,OAAO,IAAI;AACb,EAAA;AACF;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,iBAAiBA,CAACC,eAAe,EAAEC,MAAM,EACzD;EACE,IAAID,eAAe,KAAK,IAAI,IAAIA,eAAe,KAAK5B,SAAS,EAAE,OAAO,IAAI;AAE1E,EAAA,MAAM8B,QAAQ,GAAGhC,YAAY,CAAC8B,eAAe,CAAC;;AAE9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAA,IAAIE,QAAQ,KAAK,IAAI,EAAE,OAAO,IAAI;EAElC,OAAO,CAAA,EAAGA,QAAQ,CAAA,CAAA,EAAIhC,YAAY,CAAC+B,MAAM,IAAI,IAAI,CAAC,CAAA,CAAE;AACtD;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { CjsSchema } from '#schema';
2
- import { RenderPipelineKey } from './pipelineCache.js';
2
+ import { RenderPipelineKey } from './CjsWebgpuPipelineCache.js';
3
3
  import { TOPOLOGIES } from './topology.js';
4
4
 
5
5
  // Source: trinity/trinityal/dx12/util/PsoDescription.h
@@ -175,4 +175,4 @@ CjsSchema.define(CjsWebgpuPsoDescription, {
175
175
  });
176
176
 
177
177
  export { CjsWebgpuPsoDescription };
178
- //# sourceMappingURL=psoDescription.js.map
178
+ //# sourceMappingURL=CjsWebgpuPsoDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsWebgpuPsoDescription.js","sources":["../../../../../src/trinityal/webgpu/core/CjsWebgpuPsoDescription.js"],"sourcesContent":["// Source: trinity/trinityal/dx12/util/PsoDescription.h\n// trinity/trinityal/dx12/util/PsoDescription.cpp\n// trinity/trinityal/dx12/Tr2RenderContextDx12.cpp (the setters and SetAllState)\n//\n// The pipeline description a draw resolves, and the fourth piece of the\n// immediate-draw route.\n//\n// WHAT CARBON DOES. Its backend does not assemble a pipeline per draw. The\n// setters describe one incrementally and mark it dirty\n// (`Tr2RenderContextDx12.cpp:315-338`: each compares before dirtying, so a\n// redundant apply costs nothing), and the draw resolves it:\n//\n// m_psoDescription.UpdateHash(); // cpp:793\n// auto found = m_ownerDevice->m_pipelineStates.find( m_psoDescription );\n// if( found != end ) return found->second;\n// m_psoDescription.CreatePipelineState( device, pipelineState );\n// m_ownerDevice->m_pipelineStates[ m_psoDescription ] = pipelineState;\n//\n// THE CACHE IS ON THE DEVICE, NOT THE CONTEXT (`Tr2PrimaryRenderContextDx12.h:319`),\n// which is why two contexts drawing the same material share one pipeline. Ours\n// is `CjsWebgpuPipelineCache`, already on `CjsWebgpuDevice` and already serving\n// the batch path - this describes, and hands the description to that.\n//\n// Carbon's fields, and where each lives here:\n//\n// m_vertexLayout -> vertexBufferLayouts, from the bound layout\n// m_shaderProgram -> shaderProgram, a CjsWebgpuShaderProgramAL\n// m_topologyType -> topology, mapped through the AL's own table\n// m_blendDesc }\n// m_rasterizerDesc } all three -> renderStateSetup + overrides, which\n// m_depthStencilDesc } `GetWebgpuRecipe` projects. WebGPU folds state into\n// a pipeline at creation, so the three descriptors\n// are one projection rather than three structs.\n// m_renderTargetFormats -> colorFormats\n// m_depthStencilFormat -> depthFormat\n// m_sampleDesc -> sampleCount\n// m_vertexStreamMask -> derived from vertexBufferLayouts\n//\n// THE PROJECTION IS NOT REIMPLEMENTED HERE. `Tr2RenderStateSetup.GetWebgpuRecipe`\n// already turns an interpreted setup into WebGPU state, applies the render-state\n// overrides while doing it, and refuses a fill mode WebGPU cannot rasterize. A\n// second translator is the mistake this whole lane exists to undo.\nimport { CjsSchema } from \"#schema\";\nimport { RenderPipelineKey } from \"./CjsWebgpuPipelineCache.js\";\nimport { TOPOLOGIES } from \"./topology.js\";\n\n\n/**\n * A pipeline description, filled by the abstraction layer's setters.\n *\n * Carbon's `PSODescription` is a plain struct with an `operator==` and a hash;\n * this is the same, with `GetKey` standing in for both because a canonical key\n * compares and hashes at once.\n */\nexport class CjsWebgpuPsoDescription\n{\n /** m_shaderProgram */\n shaderProgram = null;\n\n /** m_vertexLayout, as WebGPU buffer layouts. */\n vertexBufferLayouts = [];\n\n /** m_topologyType, in the abstraction layer's vocabulary. */\n topology = null;\n\n /** The authored state, projected at resolve time. */\n renderStateSetup = null;\n\n /** The state manager's overrides, applied by the projection. */\n renderStateOverrides = null;\n\n /** m_renderTargetFormats[MAX_RENDER_TARGET] */\n colorFormats = [];\n\n /** m_depthStencilFormat; null means no depth attachment. */\n depthFormat = null;\n\n /** m_sampleDesc, reduced to the one field WebGPU exposes. */\n sampleCount = 1;\n\n /**\n * Whether the description names everything a pipeline needs.\n *\n * Carbon's `GetPipelineState` returns null and `SetAllState` fails\n * (`cpp:847-851`) rather than creating a partial pipeline; this is the same\n * check, made before the attempt so the caller can say what is missing.\n *\n * @returns {string|null} What is missing, or null when complete.\n */\n GetMissing()\n {\n if (!this.shaderProgram || !this.shaderProgram.IsValid()) return \"a linked shader program\";\n if (!this.renderStateSetup) return \"a render-state setup\";\n if (this.topology === null || TOPOLOGIES[this.topology] === undefined) return \"a topology WebGPU can draw\";\n if (this.colorFormats.length === 0 && this.depthFormat === null) return \"a colour or depth attachment\";\n\n return null;\n }\n\n /**\n * The WebGPU pipeline descriptor this description resolves to.\n *\n * Carbon's `CreatePipelineState` builds a `D3D12_GRAPHICS_PIPELINE_STATE_DESC`\n * from the same fields. Ours produces the recipe shape the device's pipeline\n * factory already takes from the batch path, so both paths create pipelines\n * the same way.\n *\n * @returns {object} The recipe.\n */\n BuildRecipe()\n {\n const projected = this.renderStateSetup.GetWebgpuRecipe({\n depthFormat: this.depthFormat,\n invertedDepthTest: !!this.renderStateOverrides?.invertedDepthTest,\n invertedCullMode: !!this.renderStateOverrides?.invertedCullMode\n });\n\n return {\n ...projected,\n primitive: { ...projected.primitive, topology: TOPOLOGIES[this.topology] },\n vertex: { buffers: this.vertexBufferLayouts },\n fragment: {\n targets: this.colorFormats.map(format => ({ format, blend: projected.blend ?? undefined }))\n },\n multisample: { count: this.sampleCount }\n };\n }\n\n /**\n * The cache key, which is Carbon's `UpdateHash` plus `operator==` at once.\n *\n * Two descriptions with the same key resolve to the same pipeline, which is\n * the whole point of describing rather than assembling: a frame that draws\n * two hundred objects through one material creates one pipeline.\n *\n * @returns {string|null} The key, or null when the description is incomplete.\n */\n GetKey()\n {\n if (this.GetMissing()) return null;\n\n // A real program names itself; a stand-in keys on its own fields. Metal\n // hashes the function pointers for this (`MetalWorkQueue.mm:1610-1611`),\n // and canonicalising a program's modules would serialise device objects.\n const identity = typeof this.shaderProgram.GetIdentity === \"function\"\n ? this.shaderProgram.GetIdentity()\n : this.shaderProgram;\n\n return RenderPipelineKey(identity, this.BuildRecipe());\n }\n\n /**\n * Whether two descriptions resolve to the same pipeline.\n *\n * @param {CjsWebgpuPsoDescription} other The description to compare.\n * @returns {boolean} True when both are complete and equal.\n */\n Equals(other)\n {\n if (!other) return false;\n\n const key = this.GetKey();\n\n return key !== null && key === other.GetKey();\n }\n}\n\n\n// DECLARED AS A CALL, NOT A DECORATOR. The abstraction layer is imported\n// straight from source by its tests - `#trinityal/...` resolves to `src/` - and\n// raw Node cannot parse decorator syntax, so a decorator here breaks every test\n// that reaches this file without a build first. `CjsSchema.define` is the same\n// metadata through the door the schema already provides for exactly this, and\n// it keeps the layer free of the decorator chain it has never carried.\nCjsSchema.define(CjsWebgpuPsoDescription, { className: \"CjsWebgpuPsoDescription\", carbon: \"PSODescription\" });\n"],"names":["CjsWebgpuPsoDescription","shaderProgram","vertexBufferLayouts","topology","renderStateSetup","renderStateOverrides","colorFormats","depthFormat","sampleCount","GetMissing","IsValid","TOPOLOGIES","undefined","length","BuildRecipe","projected","GetWebgpuRecipe","invertedDepthTest","invertedCullMode","primitive","vertex","buffers","fragment","targets","map","format","blend","multisample","count","GetKey","identity","GetIdentity","RenderPipelineKey","Equals","other","key","CjsSchema","define","className","carbon"],"mappings":";;;;AAAA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,uBAAuB,CACpC;AACE;AACAC,EAAAA,aAAa,GAAG,IAAI;;AAEpB;AACAC,EAAAA,mBAAmB,GAAG,EAAE;;AAExB;AACAC,EAAAA,QAAQ,GAAG,IAAI;;AAEf;AACAC,EAAAA,gBAAgB,GAAG,IAAI;;AAEvB;AACAC,EAAAA,oBAAoB,GAAG,IAAI;;AAE3B;AACAC,EAAAA,YAAY,GAAG,EAAE;;AAEjB;AACAC,EAAAA,WAAW,GAAG,IAAI;;AAElB;AACAC,EAAAA,WAAW,GAAG,CAAC;;AAEf;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,UAAUA,GACV;AACE,IAAA,IAAI,CAAC,IAAI,CAACR,aAAa,IAAI,CAAC,IAAI,CAACA,aAAa,CAACS,OAAO,EAAE,EAAE,OAAO,yBAAyB;AAC1F,IAAA,IAAI,CAAC,IAAI,CAACN,gBAAgB,EAAE,OAAO,sBAAsB;AACzD,IAAA,IAAI,IAAI,CAACD,QAAQ,KAAK,IAAI,IAAIQ,UAAU,CAAC,IAAI,CAACR,QAAQ,CAAC,KAAKS,SAAS,EAAE,OAAO,4BAA4B;AAC1G,IAAA,IAAI,IAAI,CAACN,YAAY,CAACO,MAAM,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C,IAAI,CAAC9B,aAAa;IAEtB,OAAO+B,iBAAiB,CAACF,QAAQ,EAAE,IAAI,CAAChB,WAAW,EAAE,CAAC;AACxD,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EACEmB,MAAMA,CAACC,KAAK,EACZ;AACE,IAAA,IAAI,CAACA,KAAK,EAAE,OAAO,KAAK;AAExB,IAAA,MAAMC,GAAG,GAAG,IAAI,CAACN,MAAM,EAAE;IAEzB,OAAOM,GAAG,KAAK,IAAI,IAAIA,GAAG,KAAKD,KAAK,CAACL,MAAM,EAAE;AAC/C,EAAA;AACF;;AAGA;AACA;AACA;AACA;AACA;AACA;AACAO,SAAS,CAACC,MAAM,CAACrC,uBAAuB,EAAE;AAAEsC,EAAAA,SAAS,EAAE,yBAAyB;AAAEC,EAAAA,MAAM,EAAE;AAAiB,CAAC,CAAC;;;;"}
@@ -398,4 +398,4 @@ class CjsWebgpuRenderTarget {
398
398
  }
399
399
 
400
400
  export { CjsWebgpuRenderTarget };
401
- //# sourceMappingURL=renderTarget.js.map
401
+ //# sourceMappingURL=CjsWebgpuRenderTarget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsWebgpuRenderTarget.js","sources":["../../../../../src/trinityal/webgpu/core/CjsWebgpuRenderTarget.js"],"sourcesContent":["// Attachment and target ownership for the WebGPU backend.\r\n//\r\n// Carbon's target model is a render context that owns its swap chain and\r\n// depth-stencil surface. WebGPU's is a render-pass descriptor with FIXED\r\n// attachments, decided before the pass opens and unchangeable inside it, so\r\n// there is nothing to port line for line - the divergence table already records\r\n// this as one of the places the two backends legitimately differ in\r\n// implementation while agreeing on the frame progression.\r\n//\r\n// What this owns: canvas configuration, the depth attachment, the multisample\r\n// attachment, and their size. What it deliberately does not own: when a frame\r\n// happens, which passes exist, or what is drawn. Those belong to the executor\r\n// and to Trinity's steps.\r\n//\r\n// THREE THINGS THAT MUST FAIL LOUDLY, because each is silent otherwise.\r\n//\r\n// 1. A canvas texture view is valid for ONE frame. WebGPU replaces the texture\r\n// behind `getCurrentTexture()` at presentation, so a view cached across\r\n// frames refers to a texture that is gone. Reusing one is rejected here\r\n// rather than surfacing as a validation error from a pass whose descriptor\r\n// looks correct.\r\n// 2. Depth and colour attachments must agree on size and sample count exactly.\r\n// A stale depth attachment after a resize is the classic version of this,\r\n// and beginRenderPass reports it far from the resize that caused it.\r\n// 3. Everything is bound to a device generation. After device loss the context\r\n// must be reconfigured and every attachment recreated; an attachment from\r\n// the previous device is not repairable.\r\n//\r\n// PRESENTATION IS NOT A CALL. Carbon presents the previous frame at the top of\r\n// the next tick through Tr2RenderContextAL::Present. WebGPU has no present:\r\n// the browser presents a configured canvas after the queue submission that drew\r\n// into its current texture. So the engine-side tick wrapper has a Present step\r\n// for WebGL and genuinely nothing to do here, and that asymmetry is expected\r\n// rather than a missing port.\r\n\r\nimport { CjsWebgpuDevice } from \"../CjsWebgpuDevice.js\";\r\n\r\nfunction fail(message)\r\n{\r\n const error = new Error(`CjsWebgpuRenderTarget: ${message}`);\r\n error.code = \"CJS_WEBGPU_RENDER_TARGET_INVALID\";\r\n throw error;\r\n}\r\n\r\n\r\nfunction positiveSize(value, name)\r\n{\r\n if (!Number.isInteger(value) || value < 1)\r\n {\r\n fail(`${name} must be a positive integer`);\r\n }\r\n return value;\r\n}\r\n\r\n\r\n/** Owns a WebGPU presentation surface and its per-frame attachments. */\r\nexport class CjsWebgpuRenderTarget\r\n{\r\n _webgpu;\r\n\r\n _canvas = null;\r\n\r\n _context = null;\r\n\r\n _format = null;\r\n\r\n _alphaMode = \"opaque\";\r\n\r\n _extraUsage = 0;\r\n\r\n _sampleCount = 1;\r\n\r\n _depthFormat = null;\r\n\r\n _width = 0;\r\n\r\n _height = 0;\r\n\r\n _generation = 0;\r\n\r\n _depth = null;\r\n\r\n _multisample = null;\r\n\r\n _frame = null;\r\n\r\n _destroyed = false;\r\n\r\n /**\r\n * @param {CjsWebgpuDevice} webgpu Canonical WebGPU device.\r\n * @param {object} options Target options.\r\n * @param {object} options.canvas Canvas or OffscreenCanvas to present to.\r\n * @param {object} [options.context] Pre-acquired WebGPU canvas context.\r\n * @param {string} [options.format] Presentation format; defaults to the\r\n * browser's preferred canvas format.\r\n * @param {string} [options.alphaMode=\"opaque\"] Canvas alpha mode.\r\n * @param {number} [options.sampleCount=1] Multisample count.\r\n * @param {string} [options.depthFormat] Depth attachment format, or omitted\r\n * for a colour-only target.\r\n * @param {object} [options.textureUsage] GPUTextureUsage constants.\r\n * @param {object} [options.gpu] `navigator.gpu`-like object, for the\r\n * preferred canvas format.\r\n * @param {number} [options.extraUsage] Extra `GPUTextureUsage` bits for the\r\n * surface - `COPY_SRC` when the frame has to be read back and counted.\r\n */\r\n constructor(webgpu, options = {})\r\n {\r\n if (!(webgpu instanceof CjsWebgpuDevice))\r\n {\r\n fail(\"webgpu boundary must be a CjsWebgpuDevice\");\r\n }\r\n this._webgpu = webgpu;\r\n this._canvas = options.canvas ?? null;\r\n this._context = options.context ?? null;\r\n\r\n if (!this._context && !this._canvas) fail(\"a canvas or a context is required\");\r\n\r\n this._textureUsage = options.textureUsage || globalThis.GPUTextureUsage || null;\r\n this._gpu = options.gpu ?? globalThis.navigator?.gpu ?? null;\r\n this._alphaMode = options.alphaMode ?? \"opaque\";\r\n this._sampleCount = options.sampleCount ?? 1;\r\n this._depthFormat = options.depthFormat ?? null;\r\n this._format = options.format ?? null;\r\n this._extraUsage = options.extraUsage ?? 0;\r\n }\r\n\r\n /** The presentation format the canvas is configured with. */\r\n GetFormat()\r\n {\r\n return this._format;\r\n }\r\n\r\n /**\r\n * The depth attachment's format, or null when there is no depth.\r\n *\r\n * The field existed from the start and nothing could read it, so the value\r\n * reached a pipeline only by being passed separately into the batch\r\n * resolver's constructor. A pipeline description assembled from bound state\r\n * has no constructor to receive it, and asking the target that owns it is\r\n * both shorter and impossible to disagree with.\r\n *\r\n * @returns {string|null} A `GPUTextureFormat`, or null.\r\n */\r\n GetDepthFormat()\r\n {\r\n return this._depthFormat;\r\n }\r\n\r\n /** The current attachment size. */\r\n GetSize()\r\n {\r\n return { width: this._width, height: this._height };\r\n }\r\n\r\n // CARBON'S TEXTURE ACCESSORS, so this can BE a bound render target rather\r\n // than needing an adapter to become one. `Tr2TextureAL` answers `GetWidth`\r\n // and `GetHeight`, and the abstraction layer resets the viewport from\r\n // whatever is bound at slot zero by asking exactly those two questions\r\n // (`Tr2RenderContextMetal.mm:762-766`). Without them a target has to be\r\n // wrapped at every call site, and the first one that forgets gets a viewport\r\n // left at the previous pass's size - the 2048 shadow-map defect.\r\n\r\n /** The bound width, as `Tr2TextureAL::GetWidth` answers it. @returns {number} */\r\n GetWidth()\r\n {\r\n return this._width;\r\n }\r\n\r\n /** The bound height, as `Tr2TextureAL::GetHeight` answers it. @returns {number} */\r\n GetHeight()\r\n {\r\n return this._height;\r\n }\r\n\r\n /** The multisample count every attachment is created with. */\r\n GetSampleCount()\r\n {\r\n return this._sampleCount;\r\n }\r\n\r\n /**\r\n * Configures the canvas context and sizes every attachment.\r\n *\r\n * Idempotent for an unchanged size, format and device generation, so a caller\r\n * may invoke it each frame without recreating anything. A generation change\r\n * reconfigures unconditionally, because the previous device's configuration\r\n * does not carry over.\r\n */\r\n Configure(options = {})\r\n {\r\n this._AssertLive();\r\n\r\n const width = positiveSize(options.width ?? this._width, \"width\");\r\n const height = positiveSize(options.height ?? this._height, \"height\");\r\n const generation = this._webgpu.GetGeneration();\r\n const device = this._webgpu.GetDevice();\r\n\r\n if (!this._context)\r\n {\r\n this._context = this._canvas?.getContext?.(\"webgpu\") ?? null;\r\n if (!this._context) fail(\"the canvas does not provide a webgpu context\");\r\n }\r\n\r\n if (!this._format)\r\n {\r\n this._format = options.format\r\n ?? this._gpu?.getPreferredCanvasFormat?.()\r\n ?? fail(\"a presentation format is required when the browser reports no preferred one\");\r\n }\r\n\r\n const changed = generation !== this._generation\r\n || width !== this._width\r\n || height !== this._height;\r\n\r\n if (!changed) return this;\r\n\r\n // The canvas backing store drives the surface size, so it is set before the\r\n // context is configured rather than after.\r\n if (this._canvas)\r\n {\r\n this._canvas.width = width;\r\n this._canvas.height = height;\r\n }\r\n\r\n const usage = this._RequireUsage();\r\n\r\n // EXTRA USAGE IS THE CALLER'S TO ASK FOR, because the surface is theirs to\r\n // read. A frame that has to be counted back needs COPY_SRC, and hardcoding\r\n // RENDER_ATTACHMENT alone silently makes that impossible - the readback\r\n // fails at copy time, long after the configure that caused it. Defaults to\r\n // nothing extra, so nobody pays for a capability they did not ask for.\r\n this._context.configure({\r\n device,\r\n format: this._format,\r\n alphaMode: this._alphaMode,\r\n usage: usage.RENDER_ATTACHMENT | (this._extraUsage ?? 0)\r\n });\r\n\r\n this._width = width;\r\n this._height = height;\r\n this._generation = generation;\r\n this._ReleaseAttachments();\r\n this._CreateAttachments(device, usage);\r\n this._frame = null;\r\n\r\n return this;\r\n }\r\n\r\n /**\r\n * Acquires this frame's colour texture view and the matching attachments.\r\n *\r\n * A new frame invalidates the previous one. The returned record is the only\r\n * legal source of a view for the frame it belongs to.\r\n */\r\n AcquireFrame()\r\n {\r\n this._AssertLive();\r\n if (!this._context || !this._width) fail(\"Configure must run before a frame is acquired\");\r\n if (this._generation !== this._webgpu.GetGeneration())\r\n {\r\n fail(\"the device generation changed; Configure must run again before acquiring a frame\");\r\n }\r\n\r\n const texture = this._context.getCurrentTexture();\r\n if (!texture) fail(\"the canvas context returned no current texture\");\r\n\r\n if (this._frame) this._frame.valid = false;\r\n\r\n const view = texture.createView();\r\n this._frame = {\r\n valid: true,\r\n generation: this._generation,\r\n // With multisampling the pass renders into the multisample attachment and\r\n // resolves into the canvas; without it the canvas is the render target.\r\n colorView: this._multisample ? this._multisample.view : view,\r\n resolveView: this._multisample ? view : null,\r\n depthView: this._depth ? this._depth.view : null\r\n };\r\n\r\n return { ...this._frame };\r\n }\r\n\r\n /**\r\n * Builds a render-pass descriptor for an acquired frame.\r\n *\r\n * `clearColor` omitted means the colour attachment LOADS rather than clears,\r\n * which is how a second pass over the same target composites. The divergence\r\n * decision prefers attachment load operations to an explicit clear operation,\r\n * so clearing is expressed here and never as a separate draw.\r\n */\r\n CreateRenderPassDescriptor(frame, options = {})\r\n {\r\n this._AssertLive();\r\n this._AssertFrame(frame);\r\n\r\n const clearColor = options.clearColor ?? null;\r\n const colorAttachment = {\r\n view: frame.colorView,\r\n loadOp: clearColor ? \"clear\" : \"load\",\r\n storeOp: \"store\"\r\n };\r\n if (clearColor) colorAttachment.clearValue = clearColor;\r\n if (frame.resolveView) colorAttachment.resolveTarget = frame.resolveView;\r\n\r\n const descriptor = {\r\n label: options.label,\r\n colorAttachments: [ colorAttachment ]\r\n };\r\n\r\n if (frame.depthView)\r\n {\r\n const clearDepth = options.clearDepth;\r\n descriptor.depthStencilAttachment = {\r\n view: frame.depthView,\r\n depthLoadOp: clearDepth === undefined ? \"load\" : \"clear\",\r\n depthStoreOp: options.discardDepth ? \"discard\" : \"store\",\r\n ...(clearDepth === undefined ? {} : { depthClearValue: clearDepth })\r\n };\r\n }\r\n else if (options.clearDepth !== undefined)\r\n {\r\n fail(\"clearDepth was given but this target has no depth attachment\");\r\n }\r\n\r\n return descriptor;\r\n }\r\n\r\n /**\r\n * Applies viewport and scissor to an open pass.\r\n *\r\n * Both default to the whole target. WebGPU treats these as encoder state\r\n * inside a pass rather than as context state, so they are applied per pass\r\n * and never persist across one.\r\n */\r\n ApplyViewport(pass, options = {})\r\n {\r\n this._AssertLive();\r\n if (typeof pass?.setViewport !== \"function\") fail(\"a GPURenderPassEncoder is required\");\r\n\r\n const viewport = options.viewport ?? null;\r\n const scissor = options.scissor ?? null;\r\n\r\n if (viewport)\r\n {\r\n this._AssertInside(viewport, \"viewport\");\r\n pass.setViewport(\r\n viewport.x, viewport.y, viewport.width, viewport.height,\r\n viewport.minDepth ?? 0, viewport.maxDepth ?? 1\r\n );\r\n }\r\n else\r\n {\r\n pass.setViewport(0, 0, this._width, this._height, 0, 1);\r\n }\r\n\r\n if (typeof pass.setScissorRect !== \"function\") return this;\r\n\r\n if (scissor)\r\n {\r\n this._AssertInside(scissor, \"scissor\");\r\n pass.setScissorRect(scissor.x, scissor.y, scissor.width, scissor.height);\r\n }\r\n else\r\n {\r\n pass.setScissorRect(0, 0, this._width, this._height);\r\n }\r\n\r\n return this;\r\n }\r\n\r\n /** Releases every attachment this target created. The canvas is the caller's. */\r\n Destroy()\r\n {\r\n if (this._destroyed) return this;\r\n this._destroyed = true;\r\n if (this._frame) this._frame.valid = false;\r\n this._frame = null;\r\n this._ReleaseAttachments();\r\n // Unconfiguring returns the surface; the canvas element itself is not ours\r\n // to remove, and a caller may configure a new target against it.\r\n this._context?.unconfigure?.();\r\n return this;\r\n }\r\n\r\n /** Creates owned multisample and depth attachments for the current size. */\r\n _CreateAttachments(device, usage)\r\n {\r\n if (this._sampleCount > 1)\r\n {\r\n const texture = device.createTexture({\r\n label: \"CjsWebgpuRenderTarget.multisample\",\r\n size: { width: this._width, height: this._height, depthOrArrayLayers: 1 },\r\n sampleCount: this._sampleCount,\r\n format: this._format,\r\n usage: usage.RENDER_ATTACHMENT\r\n });\r\n this._multisample = { texture, view: texture.createView() };\r\n }\r\n\r\n if (this._depthFormat)\r\n {\r\n // Same size and sample count as the colour attachment, which is what\r\n // beginRenderPass validates and what a stale depth texture violates.\r\n const texture = device.createTexture({\r\n label: \"CjsWebgpuRenderTarget.depth\",\r\n size: { width: this._width, height: this._height, depthOrArrayLayers: 1 },\r\n sampleCount: this._sampleCount,\r\n format: this._depthFormat,\r\n usage: usage.RENDER_ATTACHMENT\r\n });\r\n this._depth = { texture, view: texture.createView() };\r\n }\r\n }\r\n\r\n /** Destroys and forgets every owned attachment. */\r\n _ReleaseAttachments()\r\n {\r\n this._depth?.texture?.destroy?.();\r\n this._multisample?.texture?.destroy?.();\r\n this._depth = null;\r\n this._multisample = null;\r\n }\r\n\r\n /** Gets the validated texture-usage vocabulary supplied by the host. */\r\n _RequireUsage()\r\n {\r\n const usage = this._textureUsage;\r\n if (!usage || !Number.isInteger(usage.RENDER_ATTACHMENT))\r\n {\r\n fail(\"the GPUTextureUsage RENDER_ATTACHMENT constant is required\");\r\n }\r\n return usage;\r\n }\r\n\r\n /** Throws when this target has already been destroyed. */\r\n _AssertLive()\r\n {\r\n if (this._destroyed) fail(\"the render target is destroyed\");\r\n }\r\n\r\n // Ordered so the message names the actual problem. A frame invalidated by a\r\n // later acquire, a resize or a device loss is STALE, and saying \"no frame\" of\r\n // one the caller is holding sends them looking in the wrong place.\r\n /** Validates that a frame belongs to the target's current generation. */\r\n _AssertFrame(frame)\r\n {\r\n if (!frame || typeof frame !== \"object\") fail(\"a frame acquired from this target is required\");\r\n if (!this._frame || !this._frame.valid\r\n || frame.generation !== this._generation\r\n || frame.colorView !== this._frame.colorView)\r\n {\r\n fail(\"the frame is stale; a canvas texture view is valid for one frame only\");\r\n }\r\n }\r\n\r\n /** Validates that one viewport or scissor rectangle lies inside the target. */\r\n _AssertInside(rect, name)\r\n {\r\n const values = [ rect.x, rect.y, rect.width, rect.height ];\r\n if (values.some((value) => !Number.isFinite(value) || value < 0))\r\n {\r\n fail(`${name} must have non-negative finite bounds`);\r\n }\r\n if (rect.x + rect.width > this._width || rect.y + rect.height > this._height)\r\n {\r\n fail(`${name} exceeds the ${this._width}x${this._height} target`);\r\n }\r\n }\r\n}\r\n"],"names":["fail","message","error","Error","code","positiveSize","value","name","Number","isInteger","CjsWebgpuRenderTarget","_webgpu","_canvas","_context","_format","_alphaMode","_extraUsage","_sampleCount","_depthFormat","_width","_height","_generation","_depth","_multisample","_frame","_destroyed","constructor","webgpu","options","CjsWebgpuDevice","canvas","context","_textureUsage","textureUsage","globalThis","GPUTextureUsage","_gpu","gpu","navigator","alphaMode","sampleCount","depthFormat","format","extraUsage","GetFormat","GetDepthFormat","GetSize","width","height","GetWidth","GetHeight","GetSampleCount","Configure","_AssertLive","generation","GetGeneration","device","GetDevice","getContext","getPreferredCanvasFormat","changed","usage","_RequireUsage","configure","RENDER_ATTACHMENT","_ReleaseAttachments","_CreateAttachments","AcquireFrame","texture","getCurrentTexture","valid","view","createView","colorView","resolveView","depthView","CreateRenderPassDescriptor","frame","_AssertFrame","clearColor","colorAttachment","loadOp","storeOp","clearValue","resolveTarget","descriptor","label","colorAttachments","clearDepth","depthStencilAttachment","depthLoadOp","undefined","depthStoreOp","discardDepth","depthClearValue","ApplyViewport","pass","setViewport","viewport","scissor","_AssertInside","x","y","minDepth","maxDepth","setScissorRect","Destroy","unconfigure","createTexture","size","depthOrArrayLayers","destroy","rect","values","some","isFinite"],"mappings":";;AAAA;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;AACA;;AAIA,SAASA,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,uBAAA,EAA0BF,OAAO,EAAE,CAAC;EAC5DC,KAAK,CAACE,IAAI,GAAG,kCAAkC;AAC/C,EAAA,MAAMF,KAAK;AACb;AAGA,SAASG,YAAYA,CAACC,KAAK,EAAEC,IAAI,EACjC;EACE,IAAI,CAACC,MAAM,CAACC,SAAS,CAACH,KAAK,CAAC,IAAIA,KAAK,GAAG,CAAC,EACzC;AACEN,IAAAA,IAAI,CAAC,CAAA,EAAGO,IAAI,CAAA,2BAAA,CAA6B,CAAC;AAC5C,EAAA;AACA,EAAA,OAAOD,KAAK;AACd;;AAGA;AACO,MAAMI,qBAAqB,CAClC;EACEC,OAAO;AAEPC,EAAAA,OAAO,GAAG,IAAI;AAEdC,EAAAA,QAAQ,GAAG,IAAI;AAEfC,EAAAA,OAAO,GAAG,IAAI;AAEdC,EAAAA,UAAU,GAAG,QAAQ;AAErBC,EAAAA,WAAW,GAAG,CAAC;AAEfC,EAAAA,YAAY,GAAG,CAAC;AAEhBC,EAAAA,YAAY,GAAG,IAAI;AAEnBC,EAAAA,MAAM,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D,KAAK,CAACJ,SAAS,KAAK,IAAI,CAACjD,MAAM,CAACiD,SAAS,EAC9C;MACEzE,IAAI,CAAC,uEAAuE,CAAC;AAC/E,IAAA;AACF,EAAA;;AAEA;AACAoG,EAAAA,aAAaA,CAACY,IAAI,EAAEzG,IAAI,EACxB;AACE,IAAA,MAAM0G,MAAM,GAAG,CAAED,IAAI,CAACX,CAAC,EAAEW,IAAI,CAACV,CAAC,EAAEU,IAAI,CAACjE,KAAK,EAAEiE,IAAI,CAAChE,MAAM,CAAE;AAC1D,IAAA,IAAIiE,MAAM,CAACC,IAAI,CAAE5G,KAAK,IAAK,CAACE,MAAM,CAAC2G,QAAQ,CAAC7G,KAAK,CAAC,IAAIA,KAAK,GAAG,CAAC,CAAC,EAChE;AACEN,MAAAA,IAAI,CAAC,CAAA,EAAGO,IAAI,CAAA,qCAAA,CAAuC,CAAC;AACtD,IAAA;IACA,IAAIyG,IAAI,CAACX,CAAC,GAAGW,IAAI,CAACjE,KAAK,GAAG,IAAI,CAAC5B,MAAM,IAAI6F,IAAI,CAACV,CAAC,GAAGU,IAAI,CAAChE,MAAM,GAAG,IAAI,CAAC5B,OAAO,EAC5E;AACEpB,MAAAA,IAAI,CAAC,CAAA,EAAGO,IAAI,CAAA,aAAA,EAAgB,IAAI,CAACY,MAAM,CAAA,CAAA,EAAI,IAAI,CAACC,OAAO,CAAA,OAAA,CAAS,CAAC;AACnE,IAAA;AACF,EAAA;AACF;;;;"}
@@ -84,4 +84,4 @@ class CjsWebgpuSamplerSource {
84
84
  }
85
85
 
86
86
  export { CjsWebgpuSamplerSource };
87
- //# sourceMappingURL=samplerSource.js.map
87
+ //# sourceMappingURL=CjsWebgpuSamplerSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsWebgpuSamplerSource.js","sources":["../../../../../src/trinityal/webgpu/core/CjsWebgpuSamplerSource.js"],"sourcesContent":["// An effect's declared sampler to a realized WebGPU sampler.\n//\n// The mirror of CjsWebgpuTextureSource, and much shorter, because a sampler\n// needs nothing loaded. Its state is authored INTO the effect container and\n// arrives on the binding record itself, so resolution is synchronous and has no\n// resource path, no network and no first-frame absence.\n//\n// The one thing worth knowing is what a sampler is NOT: it is not paired with a\n// texture here. Carbon shares samplers across textures and stores the t#/s#\n// pairing only in the DXBC operands - quadv5 binds nine textures against a\n// single s0 - so a source that tried to hand out one sampler per texture would\n// be inventing a relationship the container does not express. See\n// /docs/contracts/texture-sampler-pairing.md.\nimport { CarbonSamplerDescriptor } from \"./samplerDescriptor.js\";\n\n\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuSamplerSource: ${message}`);\n error.code = \"CJS_WEBGPU_SAMPLER_SOURCE_INVALID\";\n throw error;\n}\n\n\n/** Resolves an effect's declared samplers against one device. */\nexport class CjsWebgpuSamplerSource\n{\n _webgpu;\n\n /** Descriptor cache key to the in-flight or settled sampler. */\n _created = new Map();\n\n /**\n * @param {object} webgpu Canonical WebGPU device.\n */\n constructor(webgpu)\n {\n if (!webgpu) fail(\"a WebGPU device is required\");\n\n this._webgpu = webgpu;\n }\n\n /**\n * The sampler for one declared binding.\n *\n * Keyed on the translated descriptor rather than on the binding's name,\n * because the name is scoped to one pass while the state is not: every pass\n * authoring the same state wants the same sampler, and s0 in two effects is\n * two different bindings that may well be one sampler.\n *\n * @param {string} name Binding name, for diagnostics.\n * @param {object} material Trinity material, unused; kept for the hook shape.\n * @param {object} binding Declared binding record carrying the authored state.\n * @returns {Promise<object>} Realized sampler handle.\n */\n async Resolve(name, material, binding)\n {\n const authored = binding?.carbon?.sampler;\n\n if (!authored)\n {\n fail(`sampler binding \"${name}\" carries no authored state, so there is nothing to translate`);\n }\n\n // Keyed BEFORE the label is attached. The label carries the binding name,\n // so keying on it would give two names with identical state two samplers,\n // which is the sharing this cache exists to do.\n const descriptor = CarbonSamplerDescriptor(authored);\n const key = JSON.stringify(descriptor);\n const existing = this._created.get(key);\n\n if (existing) return existing;\n\n const created = this._webgpu.CreateSampler({ ...descriptor, label: `effect sampler ${name}` });\n\n this._created.set(key, created);\n\n return created;\n }\n\n /**\n * A resolver hook bound to this source.\n *\n * @returns {Function} `(name, material, binding) => Promise<object>`\n */\n ResolveSampler()\n {\n return (name, material, binding) => this.Resolve(name, material, binding);\n }\n\n /** Forgets every sampler, so a device loss can rebuild them. */\n Clear()\n {\n this._created.clear();\n }\n}\n"],"names":["fail","message","error","Error","code","CjsWebgpuSamplerSource","_webgpu","_created","Map","constructor","webgpu","Resolve","name","material","binding","authored","carbon","sampler","descriptor","CarbonSamplerDescriptor","key","JSON","stringify","existing","get","created","CreateSampler","label","set","ResolveSampler","Clear","clear"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA,SAASA,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,wBAAA,EAA2BF,OAAO,EAAE,CAAC;EAC7DC,KAAK,CAACE,IAAI,GAAG,mCAAmC;AAChD,EAAA,MAAMF,KAAK;AACb;;AAGA;AACO,MAAMG,sBAAsB,CACnC;EACEC,OAAO;;AAEP;AACAC,EAAAA,QAAQ,GAAG,IAAIC,GAAG,EAAE;;AAEpB;AACF;AACA;EACEC,WAAWA,CAACC,MAAM,EAClB;AACE,IAAA,IAAI,CAACA,MAAM,EAAEV,IAAI,CAAC,6BAA6B,CAAC;IAEhD,IAAI,CAACM,OAAO,GAAGI,MAAM;AACvB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACE,EAAA,MAAMC,OAAOA,CAACC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,EACrC;AACE,IAAA,MAAMC,QAAQ,GAAGD,OAAO,EAAEE,MAAM,EAAEC,OAAO;IAEzC,IAAI,CAACF,QAAQ,EACb;AACEf,MAAAA,IAAI,CAAC,CAAA,iBAAA,EAAoBY,IAAI,CAAA,6DAAA,CAA+D,CAAC;AAC/F,IAAA;;AAEA;AACA;AACA;AACA,IAAA,MAAMM,UAAU,GAAGC,uBAAuB,CAACJ,QAAQ,CAAC;AACpD,IAAA,MAAMK,GAAG,GAAGC,IAAI,CAACC,SAAS,CAACJ,UAAU,CAAC;IACtC,MAAMK,QAAQ,GAAG,IAAI,CAAChB,QAAQ,CAACiB,GAAG,CAACJ,GAAG,CAAC;IAEvC,IAAIG,QAAQ,EAAE,OAAOA,QAAQ;AAE7B,IAAA,MAAME,OAAO,GAAG,IAAI,CAACnB,OAAO,CAACoB,aAAa,CAAC;AAAE,MAAA,GAAGR,UAAU;MAAES,KAAK,EAAE,kBAAkBf,IAAI,CAAA;AAAG,KAAC,CAAC;IAE9F,IAAI,CAACL,QAAQ,CAACqB,GAAG,CAACR,GAAG,EAAEK,OAAO,CAAC;AAE/B,IAAA,OAAOA,OAAO;AAChB,EAAA;;AAEA;AACF;AACA;AACA;AACA;AACEI,EAAAA,cAAcA,GACd;AACE,IAAA,OAAO,CAACjB,IAAI,EAAEC,QAAQ,EAAEC,OAAO,KAAK,IAAI,CAACH,OAAO,CAACC,IAAI,EAAEC,QAAQ,EAAEC,OAAO,CAAC;AAC3E,EAAA;;AAEA;AACAgB,EAAAA,KAAKA,GACL;AACE,IAAA,IAAI,CAACvB,QAAQ,CAACwB,KAAK,EAAE;AACvB,EAAA;AACF;;;;"}
@@ -123,4 +123,4 @@ class CjsWebgpuTextureSource {
123
123
  }
124
124
 
125
125
  export { CjsWebgpuTextureSource };
126
- //# sourceMappingURL=textureSource.js.map
126
+ //# sourceMappingURL=CjsWebgpuTextureSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsWebgpuTextureSource.js","sources":["../../../../../src/trinityal/webgpu/core/CjsWebgpuTextureSource.js"],"sourcesContent":["// An effect's named texture to a realized WebGPU texture.\n//\n// This is the last link of the chain and the one that was genuinely missing.\n// Both ends already worked: the format readers decode dds, png, jpeg, tga, gif\n// and webp, and CjsWebgpuDevice realizes a published payload. Nothing joined\n// them, because `TriTextureParameter.SetResource` is never called from src, so\n// an authored texture path never became a bound texture.\n//\n// Carbon binds an already-created texture: TriTextureParameter holds\n// `m_cachedTexture` and CopyToResourceSet hands it straight to the resource-set\n// description (TriTextureParameter.cpp:177-186). Realization happened when the\n// resource loaded, long before the draw.\n//\n// A BROWSER CANNOT DO THAT, and this is the one honest deviation. A texture\n// arrives over the network, so the first frame that wants it may be earlier\n// than the frame that has it. Resolution is therefore asynchronous and\n// idempotent: the same name resolves to the same texture for the life of the\n// resource, and a caller awaits once rather than polling.\n//\n// The sRGB flag travels with the binding, not with the texture: the same bytes\n// are read as colour by one effect and as data by another, which is why Carbon\n// carries it in the resource FLAGS rather than in the texture. See\n// /docs/contracts/texture-sampler-pairing.md for why the sampler pairing cannot\n// come from here.\nimport { ResourceRequirement } from \"#resource/ResourceRequirement\";\n\n\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuTextureSource: ${message}`);\n error.code = \"CJS_WEBGPU_TEXTURE_SOURCE_INVALID\";\n throw error;\n}\n\n\n/** Resolves an effect's named textures against one device and resource manager. */\nexport class CjsWebgpuTextureSource\n{\n _webgpu;\n\n _resourceManager;\n\n _adapterKey;\n\n /** Resource path to the in-flight or settled realization. */\n _realized = new Map();\n\n /**\n * @param {object} webgpu Canonical WebGPU device.\n * @param {object} options Composition.\n * @param {object} options.resourceManager Loads textures by path.\n * @param {string} [options.adapterKey] Adapter slot the realization publishes into.\n */\n constructor(webgpu, options = {})\n {\n if (!webgpu) fail(\"a WebGPU device is required\");\n if (!options.resourceManager) fail(\"a resource manager is required to load textures by path\");\n\n this._webgpu = webgpu;\n this._resourceManager = options.resourceManager;\n this._adapterKey = options.adapterKey ?? \"webgpu\";\n }\n\n /**\n * The realized texture for one of an effect's named resources.\n *\n * Named rather than pathed, because the shader binds by name and only the\n * effect knows which file that name currently points at - a skin changes the\n * path and not the name.\n *\n * @param {string} name Effect resource name, as the shader declares it.\n * @param {object} material Trinity material owning the resource.\n * @returns {Promise<object>} Realized texture bundle.\n */\n async Resolve(name, material)\n {\n const parameter = material?.GetResourceByName?.(name) ?? null;\n\n if (!parameter)\n {\n fail(`effect declares no resource named \"${name}\", so nothing says which file to bind`);\n }\n\n const path = parameter.resourcePath ?? parameter.GetResourcePath?.() ?? \"\";\n\n if (!path)\n {\n fail(`effect resource \"${name}\" names no path; an unset texture cannot be bound`);\n }\n\n const existing = this._realized.get(path);\n\n // Shared rather than re-entered: two batches binding the same texture in one\n // frame is the ordinary case, and realizing it twice would allocate twice.\n if (existing) return existing;\n\n const realization = this._Realize(path, name);\n\n this._realized.set(path, realization);\n\n return realization;\n }\n\n /**\n * Loads and realizes one texture path.\n *\n * @param {string} path Resource path.\n * @param {string} name Effect resource name, for diagnostics.\n * @returns {Promise<object>} Realized bundle.\n */\n async _Realize(path, name)\n {\n const resource = this._resourceManager.GetResource(path, {\n requirement: ResourceRequirement.TEXTURE\n });\n\n if (!resource) fail(`no resource for \"${name}\" at ${JSON.stringify(path)}`);\n\n // The resource publishes its CPU payload before an adapter can be made from\n // it; a texture still in flight is not an error, it is the normal first\n // frame.\n await resource.Ready?.();\n\n return this._webgpu.RealizeRgba8Texture(resource, {\n textureKey: name,\n bundleLabel: `effect texture ${name}`,\n adapterKey: this._adapterKey\n });\n }\n\n /**\n * A resolver hook bound to this source.\n *\n * @returns {Function} `(name, material) => Promise<object>`\n */\n ResolveTexture()\n {\n return (name, material) => this.Resolve(name, material);\n }\n\n /** Forgets every realization, so a device loss can rebuild them. */\n Clear()\n {\n this._realized.clear();\n }\n}\n"],"names":["fail","message","error","Error","code","CjsWebgpuTextureSource","_webgpu","_resourceManager","_adapterKey","_realized","Map","constructor","webgpu","options","resourceManager","adapterKey","Resolve","name","material","parameter","GetResourceByName","path","resourcePath","GetResourcePath","existing","get","realization","_Realize","set","resource","GetResource","requirement","ResourceRequirement","TEXTURE","JSON","stringify","Ready","RealizeRgba8Texture","textureKey","bundleLabel","ResolveTexture","Clear","clear"],"mappings":";;AAAA;A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F,OAAO,CAACC,IAAI,EAAEC,QAAQ,CAAC;AACzD,EAAA;;AAEA;AACAuB,EAAAA,KAAKA,GACL;AACE,IAAA,IAAI,CAAChC,SAAS,CAACiC,KAAK,EAAE;AACxB,EAAA;AACF;;;;"}
@@ -1,10 +1,10 @@
1
1
  import { CjsWebgpuDevice } from '../CjsWebgpuDevice.js';
2
2
  import { CjsTrinityBatchDispatcher } from '#trinity/core/batch/CjsTrinityBatchDispatcher';
3
3
  import { CjsTrinityBatchResolver } from '#trinity/core/batch/CjsTrinityBatchResolver';
4
- import { ITriRenderBatchAccumulator } from '#trinity/core/batch/ITriRenderBatchAccumulator';
5
- import { Tr2RenderBatch } from '#trinity/core/batch/Tr2RenderBatch';
4
+ import { ITriRenderBatchAccumulator } from '#trinity/core/batch/TriRenderBatch/ITriRenderBatchAccumulator';
5
+ import { Tr2RenderBatch } from '#trinity/core/batch/TriRenderBatch/Tr2RenderBatch';
6
6
  import { TriRenderBatchMap } from '#trinity/core/batch/TriRenderBatchMap';
7
- import { DeriveBatchGroups, CjsWebgpuEncodeState } from './batchGroups.js';
7
+ import { DeriveBatchGroups, CjsWebgpuEncodeState } from './CjsWebgpuEncodeState.js';
8
8
  import { TOPOLOGIES } from './topology.js';
9
9
 
10
10
  const MAX_GPU_SIZE_32 = 0xffffffff;
@@ -484,4 +484,4 @@ class CjsWebgpuTrinityBatchDispatcher extends CjsTrinityBatchDispatcher {
484
484
  }
485
485
 
486
486
  export { CjsWebgpuTrinityBatchDispatcher, TOPOLOGIES };
487
- //# sourceMappingURL=trinityBatchDispatcher.js.map
487
+ //# sourceMappingURL=CjsWebgpuTrinityBatchDispatcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsWebgpuTrinityBatchDispatcher.js","sources":["../../../../../src/trinityal/webgpu/core/CjsWebgpuTrinityBatchDispatcher.js"],"sourcesContent":["import { CjsWebgpuDevice } from \"../CjsWebgpuDevice.js\";\nimport { CjsTrinityBatchDispatcher } from \"#trinity/core/batch/CjsTrinityBatchDispatcher\";\nimport { CjsTrinityBatchResolver } from \"#trinity/core/batch/CjsTrinityBatchResolver\";\nimport { ITriRenderBatchAccumulator } from \"#trinity/core/batch/TriRenderBatch/ITriRenderBatchAccumulator\";\nimport { Tr2RenderBatch } from \"#trinity/core/batch/TriRenderBatch/Tr2RenderBatch\";\nimport { TriRenderBatchMap } from \"#trinity/core/batch/TriRenderBatchMap\";\nimport { CjsWebgpuEncodeState, DeriveBatchGroups } from \"./CjsWebgpuEncodeState.js\";\n// Re-exported so existing importers keep working while this file lives; the\n// table itself moved to topology.js, which is not going away.\nimport { TOPOLOGIES } from \"./topology.js\";\n\nexport { TOPOLOGIES };\n\nconst MAX_GPU_SIZE_32 = 0xffffffff;\n\n\nconst PREPARED_BATCHES = new WeakMap();\nconst PREPARED_ACCUMULATORS = new WeakMap();\nconst PREPARED_BATCH_MAPS = new WeakMap();\nconst EMPTY_CONTEXT = Object.freeze({});\n\nfunction fail(message)\n{\n const error = new Error(`CjsWebgpuTrinityBatchDispatcher: ${message}`);\n error.code = \"CJS_WEBGPU_TRINITY_BATCH_INVALID\";\n throw error;\n}\n\nfunction gpuSize32(value, name, owner = \"batch\")\n{\n if (!Number.isSafeInteger(value) || value < 0 || value > MAX_GPU_SIZE_32)\n {\n fail(`${owner} ${name} must be a GPUSize32 value`);\n }\n return value;\n}\n\nfunction signedOffset32(value, name)\n{\n if (!Number.isSafeInteger(value) || value < -0x80000000 || value > 0x7fffffff)\n {\n fail(`resolved geometry draw ${name} must be a GPUSignedOffset32 value`);\n }\n return value;\n}\n\nfunction signedBaseVertex(value)\n{\n const bits = gpuSize32(value, \"baseVertexLocation\");\n return bits > 0x7fffffff ? bits - 0x100000000 : bits;\n}\n\nfunction preparationContext(value)\n{\n if (value === undefined) return EMPTY_CONTEXT;\n if (!value || typeof value !== \"object\" || Array.isArray(value))\n {\n fail(\"preparation context must be an object\");\n }\n const context = { ...value };\n if (context.batchType !== undefined\n && (!Number.isInteger(context.batchType) || context.batchType < 0))\n {\n fail(\"preparation context batchType must be a non-negative integer\");\n }\n return context;\n}\n\n/** Carbon's DEFAULT_TECHNIQUE (Tr2RenderContext.h:37). */\nconst DEFAULT_TECHNIQUE = \"Main\";\n\n/**\n * How many passes this batch's material draws, the way Carbon asks\n * (Tr2RenderContext.cpp:463-471): the material's shader state interface for the\n * technique index, then its pass count, returning zero for either miss so the\n * batch emits nothing.\n *\n * A material that cannot answer draws ONE pass. Carbon has no such material -\n * it always holds a Tr2Material - but a caller that resolves its own pipeline\n * without Trinity reflection means exactly one thing to draw, and refusing it\n * would reject the composition boundary's whole point.\n */\nfunction passCountOf(material, techniqueName)\n{\n // EXPLICIT PROBES, not hedges, and the line below already asked this way.\n // The boundary deliberately accepts a caller's own material - see the\n // paragraph above - so \"does this object answer\" is the real question here.\n const shader = typeof material.GetShaderStateInterface === \"function\"\n ? material.GetShaderStateInterface()\n : null;\n\n if (!shader || typeof shader.GetTechniqueIndex !== \"function\") return 1;\n\n const techniqueIndex = shader.GetTechniqueIndex(techniqueName);\n\n if (!Number.isInteger(techniqueIndex) || techniqueIndex < 0) return 0;\n\n return typeof shader.GetPassCount === \"function\" ? shader.GetPassCount(techniqueIndex) : 0;\n}\n\nfunction geometryDraw(value, indexed)\n{\n if (!value || typeof value !== \"object\" || Array.isArray(value))\n {\n fail(\"ResolveGeometry draw must be an object\");\n }\n if (indexed)\n {\n return {\n indexCount: gpuSize32(value.indexCount, \"indexCount\", \"resolved geometry draw\"),\n instanceCount: gpuSize32(value.instanceCount, \"instanceCount\", \"resolved geometry draw\"),\n firstIndex: gpuSize32(value.firstIndex, \"firstIndex\", \"resolved geometry draw\"),\n baseVertex: signedOffset32(value.baseVertex, \"baseVertex\"),\n firstInstance: gpuSize32(value.firstInstance, \"firstInstance\", \"resolved geometry draw\")\n };\n }\n return {\n vertexCount: gpuSize32(value.vertexCount, \"vertexCount\", \"resolved geometry draw\"),\n instanceCount: gpuSize32(value.instanceCount, \"instanceCount\", \"resolved geometry draw\"),\n firstVertex: gpuSize32(value.firstVertex, \"firstVertex\", \"resolved geometry draw\"),\n firstInstance: gpuSize32(value.firstInstance, \"firstInstance\", \"resolved geometry draw\")\n };\n}\n\nfunction batchDraw(batch, indexed)\n{\n const count = gpuSize32(batch.indexCountPerInstance, \"indexCountPerInstance\");\n const instanceCount = gpuSize32(batch.instanceCount, \"instanceCount\");\n const first = gpuSize32(batch.startIndexLocation, \"startIndexLocation\");\n const firstInstance = gpuSize32(batch.startInstanceLocation, \"startInstanceLocation\");\n if (indexed)\n {\n return {\n indexCount: count,\n instanceCount,\n firstIndex: first,\n baseVertex: signedBaseVertex(batch.baseVertexLocation),\n firstInstance\n };\n }\n return {\n vertexCount: count,\n instanceCount,\n firstVertex: first,\n firstInstance\n };\n}\n\nfunction pipelineRecipe(recipe, topology)\n{\n if (!recipe || typeof recipe !== \"object\" || Array.isArray(recipe))\n {\n fail(\"ResolveMaterial must return a pipeline recipe\");\n }\n const primitive = recipe.primitive ?? {};\n if (!primitive || typeof primitive !== \"object\" || Array.isArray(primitive))\n {\n fail(\"resolved pipeline primitive recipe must be an object\");\n }\n if (primitive.topology !== undefined && primitive.topology !== topology)\n {\n fail(`batch topology ${topology} conflicts with resolved pipeline topology ${primitive.topology}`);\n }\n return {\n ...recipe,\n primitive: {\n ...primitive,\n topology\n }\n };\n}\n\n/**\n * Engine-side adapter for canonical Trinity render batches.\n *\n * Trinity supplies transient CPU references and draw arguments. A nominal\n * composition resolver maps those references to WebGPU-owned material,\n * geometry, and binding objects.\n */\nexport class CjsWebgpuTrinityBatchDispatcher extends CjsTrinityBatchDispatcher\n{\n _webgpu;\n\n _resolver;\n\n /**\n * @param {CjsWebgpuDevice} webgpu Canonical WebGPU device.\n * @param {CjsTrinityBatchResolver} resolver Backend composition resolver.\n * @param {Function} resolver.ResolveMaterial Resolves batch material to\n * { pipeline, recipe, prepareOptions? }; receives immutable preparation\n * context as its third argument.\n * @param {Function} resolver.ResolveGeometry Resolves geometrySource to\n * { geometry, indexed, draw? }; a draw override supplies arguments derived\n * from deferred geometry areas and realized buffer packing. Receives\n * preparation context as its third argument.\n * @param {Function} resolver.ResolveBindings Resolves batch/object data to\n * { uniformData, resources }; receives preparation context as its third\n * argument.\n */\n constructor(webgpu, resolver)\n {\n super();\n if (!(webgpu instanceof CjsWebgpuDevice))\n {\n fail(\"webgpu boundary requires a CjsWebgpuDevice\");\n }\n if (!(resolver instanceof CjsTrinityBatchResolver))\n {\n fail(\"composition resolver requires a CjsTrinityBatchResolver\");\n }\n this._webgpu = webgpu;\n this._resolver = resolver;\n }\n\n /**\n * Resolves and validates one transient Trinity batch into a generation-bound\n * WebGPU draw. External geometry and resources remain owned by their\n * resolvers; the returned handle owns only its binding set.\n */\n async Prepare(batch, context = undefined)\n {\n const preparedContext = preparationContext(context);\n if (!(batch instanceof Tr2RenderBatch)) fail(\"batch must be a Tr2RenderBatch\");\n if (batch.material === null || batch.material === undefined) fail(\"batch material is required\");\n if (batch.geometrySource === null || batch.geometrySource === undefined)\n {\n fail(\"batch geometrySource is required\");\n }\n const topology = TOPOLOGIES[batch.topology];\n if (!topology) fail(`batch topology ${batch.topology} is unsupported`);\n\n // Carbon bails before touching the device when the technique is absent or\n // draws nothing (Tr2RenderContext.cpp:465-471), and so does this.\n const passCount = passCountOf(batch.material, preparedContext.techniqueName ?? DEFAULT_TECHNIQUE);\n\n if (!passCount) return null;\n\n const material = await this._resolver.ResolveMaterial(\n batch.material,\n batch,\n { ...preparedContext, passIndex: 0 }\n );\n if (!material || typeof material !== \"object\" || material.pipeline == null)\n {\n fail(\"ResolveMaterial must return a pipeline and recipe\");\n }\n const geometry = await this._resolver.ResolveGeometry(\n batch.geometrySource,\n batch,\n preparedContext\n );\n if (!geometry || typeof geometry !== \"object\" || geometry.geometry == null\n || typeof geometry.indexed !== \"boolean\")\n {\n fail(\"ResolveGeometry must return geometry and an indexed boolean\");\n }\n const drawArguments = geometry.draw === undefined\n ? batchDraw(batch, geometry.indexed)\n : geometryDraw(geometry.draw, geometry.indexed);\n\n // Carbon resolves the shader program and render states per PASS and the\n // material data per pass as well (Tr2RenderContext.cpp:472-535), so a\n // multi-pass technique yields one pipeline and one binding set per pass over\n // the same geometry and the same draw arguments.\n const passes = [];\n\n try\n {\n for (let passIndex = 0; passIndex < passCount; passIndex += 1)\n {\n const passContext = { ...preparedContext, passIndex };\n\n const perPass = passIndex === 0\n ? material\n : await this._resolver.ResolveMaterial(batch.material, batch, passContext);\n\n if (!perPass || typeof perPass !== \"object\" || perPass.pipeline == null)\n {\n fail(`ResolveMaterial must return a pipeline and recipe for pass ${passIndex}`);\n }\n\n const prepared = await this._webgpu.PreparePipeline(\n perPass.pipeline,\n perPass.prepareOptions ?? { warningsAsErrors: true }\n );\n const livePipeline = await this._webgpu.CreateRenderPipeline(\n prepared,\n pipelineRecipe(perPass.recipe, topology)\n );\n const bindings = await this._resolver.ResolveBindings(batch, batch.objectData, passContext);\n\n if (!bindings || typeof bindings !== \"object\")\n {\n fail(\"ResolveBindings must return uniformData and resources\");\n }\n\n // Recorded BEFORE the draw is made, so a rejected draw still leaves its\n // binding set owned and destroyable by the rollback below.\n const entry = {\n passIndex,\n prepared,\n livePipeline,\n bindingSet: this._webgpu.CreateBindingSet(livePipeline, {\n uniformData: bindings.uniformData,\n resources: bindings.resources\n }),\n draw: null\n };\n\n passes.push(entry);\n\n entry.draw = this._webgpu.CreateDraw(livePipeline, {\n bindingSet: entry.bindingSet,\n geometry: geometry.geometry,\n draw: drawArguments\n });\n }\n }\n catch (error)\n {\n for (const entry of passes) entry.bindingSet.Destroy();\n throw error;\n }\n\n const handle = {\n batch,\n context: preparedContext,\n passes,\n // The first pass's members stay on the handle: grouping compares draws,\n // and a single-pass batch - which is nearly all of them - reads exactly\n // as it did before passes existed.\n prepared: passes[0].prepared,\n livePipeline: passes[0].livePipeline,\n bindingSet: passes[0].bindingSet,\n draw: passes[0].draw\n };\n\n PREPARED_BATCHES.set(handle, { owner: this, destroyed: false });\n\n return handle;\n }\n\n /**\n * Encodes one prepared batch into the supplied render pass.\n *\n * `encodeState` is optional and, when given, elides the sets a previous batch\n * in the same run already performed. A caller encoding a single batch omits\n * it and every set happens.\n */\n Encode(pass, handle, encodeState = null)\n {\n const state = PREPARED_BATCHES.get(handle);\n if (!state || state.owner !== this) fail(\"prepared batch belongs to another dispatcher\");\n if (state.destroyed) fail(\"prepared batch is destroyed\");\n for (const entry of handle.passes) this._webgpu.EncodeDraw(pass, entry.draw, encodeState);\n }\n\n /** Encodes one pass of a prepared batch, for the grouped pass-major walk. */\n _EncodePass(pass, handle, passIndex, encodeState)\n {\n const entry = handle.passes[passIndex];\n\n if (entry) this._webgpu.EncodeDraw(pass, entry.draw, encodeState);\n }\n\n /**\n * Encodes a batch vector run by run, hoisting each run's shared pipeline and\n * buffer bindings to its first batch, as Carbon's RenderBatchGroup hoists\n * them to the group.\n *\n * Order is preserved exactly. Runs are found among ADJACENT batches that\n * already agree; nothing is reordered, because sorting is Trinity's and a\n * reorder here would break golden-image comparison between backends.\n */\n _EncodeGrouped(pass, batches, encodeState)\n {\n for (const group of DeriveBatchGroups(batches, handle => handle?.draw))\n {\n // PASS-MAJOR, as Carbon's RenderBatchGroup is: every batch of the group\n // draws pass 0, then every batch draws pass 1\n // (Tr2RenderContext.cpp:472-535). Encoding batch-major instead would\n // interleave a two-pass effect's passes between objects and change what\n // lands on screen.\n let passCount = 0;\n for (let index = group.start; index < group.end; index += 1)\n {\n passCount = Math.max(passCount, batches[index]?.passes?.length ?? 0);\n }\n\n for (let passIndex = 0; passIndex < passCount; passIndex += 1)\n {\n for (let index = group.start; index < group.end; index += 1)\n {\n this._EncodePass(pass, batches[index], passIndex, encodeState);\n }\n }\n }\n }\n\n /** Releases the prepared batch's owned binding set. */\n Destroy(handle)\n {\n const state = PREPARED_BATCHES.get(handle);\n if (!state || state.owner !== this) fail(\"prepared batch belongs to another dispatcher\");\n if (state.destroyed) return;\n state.destroyed = true;\n for (const entry of handle.passes) entry.bindingSet.Destroy();\n }\n\n /**\n * Snapshots and prepares both vectors of one finalized\n * canonical Trinity batch accumulator. GDPR batches retain their\n * separate identity. Both vectors are grouped at encode time; preparation\n * stays per batch, because a binding set belongs to one batch.\n */\n async PrepareAccumulator(accumulator, context = undefined)\n {\n const preparedContext = preparationContext(context);\n if (!(accumulator instanceof ITriRenderBatchAccumulator))\n {\n fail(\"accumulator must be an ITriRenderBatchAccumulator\");\n }\n const gdprBatches = accumulator.GetGdprBatches();\n const batches = accumulator.GetBatches();\n if (!Array.isArray(gdprBatches) || !Array.isArray(batches))\n {\n fail(\"accumulator batch getters must return arrays\");\n }\n if (accumulator.GetBatchCount() !== gdprBatches.length + batches.length)\n {\n fail(\"accumulator batch count does not match its batch vectors\");\n }\n\n const preparedGdprBatches = [];\n const preparedBatches = [];\n try\n {\n for (const batch of gdprBatches)\n {\n preparedGdprBatches.push(await this.Prepare(batch, preparedContext));\n }\n for (const batch of batches)\n {\n preparedBatches.push(await this.Prepare(batch, preparedContext));\n }\n const handle = {\n accumulator,\n context: preparedContext,\n gdprBatches: preparedGdprBatches.slice(),\n batches: preparedBatches.slice()\n };\n PREPARED_ACCUMULATORS.set(handle, {\n owner: this,\n destroyed: false\n });\n return handle;\n }\n catch (error)\n {\n for (let index = preparedBatches.length - 1; index >= 0; index -= 1)\n {\n this.Destroy(preparedBatches[index]);\n }\n for (let index = preparedGdprBatches.length - 1; index >= 0; index -= 1)\n {\n this.Destroy(preparedGdprBatches[index]);\n }\n throw error;\n }\n }\n\n /**\n * Encodes GDPR then ordinary prepared batches in accumulator order, grouping\n * each vector into hoisted runs.\n *\n * One encode state spans both vectors because they are encoded into one pass\n * and pass state does not reset at a vector boundary; a redundant set there\n * would be as wasteful as one inside a run.\n */\n EncodeAccumulator(pass, handle)\n {\n const state = PREPARED_ACCUMULATORS.get(handle);\n if (!state || state.owner !== this) fail(\"prepared accumulator belongs to another dispatcher\");\n if (state.destroyed) fail(\"prepared accumulator is destroyed\");\n const encodeState = new CjsWebgpuEncodeState();\n this._EncodeGrouped(pass, handle.gdprBatches, encodeState);\n this._EncodeGrouped(pass, handle.batches, encodeState);\n }\n\n /** Releases every binding set owned by a prepared accumulator. */\n DestroyAccumulator(handle)\n {\n const state = PREPARED_ACCUMULATORS.get(handle);\n if (!state || state.owner !== this) fail(\"prepared accumulator belongs to another dispatcher\");\n if (state.destroyed) return;\n state.destroyed = true;\n for (let index = handle.batches.length - 1; index >= 0; index -= 1)\n {\n this.Destroy(handle.batches[index]);\n }\n for (let index = handle.gdprBatches.length - 1; index >= 0; index -= 1)\n {\n this.Destroy(handle.gdprBatches[index]);\n }\n }\n\n /**\n * Snapshots and prepares every accumulator in one\n * canonical TriRenderBatchMap without interpreting batch-type\n * meaning or selecting render passes.\n */\n async PrepareBatchMap(batchMap)\n {\n if (!(batchMap instanceof TriRenderBatchMap))\n {\n fail(\"batch map must be a TriRenderBatchMap\");\n }\n const batchTypes = batchMap.GetBatchTypes();\n if (!Array.isArray(batchTypes)) fail(\"batch map GetBatchTypes must return an array\");\n const seen = new Set();\n for (const batchType of batchTypes)\n {\n if (!Number.isInteger(batchType) || batchType < 0)\n {\n fail(\"batch map types must be non-negative integers\");\n }\n if (seen.has(batchType)) fail(`batch map duplicates batch type ${batchType}`);\n seen.add(batchType);\n }\n\n const entries = [];\n try\n {\n for (const batchType of batchTypes)\n {\n const accumulator = batchMap.GetAccumulator(batchType);\n if (!accumulator) fail(`batch map has no accumulator for type ${batchType}`);\n entries.push({\n batchType,\n accumulator: await this.PrepareAccumulator(accumulator, { batchType })\n });\n }\n const preparedCount = entries.reduce(\n (count, entry) => count\n + entry.accumulator.gdprBatches.length\n + entry.accumulator.batches.length,\n 0\n );\n if (batchMap.GetBatchCount() !== preparedCount)\n {\n fail(\"batch map count does not match its accumulators\");\n }\n const handle = {\n batchMap,\n entries: entries.slice()\n };\n PREPARED_BATCH_MAPS.set(handle, {\n owner: this,\n destroyed: false,\n entries: new Map(entries.map((entry) => [ entry.batchType, entry ]))\n });\n return handle;\n }\n catch (error)\n {\n for (let index = entries.length - 1; index >= 0; index -= 1)\n {\n this.DestroyAccumulator(entries[index].accumulator);\n }\n throw error;\n }\n }\n\n /**\n * Encodes one prepared batch type into a caller-selected compatible render\n * pass.\n */\n EncodeBatchType(pass, handle, batchType)\n {\n const state = PREPARED_BATCH_MAPS.get(handle);\n if (!state || state.owner !== this) fail(\"prepared batch map belongs to another dispatcher\");\n if (state.destroyed) fail(\"prepared batch map is destroyed\");\n const entry = state.entries.get(batchType);\n if (!entry) fail(`prepared batch map has no batch type ${batchType}`);\n this.EncodeAccumulator(pass, entry.accumulator);\n }\n\n /** Releases every accumulator and binding set owned by a prepared batch map. */\n DestroyBatchMap(handle)\n {\n const state = PREPARED_BATCH_MAPS.get(handle);\n if (!state || state.owner !== this) fail(\"prepared batch map belongs to another dispatcher\");\n if (state.destroyed) return;\n state.destroyed = true;\n for (let index = handle.entries.length - 1; index >= 0; index -= 1)\n {\n this.DestroyAccumulator(handle.entries[index].accumulator);\n }\n }\n}\n"],"names":["MAX_GPU_SIZE_32","PREPARED_BATCHES","WeakMap","PREPARED_ACCUMULATORS","PREPARED_BATCH_MAPS","EMPTY_CONTEXT","Object","freeze","fail","message","error","Error","code","gpuSize32","value","name","owner","Number","isSafeInteger","signedOffset32","signedBaseVertex","bits","preparationContext","undefined","Array","isArray","context","batchType","isInteger","DEFAULT_TECHNIQUE","passCountOf","material","techniqueName","shader","GetShaderStateInterface","GetTechniqueIndex","techniqueIndex","GetPassCount","geometryDraw","indexed","indexCount","instanceCount","firstIndex","baseVertex","firstInstance","vertexCount","firstVertex","batchDraw","batch","count","indexCountPerInstance","first","startIndexLocation","startInstanceLocation","baseVertexLocation","pipelineRecipe","recipe","topology","primitive","CjsWebgpuTrinityBatchDispatcher","CjsTrinityBatchDispatcher","_webgpu","_resolver","constructor","webgpu","resolver","CjsWebgpuDevice","CjsTrinityBatchResolver","Prepare","preparedContext","Tr2RenderBatch","geometrySource","TOPOLOGIES","passCount","ResolveMaterial","passIndex","pipeline","geometry","ResolveGeometry","drawArguments","draw","passes","passContext","perPass","prepared","PreparePipeline","prepareOptions","warningsAsErrors","livePipeline","CreateRenderPipeline","bindings","ResolveBindings","objectData","entry","bindingSet","CreateBindingSet","uniformData","resources","push","CreateDraw","Destroy","handle","set","destroyed","Encode","pass","encodeState","state","get","EncodeDraw","_EncodePass","_EncodeGrouped","batches","group","DeriveBatchGroups","index","start","end","Math","max","length","PrepareAccumulator","accumulator","ITriRenderBatchAccumulator","gdprBatches","GetGdprBatches","GetBatches","GetBatchCount","preparedGdprBatches","preparedBatches","slice","EncodeAccumulator","CjsWebgpuEncodeState","DestroyAccumulator","PrepareBatchMap","batchMap","TriRenderBatchMap","batchTypes","GetBatchTypes","seen","Set","has","add","entries","GetAccumulator","preparedCount","reduce","Map","map","EncodeBatchType","DestroyBatchMap"],"mappings":";;;;;;;;;AAaA,MAAMA,eAAe,GAAG,UAAU;AAGlC,MAAMC,gBAAgB,GAAG,IAAIC,OAAO,EAAE;AACtC,MAAMC,qBAAqB,GAAG,IAAID,OAAO,EAAE;AAC3C,MAAME,mBAAmB,GAAG,IAAIF,OAAO,EAAE;AACzC,MAAMG,aAAa,GAAGC,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;AAEvC,SAASC,IAAIA,CAACC,OAAO,EACrB;EACE,MAAMC,KAAK,GAAG,IAAIC,KAAK,CAAC,CAAA,iCAAA,EAAoCF,OAAO,EAAE,CAAC;EACtEC,KAAK,CAACE,IAAI,GAAG,kCAAkC;AAC/C,EAAA,MAAMF,KAAK;AACb;AAEA,SAASG,SAASA,CAACC,KAAK,EAAEC,IAAI,EAAEC,KAAK,GAAG,OAAO,EAC/C;AACE,EAAA,IAAI,CAACC,MAAM,CAACC,aAAa,CAACJ,KAAK,CAAC,IAAIA,KAAK,GAAG,CAAC,IAAIA,KAAK,GAAGd,eAAe,EACxE;AACEQ,IAAAA,IAAI,CAAC,CAAA,EAAGQ,KAAK,CAAA,CAAA,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