@carbonenginejs/runtime-resource 0.9.2 → 0.11.0

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 (544) hide show
  1. package/NOTICE +3 -2
  2. package/README.md +47 -6
  3. package/dist/CjsMotherLode.js +88 -88
  4. package/dist/CjsMotherLode.js.map +1 -1
  5. package/dist/CjsResMan.js +717 -228
  6. package/dist/CjsResMan.js.map +1 -1
  7. package/dist/CjsResManFetchProvider.js +94 -0
  8. package/dist/CjsResManFetchProvider.js.map +1 -0
  9. package/dist/{CjsResManQueue.js → CjsResManWorkQueue.js} +112 -25
  10. package/dist/CjsResManWorkQueue.js.map +1 -0
  11. package/dist/format/CjsBlueReader.js +89 -0
  12. package/dist/format/CjsBlueReader.js.map +1 -1
  13. package/dist/format/CjsFormat.js +42 -16
  14. package/dist/format/CjsFormat.js.map +1 -1
  15. package/dist/format/CjsReader.js +4 -0
  16. package/dist/format/CjsReader.js.map +1 -1
  17. package/dist/format/CjsResourceProbe.js +2 -0
  18. package/dist/format/CjsResourceProbe.js.map +1 -1
  19. package/dist/format/effect/effectPermutationGraph.js +257 -0
  20. package/dist/format/effect/effectPermutationGraph.js.map +1 -0
  21. package/dist/format/effect/effectReflectionPackage.js +636 -0
  22. package/dist/format/effect/effectReflectionPackage.js.map +1 -0
  23. package/dist/format/effect/sha256.js +114 -0
  24. package/dist/format/effect/sha256.js.map +1 -0
  25. package/dist/format/payloadContract.js +20 -0
  26. package/dist/format/payloadContract.js.map +1 -1
  27. package/dist/formats/black/CjsBlackFormat.js +15 -1
  28. package/dist/formats/black/CjsBlackFormat.js.map +1 -1
  29. package/dist/formats/black/core/CjsBlackBinaryReader.js +103 -0
  30. package/dist/formats/black/core/CjsBlackBinaryReader.js.map +1 -1
  31. package/dist/formats/black/core/CjsBlackPropertyReaders.js +61 -0
  32. package/dist/formats/black/core/CjsBlackPropertyReaders.js.map +1 -1
  33. package/dist/formats/black/core/CjsBlackReader.js +125 -0
  34. package/dist/formats/black/core/CjsBlackReader.js.map +1 -1
  35. package/dist/formats/black/core/CjsBlackSchemaRegistry.js +103 -0
  36. package/dist/formats/black/core/CjsBlackSchemaRegistry.js.map +1 -1
  37. package/dist/formats/black/core/helpers.js +17 -0
  38. package/dist/formats/black/core/helpers.js.map +1 -1
  39. package/dist/formats/bnk/CjsBnkFormat.js +8 -0
  40. package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
  41. package/dist/formats/bnk/core/helpers.js +20 -0
  42. package/dist/formats/bnk/core/helpers.js.map +1 -1
  43. package/dist/formats/bnk/core/musicNodes.js +40 -3
  44. package/dist/formats/bnk/core/musicNodes.js.map +1 -1
  45. package/dist/formats/bnk/core/soundbanksInfo.js +2 -0
  46. package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -1
  47. package/dist/formats/cmf/core/binary.js +71 -0
  48. package/dist/formats/cmf/core/binary.js.map +1 -1
  49. package/dist/formats/cmf/core/buffers.js +4 -0
  50. package/dist/formats/cmf/core/buffers.js.map +1 -1
  51. package/dist/formats/cmf/core/helpers.js +31 -0
  52. package/dist/formats/cmf/core/helpers.js.map +1 -1
  53. package/dist/formats/cmf/core/schema.js +10 -0
  54. package/dist/formats/cmf/core/schema.js.map +1 -1
  55. package/dist/formats/cmf/core/shared.js +9 -0
  56. package/dist/formats/cmf/core/shared.js.map +1 -1
  57. package/dist/formats/cmf/core/writer.js +54 -0
  58. package/dist/formats/cmf/core/writer.js.map +1 -1
  59. package/dist/formats/dds/core/bc6h.js +10 -0
  60. package/dist/formats/dds/core/bc6h.js.map +1 -1
  61. package/dist/formats/dds/core/bc7.js +16 -0
  62. package/dist/formats/dds/core/bc7.js.map +1 -1
  63. package/dist/formats/dds/core/helpers.js +47 -0
  64. package/dist/formats/dds/core/helpers.js.map +1 -1
  65. package/dist/formats/dxbc/CjsDxbcFormat.js +142 -0
  66. package/dist/formats/dxbc/CjsDxbcFormat.js.map +1 -0
  67. package/dist/formats/dxbc/core/DxbcReader.js +266 -0
  68. package/dist/formats/dxbc/core/DxbcReader.js.map +1 -0
  69. package/dist/formats/dxbc/core/container.js +169 -0
  70. package/dist/formats/dxbc/core/container.js.map +1 -0
  71. package/dist/formats/dxbc/core/decoder.js +789 -0
  72. package/dist/formats/dxbc/core/decoder.js.map +1 -0
  73. package/dist/formats/dxbc/core/errors.js +19 -0
  74. package/dist/formats/dxbc/core/errors.js.map +1 -0
  75. package/dist/formats/dxbc/core/helpers.js +220 -0
  76. package/dist/formats/dxbc/core/helpers.js.map +1 -0
  77. package/dist/formats/dxbc/core/opcodes.js +45 -0
  78. package/dist/formats/dxbc/core/opcodes.js.map +1 -0
  79. package/dist/formats/dxbc/core/program.js +91 -0
  80. package/dist/formats/dxbc/core/program.js.map +1 -0
  81. package/dist/formats/dxbc/core/signature.js +172 -0
  82. package/dist/formats/dxbc/core/signature.js.map +1 -0
  83. package/dist/formats/dxbc/index.js +2 -0
  84. package/dist/formats/dxbc/index.js.map +1 -0
  85. package/dist/formats/fbx/core/helpers.js +21 -0
  86. package/dist/formats/fbx/core/helpers.js.map +1 -1
  87. package/dist/formats/flac/CjsFlacFormat.js +49 -0
  88. package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
  89. package/dist/formats/flac/core/helpers.js +20 -0
  90. package/dist/formats/flac/core/helpers.js.map +1 -1
  91. package/dist/formats/gif/CjsGifFormat.js +49 -0
  92. package/dist/formats/gif/CjsGifFormat.js.map +1 -1
  93. package/dist/formats/gif/core/helpers.js +20 -0
  94. package/dist/formats/gif/core/helpers.js.map +1 -1
  95. package/dist/formats/gltf/core/helpers.js +15 -0
  96. package/dist/formats/gltf/core/helpers.js.map +1 -1
  97. package/dist/formats/gltf/core/parser.js +13 -0
  98. package/dist/formats/gltf/core/parser.js.map +1 -1
  99. package/dist/formats/gltf/core/targets.js +10 -0
  100. package/dist/formats/gltf/core/targets.js.map +1 -1
  101. package/dist/formats/gr2/core/bitknit2.js +2 -0
  102. package/dist/formats/gr2/core/bitknit2.js.map +1 -1
  103. package/dist/formats/gr2/core/helpers.js +20 -0
  104. package/dist/formats/gr2/core/helpers.js.map +1 -1
  105. package/dist/formats/gr2/core/targets.js +10 -0
  106. package/dist/formats/gr2/core/targets.js.map +1 -1
  107. package/dist/formats/hlsl/CjsHlslFormat.js +254 -0
  108. package/dist/formats/hlsl/CjsHlslFormat.js.map +1 -0
  109. package/dist/formats/hlsl/core/HlslBinaryUtils.js +15 -0
  110. package/dist/formats/hlsl/core/HlslBinaryUtils.js.map +1 -0
  111. package/dist/formats/hlsl/core/HlslEffectReadError.js +19 -0
  112. package/dist/formats/hlsl/core/HlslEffectReadError.js.map +1 -0
  113. package/dist/formats/hlsl/core/HlslEffectStateManager.js +130 -0
  114. package/dist/formats/hlsl/core/HlslEffectStateManager.js.map +1 -0
  115. package/dist/formats/hlsl/core/HlslReader.js +266 -0
  116. package/dist/formats/hlsl/core/HlslReader.js.map +1 -0
  117. package/dist/formats/hlsl/core/HlslRenderStateSetup.js +37 -0
  118. package/dist/formats/hlsl/core/HlslRenderStateSetup.js.map +1 -0
  119. package/dist/formats/hlsl/core/HlslResourceSetDescription.js +94 -0
  120. package/dist/formats/hlsl/core/HlslResourceSetDescription.js.map +1 -0
  121. package/dist/formats/hlsl/core/HlslShaderBytecode.js +44 -0
  122. package/dist/formats/hlsl/core/HlslShaderBytecode.js.map +1 -0
  123. package/dist/formats/hlsl/core/analysis.js +51 -0
  124. package/dist/formats/hlsl/core/analysis.js.map +1 -0
  125. package/dist/formats/hlsl/core/helpers.js +270 -0
  126. package/dist/formats/hlsl/core/helpers.js.map +1 -0
  127. package/dist/formats/hlsl/core/json.js +284 -0
  128. package/dist/formats/hlsl/core/json.js.map +1 -0
  129. package/dist/formats/hlsl/core/metadata.js +327 -0
  130. package/dist/formats/hlsl/core/metadata.js.map +1 -0
  131. package/dist/formats/hlsl/core/portableReflection.js +848 -0
  132. package/dist/formats/hlsl/core/portableReflection.js.map +1 -0
  133. package/dist/formats/hlsl/core/render-states.js +280 -0
  134. package/dist/formats/hlsl/core/render-states.js.map +1 -0
  135. package/dist/formats/hlsl/core/tr2/HlslRenderContextEnum.js +43 -0
  136. package/dist/formats/hlsl/core/tr2/HlslRenderContextEnum.js.map +1 -0
  137. package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +294 -0
  138. package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -0
  139. package/dist/formats/hlsl/core/tr2/resources/HlslShaderPermutation.js +33 -0
  140. package/dist/formats/hlsl/core/tr2/resources/HlslShaderPermutation.js.map +1 -0
  141. package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js +416 -0
  142. package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js.map +1 -0
  143. package/dist/formats/hlsl/core/tr2/shader/HlslEffectConstant.js +40 -0
  144. package/dist/formats/hlsl/core/tr2/shader/HlslEffectConstant.js.map +1 -0
  145. package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js +742 -0
  146. package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js.map +1 -0
  147. package/dist/formats/hlsl/core/tr2/shader/HlslEffectLibrary.js +52 -0
  148. package/dist/formats/hlsl/core/tr2/shader/HlslEffectLibrary.js.map +1 -0
  149. package/dist/formats/hlsl/core/tr2/shader/HlslEffectParameterAnnotation.js +38 -0
  150. package/dist/formats/hlsl/core/tr2/shader/HlslEffectParameterAnnotation.js.map +1 -0
  151. package/dist/formats/hlsl/core/tr2/shader/HlslEffectResource.js +50 -0
  152. package/dist/formats/hlsl/core/tr2/shader/HlslEffectResource.js.map +1 -0
  153. package/dist/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js +86 -0
  154. package/dist/formats/hlsl/core/tr2/shader/HlslEffectStageInput.js.map +1 -0
  155. package/dist/formats/hlsl/core/tr2/shader/HlslEffectTechnique.js +31 -0
  156. package/dist/formats/hlsl/core/tr2/shader/HlslEffectTechnique.js.map +1 -0
  157. package/dist/formats/hlsl/core/tr2/shader/HlslPass.js +42 -0
  158. package/dist/formats/hlsl/core/tr2/shader/HlslPass.js.map +1 -0
  159. package/dist/formats/hlsl/core/tr2/shader/HlslSamplerDescription.js +55 -0
  160. package/dist/formats/hlsl/core/tr2/shader/HlslSamplerDescription.js.map +1 -0
  161. package/dist/formats/hlsl/core/tr2/shader/HlslSamplerSetup.js +29 -0
  162. package/dist/formats/hlsl/core/tr2/shader/HlslSamplerSetup.js.map +1 -0
  163. package/dist/formats/hlsl/core/tr2/shader/HlslShader.js +220 -0
  164. package/dist/formats/hlsl/core/tr2/shader/HlslShader.js.map +1 -0
  165. package/dist/formats/hlsl/core/tr2/shader/HlslShaderOption.js +30 -0
  166. package/dist/formats/hlsl/core/tr2/shader/HlslShaderOption.js.map +1 -0
  167. package/dist/formats/hlsl/index.js +2 -0
  168. package/dist/formats/hlsl/index.js.map +1 -0
  169. package/dist/formats/hlsl/portable.js +2 -0
  170. package/dist/formats/hlsl/portable.js.map +1 -0
  171. package/dist/formats/index.js +4 -0
  172. package/dist/formats/index.js.map +1 -1
  173. package/dist/formats/jpeg/core/helpers.js +52 -0
  174. package/dist/formats/jpeg/core/helpers.js.map +1 -1
  175. package/dist/formats/jpeg/core/jpeg.js +93 -0
  176. package/dist/formats/jpeg/core/jpeg.js.map +1 -1
  177. package/dist/formats/mp3/core/helpers.js +37 -0
  178. package/dist/formats/mp3/core/helpers.js.map +1 -1
  179. package/dist/formats/mp4/core/helpers.js +35 -0
  180. package/dist/formats/mp4/core/helpers.js.map +1 -1
  181. package/dist/formats/ogg/CjsOggFormat.js +49 -0
  182. package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
  183. package/dist/formats/ogg/core/helpers.js +23 -0
  184. package/dist/formats/ogg/core/helpers.js.map +1 -1
  185. package/dist/formats/ogg/core/vorbis.js +13 -0
  186. package/dist/formats/ogg/core/vorbis.js.map +1 -1
  187. package/dist/formats/png/core/helpers.js +52 -0
  188. package/dist/formats/png/core/helpers.js.map +1 -1
  189. package/dist/formats/red/CjsRedFormat.js +2 -0
  190. package/dist/formats/red/CjsRedFormat.js.map +1 -1
  191. package/dist/formats/red/core/CjsRedReader.js +52 -0
  192. package/dist/formats/red/core/CjsRedReader.js.map +1 -1
  193. package/dist/formats/red/core/helpers.js +19 -0
  194. package/dist/formats/red/core/helpers.js.map +1 -1
  195. package/dist/formats/stl/core/stl.js +8 -0
  196. package/dist/formats/stl/core/stl.js.map +1 -1
  197. package/dist/formats/stl/core/targets.js +10 -0
  198. package/dist/formats/stl/core/targets.js.map +1 -1
  199. package/dist/formats/tga/core/helpers.js +47 -0
  200. package/dist/formats/tga/core/helpers.js.map +1 -1
  201. package/dist/formats/wav/core/helpers.js +37 -0
  202. package/dist/formats/wav/core/helpers.js.map +1 -1
  203. package/dist/formats/webgl/CjsWebglFormat.js +221 -0
  204. package/dist/formats/webgl/CjsWebglFormat.js.map +1 -0
  205. package/dist/formats/webgl/core/cewg/CewgPackage.js +339 -0
  206. package/dist/formats/webgl/core/cewg/CewgPackage.js.map +1 -0
  207. package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js +104 -0
  208. package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js.map +1 -0
  209. package/dist/formats/webgl/core/cewg/binary.js +101 -0
  210. package/dist/formats/webgl/core/cewg/binary.js.map +1 -0
  211. package/dist/formats/webgl/core/cewgCompleteness.js +81 -0
  212. package/dist/formats/webgl/core/cewgCompleteness.js.map +1 -0
  213. package/dist/formats/webgl/core/effectPackage.js +789 -0
  214. package/dist/formats/webgl/core/effectPackage.js.map +1 -0
  215. package/dist/formats/webgl/core/effectPackageValidation.js +331 -0
  216. package/dist/formats/webgl/core/effectPackageValidation.js.map +1 -0
  217. package/dist/formats/webgl/core/errors.js +27 -0
  218. package/dist/formats/webgl/core/errors.js.map +1 -0
  219. package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +2678 -0
  220. package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -0
  221. package/dist/formats/webgl/core/glsl/DxbcGlslHelpers.js +89 -0
  222. package/dist/formats/webgl/core/glsl/DxbcGlslHelpers.js.map +1 -0
  223. package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +428 -0
  224. package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -0
  225. package/dist/formats/webgl/core/helpers.js +306 -0
  226. package/dist/formats/webgl/core/helpers.js.map +1 -0
  227. package/dist/formats/webgl/index.js +2 -0
  228. package/dist/formats/webgl/index.js.map +1 -0
  229. package/dist/formats/webgpu/CjsWebgpuFormat.js +376 -0
  230. package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -0
  231. package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js +415 -0
  232. package/dist/formats/webgpu/core/cewgpu/CewgpuPackage.js.map +1 -0
  233. package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js +100 -0
  234. package/dist/formats/webgpu/core/cewgpu/CewgpuPackageBuilder.js.map +1 -0
  235. package/dist/formats/webgpu/core/cewgpu/binary.js +93 -0
  236. package/dist/formats/webgpu/core/cewgpu/binary.js.map +1 -0
  237. package/dist/formats/webgpu/core/cewgpu/tags.js +17 -0
  238. package/dist/formats/webgpu/core/cewgpu/tags.js.map +1 -0
  239. package/dist/formats/webgpu/core/effectAnalysis.js +82 -0
  240. package/dist/formats/webgpu/core/effectAnalysis.js.map +1 -0
  241. package/dist/formats/webgpu/core/effectBackendBodySet.js +305 -0
  242. package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -0
  243. package/dist/formats/webgpu/core/effectPackageValidation.js +1078 -0
  244. package/dist/formats/webgpu/core/effectPackageValidation.js.map +1 -0
  245. package/dist/formats/webgpu/core/errors.js +20 -0
  246. package/dist/formats/webgpu/core/errors.js.map +1 -0
  247. package/dist/formats/webgpu/core/helpers.js +448 -0
  248. package/dist/formats/webgpu/core/helpers.js.map +1 -0
  249. package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js +223 -0
  250. package/dist/formats/webgpu/core/ir/analyzeRegisterValues.js.map +1 -0
  251. package/dist/formats/webgpu/core/ir/buildControlFlow.js +220 -0
  252. package/dist/formats/webgpu/core/ir/buildControlFlow.js.map +1 -0
  253. package/dist/formats/webgpu/core/ir/indexableTemps.js +137 -0
  254. package/dist/formats/webgpu/core/ir/indexableTemps.js.map +1 -0
  255. package/dist/formats/webgpu/core/ir/inferValueTypes.js +454 -0
  256. package/dist/formats/webgpu/core/ir/inferValueTypes.js.map +1 -0
  257. package/dist/formats/webgpu/core/ir/lowerDxbcToIr.js +494 -0
  258. package/dist/formats/webgpu/core/ir/lowerDxbcToIr.js.map +1 -0
  259. package/dist/formats/webgpu/core/ir/resolveRegisterFlow.js +177 -0
  260. package/dist/formats/webgpu/core/ir/resolveRegisterFlow.js.map +1 -0
  261. package/dist/formats/webgpu/core/ir/sourceLanes.js +61 -0
  262. package/dist/formats/webgpu/core/ir/sourceLanes.js.map +1 -0
  263. package/dist/formats/webgpu/core/packageEffect.js +300 -0
  264. package/dist/formats/webgpu/core/packageEffect.js.map +1 -0
  265. package/dist/formats/webgpu/core/packageEffectSelection.js +164 -0
  266. package/dist/formats/webgpu/core/packageEffectSelection.js.map +1 -0
  267. package/dist/formats/webgpu/core/packageMetadata.js +8 -0
  268. package/dist/formats/webgpu/core/packageMetadata.js.map +1 -0
  269. package/dist/formats/webgpu/core/schema.js +4 -0
  270. package/dist/formats/webgpu/core/schema.js.map +1 -0
  271. package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +275 -0
  272. package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -0
  273. package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js +182 -0
  274. package/dist/formats/webgpu/core/wgsl/buildWgslBindingPlan.js.map +1 -0
  275. package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +324 -0
  276. package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -0
  277. package/dist/formats/webgpu/core/wgsl/emitWgsl.js +356 -0
  278. package/dist/formats/webgpu/core/wgsl/emitWgsl.js.map +1 -0
  279. package/dist/formats/webgpu/core/wgsl/hoistEscapingValues.js +77 -0
  280. package/dist/formats/webgpu/core/wgsl/hoistEscapingValues.js.map +1 -0
  281. package/dist/formats/webgpu/core/wgsl/lowerBindingLayout.js +451 -0
  282. package/dist/formats/webgpu/core/wgsl/lowerBindingLayout.js.map +1 -0
  283. package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js +754 -0
  284. package/dist/formats/webgpu/core/wgsl/lowerComputeProgram.js.map +1 -0
  285. package/dist/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js +457 -0
  286. package/dist/formats/webgpu/core/wgsl/lowerCreateHistogramsComputeProgram.js.map +1 -0
  287. package/dist/formats/webgpu/core/wgsl/lowerFragmentProgram.js +1572 -0
  288. package/dist/formats/webgpu/core/wgsl/lowerFragmentProgram.js.map +1 -0
  289. package/dist/formats/webgpu/core/wgsl/lowerMergeHistogramsComputeProgram.js +659 -0
  290. package/dist/formats/webgpu/core/wgsl/lowerMergeHistogramsComputeProgram.js.map +1 -0
  291. package/dist/formats/webgpu/core/wgsl/lowerParticleClearComputePrograms.js +734 -0
  292. package/dist/formats/webgpu/core/wgsl/lowerParticleClearComputePrograms.js.map +1 -0
  293. package/dist/formats/webgpu/core/wgsl/lowerParticleEmitComputeProgram.js +583 -0
  294. package/dist/formats/webgpu/core/wgsl/lowerParticleEmitComputeProgram.js.map +1 -0
  295. package/dist/formats/webgpu/core/wgsl/lowerSkinVerticesComputeProgram.js +621 -0
  296. package/dist/formats/webgpu/core/wgsl/lowerSkinVerticesComputeProgram.js.map +1 -0
  297. package/dist/formats/webgpu/core/wgsl/lowerSortComputeProgram.js +824 -0
  298. package/dist/formats/webgpu/core/wgsl/lowerSortComputeProgram.js.map +1 -0
  299. package/dist/formats/webgpu/core/wgsl/lowerSortInnerComputeProgram.js +697 -0
  300. package/dist/formats/webgpu/core/wgsl/lowerSortInnerComputeProgram.js.map +1 -0
  301. package/dist/formats/webgpu/core/wgsl/lowerSortStepComputeProgram.js +559 -0
  302. package/dist/formats/webgpu/core/wgsl/lowerSortStepComputeProgram.js.map +1 -0
  303. package/dist/formats/webgpu/core/wgsl/lowerVertexProgram.js +1328 -0
  304. package/dist/formats/webgpu/core/wgsl/lowerVertexProgram.js.map +1 -0
  305. package/dist/formats/webgpu/core/wgsl/particleEmitSemanticDigest.js +110 -0
  306. package/dist/formats/webgpu/core/wgsl/particleEmitSemanticDigest.js.map +1 -0
  307. package/dist/formats/webgpu/core/wgsl/precisionControls.js +55 -0
  308. package/dist/formats/webgpu/core/wgsl/precisionControls.js.map +1 -0
  309. package/dist/formats/webgpu/core/wgsl/selectionPlans.js +758 -0
  310. package/dist/formats/webgpu/core/wgsl/selectionPlans.js.map +1 -0
  311. package/dist/formats/webgpu/core/wgsl/uniformity.js +78 -0
  312. package/dist/formats/webgpu/core/wgsl/uniformity.js.map +1 -0
  313. package/dist/formats/webgpu/core/wgsl/validateExactComputeIr.js +196 -0
  314. package/dist/formats/webgpu/core/wgsl/validateExactComputeIr.js.map +1 -0
  315. package/dist/formats/webgpu/core/wgsl/validateHandleOperand.js +37 -0
  316. package/dist/formats/webgpu/core/wgsl/validateHandleOperand.js.map +1 -0
  317. package/dist/formats/webgpu/index.js +2 -0
  318. package/dist/formats/webgpu/index.js.map +1 -0
  319. package/dist/formats/webm/core/helpers.js +35 -0
  320. package/dist/formats/webm/core/helpers.js.map +1 -1
  321. package/dist/formats/webp/CjsWebpFormat.js +49 -0
  322. package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
  323. package/dist/formats/webp/core/helpers.js +23 -0
  324. package/dist/formats/webp/core/helpers.js.map +1 -1
  325. package/dist/formats/wem/CjsWemFormat.js +8 -0
  326. package/dist/formats/wem/CjsWemFormat.js.map +1 -1
  327. package/dist/formats/wem/core/bitStream.js +2 -0
  328. package/dist/formats/wem/core/bitStream.js.map +1 -1
  329. package/dist/formats/wem/core/helpers.js +20 -0
  330. package/dist/formats/wem/core/helpers.js.map +1 -1
  331. package/dist/formats/yaml/CjsYamlFormat.js +45 -0
  332. package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
  333. package/dist/formats/yaml/core/CjsYamlReader.js +91 -0
  334. package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
  335. package/dist/formats/yaml/core/helpers.js +10 -0
  336. package/dist/formats/yaml/core/helpers.js.map +1 -1
  337. package/dist/index.js +56 -43
  338. package/dist/index.js.map +1 -1
  339. package/dist/{CjsResource.js → resource/CjsResource.js} +232 -17
  340. package/dist/resource/CjsResource.js.map +1 -0
  341. package/dist/{resources → resource}/Tr2LightProfileRes.js +4 -3
  342. package/dist/resource/Tr2LightProfileRes.js.map +1 -0
  343. package/dist/{resources → resource/audio}/AudioGeometryResData.js +1 -1
  344. package/dist/resource/audio/AudioGeometryResData.js.map +1 -0
  345. package/dist/resource/audio/CjsAudioBufferRes.js +86 -0
  346. package/dist/resource/audio/CjsAudioBufferRes.js.map +1 -0
  347. package/dist/resource/audio/CjsAudioRes.js +213 -0
  348. package/dist/resource/audio/CjsAudioRes.js.map +1 -0
  349. package/dist/resource/audio/index.js +4 -0
  350. package/dist/resource/audio/index.js.map +1 -0
  351. package/dist/{resources → resource/geometry}/MeshDecalData.js +1 -1
  352. package/dist/resource/geometry/MeshDecalData.js.map +1 -0
  353. package/dist/{resources → resource/geometry}/MeshDecalLodData.js +1 -1
  354. package/dist/resource/geometry/MeshDecalLodData.js.map +1 -0
  355. package/dist/resource/geometry/TriGeometryRes.js +656 -0
  356. package/dist/resource/geometry/TriGeometryRes.js.map +1 -0
  357. package/dist/{resources → resource/geometry}/TriGeometryResAreaData.js +1 -1
  358. package/dist/resource/geometry/TriGeometryResAreaData.js.map +1 -0
  359. package/dist/{resources → resource/geometry}/TriGeometryResJointData.js +1 -1
  360. package/dist/resource/geometry/TriGeometryResJointData.js.map +1 -0
  361. package/dist/{resources → resource/geometry}/TriGeometryResLodData.js +1 -1
  362. package/dist/resource/geometry/TriGeometryResLodData.js.map +1 -0
  363. package/dist/{resources → resource/geometry}/TriGeometryResMeshData.js +1 -1
  364. package/dist/resource/geometry/TriGeometryResMeshData.js.map +1 -0
  365. package/dist/{resources → resource/geometry}/TriGeometryResSkeletonData.js +1 -1
  366. package/dist/resource/geometry/TriGeometryResSkeletonData.js.map +1 -0
  367. package/dist/{resources → resource/geometry}/TriJointBinding.js +1 -1
  368. package/dist/resource/geometry/TriJointBinding.js.map +1 -0
  369. package/dist/{resources → resource/geometry}/TriMorphTargetGeometryConstants.js +1 -1
  370. package/dist/resource/geometry/TriMorphTargetGeometryConstants.js.map +1 -0
  371. package/dist/{resources → resource/geometry}/TriRtGeometryConstants.js +1 -1
  372. package/dist/resource/geometry/TriRtGeometryConstants.js.map +1 -0
  373. package/dist/{resources → resource/geometry/granny}/GStateBindingCallbackData.js +1 -1
  374. package/dist/resource/geometry/granny/GStateBindingCallbackData.js.map +1 -0
  375. package/dist/{resources → resource/geometry/granny}/Tr2GrannyIntersectionResult.js +1 -1
  376. package/dist/resource/geometry/granny/Tr2GrannyIntersectionResult.js.map +1 -0
  377. package/dist/{resources → resource/geometry/granny}/Tr2GrannyStateRes.js +6 -5
  378. package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -0
  379. package/dist/{resources → resource/geometry/granny}/TriGrannyRes.js +6 -5
  380. package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -0
  381. package/dist/{resources → resource/geometry/granny}/enums.js +1 -9
  382. package/dist/resource/geometry/granny/enums.js.map +1 -0
  383. package/dist/resource/geometry/granny/index.js +6 -0
  384. package/dist/resource/geometry/granny/index.js.map +1 -0
  385. package/dist/resource/geometry/index.js +17 -0
  386. package/dist/resource/geometry/index.js.map +1 -0
  387. package/dist/resource/index.js +52 -0
  388. package/dist/resource/index.js.map +1 -0
  389. package/dist/resource/resourceBoundary.js +64 -0
  390. package/dist/resource/resourceBoundary.js.map +1 -0
  391. package/dist/resource/shader/Tr2EffectRes.js +429 -0
  392. package/dist/resource/shader/Tr2EffectRes.js.map +1 -0
  393. package/dist/resource/shader/Tr2MaterialArea.js +34 -0
  394. package/dist/resource/shader/Tr2MaterialArea.js.map +1 -0
  395. package/dist/resource/shader/Tr2MaterialMesh.js +30 -0
  396. package/dist/resource/shader/Tr2MaterialMesh.js.map +1 -0
  397. package/dist/resource/shader/Tr2MaterialRes.js +35 -0
  398. package/dist/resource/shader/Tr2MaterialRes.js.map +1 -0
  399. package/dist/resource/shader/Tr2Shader.js +256 -0
  400. package/dist/resource/shader/Tr2Shader.js.map +1 -0
  401. package/dist/resource/shader/Tr2ShaderPermutation.js +47 -0
  402. package/dist/resource/shader/Tr2ShaderPermutation.js.map +1 -0
  403. package/dist/resource/shader/index.js +17 -0
  404. package/dist/resource/shader/index.js.map +1 -0
  405. package/dist/resource/shader/portable.js +33 -0
  406. package/dist/resource/shader/portable.js.map +1 -0
  407. package/dist/resource/shader/reflection/Tr2EffectConstant.js +135 -0
  408. package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -0
  409. package/dist/resource/shader/reflection/Tr2EffectDefine.js +28 -0
  410. package/dist/resource/shader/reflection/Tr2EffectDefine.js.map +1 -0
  411. package/dist/resource/shader/reflection/Tr2EffectDescription.js +107 -0
  412. package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -0
  413. package/dist/resource/shader/reflection/Tr2EffectLibrary.js +145 -0
  414. package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -0
  415. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +103 -0
  416. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -0
  417. package/dist/resource/shader/reflection/Tr2EffectResource.js +84 -0
  418. package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -0
  419. package/dist/resource/shader/reflection/Tr2EffectStageInput.js +239 -0
  420. package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -0
  421. package/dist/resource/shader/reflection/Tr2EffectTechnique.js +66 -0
  422. package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -0
  423. package/dist/resource/shader/reflection/Tr2Pass.js +109 -0
  424. package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -0
  425. package/dist/resource/shader/sampler/Tr2SamplerSetup.js +75 -0
  426. package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -0
  427. package/dist/{texture → resource/texture}/CjsTextureArrayRes.js +83 -6
  428. package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -0
  429. package/dist/{texture/CjsTextureParameterProxy.js → resource/texture/CjsTextureArrayResParameterProxy.js} +56 -10
  430. package/dist/resource/texture/CjsTextureArrayResParameterProxy.js.map +1 -0
  431. package/dist/{resources → resource/texture}/Tr2ImageRes.js +6 -4
  432. package/dist/resource/texture/Tr2ImageRes.js.map +1 -0
  433. package/dist/{resources → resource/texture}/Tr2TextureLodManager.js +3 -1
  434. package/dist/resource/texture/Tr2TextureLodManager.js.map +1 -0
  435. package/dist/{resources → resource/texture}/Tr2TextureLodUpdateRequest.js +1 -1
  436. package/dist/resource/texture/Tr2TextureLodUpdateRequest.js.map +1 -0
  437. package/dist/{resources → resource/texture}/Tr2TexturePackChannel.js +1 -1
  438. package/dist/resource/texture/Tr2TexturePackChannel.js.map +1 -0
  439. package/dist/{resources → resource/texture}/Tr2TexturePipeline.js +6 -4
  440. package/dist/resource/texture/Tr2TexturePipeline.js.map +1 -0
  441. package/dist/{resources → resource/texture}/Tr2TexturePipelineParams.js +1 -1
  442. package/dist/resource/texture/Tr2TexturePipelineParams.js.map +1 -0
  443. package/dist/{resources → resource/texture}/Tr2TexturePipelineStepCompress.js +1 -1
  444. package/dist/resource/texture/Tr2TexturePipelineStepCompress.js.map +1 -0
  445. package/dist/{resources → resource/texture}/Tr2TexturePipelineStepGenerateMips.js +1 -1
  446. package/dist/resource/texture/Tr2TexturePipelineStepGenerateMips.js.map +1 -0
  447. package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLimitSize.js +1 -1
  448. package/dist/resource/texture/Tr2TexturePipelineStepLimitSize.js.map +1 -0
  449. package/dist/{resources → resource/texture}/Tr2TexturePipelineStepLoad.js +1 -1
  450. package/dist/resource/texture/Tr2TexturePipelineStepLoad.js.map +1 -0
  451. package/dist/{resources → resource/texture}/Tr2TexturePipelineStepPack.js +1 -1
  452. package/dist/resource/texture/Tr2TexturePipelineStepPack.js.map +1 -0
  453. package/dist/{resources → resource/texture}/TriTextureRes.js +42 -26
  454. package/dist/resource/texture/TriTextureRes.js.map +1 -0
  455. package/dist/resource/texture/index.js +15 -0
  456. package/dist/resource/texture/index.js.map +1 -0
  457. package/dist/{resources → resource/texture}/texturePipelineBehavior.js +59 -59
  458. package/dist/resource/texture/texturePipelineBehavior.js.map +1 -0
  459. package/dist/worker/CjsResManMainThreadLoader.js +87 -0
  460. package/dist/worker/CjsResManMainThreadLoader.js.map +1 -0
  461. package/dist/worker/CjsResManWorker.js +217 -0
  462. package/dist/worker/CjsResManWorker.js.map +1 -0
  463. package/dist/worker/CjsResManWorkerLoader.js +434 -0
  464. package/dist/worker/CjsResManWorkerLoader.js.map +1 -0
  465. package/dist/worker/protocol.js +12 -0
  466. package/dist/worker/protocol.js.map +1 -0
  467. package/docs/README.md +16 -3
  468. package/docs/architecture.md +39 -16
  469. package/docs/concepts/resource-lifecycle.md +2 -1
  470. package/docs/formats/README.md +8 -0
  471. package/docs/formats/provenance.md +11 -3
  472. package/docs/reference/classes/README.md +6 -4
  473. package/docs/reference/classes/audio.md +30 -0
  474. package/docs/reference/classes/core.md +31 -11
  475. package/docs/reference/classes/formats.md +440 -0
  476. package/docs/reference/classes/resources.md +151 -41
  477. package/docs/reference/classes/texture.md +7 -7
  478. package/docs/reference/motherlode-cache.md +17 -0
  479. package/docs/reference/queues.md +9 -1
  480. package/docs/reference/workers.md +135 -0
  481. package/docs/roadmap.md +27 -1
  482. package/format-notices/dxbc/LICENSE +21 -0
  483. package/format-notices/dxbc/NOTICE +20 -0
  484. package/format-notices/hlsl/LICENSE +21 -0
  485. package/format-notices/hlsl/NOTICE +25 -0
  486. package/format-notices/webgl/LICENSE +21 -0
  487. package/format-notices/webgl/NOTICE +35 -0
  488. package/format-notices/webgpu/LICENSE +21 -0
  489. package/format-notices/webgpu/NOTICE +31 -0
  490. package/package.json +13 -1
  491. package/dist/CjsResManQueue.js.map +0 -1
  492. package/dist/CjsResource.js.map +0 -1
  493. package/dist/CjsResourceSource.js +0 -68
  494. package/dist/CjsResourceSource.js.map +0 -1
  495. package/dist/resourcePath.js +0 -18
  496. package/dist/resourcePath.js.map +0 -1
  497. package/dist/resourceStates.js +0 -9
  498. package/dist/resourceStates.js.map +0 -1
  499. package/dist/resources/AudioGeometryResData.js.map +0 -1
  500. package/dist/resources/GStateBindingCallbackData.js.map +0 -1
  501. package/dist/resources/MeshDecalData.js.map +0 -1
  502. package/dist/resources/MeshDecalLodData.js.map +0 -1
  503. package/dist/resources/Tr2EffectRes.js +0 -71
  504. package/dist/resources/Tr2EffectRes.js.map +0 -1
  505. package/dist/resources/Tr2GrannyIntersectionResult.js.map +0 -1
  506. package/dist/resources/Tr2GrannyStateRes.js.map +0 -1
  507. package/dist/resources/Tr2ImageRes.js.map +0 -1
  508. package/dist/resources/Tr2LightProfileRes.js.map +0 -1
  509. package/dist/resources/Tr2MaterialArea.js +0 -34
  510. package/dist/resources/Tr2MaterialArea.js.map +0 -1
  511. package/dist/resources/Tr2MaterialMesh.js +0 -31
  512. package/dist/resources/Tr2MaterialMesh.js.map +0 -1
  513. package/dist/resources/Tr2MaterialRes.js +0 -34
  514. package/dist/resources/Tr2MaterialRes.js.map +0 -1
  515. package/dist/resources/Tr2ShaderPermutation.js +0 -43
  516. package/dist/resources/Tr2ShaderPermutation.js.map +0 -1
  517. package/dist/resources/Tr2TextureLodManager.js.map +0 -1
  518. package/dist/resources/Tr2TextureLodUpdateRequest.js.map +0 -1
  519. package/dist/resources/Tr2TexturePackChannel.js.map +0 -1
  520. package/dist/resources/Tr2TexturePipeline.js.map +0 -1
  521. package/dist/resources/Tr2TexturePipelineParams.js.map +0 -1
  522. package/dist/resources/Tr2TexturePipelineStepCompress.js.map +0 -1
  523. package/dist/resources/Tr2TexturePipelineStepGenerateMips.js.map +0 -1
  524. package/dist/resources/Tr2TexturePipelineStepLimitSize.js.map +0 -1
  525. package/dist/resources/Tr2TexturePipelineStepLoad.js.map +0 -1
  526. package/dist/resources/Tr2TexturePipelineStepPack.js.map +0 -1
  527. package/dist/resources/TriGeometryRes.js +0 -239
  528. package/dist/resources/TriGeometryRes.js.map +0 -1
  529. package/dist/resources/TriGeometryResAreaData.js.map +0 -1
  530. package/dist/resources/TriGeometryResJointData.js.map +0 -1
  531. package/dist/resources/TriGeometryResLodData.js.map +0 -1
  532. package/dist/resources/TriGeometryResMeshData.js.map +0 -1
  533. package/dist/resources/TriGeometryResSkeletonData.js.map +0 -1
  534. package/dist/resources/TriGrannyRes.js.map +0 -1
  535. package/dist/resources/TriJointBinding.js.map +0 -1
  536. package/dist/resources/TriMorphTargetGeometryConstants.js.map +0 -1
  537. package/dist/resources/TriRtGeometryConstants.js.map +0 -1
  538. package/dist/resources/TriTextureRes.js.map +0 -1
  539. package/dist/resources/enums.js.map +0 -1
  540. package/dist/resources/resourceBoundary.js +0 -47
  541. package/dist/resources/resourceBoundary.js.map +0 -1
  542. package/dist/resources/texturePipelineBehavior.js.map +0 -1
  543. package/dist/texture/CjsTextureArrayRes.js.map +0 -1
  544. package/dist/texture/CjsTextureParameterProxy.js.map +0 -1
@@ -0,0 +1,107 @@
1
+ import { CjsSchema, type } from '@carbonenginejs/runtime-utils/schema';
2
+ import { CjsModel } from '@carbonenginejs/runtime-utils/model';
3
+ import { isPlainObject, isArray } from '@carbonenginejs/runtime-utils/is';
4
+ import { Tr2EffectParameterAnnotation } from './Tr2EffectParameterAnnotation.js';
5
+ import { Tr2EffectTechnique } from './Tr2EffectTechnique.js';
6
+
7
+ // Source: trinity/trinity/Shader/Tr2EffectDescription.h
8
+ // Source: trinity/trinity/Shader/Tr2EffectDescription.cpp
9
+
10
+ /** Complete device-free effect description for one selected shader body. */
11
+ class Tr2EffectDescription extends CjsModel {
12
+ /** techniques (TrackableStdVector<Tr2EffectTechnique>) */
13
+ techniques = [];
14
+
15
+ /** annotations (Tr2EffectAnnotationMap) */
16
+ annotations = new Map();
17
+
18
+ /**
19
+ * Construct a canonical effect description from JS/JSON model values.
20
+ *
21
+ * @param {object} values Canonical model values.
22
+ * @param {object} options CjsModel import options.
23
+ * @returns {Tr2EffectDescription} Hydrated description.
24
+ */
25
+ static from(values = {}, options = {}) {
26
+ let normalized = values;
27
+ let annotations = null;
28
+ if (values && Object.hasOwn(values, "annotations")) {
29
+ const entries = values.annotations instanceof Map ? values.annotations : Object.entries(values.annotations ?? {});
30
+ annotations = new Map();
31
+ for (const [parameterName, records] of entries) {
32
+ if (!Array.isArray(records)) {
33
+ throw new TypeError(`Effect annotations for "${parameterName}" must be an array`);
34
+ }
35
+ annotations.set(String(parameterName), records.map(record => record instanceof Tr2EffectParameterAnnotation ? record : Tr2EffectParameterAnnotation.from(record, options)));
36
+ }
37
+ normalized = {
38
+ ...values,
39
+ annotations
40
+ };
41
+ }
42
+ const effect = super.from(normalized, options);
43
+ if (annotations) {
44
+ effect.annotations = annotations;
45
+ }
46
+ return effect;
47
+ }
48
+
49
+ /**
50
+ * Build one complete effect description from its portable JSON record.
51
+ *
52
+ * @param {object} value Portable effect-description record.
53
+ * @returns {Tr2EffectDescription} Reflected description.
54
+ */
55
+ static fromPortable(value) {
56
+ if (!isPlainObject(value)) {
57
+ throw new TypeError("Portable effect description must be an object");
58
+ }
59
+ if (!isArray(value.annotations)) {
60
+ throw new TypeError("Portable effect annotation groups must be an array");
61
+ }
62
+ if (!isArray(value.techniques)) {
63
+ throw new TypeError("Portable effect techniques must be an array");
64
+ }
65
+ if (value.annotationGroupCount !== value.annotations.length || value.techniqueCount !== value.techniques.length) {
66
+ throw new Error("Portable effect description counts disagree with its collections");
67
+ }
68
+ const effect = new this();
69
+ effect.annotations = this.readPortableAnnotationGroups(value.annotations);
70
+ effect.techniques = value.techniques.map(entry => Tr2EffectTechnique.fromPortable(entry));
71
+ return effect;
72
+ }
73
+
74
+ /** Build parameter-name-indexed annotation groups. */
75
+ static readPortableAnnotationGroups(values) {
76
+ const result = new Map();
77
+ for (const value of values) {
78
+ if (!isPlainObject(value)) {
79
+ throw new TypeError("Portable effect annotation group must be an object");
80
+ }
81
+ const parameterName = String(value.parameterName ?? "");
82
+ if (!isArray(value.annotations)) {
83
+ throw new TypeError(`Portable annotations for parameter "${parameterName}" must be an array`);
84
+ }
85
+ if (result.has(parameterName)) {
86
+ throw new Error(`Portable effect annotation group "${parameterName}" is duplicated`);
87
+ }
88
+ result.set(parameterName, value.annotations.map(entry => Tr2EffectParameterAnnotation.fromPortable(entry)));
89
+ }
90
+ return result;
91
+ }
92
+ }
93
+
94
+ // Declared imperatively rather than with decorators, so this module stays
95
+ // plain ESM that loads from source without a transform. The decorator
96
+ // expressions are reused verbatim, so the registered metadata is identical.
97
+ // Statics belong in `methods`: decorateMethod targets the prototype and
98
+ // would register a static as an instance field.
99
+ CjsSchema.define(Tr2EffectDescription, {
100
+ className: "Tr2EffectDescription",
101
+ family: "shader"
102
+ });
103
+ CjsSchema.decorateField(Tr2EffectDescription, "techniques", type.list("Tr2EffectTechnique"));
104
+ CjsSchema.decorateField(Tr2EffectDescription, "annotations", type.map("Tr2EffectParameterAnnotationMap"));
105
+
106
+ export { Tr2EffectDescription };
107
+ //# sourceMappingURL=Tr2EffectDescription.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tr2EffectDescription.js","sources":["../../../../../src/resource/shader/reflection/Tr2EffectDescription.js"],"sourcesContent":["// Source: trinity/trinity/Shader/Tr2EffectDescription.h\n// Source: trinity/trinity/Shader/Tr2EffectDescription.cpp\nimport { CjsSchema, impl, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\nimport {\n isArray,\n isPlainObject\n} from \"@carbonenginejs/runtime-utils/is\";\nimport { Tr2EffectParameterAnnotation } from \"./Tr2EffectParameterAnnotation.js\";\nimport { Tr2EffectTechnique } from \"./Tr2EffectTechnique.js\";\n\n/** Complete device-free effect description for one selected shader body. */\nexport class Tr2EffectDescription extends CjsModel\n{\n\n /** techniques (TrackableStdVector<Tr2EffectTechnique>) */\n techniques = [];\n\n /** annotations (Tr2EffectAnnotationMap) */\n annotations = new Map();\n\n /**\n * Construct a canonical effect description from JS/JSON model values.\n *\n * @param {object} values Canonical model values.\n * @param {object} options CjsModel import options.\n * @returns {Tr2EffectDescription} Hydrated description.\n */\n static from(values = {}, options = {})\n {\n let normalized = values;\n let annotations = null;\n if (values && Object.hasOwn(values, \"annotations\"))\n {\n const entries = values.annotations instanceof Map\n ? values.annotations\n : Object.entries(values.annotations ?? {});\n annotations = new Map();\n for (const [ parameterName, records ] of entries)\n {\n if (!Array.isArray(records))\n {\n throw new TypeError(\n `Effect annotations for \"${parameterName}\" must be an array`\n );\n }\n annotations.set(\n String(parameterName),\n records.map(record => record instanceof Tr2EffectParameterAnnotation\n ? record\n : Tr2EffectParameterAnnotation.from(record, options))\n );\n }\n normalized = { ...values, annotations };\n }\n const effect = super.from(normalized, options);\n if (annotations)\n {\n effect.annotations = annotations;\n }\n return effect;\n }\n\n /**\n * Build one complete effect description from its portable JSON record.\n *\n * @param {object} value Portable effect-description record.\n * @returns {Tr2EffectDescription} Reflected description.\n */\n static fromPortable(value)\n {\n if (!isPlainObject(value))\n {\n throw new TypeError(\"Portable effect description must be an object\");\n }\n if (!isArray(value.annotations))\n {\n throw new TypeError(\n \"Portable effect annotation groups must be an array\"\n );\n }\n if (!isArray(value.techniques))\n {\n throw new TypeError(\"Portable effect techniques must be an array\");\n }\n if (value.annotationGroupCount !== value.annotations.length\n || value.techniqueCount !== value.techniques.length)\n {\n throw new Error(\n \"Portable effect description counts disagree with its collections\"\n );\n }\n\n const effect = new this();\n effect.annotations = this.readPortableAnnotationGroups(\n value.annotations\n );\n effect.techniques = value.techniques.map(\n entry => Tr2EffectTechnique.fromPortable(entry)\n );\n return effect;\n }\n\n /** Build parameter-name-indexed annotation groups. */\n static readPortableAnnotationGroups(values)\n {\n const result = new Map();\n for (const value of values)\n {\n if (!isPlainObject(value))\n {\n throw new TypeError(\n \"Portable effect annotation group must be an object\"\n );\n }\n const parameterName = String(value.parameterName ?? \"\");\n if (!isArray(value.annotations))\n {\n throw new TypeError(\n `Portable annotations for parameter \"${parameterName}\" must be an array`\n );\n }\n if (result.has(parameterName))\n {\n throw new Error(\n `Portable effect annotation group \"${parameterName}\" is duplicated`\n );\n }\n result.set(\n parameterName,\n value.annotations.map(\n entry => Tr2EffectParameterAnnotation.fromPortable(entry)\n )\n );\n }\n return result;\n }\n\n}\n\n// Declared imperatively rather than with decorators, so this module stays\n// plain ESM that loads from source without a transform. The decorator\n// expressions are reused verbatim, so the registered metadata is identical.\n// Statics belong in `methods`: decorateMethod targets the prototype and\n// would register a static as an instance field.\nCjsSchema.define(Tr2EffectDescription, {\n className: \"Tr2EffectDescription\",\n family: \"shader\"\n});\nCjsSchema.decorateField(Tr2EffectDescription, \"techniques\", type.list(\"Tr2EffectTechnique\"));\nCjsSchema.decorateField(Tr2EffectDescription, \"annotations\", type.map(\"Tr2EffectParameterAnnotationMap\"));\n"],"names":["Tr2EffectDescription","CjsModel","techniques","annotations","Map","from","values","options","normalized","Object","hasOwn","entries","parameterName","records","Array","isArray","TypeError","set","String","map","record","Tr2EffectParameterAnnotation","effect","fromPortable","value","isPlainObject","annotationGroupCount","length","techniqueCount","Error","readPortableAnnotationGroups","entry","Tr2EffectTechnique","result","has","CjsSchema","define","className","family","decorateField","type","list"],"mappings":";;;;;;AAAA;AACA;;AAUA;AACO,MAAMA,oBAAoB,SAASC,QAAQ,CAClD;AAEE;AACAC,EAAAA,UAAU,GAAG,EAAE;;AAEf;AACAC,EAAAA,WAAW,GAAG,IAAIC,GAAG,EAAE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aAAa,IAAI,EAAE,CAAC;AACvD,MAAA,IAAI,CAACG,OAAO,CAACS,KAAK,CAACrB,WAAW,CAAC,EAC/B;AACE,QAAA,MAAM,IAAIa,SAAS,CACjB,CAAA,oCAAA,EAAuCJ,aAAa,oBACtD,CAAC;AACH,MAAA;AACA,MAAA,IAAIqB,MAAM,CAACC,GAAG,CAACtB,aAAa,CAAC,EAC7B;AACE,QAAA,MAAM,IAAIiB,KAAK,CACb,CAAA,kCAAA,EAAqCjB,aAAa,iBACpD,CAAC;AACH,MAAA;MACAqB,MAAM,CAAChB,GAAG,CACRL,aAAa,EACbY,KAAK,CAACrB,WAAW,CAACgB,GAAG,CACnBY,KAAK,IAAIV,4BAA4B,CAACE,YAAY,CAACQ,KAAK,CAC1D,CACF,CAAC;AACH,IAAA;AACA,IAAA,OAAOE,MAAM;AACf,EAAA;AAEF;;AAEA;AACA;AACA;AACA;AACA;AACAE,SAAS,CAACC,MAAM,CAACpC,oBAAoB,EAAE;AACrCqC,EAAAA,SAAS,EAAE,sBAAsB;AACjCC,EAAAA,MAAM,EAAE;AACV,CAAC,CAAC;AACFH,SAAS,CAACI,aAAa,CAACvC,oBAAoB,EAAE,YAAY,EAAEwC,IAAI,CAACC,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAC5FN,SAAS,CAACI,aAAa,CAACvC,oBAAoB,EAAE,aAAa,EAAEwC,IAAI,CAACrB,GAAG,CAAC,iCAAiC,CAAC,CAAC;;;;"}
@@ -0,0 +1,145 @@
1
+ import { CjsSchema, type, impl } from '@carbonenginejs/runtime-utils/schema';
2
+ import { CjsModel } from '@carbonenginejs/runtime-utils/model';
3
+ import { isPlainObject, isArray, isUint32 } from '@carbonenginejs/runtime-utils/is';
4
+ import { clonePortableSourceProgram } from '../portable.js';
5
+ import { Tr2EffectStageInput } from './Tr2EffectStageInput.js';
6
+
7
+ // Source: trinity/trinity/Shader/Tr2EffectDescription.h
8
+
9
+ /** Reflected shader-library metadata. */
10
+ class Tr2EffectLibrary extends CjsModel {
11
+ /** payloadSize (uint32_t) */
12
+ payloadSize = 0;
13
+
14
+ /** libraryHandle (uint32_t) */
15
+ libraryHandle = 0;
16
+
17
+ /** rayGenName (BlueSharedStringW) */
18
+ rayGenName = "";
19
+
20
+ /** missName (BlueSharedStringW) */
21
+ missName = "";
22
+
23
+ /** closestHitName (BlueSharedStringW) */
24
+ closestHitName = "";
25
+
26
+ /** anyHitName (BlueSharedStringW) */
27
+ anyHitName = "";
28
+
29
+ /** intersectionName (BlueSharedStringW) */
30
+ intersectionName = "";
31
+
32
+ /** hitGroupName (BlueSharedStringW) */
33
+ hitGroupName = "";
34
+
35
+ /** globalInput (Tr2EffectStageInput) */
36
+ globalInput = null;
37
+
38
+ /** localInput (Tr2EffectStageInput) */
39
+ localInput = null;
40
+
41
+ /** globalResourceSetDesc (Tr2ResourceSetDescriptionAL) */
42
+ globalResourceSetDesc = null;
43
+
44
+ /** Exact source library program metadata and owned bytes. */
45
+ sourceProgram = null;
46
+
47
+ /** Portable export records retained before backend library registration. */
48
+ exports = [];
49
+
50
+ /**
51
+ * Construct one canonical library from JS/JSON model values.
52
+ *
53
+ * @param {object} values Canonical model values.
54
+ * @param {object} options CjsModel import options.
55
+ * @returns {Tr2EffectLibrary} Hydrated library.
56
+ */
57
+ static from(values = {}, options = {}) {
58
+ let normalized = values;
59
+ const inputs = new Map();
60
+ for (const field of ["globalInput", "localInput"]) {
61
+ if (values?.[field] && !(values[field] instanceof Tr2EffectStageInput)) {
62
+ normalized = normalized === values ? {
63
+ ...values
64
+ } : normalized;
65
+ normalized[field] = Tr2EffectStageInput.from(values[field], options);
66
+ inputs.set(field, normalized[field]);
67
+ }
68
+ }
69
+ const library = super.from(normalized, options);
70
+ for (const [field, value] of inputs) {
71
+ library[field] = value;
72
+ }
73
+ return library;
74
+ }
75
+
76
+ /**
77
+ * Build one shader library from its portable JSON reflection record.
78
+ *
79
+ * @param {object} value Portable library record.
80
+ * @returns {Tr2EffectLibrary} Reflected library.
81
+ */
82
+ static fromPortable(value) {
83
+ if (!isPlainObject(value)) {
84
+ throw new TypeError("Portable effect library must be an object");
85
+ }
86
+ if (!isArray(value.exports)) {
87
+ throw new TypeError("Portable effect library exports must be an array");
88
+ }
89
+ if (value.exportCount !== value.exports.length) {
90
+ throw new Error("Portable effect library export count disagrees with its collection");
91
+ }
92
+ const library = new this();
93
+ if (!isUint32(value.payloadSize)) {
94
+ throw new RangeError("Portable effect library payload size must fit uint32");
95
+ }
96
+ library.payloadSize = value.payloadSize;
97
+ library.hitGroupName = String(value.hitGroupName ?? "");
98
+ library.exports = value.exports.map(entry => {
99
+ if (!isUint32(entry?.type)) {
100
+ throw new RangeError("Portable effect library export type must fit uint32");
101
+ }
102
+ return {
103
+ type: entry.type,
104
+ name: String(entry?.name ?? "")
105
+ };
106
+ });
107
+ for (const entry of library.exports) {
108
+ if (entry.type === 0) library.rayGenName = entry.name;
109
+ if (entry.type === 1) library.missName = entry.name;
110
+ if (entry.type === 2) library.closestHitName = entry.name;
111
+ if (entry.type === 3) library.anyHitName = entry.name;
112
+ if (entry.type === 4) library.intersectionName = entry.name;
113
+ }
114
+ library.sourceProgram = clonePortableSourceProgram(value.sourceProgram, "library");
115
+ library.globalInput = Tr2EffectStageInput.fromPortableInput(value.globalInput);
116
+ library.localInput = Tr2EffectStageInput.fromPortableInput(value.localInput);
117
+ return library;
118
+ }
119
+ }
120
+
121
+ // Declared imperatively rather than with decorators, so this module stays
122
+ // plain ESM that loads from source without a transform. The decorator
123
+ // expressions are reused verbatim, so the registered metadata is identical.
124
+ // Statics belong in `methods`: decorateMethod targets the prototype and
125
+ // would register a static as an instance field.
126
+ CjsSchema.define(Tr2EffectLibrary, {
127
+ className: "Tr2EffectLibrary",
128
+ family: "shader"
129
+ });
130
+ CjsSchema.decorateField(Tr2EffectLibrary, "payloadSize", type.uint32);
131
+ CjsSchema.decorateField(Tr2EffectLibrary, "libraryHandle", type.uint32);
132
+ CjsSchema.decorateField(Tr2EffectLibrary, "rayGenName", type.string);
133
+ CjsSchema.decorateField(Tr2EffectLibrary, "missName", type.string);
134
+ CjsSchema.decorateField(Tr2EffectLibrary, "closestHitName", type.string);
135
+ CjsSchema.decorateField(Tr2EffectLibrary, "anyHitName", type.string);
136
+ CjsSchema.decorateField(Tr2EffectLibrary, "intersectionName", type.string);
137
+ CjsSchema.decorateField(Tr2EffectLibrary, "hitGroupName", type.string);
138
+ CjsSchema.decorateField(Tr2EffectLibrary, "globalInput", type.rawStruct("Tr2EffectStageInput"));
139
+ CjsSchema.decorateField(Tr2EffectLibrary, "localInput", type.rawStruct("Tr2EffectStageInput"));
140
+ CjsSchema.decorateField(Tr2EffectLibrary, "globalResourceSetDesc", type.rawStruct("Tr2ResourceSetDescriptionAL"));
141
+ CjsSchema.decorateField(Tr2EffectLibrary, "sourceProgram", impl.adapted, impl.reason("Carbon registers the library with the renderer while reading; the device-free graph retains the source program for later engine realization."), type.rawStruct("CjsEffectSourceProgram"));
142
+ CjsSchema.decorateField(Tr2EffectLibrary, "exports", impl.adapted, impl.reason("Carbon resolves these exports into a renderer library handle; the device-free graph keeps the declarative export list."), type.rawStruct("CjsEffectLibraryExports"));
143
+
144
+ export { Tr2EffectLibrary };
145
+ //# sourceMappingURL=Tr2EffectLibrary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tr2EffectLibrary.js","sources":["../../../../../src/resource/shader/reflection/Tr2EffectLibrary.js"],"sourcesContent":["// Source: trinity/trinity/Shader/Tr2EffectDescription.h\nimport { CjsSchema, impl, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\nimport {\n isArray,\n isPlainObject,\n isUint32\n} from \"@carbonenginejs/runtime-utils/is\";\nimport { clonePortableSourceProgram } from \"../portable.js\";\nimport { Tr2EffectStageInput } from \"./Tr2EffectStageInput.js\";\n\n/** Reflected shader-library metadata. */\nexport class Tr2EffectLibrary extends CjsModel\n{\n\n /** payloadSize (uint32_t) */\n payloadSize = 0;\n\n /** libraryHandle (uint32_t) */\n libraryHandle = 0;\n\n /** rayGenName (BlueSharedStringW) */\n rayGenName = \"\";\n\n /** missName (BlueSharedStringW) */\n missName = \"\";\n\n /** closestHitName (BlueSharedStringW) */\n closestHitName = \"\";\n\n /** anyHitName (BlueSharedStringW) */\n anyHitName = \"\";\n\n /** intersectionName (BlueSharedStringW) */\n intersectionName = \"\";\n\n /** hitGroupName (BlueSharedStringW) */\n hitGroupName = \"\";\n\n /** globalInput (Tr2EffectStageInput) */\n globalInput = null;\n\n /** localInput (Tr2EffectStageInput) */\n localInput = null;\n\n /** globalResourceSetDesc (Tr2ResourceSetDescriptionAL) */\n globalResourceSetDesc = null;\n\n /** Exact source library program metadata and owned bytes. */\n sourceProgram = null;\n\n /** Portable export records retained before backend library registration. */\n exports = [];\n\n /**\n * Construct one canonical library from JS/JSON model values.\n *\n * @param {object} values Canonical model values.\n * @param {object} options CjsModel import options.\n * @returns {Tr2EffectLibrary} Hydrated library.\n */\n static from(values = {}, options = {})\n {\n let normalized = values;\n const inputs = new Map();\n for (const field of [ \"globalInput\", \"localInput\" ])\n {\n if (values?.[field]\n && !(values[field] instanceof Tr2EffectStageInput))\n {\n normalized = normalized === values ? { ...values } : normalized;\n normalized[field] = Tr2EffectStageInput.from(\n values[field],\n options\n );\n inputs.set(field, normalized[field]);\n }\n }\n const library = super.from(normalized, options);\n for (const [ field, value ] of inputs)\n {\n library[field] = value;\n }\n return library;\n }\n\n /**\n * Build one shader library from its portable JSON reflection record.\n *\n * @param {object} value Portable library record.\n * @returns {Tr2EffectLibrary} Reflected library.\n */\n static fromPortable(value)\n {\n if (!isPlainObject(value))\n {\n throw new TypeError(\"Portable effect library must be an object\");\n }\n if (!isArray(value.exports))\n {\n throw new TypeError(\n \"Portable effect library exports must be an array\"\n );\n }\n if (value.exportCount !== value.exports.length)\n {\n throw new Error(\n \"Portable effect library export count disagrees with its collection\"\n );\n }\n\n const library = new this();\n if (!isUint32(value.payloadSize))\n {\n throw new RangeError(\n \"Portable effect library payload size must fit uint32\"\n );\n }\n library.payloadSize = value.payloadSize;\n library.hitGroupName = String(value.hitGroupName ?? \"\");\n library.exports = value.exports.map(entry =>\n {\n if (!isUint32(entry?.type))\n {\n throw new RangeError(\n \"Portable effect library export type must fit uint32\"\n );\n }\n return {\n type: entry.type,\n name: String(entry?.name ?? \"\")\n };\n });\n for (const entry of library.exports)\n {\n if (entry.type === 0) library.rayGenName = entry.name;\n if (entry.type === 1) library.missName = entry.name;\n if (entry.type === 2) library.closestHitName = entry.name;\n if (entry.type === 3) library.anyHitName = entry.name;\n if (entry.type === 4) library.intersectionName = entry.name;\n }\n library.sourceProgram = clonePortableSourceProgram(\n value.sourceProgram,\n \"library\"\n );\n library.globalInput = Tr2EffectStageInput.fromPortableInput(\n value.globalInput\n );\n library.localInput = Tr2EffectStageInput.fromPortableInput(\n value.localInput\n );\n return library;\n }\n\n}\n\n// Declared imperatively rather than with decorators, so this module stays\n// plain ESM that loads from source without a transform. The decorator\n// expressions are reused verbatim, so the registered metadata is identical.\n// Statics belong in `methods`: decorateMethod targets the prototype and\n// would register a static as an instance field.\nCjsSchema.define(Tr2EffectLibrary, {\n className: \"Tr2EffectLibrary\",\n family: \"shader\"\n});\nCjsSchema.decorateField(Tr2EffectLibrary, \"payloadSize\", type.uint32);\nCjsSchema.decorateField(Tr2EffectLibrary, \"libraryHandle\", type.uint32);\nCjsSchema.decorateField(Tr2EffectLibrary, \"rayGenName\", type.string);\nCjsSchema.decorateField(Tr2EffectLibrary, \"missName\", type.string);\nCjsSchema.decorateField(Tr2EffectLibrary, \"closestHitName\", type.string);\nCjsSchema.decorateField(Tr2EffectLibrary, \"anyHitName\", type.string);\nCjsSchema.decorateField(Tr2EffectLibrary, \"intersectionName\", type.string);\nCjsSchema.decorateField(Tr2EffectLibrary, \"hitGroupName\", type.string);\nCjsSchema.decorateField(Tr2EffectLibrary, \"globalInput\", type.rawStruct(\"Tr2EffectStageInput\"));\nCjsSchema.decorateField(Tr2EffectLibrary, \"localInput\", type.rawStruct(\"Tr2EffectStageInput\"));\nCjsSchema.decorateField(Tr2EffectLibrary, \"globalResourceSetDesc\", type.rawStruct(\"Tr2ResourceSetDescriptionAL\"));\nCjsSchema.decorateField(Tr2EffectLibrary, \"sourceProgram\", impl.adapted, impl.reason(\"Carbon registers the library with the renderer while reading; the device-free graph retains the source program for later engine realization.\"), type.rawStruct(\"CjsEffectSourceProgram\"));\nCjsSchema.decorateField(Tr2EffectLibrary, \"exports\", impl.adapted, impl.reason(\"Carbon resolves these exports into a renderer library handle; the device-free graph keeps the declarative export list.\"), type.rawStruct(\"CjsEffectLibraryExports\"));\n"],"names":["Tr2EffectLibrary","CjsModel","payloadSize","libraryHandle","rayGenName","missName","closestHitName","anyHitName","intersectionName","hitGroupName","globalInput","localInput","globalResourceSetDesc","sourceProgram","exports","from","values","options","normalized","inputs","Map","field","Tr2EffectStageInput","set","library","value","fromPortable","isPlainObject","TypeError","isArray","exportCount","length","Error","isUint32","RangeError","String","map","entry","type","name","clonePortableSourceProgram","fromPortableInput","CjsSchema","define","className","family","decorateField","uint32","string","rawStruct","impl","adapted","reason"],"mappings":";;;;;;AAAA;;AAWA;AACO,MAAMA,gBAAgB,SAASC,QAAQ,CAC9C;AAEE;AACAC,EAAAA,WAAW,GAAG,CAAC;;AAEf;AACAC,EAAAA,aAAa,GAAG,CAAC;;AAEjB;AACAC,EAAAA,UAAU,GAAG,EAAE;;AAEf;AACAC,EAAAA,QAAQ,GAAG,EAAE;;AAEb;AACAC,EAAAA,cAAc,GAAG,EAAE;;AAEnB;AACAC,EAAAA,UAAU,GAAG,EAAE;;AAEf;AACAC,EAAAA,gBAAgB,GAAG,EAAE;;AAErB;AACAC,EAAAA,YAAY,GAAG,EAAE;;AAEjB;AACAC,EAAAA,WAAW,GAAG,IAAI;;AAElB;AACAC,EAAAA,UAAU,GAAG,IAAI;;AAEjB;AACAC,EAAAA,qBAAqB,GAAG,IAAI;;AAE5B;AACAC,EA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,CAAC9C,gBAAgB,EAAE,kBAAkB,EAAEsC,IAAI,CAACU,MAAM,CAAC;AAC1EN,SAAS,CAACI,aAAa,CAAC9C,gBAAgB,EAAE,cAAc,EAAEsC,IAAI,CAACU,MAAM,CAAC;AACtEN,SAAS,CAACI,aAAa,CAAC9C,gBAAgB,EAAE,aAAa,EAAEsC,IAAI,CAACW,SAAS,CAAC,qBAAqB,CAAC,CAAC;AAC/FP,SAAS,CAACI,aAAa,CAAC9C,gBAAgB,EAAE,YAAY,EAAEsC,IAAI,CAACW,SAAS,CAAC,qBAAqB,CAAC,CAAC;AAC9FP,SAAS,CAACI,aAAa,CAAC9C,gBAAgB,EAAE,uBAAuB,EAAEsC,IAAI,CAACW,SAAS,CAAC,6BAA6B,CAAC,CAAC;AACjHP,SAAS,CAACI,aAAa,CAAC9C,gBAAgB,EAAE,eAAe,EAAEkD,IAAI,CAACC,OAAO,EAAED,IAAI,CAACE,MAAM,CAAC,8IAA8I,CAAC,EAAEd,IAAI,CAACW,SAAS,CAAC,wBAAwB,CAAC,CAAC;AAC/QP,SAAS,CAACI,aAAa,CAAC9C,gBAAgB,EAAE,SAAS,EAAEkD,IAAI,CAACC,OAAO,EAAED,IAAI,CAACE,MAAM,CAAC,wHAAwH,CAAC,EAAEd,IAAI,CAACW,SAAS,CAAC,yBAAyB,CAAC,CAAC;;;;"}
@@ -0,0 +1,103 @@
1
+ import { CjsSchema, type, schema, impl } from '@carbonenginejs/runtime-utils/schema';
2
+ import { CjsModel } from '@carbonenginejs/runtime-utils/model';
3
+ import { dwordToFloat } from '@carbonenginejs/runtime-utils/math/num';
4
+ import { isPlainObject, isUint32 } from '@carbonenginejs/runtime-utils/is';
5
+
6
+ // Source: trinity/trinity/Shader/Tr2EffectDescription.h
7
+
8
+ /** Typed annotation attached to a reflected effect parameter. */
9
+ class Tr2EffectParameterAnnotation extends CjsModel {
10
+ /** name (const char*) */
11
+ name = "";
12
+
13
+ /** type (Type - enum Type) */
14
+ type = 0;
15
+
16
+ /** boolValue (bool) */
17
+ boolValue = false;
18
+
19
+ /** Exact serialized BOOL, INT, or FLOAT payload bits. */
20
+ rawValue = 0;
21
+
22
+ /** intValue (int) */
23
+ intValue = 0;
24
+
25
+ /** floatValue (float) */
26
+ floatValue = 0;
27
+
28
+ /** stringValue (const char*) */
29
+ stringValue = "";
30
+
31
+ /**
32
+ * Build one typed annotation from its portable JSON reflection record.
33
+ *
34
+ * @param {object} value Portable annotation record.
35
+ * @returns {Tr2EffectParameterAnnotation} Reflected annotation.
36
+ */
37
+ static fromPortable(value) {
38
+ if (!isPlainObject(value)) {
39
+ throw new TypeError("Portable effect annotation must be an object");
40
+ }
41
+ if (!isUint32(value.type)) {
42
+ throw new RangeError("Portable annotation type must fit uint32");
43
+ }
44
+ const annotation = new this();
45
+ annotation.name = String(value.name ?? "");
46
+ annotation.type = value.type;
47
+ switch (annotation.type) {
48
+ case this.Type.BOOL:
49
+ if (!isUint32(value.rawValue)) {
50
+ throw new RangeError("Portable boolean annotation must fit uint32");
51
+ }
52
+ annotation.rawValue = value.rawValue;
53
+ annotation.boolValue = annotation.rawValue !== 0;
54
+ break;
55
+ case this.Type.INT:
56
+ if (!isUint32(value.rawValue)) {
57
+ throw new RangeError("Portable integer annotation must fit uint32");
58
+ }
59
+ annotation.rawValue = value.rawValue;
60
+ annotation.intValue = annotation.rawValue | 0;
61
+ break;
62
+ case this.Type.FLOAT:
63
+ if (!isUint32(value.rawValue)) {
64
+ throw new RangeError("Portable float annotation must fit uint32");
65
+ }
66
+ annotation.rawValue = value.rawValue;
67
+ annotation.floatValue = dwordToFloat(annotation.rawValue);
68
+ break;
69
+ case this.Type.STRING:
70
+ annotation.stringValue = String(value.stringValue ?? "");
71
+ break;
72
+ default:
73
+ throw new Error(`Portable annotation type ${annotation.type} is unsupported`);
74
+ }
75
+ return annotation;
76
+ }
77
+ static Type = Object.freeze({
78
+ BOOL: 0,
79
+ INT: 1,
80
+ FLOAT: 2,
81
+ STRING: 3
82
+ });
83
+ }
84
+
85
+ // Declared imperatively rather than with decorators, so this module stays
86
+ // plain ESM that loads from source without a transform. The decorator
87
+ // expressions are reused verbatim, so the registered metadata is identical.
88
+ // Statics belong in `methods`: decorateMethod targets the prototype and
89
+ // would register a static as an instance field.
90
+ CjsSchema.define(Tr2EffectParameterAnnotation, {
91
+ className: "Tr2EffectParameterAnnotation",
92
+ family: "shader"
93
+ });
94
+ CjsSchema.decorateField(Tr2EffectParameterAnnotation, "name", type.string);
95
+ CjsSchema.decorateField(Tr2EffectParameterAnnotation, "type", type.int32, schema.enum("Type"));
96
+ CjsSchema.decorateField(Tr2EffectParameterAnnotation, "boolValue", type.boolean);
97
+ CjsSchema.decorateField(Tr2EffectParameterAnnotation, "rawValue", impl.adapted, impl.reason("Carbon reads numeric annotations into typed values; the portable source contract retains the exact uint32 payload so NaN, negative zero, and integer bit patterns round-trip losslessly."), type.uint32);
98
+ CjsSchema.decorateField(Tr2EffectParameterAnnotation, "intValue", type.int32);
99
+ CjsSchema.decorateField(Tr2EffectParameterAnnotation, "floatValue", type.float32);
100
+ CjsSchema.decorateField(Tr2EffectParameterAnnotation, "stringValue", type.string);
101
+
102
+ export { Tr2EffectParameterAnnotation };
103
+ //# sourceMappingURL=Tr2EffectParameterAnnotation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tr2EffectParameterAnnotation.js","sources":["../../../../../src/resource/shader/reflection/Tr2EffectParameterAnnotation.js"],"sourcesContent":["// Source: trinity/trinity/Shader/Tr2EffectDescription.h\nimport { CjsSchema, impl, schema, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\nimport { dwordToFloat } from \"@carbonenginejs/runtime-utils/math/num\";\nimport {\n isPlainObject,\n isUint32\n} from \"@carbonenginejs/runtime-utils/is\";\n\n/** Typed annotation attached to a reflected effect parameter. */\nexport class Tr2EffectParameterAnnotation extends CjsModel\n{\n\n /** name (const char*) */\n name = \"\";\n\n /** type (Type - enum Type) */\n type = 0;\n\n /** boolValue (bool) */\n boolValue = false;\n\n /** Exact serialized BOOL, INT, or FLOAT payload bits. */\n rawValue = 0;\n\n /** intValue (int) */\n intValue = 0;\n\n /** floatValue (float) */\n floatValue = 0;\n\n /** stringValue (const char*) */\n stringValue = \"\";\n\n /**\n * Build one typed annotation from its portable JSON reflection record.\n *\n * @param {object} value Portable annotation record.\n * @returns {Tr2EffectParameterAnnotation} Reflected annotation.\n */\n static fromPortable(value)\n {\n if (!isPlainObject(value))\n {\n throw new TypeError(\"Portable effect annotation must be an object\");\n }\n if (!isUint32(value.type))\n {\n throw new RangeError(\"Portable annotation type must fit uint32\");\n }\n\n const annotation = new this();\n annotation.name = String(value.name ?? \"\");\n annotation.type = value.type;\n\n switch (annotation.type)\n {\n case this.Type.BOOL:\n if (!isUint32(value.rawValue))\n {\n throw new RangeError(\n \"Portable boolean annotation must fit uint32\"\n );\n }\n annotation.rawValue = value.rawValue;\n annotation.boolValue = annotation.rawValue !== 0;\n break;\n\n case this.Type.INT:\n if (!isUint32(value.rawValue))\n {\n throw new RangeError(\n \"Portable integer annotation must fit uint32\"\n );\n }\n annotation.rawValue = value.rawValue;\n annotation.intValue = annotation.rawValue | 0;\n break;\n\n case this.Type.FLOAT:\n if (!isUint32(value.rawValue))\n {\n throw new RangeError(\n \"Portable float annotation must fit uint32\"\n );\n }\n annotation.rawValue = value.rawValue;\n annotation.floatValue = dwordToFloat(annotation.rawValue);\n break;\n\n case this.Type.STRING:\n annotation.stringValue = String(value.stringValue ?? \"\");\n break;\n\n default:\n throw new Error(\n `Portable annotation type ${annotation.type} is unsupported`\n );\n }\n\n return annotation;\n }\n\n static Type = Object.freeze({\n BOOL: 0,\n INT: 1,\n FLOAT: 2,\n STRING: 3\n });\n\n}\n\n// Declared imperatively rather than with decorators, so this module stays\n// plain ESM that loads from source without a transform. The decorator\n// expressions are reused verbatim, so the registered metadata is identical.\n// Statics belong in `methods`: decorateMethod targets the prototype and\n// would register a static as an instance field.\nCjsSchema.define(Tr2EffectParameterAnnotation, {\n className: \"Tr2EffectParameterAnnotation\",\n family: \"shader\"\n});\nCjsSchema.decorateField(Tr2EffectParameterAnnotation, \"name\", type.string);\nCjsSchema.decorateField(Tr2EffectParameterAnnotation, \"type\", type.int32, schema.enum(\"Type\"));\nCjsSchema.decorateField(Tr2EffectParameterAnnotation, \"boolValue\", type.boolean);\nCjsSchema.decorateField(Tr2EffectParameterAnnotation, \"rawValue\", impl.adapted, impl.reason(\"Carbon reads numeric annotations into typed values; the portable source contract retains the exact uint32 payload so NaN, negative zero, and integer bit patterns round-trip losslessly.\"), type.uint32);\nCjsSchema.decorateField(Tr2EffectParameterAnnotation, \"intValue\", type.int32);\nCjsSchema.decorateField(Tr2EffectParameterAnnotation, \"floatValue\", type.float32);\nCjsSchema.decorateField(Tr2EffectParameterAnnotation, \"stringValue\", type.string);\n"],"names":["Tr2EffectParameterAnnotation","CjsModel","name","type","boolValue","rawValue","intValue","floatValue","stringValue","fromPortable","value","isPlainObject","TypeError","isUint32","RangeError","annotation","String","Type","BOOL","INT","FLOAT","dwordToFloat","STRING","Error","Object","freeze","CjsSchema","define","className","family","decorateField","string","int32","schema","enum","boolean","impl","adapted","reason","uint32","float32"],"mappings":";;;;;AAAA;;AASA;AACO,MAAMA,4BAA4B,SAASC,QAAQ,CAC1D;AAEE;AACAC,EAAAA,IAAI,GAAG,EAAE;;AAET;AACAC,EAAAA,IAAI,GAAG,CAAC;;AAER;AACAC,EAAAA,SAAS,GAAG,KAAK;;AAEjB;AACAC,EAAAA,QAAQ,GAAG,CAAC;;AAEZ;AACAC,EAAAA,QAAQ,GAAG,CAAC;;AAEZ;AACAC,EAAAA,UAAU,GAAG,CAAC;;AAEd;AACAC,EAAAA,WAAW,GAAG,EAAE;;AAEhB;AACF;AACA;AACA;AACA;AACA;EACE,OAAOC,YAAYA,CAACC,KAAK,EACzB;AACE,IAAA,IAAI,CAACC,aAAa,CAACD,KAAK,CAAC,EACzB;AACE,MAAA,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C;AACrSb,SAAS,CAACI,aAAa,CAAC9B,4BAA4B,EAAE,UAAU,EAAEG,IAAI,CAAC6B,KAAK,CAAC;AAC7EN,SAAS,CAACI,aAAa,CAAC9B,4BAA4B,EAAE,YAAY,EAAEG,IAAI,CAACqC,OAAO,CAAC;AACjFd,SAAS,CAACI,aAAa,CAAC9B,4BAA4B,EAAE,aAAa,EAAEG,IAAI,CAAC4B,MAAM,CAAC;;;;"}
@@ -0,0 +1,84 @@
1
+ import { CjsSchema, type, schema } from '@carbonenginejs/runtime-utils/schema';
2
+ import { CjsModel } from '@carbonenginejs/runtime-utils/model';
3
+ import { isPlainObject, isUint32 } from '@carbonenginejs/runtime-utils/is';
4
+
5
+ // Source: trinity/trinity/Shader/Tr2EffectDescription.h
6
+
7
+ /** Reflected SRV or UAV resource metadata. */
8
+ class Tr2EffectResource extends CjsModel {
9
+ /** isSRGB (bool) */
10
+ isSRGB = false;
11
+
12
+ /** isAutoregister (bool) */
13
+ isAutoregister = false;
14
+
15
+ /** name (const char*) */
16
+ name = "";
17
+
18
+ /** type (Type - enum Type) */
19
+ type = 0;
20
+
21
+ /** arrayElements (uint32_t) */
22
+ arrayElements = 0;
23
+
24
+ /**
25
+ * Build one SRV or UAV from its portable JSON reflection record.
26
+ *
27
+ * @param {object} value Portable resource record.
28
+ * @returns {Tr2EffectResource} Reflected resource.
29
+ */
30
+ static fromPortable(value) {
31
+ if (!isPlainObject(value)) {
32
+ throw new TypeError("Portable effect resource must be an object");
33
+ }
34
+ if (!isUint32(value.type)) {
35
+ throw new RangeError("Portable resource type must fit uint32");
36
+ }
37
+ if (!isUint32(value.arrayElements)) {
38
+ throw new RangeError("Portable resource array element count must fit uint32");
39
+ }
40
+ const resource = new this();
41
+ resource.name = String(value.name ?? "");
42
+ resource.type = value.type;
43
+ resource.arrayElements = value.arrayElements;
44
+ resource.isSRGB = !!value.isSRGB;
45
+ resource.isAutoregister = !!value.isAutoregister;
46
+ return resource;
47
+ }
48
+ static BINDLESS_SAMPLER = 100;
49
+ static Type = Object.freeze({
50
+ TEXTURE_1D: 1,
51
+ TEXTURE_2D: 2,
52
+ TEXTURE_3D: 3,
53
+ TEXTURE_CUBE: 4,
54
+ TEXTURE_TYPELESS: 5,
55
+ BUFFER: 6,
56
+ STRUCTURED_BUFFER: 7,
57
+ TBUFFER: 8,
58
+ BYTEADDRESS_BUFFER: 9,
59
+ UAV_RWTYPED: 10,
60
+ UAV_RWSTRUCTURED: 11,
61
+ UAV_RWBYTEADDRESS: 12,
62
+ UAV_APPEND_STRUCTURED: 13,
63
+ UAV_CONSUME_STRUCTURED: 14,
64
+ UAV_RWSTRUCTURED_WITH_COUNTER: 15
65
+ });
66
+ }
67
+
68
+ // Declared imperatively rather than with decorators, so this module stays
69
+ // plain ESM that loads from source without a transform. The decorator
70
+ // expressions are reused verbatim, so the registered metadata is identical.
71
+ // Statics belong in `methods`: decorateMethod targets the prototype and
72
+ // would register a static as an instance field.
73
+ CjsSchema.define(Tr2EffectResource, {
74
+ className: "Tr2EffectResource",
75
+ family: "shader"
76
+ });
77
+ CjsSchema.decorateField(Tr2EffectResource, "isSRGB", type.boolean);
78
+ CjsSchema.decorateField(Tr2EffectResource, "isAutoregister", type.boolean);
79
+ CjsSchema.decorateField(Tr2EffectResource, "name", type.string);
80
+ CjsSchema.decorateField(Tr2EffectResource, "type", type.int32, schema.enum("Type"));
81
+ CjsSchema.decorateField(Tr2EffectResource, "arrayElements", type.uint32);
82
+
83
+ export { Tr2EffectResource };
84
+ //# sourceMappingURL=Tr2EffectResource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Tr2EffectResource.js","sources":["../../../../../src/resource/shader/reflection/Tr2EffectResource.js"],"sourcesContent":["// Source: trinity/trinity/Shader/Tr2EffectDescription.h\nimport { CjsSchema, impl, schema, type } from \"@carbonenginejs/runtime-utils/schema\";\nimport { CjsModel } from \"@carbonenginejs/runtime-utils/model\";\nimport {\n isPlainObject,\n isUint32\n} from \"@carbonenginejs/runtime-utils/is\";\n\n/** Reflected SRV or UAV resource metadata. */\nexport class Tr2EffectResource extends CjsModel\n{\n\n /** isSRGB (bool) */\n isSRGB = false;\n\n /** isAutoregister (bool) */\n isAutoregister = false;\n\n /** name (const char*) */\n name = \"\";\n\n /** type (Type - enum Type) */\n type = 0;\n\n /** arrayElements (uint32_t) */\n arrayElements = 0;\n\n /**\n * Build one SRV or UAV from its portable JSON reflection record.\n *\n * @param {object} value Portable resource record.\n * @returns {Tr2EffectResource} Reflected resource.\n */\n static fromPortable(value)\n {\n if (!isPlainObject(value))\n {\n throw new TypeError(\"Portable effect resource must be an object\");\n }\n if (!isUint32(value.type))\n {\n throw new RangeError(\"Portable resource type must fit uint32\");\n }\n if (!isUint32(value.arrayElements))\n {\n throw new RangeError(\n \"Portable resource array element count must fit uint32\"\n );\n }\n\n const resource = new this();\n resource.name = String(value.name ?? \"\");\n resource.type = value.type;\n resource.arrayElements = value.arrayElements;\n resource.isSRGB = !!value.isSRGB;\n resource.isAutoregister = !!value.isAutoregister;\n return resource;\n }\n\n static BINDLESS_SAMPLER = 100;\n\n static Type = Object.freeze({\n TEXTURE_1D: 1,\n TEXTURE_2D: 2,\n TEXTURE_3D: 3,\n TEXTURE_CUBE: 4,\n TEXTURE_TYPELESS: 5,\n BUFFER: 6,\n STRUCTURED_BUFFER: 7,\n TBUFFER: 8,\n BYTEADDRESS_BUFFER: 9,\n UAV_RWTYPED: 10,\n UAV_RWSTRUCTURED: 11,\n UAV_RWBYTEADDRESS: 12,\n UAV_APPEND_STRUCTURED: 13,\n UAV_CONSUME_STRUCTURED: 14,\n UAV_RWSTRUCTURED_WITH_COUNTER: 15\n });\n\n}\n\n// Declared imperatively rather than with decorators, so this module stays\n// plain ESM that loads from source without a transform. The decorator\n// expressions are reused verbatim, so the registered metadata is identical.\n// Statics belong in `methods`: decorateMethod targets the prototype and\n// would register a static as an instance field.\nCjsSchema.define(Tr2EffectResource, {\n className: \"Tr2EffectResource\",\n family: \"shader\"\n});\nCjsSchema.decorateField(Tr2EffectResource, \"isSRGB\", type.boolean);\nCjsSchema.decorateField(Tr2EffectResource, \"isAutoregister\", type.boolean);\nCjsSchema.decorateField(Tr2EffectResource, \"name\", type.string);\nCjsSchema.decorateField(Tr2EffectResource, \"type\", type.int32, schema.enum(\"Type\"));\nCjsSchema.decorateField(Tr2EffectResource, \"arrayElements\", type.uint32);\n"],"names":["Tr2EffectResource","CjsModel","isSRGB","isAutoregister","name","type","arrayElements","fromPortable","value","isPlainObject","TypeError","isUint32","RangeError","resource","String","BINDLESS_SAMPLER","Type","Object","freeze","TEXTURE_1D","TEXTURE_2D","TEXTURE_3D","TEXTURE_CUBE","TEXTURE_TYPELESS","BUFFER","STRUCTURED_BUFFER","TBUFFER","BYTEADDRESS_BUFFER","UAV_RWTYPED","UAV_RWSTRUCTURED","UAV_RWBYTEADDRESS","UAV_APPEND_STRUCTURED","UAV_CONSUME_STRUCTURED","UAV_RWSTRUCTURED_WITH_COUNTER","CjsSchema","define","className","family","decorateField","boolean","string","int32","schema","enum","uint32"],"mappings":";;;;AAAA;;AAQA;AACO,MAAMA,iBAAiB,SAASC,QAAQ,CAC/C;AAEE;AACAC,EAAAA,MAAM,GAAG,KAAK;;AAEd;AACAC,EAAAA,cAAc,GAAG,KAAK;;AAEtB;AACAC,EAAAA,IAAI,GAAG,EAAE;;AAET;AACAC,EAAAA,IAAI,GAAG,CAAC;;AAER;AACAC,EAAAA,aAAa,GAAG,CAAC;;AAEjB;AACF;AACA;AACA;AACA;AACA;EACE,OAAOC,YAAYA,CAACC,KAAK,EACzB;AACE,IAAA,IAAI,CAACC,aAAa,CAACD,KAAK,CAAC,EACzB;AACE,MAAA,MAAM,IAAIE,SAAS,CAAC,4CAA4C,CAAC;AACnE,IAAA;AACA,IAAA,IAAI,CAACC,QAAQ,CAACH,KAAK,CAACH,IAAI,CAAC,EACzB;AACE,MAAA,MAAM,IAAIO,UAAU,CAAC,wCAAwC,CAAC;AAChE,IAAA;AACA,IAAA,IAAI,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