@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,220 @@
1
+ import { HlslRenderContextEnum } from '../HlslRenderContextEnum.js';
2
+ import { HlslEffectDescription, ANY_TECHNIQUE } from './HlslEffectDescription.js';
3
+
4
+ /**
5
+ * Trinity shader wrapper around a decoded `HlslEffectDescription`.
6
+ */
7
+ class HlslShader {
8
+ /**
9
+ * Creates an empty shader wrapper.
10
+ */
11
+ constructor() {
12
+ this.m_sortValue = 0;
13
+ this.m_effect = new HlslEffectDescription();
14
+ this.m_hasVertexBufferAccessInRtShadow = false;
15
+ }
16
+
17
+ /**
18
+ * Finds a technique index by name, or returns the first technique for `ANY_TECHNIQUE`.
19
+ *
20
+ * @param {string} [name] Technique name to locate.
21
+ * @returns {number} Technique index, or -1 when missing.
22
+ */
23
+ GetTechniqueIndex(name = ANY_TECHNIQUE) {
24
+ if (!this.m_effect.techniques.length) {
25
+ return -1;
26
+ }
27
+ if (name === ANY_TECHNIQUE || name === null || name === undefined) {
28
+ return 0;
29
+ }
30
+ return this.m_effect.techniques.findIndex(technique => technique.name === name);
31
+ }
32
+
33
+ /**
34
+ * Returns the number of passes in a decoded technique.
35
+ *
36
+ * @param {number} techniqueIndex Technique index.
37
+ * @returns {number} Pass count.
38
+ */
39
+ GetPassCount(techniqueIndex) {
40
+ const technique = this.m_effect.techniques[techniqueIndex];
41
+ return technique ? technique.passes.length : 0;
42
+ }
43
+
44
+ /**
45
+ * Applies shader program and render-state handles for one pass to a render context.
46
+ *
47
+ * @param {number} techniqueIndex Technique index.
48
+ * @param {number} passIndex Pass index.
49
+ * @param {object} renderContext Render context with an `m_esm` state manager.
50
+ * @returns {boolean} True when the pass existed.
51
+ */
52
+ ApplyAllStateForPass(techniqueIndex, passIndex, renderContext) {
53
+ const pass = this.m_effect.techniques[techniqueIndex]?.passes?.[passIndex];
54
+ if (!pass) return false;
55
+ renderContext?.m_esm?.ApplyShaderProgram?.(pass.shaderProgram);
56
+ renderContext?.m_esm?.ApplyRenderStates?.(pass.renderStates);
57
+ return true;
58
+ }
59
+
60
+ /**
61
+ * Applies only render-state handles for one pass to a render context.
62
+ *
63
+ * @param {number} techniqueIndex Technique index.
64
+ * @param {number} passIndex Pass index.
65
+ * @param {object} renderContext Render context with an `m_esm` state manager.
66
+ * @returns {boolean} True when the pass existed.
67
+ */
68
+ ApplyRenderStates(techniqueIndex, passIndex, renderContext) {
69
+ const pass = this.m_effect.techniques[techniqueIndex]?.passes?.[passIndex];
70
+ if (!pass) return false;
71
+ renderContext?.m_esm?.ApplyRenderStates?.(pass.renderStates);
72
+ return true;
73
+ }
74
+
75
+ /**
76
+ * Registers and applies a shader program override for a pass.
77
+ *
78
+ * @param {number} techniqueIndex Base technique index.
79
+ * @param {number} passIndex Base pass index.
80
+ * @param {HlslShader} overrideShader Shader providing the override program.
81
+ * @param {number} overridePassIndex Override pass index.
82
+ * @param {object} renderContext Render context with an `m_esm` state manager.
83
+ * @returns {number} Override program handle, or 0 when unavailable.
84
+ */
85
+ ApplyShaderOverride(techniqueIndex, passIndex, overrideShader, overridePassIndex, renderContext) {
86
+ const program = this.m_effect.techniques[techniqueIndex]?.passes?.[passIndex]?.shaderProgram;
87
+ const overrideProgram = overrideShader?.m_effect?.techniques?.[0]?.passes?.[overridePassIndex]?.shaderProgram;
88
+ if (!program || !overrideProgram) return 0;
89
+ const combined = renderContext?.m_esm?.RegisterShaderProgramOverride?.(program, overrideProgram) || 0;
90
+ renderContext?.m_esm?.ApplyShaderProgram?.(combined);
91
+ return combined;
92
+ }
93
+
94
+ /**
95
+ * Returns the shader-stage bit mask for a technique.
96
+ *
97
+ * @param {number} techniqueIndex Technique index.
98
+ * @returns {number} Shader-stage bit mask.
99
+ */
100
+ GetShaderTypeMask(techniqueIndex) {
101
+ return this.m_effect.techniques[techniqueIndex]?.shaderTypeMask || 0;
102
+ }
103
+
104
+ /**
105
+ * Finds the first constant metadata record with the supplied name.
106
+ *
107
+ * @param {string} name Constant name.
108
+ * @returns {object|null} Constant metadata or null.
109
+ */
110
+ GetConstant(name) {
111
+ for (const technique of this.m_effect.techniques) {
112
+ for (const pass of technique.passes) {
113
+ for (const stage of pass.stageInputs) {
114
+ const found = stage.constants.find(constant => constant.name === name);
115
+ if (found) return found;
116
+ }
117
+ }
118
+ }
119
+ return null;
120
+ }
121
+
122
+ /**
123
+ * Finds the first SRV or UAV resource metadata record with the supplied name.
124
+ *
125
+ * @param {string} name Resource name.
126
+ * @returns {object|null} Resource metadata or null.
127
+ */
128
+ GetResource(name) {
129
+ for (const technique of this.m_effect.techniques) {
130
+ for (const pass of technique.passes) {
131
+ for (const stage of pass.stageInputs) {
132
+ for (const resource of stage.resources.values()) {
133
+ if (resource.name === name) return resource;
134
+ }
135
+ for (const resource of stage.uavs.values()) {
136
+ if (resource.name === name) return resource;
137
+ }
138
+ }
139
+ }
140
+ }
141
+ return null;
142
+ }
143
+
144
+ /**
145
+ * Looks up annotations attached to a parameter name.
146
+ *
147
+ * @param {string} parameterName Parameter name.
148
+ * @returns {object[]|null} Annotation records or null.
149
+ */
150
+ GetParameterAnnotations(parameterName) {
151
+ return this.m_effect.annotations.get(parameterName) || null;
152
+ }
153
+
154
+ /**
155
+ * Returns Carbon's compact pass sort value.
156
+ *
157
+ * @returns {number} Sort value.
158
+ */
159
+ GetSortValue() {
160
+ return this.m_sortValue;
161
+ }
162
+
163
+ /**
164
+ * Returns the decoded effect description.
165
+ *
166
+ * @returns {HlslEffectDescription} Effect description.
167
+ */
168
+ GetEffectDescription() {
169
+ return this.m_effect;
170
+ }
171
+
172
+ /**
173
+ * Returns the decoded effect description.
174
+ *
175
+ * @returns {HlslEffectDescription} Effect description.
176
+ */
177
+ GetEffect() {
178
+ return this.m_effect;
179
+ }
180
+
181
+ /**
182
+ * Recomputes Carbon's sort value from the first technique/pass handles.
183
+ */
184
+ ProcessEffect() {
185
+ this.m_sortValue = 0;
186
+ const technique = this.m_effect.techniques[0];
187
+ const pass = technique?.passes?.[0];
188
+ if (!pass) return;
189
+ const ps = pass.stageInputs[HlslRenderContextEnum.PIXEL_SHADER]?.m_shader & 0x3ff;
190
+ const vs = pass.stageInputs[HlslRenderContextEnum.VERTEX_SHADER]?.m_shader & 0x3ff;
191
+ const states = pass.renderStates & 0x3ff;
192
+ const numPasses = technique.passes.length & 0x3;
193
+ this.m_sortValue = numPasses << 30 | ps << 20 | vs << 10 | states;
194
+ }
195
+
196
+ /**
197
+ * Reports whether this shader uses vertex-buffer access in RT shadow mode.
198
+ *
199
+ * @returns {boolean} True when RT shadow vertex-buffer access is flagged.
200
+ */
201
+ HasVertexBufferAccessInRtShadow() {
202
+ return this.m_hasVertexBufferAccessInRtShadow;
203
+ }
204
+
205
+ /**
206
+ * Returns a JSON-safe shader wrapper summary.
207
+ *
208
+ * @returns {object} Serializable shader summary.
209
+ */
210
+ toJSON() {
211
+ return {
212
+ m_sortValue: this.m_sortValue,
213
+ m_hasVertexBufferAccessInRtShadow: this.m_hasVertexBufferAccessInRtShadow,
214
+ effect: this.m_effect.toJSON()
215
+ };
216
+ }
217
+ }
218
+
219
+ export { HlslShader };
220
+ //# sourceMappingURL=HlslShader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HlslShader.js","sources":["../../../../../../../src/formats/hlsl/core/tr2/shader/HlslShader.js"],"sourcesContent":["import { HlslRenderContextEnum } from \"../HlslRenderContextEnum.js\";\nimport { ANY_TECHNIQUE, HlslEffectDescription } from \"./HlslEffectDescription.js\";\n\n/**\n * Trinity shader wrapper around a decoded `HlslEffectDescription`.\n */\nexport class HlslShader\n{\n /**\n * Creates an empty shader wrapper.\n */\n constructor()\n {\n this.m_sortValue = 0;\n this.m_effect = new HlslEffectDescription();\n this.m_hasVertexBufferAccessInRtShadow = false;\n }\n\n /**\n * Finds a technique index by name, or returns the first technique for `ANY_TECHNIQUE`.\n *\n * @param {string} [name] Technique name to locate.\n * @returns {number} Technique index, or -1 when missing.\n */\n GetTechniqueIndex(name = ANY_TECHNIQUE)\n {\n if (!this.m_effect.techniques.length)\n {\n return -1;\n }\n if (name === ANY_TECHNIQUE || name === null || name === undefined)\n {\n return 0;\n }\n return this.m_effect.techniques.findIndex((technique) => technique.name === name);\n }\n\n /**\n * Returns the number of passes in a decoded technique.\n *\n * @param {number} techniqueIndex Technique index.\n * @returns {number} Pass count.\n */\n GetPassCount(techniqueIndex)\n {\n const technique = this.m_effect.techniques[techniqueIndex];\n return technique ? technique.passes.length : 0;\n }\n\n /**\n * Applies shader program and render-state handles for one pass to a render context.\n *\n * @param {number} techniqueIndex Technique index.\n * @param {number} passIndex Pass index.\n * @param {object} renderContext Render context with an `m_esm` state manager.\n * @returns {boolean} True when the pass existed.\n */\n ApplyAllStateForPass(techniqueIndex, passIndex, renderContext)\n {\n const pass = this.m_effect.techniques[techniqueIndex]?.passes?.[passIndex];\n if (!pass) return false;\n renderContext?.m_esm?.ApplyShaderProgram?.(pass.shaderProgram);\n renderContext?.m_esm?.ApplyRenderStates?.(pass.renderStates);\n return true;\n }\n\n /**\n * Applies only render-state handles for one pass to a render context.\n *\n * @param {number} techniqueIndex Technique index.\n * @param {number} passIndex Pass index.\n * @param {object} renderContext Render context with an `m_esm` state manager.\n * @returns {boolean} True when the pass existed.\n */\n ApplyRenderStates(techniqueIndex, passIndex, renderContext)\n {\n const pass = this.m_effect.techniques[techniqueIndex]?.passes?.[passIndex];\n if (!pass) return false;\n renderContext?.m_esm?.ApplyRenderStates?.(pass.renderStates);\n return true;\n }\n\n /**\n * Registers and applies a shader program override for a pass.\n *\n * @param {number} techniqueIndex Base technique index.\n * @param {number} passIndex Base pass index.\n * @param {HlslShader} overrideShader Shader providing the override program.\n * @param {number} overridePassIndex Override pass index.\n * @param {object} renderContext Render context with an `m_esm` state manager.\n * @returns {number} Override program handle, or 0 when unavailable.\n */\n ApplyShaderOverride(techniqueIndex, passIndex, overrideShader, overridePassIndex, renderContext)\n {\n const program = this.m_effect.techniques[techniqueIndex]?.passes?.[passIndex]?.shaderProgram;\n const overrideProgram = overrideShader?.m_effect?.techniques?.[0]?.passes?.[overridePassIndex]?.shaderProgram;\n if (!program || !overrideProgram) return 0;\n const combined = renderContext?.m_esm?.RegisterShaderProgramOverride?.(program, overrideProgram) || 0;\n renderContext?.m_esm?.ApplyShaderProgram?.(combined);\n return combined;\n }\n\n /**\n * Returns the shader-stage bit mask for a technique.\n *\n * @param {number} techniqueIndex Technique index.\n * @returns {number} Shader-stage bit mask.\n */\n GetShaderTypeMask(techniqueIndex)\n {\n return this.m_effect.techniques[techniqueIndex]?.shaderTypeMask || 0;\n }\n\n /**\n * Finds the first constant metadata record with the supplied name.\n *\n * @param {string} name Constant name.\n * @returns {object|null} Constant metadata or null.\n */\n GetConstant(name)\n {\n for (const technique of this.m_effect.techniques)\n {\n for (const pass of technique.passes)\n {\n for (const stage of pass.stageInputs)\n {\n const found = stage.constants.find((constant) => constant.name === name);\n if (found) return found;\n }\n }\n }\n return null;\n }\n\n /**\n * Finds the first SRV or UAV resource metadata record with the supplied name.\n *\n * @param {string} name Resource name.\n * @returns {object|null} Resource metadata or null.\n */\n GetResource(name)\n {\n for (const technique of this.m_effect.techniques)\n {\n for (const pass of technique.passes)\n {\n for (const stage of pass.stageInputs)\n {\n for (const resource of stage.resources.values())\n {\n if (resource.name === name) return resource;\n }\n for (const resource of stage.uavs.values())\n {\n if (resource.name === name) return resource;\n }\n }\n }\n }\n return null;\n }\n\n /**\n * Looks up annotations attached to a parameter name.\n *\n * @param {string} parameterName Parameter name.\n * @returns {object[]|null} Annotation records or null.\n */\n GetParameterAnnotations(parameterName)\n {\n return this.m_effect.annotations.get(parameterName) || null;\n }\n\n /**\n * Returns Carbon's compact pass sort value.\n *\n * @returns {number} Sort value.\n */\n GetSortValue()\n {\n return this.m_sortValue;\n }\n\n /**\n * Returns the decoded effect description.\n *\n * @returns {HlslEffectDescription} Effect description.\n */\n GetEffectDescription()\n {\n return this.m_effect;\n }\n\n /**\n * Returns the decoded effect description.\n *\n * @returns {HlslEffectDescription} Effect description.\n */\n GetEffect()\n {\n return this.m_effect;\n }\n\n /**\n * Recomputes Carbon's sort value from the first technique/pass handles.\n */\n ProcessEffect()\n {\n this.m_sortValue = 0;\n const technique = this.m_effect.techniques[0];\n const pass = technique?.passes?.[0];\n if (!pass) return;\n\n const ps = pass.stageInputs[HlslRenderContextEnum.PIXEL_SHADER]?.m_shader & 0x3ff;\n const vs = pass.stageInputs[HlslRenderContextEnum.VERTEX_SHADER]?.m_shader & 0x3ff;\n const states = pass.renderStates & 0x3ff;\n const numPasses = technique.passes.length & 0x3;\n\n this.m_sortValue = (numPasses << 30) | (ps << 20) | (vs << 10) | states;\n }\n\n /**\n * Reports whether this shader uses vertex-buffer access in RT shadow mode.\n *\n * @returns {boolean} True when RT shadow vertex-buffer access is flagged.\n */\n HasVertexBufferAccessInRtShadow()\n {\n return this.m_hasVertexBufferAccessInRtShadow;\n }\n\n /**\n * Returns a JSON-safe shader wrapper summary.\n *\n * @returns {object} Serializable shader summary.\n */\n toJSON()\n {\n return {\n m_sortValue: this.m_sortValue,\n m_hasVertexBufferAccessInRtShadow: this.m_hasVertexBufferAccessInRtShadow,\n effect: this.m_effect.toJSON()\n };\n }\n}\n"],"names":["HlslShader","constructor","m_sortValue","m_effect","HlslEffectDescription","m_hasVertexBufferAccessInRtShadow","GetTechniqueIndex","name","ANY_TECHNIQUE","techniques","length","undefined","findIndex","technique","GetPassCount","techniqueIndex","passes","ApplyAllStateForPass","passIndex","renderContext","pass","m_esm","ApplyShaderProgram","shaderProgram","ApplyRenderStates","renderStates","ApplyShaderOverride","overrideShader","overridePassIndex","program","overrideProgram","combined","RegisterShaderProgramOverride","GetShaderTypeMask","shaderTypeMask","GetConstant","stage","stageInputs","found","constants","find","constant","GetResource","resource","resources","values","uavs","GetParameterAnnotations","parameterName","annotations","get","GetSortValue","GetEffectDescription","GetEffect","ProcessEffect","ps","HlslRenderContextEnum","PIXEL_SHADER","m_shader","vs","VERTEX_SHADER","states","numPasses","HasVertexBufferAccessInRtShadow","toJSON","effect"],"mappings":";;;AAGA;AACA;AACA;AACO,MAAMA,UAAU,CACvB;AACI;AACJ;AACA;AACIC,EAAAA,WAAWA,GACX;IACI,IAAI,CAACC,WAAW,GAAG,CAAC;AACpB,IAAA,IAAI,CAACC,QAAQ,GAAG,IAAIC,qBAAqB,EAAE;IAC3C,IAAI,CAACC,iCAAiC,GAAG,KAAK;AAClD,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIC,EAAAA,iBAAiBA,CAACC,IAAI,GAAGC,aAAa,EACtC;IACI,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AAC6D,MAAM;KAC/B;AACL,EAAA;AACJ;;;;"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Name/value shader permutation option used during effect lookup.
3
+ */
4
+ class HlslShaderOption {
5
+ /**
6
+ * Creates a shader option selection.
7
+ *
8
+ * @param {string} [name] Permutation axis name.
9
+ * @param {string} [value] Selected option value.
10
+ */
11
+ constructor(name = "", value = "") {
12
+ this.name = name;
13
+ this.value = value;
14
+ }
15
+
16
+ /**
17
+ * Returns a JSON-safe option selection.
18
+ *
19
+ * @returns {object} Serializable option selection.
20
+ */
21
+ toJSON() {
22
+ return {
23
+ name: this.name,
24
+ value: this.value
25
+ };
26
+ }
27
+ }
28
+
29
+ export { HlslShaderOption };
30
+ //# sourceMappingURL=HlslShaderOption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HlslShaderOption.js","sources":["../../../../../../../src/formats/hlsl/core/tr2/shader/HlslShaderOption.js"],"sourcesContent":["/**\n * Name/value shader permutation option used during effect lookup.\n */\nexport class HlslShaderOption\n{\n /**\n * Creates a shader option selection.\n *\n * @param {string} [name] Permutation axis name.\n * @param {string} [value] Selected option value.\n */\n constructor(name = \"\", value = \"\")\n {\n this.name = name;\n this.value = value;\n }\n\n /**\n * Returns a JSON-safe option selection.\n *\n * @returns {object} Serializable option selection.\n */\n toJSON()\n {\n return {\n name: this.name,\n value: this.value\n };\n }\n}\n"],"names":["HlslShaderOption","constructor","name","value","toJSON"],"mappings":"AAAA;AACA;AACA;AACO,MAAMA,gBAAgB,CAC7B;AACI;AACJ;AACA;AACA;AACA;AACA;EACIC,WAAWA,CAACC,IAAI,GAAG,EAAE,EAAEC,KAAK,GAAG,EAAE,EACjC;IACI,IAAI,CAACD,IAAI,GAAGA,IAAI;IAChB,IAAI,CAACC,KAAK,GAAGA,KAAK;AACtB,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACIC,EAAAA,MAAMA,GACN;IACI,OAAO;MACHF,IAAI,EAAE,IAAI,CAACA,IAAI;MACfC,KAAK,EAAE,IAAI,CAACA;KACf;AACL,EAAA;AACJ;;;;"}
@@ -0,0 +1,2 @@
1
+ export { CjsHlslFormat, CjsHlslFormat as default } from './CjsHlslFormat.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export { EFFECT_BODY_REFLECTION_FORMAT, EFFECT_BODY_REFLECTION_VERSION, buildEffectBodyReflection, enumerateUniqueEffectBodies, isEffectBodyReflection, readEffectBodyReflection, validateEffectBodyInput, validateEffectBodyReflection } from './core/portableReflection.js';
2
+ //# sourceMappingURL=portable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"portable.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -2,6 +2,10 @@ export { CjsBlackFormat } from './black/CjsBlackFormat.js';
2
2
  export { CjsBnkFormat } from './bnk/CjsBnkFormat.js';
3
3
  export { CjsCmfFormat } from './cmf/CjsCmfFormat.js';
4
4
  export { CjsDdsFormat } from './dds/CjsDdsFormat.js';
5
+ export { CjsDxbcFormat } from './dxbc/CjsDxbcFormat.js';
6
+ export { CjsHlslFormat } from './hlsl/CjsHlslFormat.js';
7
+ export { CjsWebglFormat } from './webgl/CjsWebglFormat.js';
8
+ export { CjsWebgpuFormat } from './webgpu/CjsWebgpuFormat.js';
5
9
  export { CjsFbxFormat } from './fbx/CjsFbxFormat.js';
6
10
  export { CjsFlacFormat } from './flac/CjsFlacFormat.js';
7
11
  export { CjsGifFormat } from './gif/CjsGifFormat.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -23,6 +23,11 @@ const IMAGE_MIME_TYPES = Object.freeze({
23
23
  tga: "image/x-tga",
24
24
  dds: "image/vnd-ms.dds"
25
25
  });
26
+
27
+ /**
28
+ * Normalizes reader options against their supported defaults for the JPEG format
29
+ * reader.
30
+ */
26
31
  function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = "CjsImageFormat") {
27
32
  const values = {
28
33
  ...DEFAULT_VALUES,
@@ -33,11 +38,15 @@ function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = "CjsI
33
38
  values.emit = normalizeEmit(values.emit, values.inputType, readerName);
34
39
  return values;
35
40
  }
41
+
42
+ /** Normalizes the requested input representation for the JPEG format reader. */
36
43
  function normalizeInputType(inputType) {
37
44
  if (!inputType) return "";
38
45
  const value = String(inputType).replace(/^\./u, "").toLowerCase();
39
46
  return value === "jpg" ? "jpeg" : value;
40
47
  }
48
+
49
+ /** Normalizes the requested output representation for the JPEG format reader. */
41
50
  function normalizeEmit(emit, inputType, readerName) {
42
51
  if (emit === undefined || emit === null) return OUTPUT_RAW;
43
52
  if (emit === OUTPUT_JSON && inputType) return DEBUG_OUTPUTS[inputType] || OUTPUT_JSON;
@@ -45,12 +54,16 @@ function normalizeEmit(emit, inputType, readerName) {
45
54
  if (Object.values(DEBUG_OUTPUTS).includes(emit)) return emit;
46
55
  throw new TypeError(`${readerName}: unknown emit value ${JSON.stringify(emit)}`);
47
56
  }
57
+
58
+ /** Returns a byte view over the supplied binary input for the JPEG format reader. */
48
59
  function toBytes(input) {
49
60
  if (input instanceof Uint8Array) return input;
50
61
  if (input instanceof ArrayBuffer) return new Uint8Array(input);
51
62
  if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
52
63
  throw new TypeError("Image input must be Uint8Array, ArrayBuffer, or DataView");
53
64
  }
65
+
66
+ /** Inspects input using normalized format options for the JPEG format reader. */
54
67
  function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
55
68
  const bytes = toBytes(input);
56
69
  const detected = inspectBytes(bytes);
@@ -66,6 +79,11 @@ function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
66
79
  ...detected
67
80
  };
68
81
  }
82
+
83
+ /**
84
+ * Reports whether input is supported under normalized format options for the
85
+ * JPEG format reader.
86
+ */
69
87
  function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
70
88
  try {
71
89
  const metadata = inspectWithValues(input, values, expectedType);
@@ -107,6 +125,8 @@ function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = ""
107
125
  };
108
126
  }
109
127
  }
128
+
129
+ /** Reads input using normalized format options for the JPEG format reader. */
110
130
  function readWithValues(input, values = DEFAULT_VALUES, expectedType = "") {
111
131
  const bytes = toBytes(input);
112
132
  const metadata = inspectWithValues(bytes, values, expectedType);
@@ -154,6 +174,8 @@ function rawVariant(metadata, canDecode) {
154
174
  function imageMimeType(sourceFormat) {
155
175
  return IMAGE_MIME_TYPES[sourceFormat] || "application/octet-stream";
156
176
  }
177
+
178
+ /** Converts a parsed payload into a JSON-safe value for the JPEG format reader. */
157
179
  function toJsonValue(value) {
158
180
  if (value instanceof Uint8Array) {
159
181
  return {
@@ -168,6 +190,11 @@ function toJsonValue(value) {
168
190
  }
169
191
  return value;
170
192
  }
193
+
194
+ /**
195
+ * Inspects the supplied bytes without decoding their payload for the JPEG format
196
+ * reader.
197
+ */
171
198
  function inspectBytes(bytes) {
172
199
  if (isPNG(bytes)) return inspectPNG(bytes);
173
200
  if (isJPEG(bytes)) return inspectJPEG(bytes);
@@ -179,18 +206,43 @@ function inspectBytes(bytes) {
179
206
  height: 0
180
207
  };
181
208
  }
209
+
210
+ /**
211
+ * Reports whether the supplied bytes begin with a PNG signature for the JPEG
212
+ * format reader.
213
+ */
182
214
  function isPNG(bytes) {
183
215
  return bytes.byteLength >= 24 && bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4e && bytes[3] === 0x47 && bytes[4] === 0x0d && bytes[5] === 0x0a && bytes[6] === 0x1a && bytes[7] === 0x0a;
184
216
  }
217
+
218
+ /**
219
+ * Reports whether the supplied bytes begin with a JPEG signature for the JPEG
220
+ * format reader.
221
+ */
185
222
  function isJPEG(bytes) {
186
223
  return bytes.byteLength >= 4 && bytes[0] === 0xff && bytes[1] === 0xd8;
187
224
  }
225
+
226
+ /**
227
+ * Reports whether the supplied bytes begin with a JPEG signature accepted as JPG
228
+ * for the JPEG format reader.
229
+ */
188
230
  function isJPG(bytes) {
189
231
  return isJPEG(bytes);
190
232
  }
233
+
234
+ /**
235
+ * Reports whether the supplied bytes begin with a DDS signature for the JPEG
236
+ * format reader.
237
+ */
191
238
  function isDDS(bytes) {
192
239
  return bytes.byteLength >= 128 && bytes[0] === 0x44 && bytes[1] === 0x44 && bytes[2] === 0x53 && bytes[3] === 0x20;
193
240
  }
241
+
242
+ /**
243
+ * Reports whether the supplied bytes have a supported TGA header for the JPEG
244
+ * format reader.
245
+ */
194
246
  function isTGA(bytes) {
195
247
  if (bytes.byteLength < 18) return false;
196
248
  const imageType = bytes[2],
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../../../../../src/formats/jpeg/core/helpers.js"],"sourcesContent":["export const OUTPUT_IMAGE = \"image\";\nexport const OUTPUT_TEXTURE = \"texture\";\nexport const OUTPUT_RGBA = \"rgba\";\nexport const OUTPUT_RAW = \"raw\";\nexport const OUTPUT_JSON = \"json\";\n\nimport { canDecodeJpeg, decodeJpegToRgba } from \"./jpeg.js\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_RAW,\n inputType: \"\",\n source: \"\"\n});\n\nconst DEBUG_OUTPUTS = Object.freeze({\n png: \"pngJson\",\n jpeg: \"jpegJson\",\n jpg: \"jpegJson\",\n tga: \"tgaJson\",\n dds: \"ddsJson\"\n});\n\nconst IMAGE_MIME_TYPES = Object.freeze({\n png: \"image/png\",\n jpeg: \"image/jpeg\",\n jpg: \"image/jpeg\",\n tga: \"image/x-tga\",\n dds: \"image/vnd-ms.dds\"\n});\n\nexport function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = \"CjsImageFormat\")\n{\n const values = { ...DEFAULT_VALUES, ...(base || {}), ...(options || {}) };\n values.inputType = normalizeInputType(values.inputType);\n values.emit = normalizeEmit(values.emit, values.inputType, readerName);\n return values;\n}\n\nexport function normalizeInputType(inputType)\n{\n if (!inputType) return \"\";\n const value = String(inputType).replace(/^\\./u, \"\").toLowerCase();\n return value === \"jpg\" ? \"jpeg\" : value;\n}\n\nexport function normalizeEmit(emit, inputType, readerName)\n{\n if (emit === undefined || emit === null) return OUTPUT_RAW;\n if (emit === OUTPUT_JSON && inputType) return DEBUG_OUTPUTS[inputType] || OUTPUT_JSON;\n if ([ OUTPUT_IMAGE, OUTPUT_RGBA, OUTPUT_RAW, OUTPUT_JSON ].includes(emit)) return emit;\n if (Object.values(DEBUG_OUTPUTS).includes(emit)) return emit;\n throw new TypeError(`${readerName}: unknown emit value ${JSON.stringify(emit)}`);\n}\n\nexport function toBytes(input)\n{\n if (input instanceof Uint8Array) return input;\n if (input instanceof ArrayBuffer) return new Uint8Array(input);\n if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);\n throw new TypeError(\"Image input must be Uint8Array, ArrayBuffer, or DataView\");\n}\n\nexport function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = toBytes(input);\n const detected = inspectBytes(bytes);\n const sourceFormat = expectedType || values.inputType || detected.sourceFormat;\n\n if (expectedType && detected.sourceFormat && detected.sourceFormat !== expectedType)\n {\n throw new TypeError(`CjsFormat${capitalize(expectedType)}: expected ${expectedType}, got ${detected.sourceFormat}`);\n }\n\n return {\n payloadType: sourceFormat === \"dds\" ? \"texture\" : \"image\",\n mediaTypes: sourceFormat === \"dds\" ? [ \"texture\", \"image\" ] : [ \"image\" ],\n sourceFormat,\n byteLength: bytes.byteLength,\n ...detected\n };\n}\n\nexport function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n try\n {\n const metadata = inspectWithValues(input, values, expectedType);\n const canDecode = metadata.sourceFormat === \"jpeg\" && canDecodeJpeg(metadata);\n const variants = [\n { kind: \"rgba\", payloadType: \"rgba\", codec: \"rgba8unorm\", supported: canDecode, reason: canDecode ? \"\" : jpegDecodeReason(metadata), containerOnly: false, isDecoded: canDecode, rgbaDecodeSupported: canDecode },\n rawVariant(metadata, canDecode)\n ];\n\n return {\n format: metadata.sourceFormat,\n source: values.source || \"buffer\",\n supported: metadata.sourceFormat ? (variants.some(variant => variant.supported && variant.kind === \"rgba\") ? \"full\" : \"partial\") : \"none\",\n confidence: metadata.sourceFormat ? 1 : 0,\n preferred: variants.find(v => v.supported)?.codec || \"\",\n reason: metadata.sourceFormat ? \"Container/header recognized.\" : \"Unrecognized image format.\",\n metadata,\n variants,\n warnings: [],\n errors: []\n };\n }\n catch (error)\n {\n return {\n format: expectedType || values.inputType || \"\",\n source: values.source || \"buffer\",\n supported: \"none\",\n confidence: 0,\n preferred: \"\",\n reason: error.message,\n metadata: null,\n variants: [],\n warnings: [],\n errors: [ error.message ]\n };\n }\n}\n\nexport function readWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = toBytes(input);\n const metadata = inspectWithValues(bytes, values, expectedType);\n\n if (values.emit === OUTPUT_RAW)\n {\n return {\n payloadType: \"raw\",\n sourceFormat: metadata.sourceFormat,\n mimeType: imageMimeType(metadata.sourceFormat),\n containerOnly: true,\n isDecoded: false,\n rgbaDecodeSupported: metadata.sourceFormat === \"jpeg\" && canDecodeJpeg(metadata),\n metadata,\n bytes\n };\n }\n\n if (values.emit === OUTPUT_JSON || values.emit === DEBUG_OUTPUTS[metadata.sourceFormat])\n {\n return metadata;\n }\n\n if ((values.emit === OUTPUT_RGBA || values.emit === OUTPUT_IMAGE) && metadata.sourceFormat === \"jpeg\")\n {\n if (!canDecodeJpeg(metadata))\n {\n const error = new Error(`jpeg: ${jpegDecodeReason(metadata)}`);\n error.code = \"CJS_FORMAT_OUTPUT_UNSUPPORTED\";\n throw error;\n }\n return decodeJpegToRgba(bytes, metadata);\n }\n\n const error = new Error(`${metadata.sourceFormat}: emit \"${values.emit}\" is not implemented yet`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_IMPLEMENTED\";\n error.sourceFormat = metadata.sourceFormat;\n error.emit = values.emit;\n throw error;\n}\n\nfunction rawVariant(metadata, canDecode)\n{\n return {\n kind: \"raw\",\n payloadType: \"raw\",\n codec: metadata.sourceFormat,\n mimeType: imageMimeType(metadata.sourceFormat),\n supported: true,\n containerOnly: true,\n isDecoded: false,\n rgbaDecodeSupported: metadata.sourceFormat === \"jpeg\" && canDecode === true\n };\n}\n\nfunction imageMimeType(sourceFormat)\n{\n return IMAGE_MIME_TYPES[sourceFormat] || \"application/octet-stream\";\n}\n\nexport function toJsonValue(value)\n{\n if (value instanceof Uint8Array)\n {\n return { byteLength: value.byteLength };\n }\n if (Array.isArray(value)) return value.map(toJsonValue);\n if (value && typeof value === \"object\")\n {\n const output = {};\n for (const [ key, entry ] of Object.entries(value)) output[key] = toJsonValue(entry);\n return output;\n }\n return value;\n}\n\nexport function inspectBytes(bytes)\n{\n if (isPNG(bytes)) return inspectPNG(bytes);\n if (isJPEG(bytes)) return inspectJPEG(bytes);\n if (isDDS(bytes)) return inspectDDS(bytes);\n if (isTGA(bytes)) return inspectTGA(bytes);\n return { sourceFormat: \"\", width: 0, height: 0 };\n}\n\nexport function isPNG(bytes)\n{\n return bytes.byteLength >= 24 &&\n bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4e && bytes[3] === 0x47 &&\n bytes[4] === 0x0d && bytes[5] === 0x0a && bytes[6] === 0x1a && bytes[7] === 0x0a;\n}\n\nexport function isJPEG(bytes)\n{\n return bytes.byteLength >= 4 && bytes[0] === 0xff && bytes[1] === 0xd8;\n}\n\nexport function isJPG(bytes)\n{\n return isJPEG(bytes);\n}\n\nexport function isDDS(bytes)\n{\n return bytes.byteLength >= 128 && bytes[0] === 0x44 && bytes[1] === 0x44 && bytes[2] === 0x53 && bytes[3] === 0x20;\n}\n\nexport function isTGA(bytes)\n{\n if (bytes.byteLength < 18) return false;\n const imageType = bytes[2], width = readU16LE(bytes, 12), height = readU16LE(bytes, 14), bpp = bytes[16];\n return width > 0 && height > 0 && [ 1, 2, 3, 9, 10, 11 ].includes(imageType) && [ 8, 16, 24, 32 ].includes(bpp);\n}\n\nfunction inspectPNG(bytes)\n{\n const colorType = bytes[25], bitDepth = bytes[24];\n return {\n sourceFormat: \"png\",\n width: readU32BE(bytes, 16),\n height: readU32BE(bytes, 20),\n bitDepth,\n colorType,\n channels: pngChannels(colorType),\n pixelFormat: `png-${bitDepth}-${colorType}`,\n isCompressed: false\n };\n}\n\nfunction inspectJPEG(bytes)\n{\n let offset = 2;\n let frame = null;\n const summary = {\n appMarkerCount: 0,\n commentCount: 0,\n hasExif: false,\n hasIccProfile: false\n };\n while (offset + 9 < bytes.byteLength)\n {\n if (bytes[offset] !== 0xff)\n {\n offset++;\n continue;\n }\n const marker = bytes[offset + 1], length = readU16BE(bytes, offset + 2);\n const dataStart = offset + 4;\n const dataEnd = offset + 2 + length;\n if (marker >= 0xe0 && marker <= 0xef)\n {\n summary.appMarkerCount++;\n if (marker === 0xe1 && ascii(bytes, dataStart, Math.min(6, dataEnd - dataStart)) === \"Exif\\0\\0\") summary.hasExif = true;\n if (marker === 0xe2 && ascii(bytes, dataStart, Math.min(12, dataEnd - dataStart)) === \"ICC_PROFILE\\0\") summary.hasIccProfile = true;\n }\n else if (marker === 0xfe)\n {\n summary.commentCount++;\n }\n if ([ 0xc0, 0xc1, 0xc2, 0xc3 ].includes(marker))\n {\n frame = {\n sourceFormat: \"jpeg\",\n width: readU16BE(bytes, offset + 7),\n height: readU16BE(bytes, offset + 5),\n channels: bytes[offset + 9],\n components: bytes[offset + 9],\n precision: bytes[offset + 4],\n marker,\n progressive: marker === 0xc2 || marker === 0xc3,\n pixelFormat: \"jpeg-ycbcr\",\n isCompressed: true\n };\n }\n if (marker === 0xda && frame)\n {\n const scanStart = offset + 4;\n const scanComponents = bytes[scanStart];\n const spectralStart = bytes[scanStart + 1 + scanComponents * 2];\n const spectralEnd = bytes[scanStart + 2 + scanComponents * 2];\n const successive = bytes[scanStart + 3 + scanComponents * 2];\n return {\n ...frame,\n ...summary,\n scanComponents,\n spectralStart,\n spectralEnd,\n successive,\n progressive: frame.progressive || spectralStart !== 0 || spectralEnd !== 63 || successive !== 0\n };\n }\n offset += Math.max(length + 2, 2);\n }\n return frame ? { ...frame, ...summary } : { sourceFormat: \"jpeg\", width: 0, height: 0, channels: 0, pixelFormat: \"jpeg\", isCompressed: true, ...summary };\n}\n\nfunction jpegDecodeReason(metadata)\n{\n if (metadata.sourceFormat !== \"jpeg\") return `${metadata.sourceFormat.toUpperCase()} RGBA decode is not implemented yet.`;\n if (metadata.progressive) return \"Progressive JPEG software decode is not implemented yet.\";\n if (metadata.marker !== undefined && metadata.marker !== 0xc0 && metadata.marker !== 0xc1)\n {\n return \"Only sequential baseline JPEG frames are supported by the software decoder.\";\n }\n if (metadata.precision !== undefined && metadata.precision !== 8)\n {\n return `JPEG sample precision ${metadata.precision} is not supported by the software decoder.`;\n }\n if (metadata.components > 3) return \"CMYK/YCCK JPEG software decode is not implemented yet.\";\n return \"JPEG baseline frame metadata is incomplete or unsupported.\";\n}\n\nfunction inspectDDS(bytes)\n{\n const fourCc = String.fromCharCode(bytes[84], bytes[85], bytes[86], bytes[87]).replace(/\\0+$/u, \"\");\n return {\n sourceFormat: \"dds\",\n width: readU32LE(bytes, 16),\n height: readU32LE(bytes, 12),\n mipCount: Math.max(readU32LE(bytes, 28), 1),\n fourCc,\n textureFormat: fourCc || \"dds-legacy\",\n isCompressed: !!fourCc,\n hasMipMaps: readU32LE(bytes, 28) > 1\n };\n}\n\nfunction inspectTGA(bytes)\n{\n return {\n sourceFormat: \"tga\",\n width: readU16LE(bytes, 12),\n height: readU16LE(bytes, 14),\n channels: Math.max(bytes[16] / 8, 1),\n imageType: bytes[2],\n pixelFormat: `tga-${bytes[16]}`,\n isCompressed: [ 9, 10, 11 ].includes(bytes[2])\n };\n}\n\nfunction pngChannels(colorType)\n{\n if (colorType === 0) return 1;\n if (colorType === 2) return 3;\n if (colorType === 3) return 1;\n if (colorType === 4) return 2;\n if (colorType === 6) return 4;\n return 0;\n}\n\nfunction readU16BE(bytes, offset)\n{\n return (bytes[offset] << 8) | bytes[offset + 1];\n}\n\nfunction readU16LE(bytes, offset)\n{\n return bytes[offset] | (bytes[offset + 1] << 8);\n}\n\nfunction readU32BE(bytes, offset)\n{\n return ((bytes[offset] * 0x1000000) + ((bytes[offset + 1] << 16) | (bytes[offset + 2] << 8) | bytes[offset + 3])) >>> 0;\n}\n\nfunction readU32LE(bytes, offset)\n{\n return (bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16) | (bytes[offset + 3] * 0x1000000)) >>> 0;\n}\n\nfunction ascii(bytes, offset, length)\n{\n return String.fromCharCode(...bytes.subarray(offset, offset + length));\n}\n\nfunction capitalize(value)\n{\n return value ? value[0].toUpperCase() + value.slice(1) : \"Image\";\n}\n"],"names":["OUTPUT_IMAGE","OUTPUT_RGBA","OUTPUT_RAW","OUTPUT_JSON","DEFAULT_VALUES","Object","freeze","emit","inputType","source","DEBUG_OUTPUTS","png","jpeg","jpg","tga","dds","IMAGE_MIME_TYPES","normalizeValues","base","options","readerName","values","normalizeInputType","normalizeEmit","value","String","replace","toLowerCase","undefined","includes","TypeError","JSON","stringify","toBytes","input","Uint8Array","ArrayBuffer","isView","buffer","byteOffset","byteLength","inspectWithValues","expectedType","bytes","detected","inspectBytes","sourceFormat","capitalize","payloadType","mediaTypes","isSupportedWithValues","metadata","canDecode","canDecodeJpeg","variants","kind","codec","supported","reason","jpegDecodeReason","containerOnly","isDecoded","rgbaDecodeSupported","rawVariant","format","some","variant","confidence","preferred","find","v","warnings","errors","error","message","readWithValues","mimeType","imageMimeType","Error","code","decodeJpegToRgba","toJsonValue","Array","isArray","map","output","key","entry","entries","isPNG","inspectPNG","isJPEG","inspectJPEG","isDDS","inspectDDS","isTGA","inspectTGA","width","height","isJPG","imageType","readU16LE","bpp","colorType","bitDepth","readU32BE","channels","pngChannels","pixelFormat","isCompressed","offset","frame","summary","appMarkerCount","commentCount","hasExif","hasIccProfile","marker","length","readU16BE","dataStart","dataEnd","ascii","Math","min","components","precision","progressive","scanStart","scanComponents","spectralStart","spectralEnd","successive","max","toUpperCase","fourCc","fromCharCode","readU32LE","mipCount","textureFormat","hasMipMaps","subarray","slice"],"mappings":";;AAAO,MAAMA,YAAY,GAAG;AAErB,MAAMC,WAAW,GAAG;AACpB,MAAMC,UAAU,GAAG;AACnB,MAAMC,WAAW,GAAG;MAIdC,cAAc,GAAGC,MAAM,CAACC,MAAM,CAAC;AACxCC,EAAAA,IAAI,EAAEL,UAAU;AAChBM,EAAAA,SAAS,EAAE,EAAE;AACbC,EAAAA,MAAM,EAAE;AACZ,CAAC;AAED,MAAMC,aAAa,GAAGL,MAAM,CAACC,MAAM,CAAC;AAChCK,EAAAA,GAAG,EAAE,SAAS;AACdC,EAAAA,IAAI,EAAE,UAAU;AAChBC,EAAAA,GAAG,EAAE,UAAU;AACfC,EAAAA,GAAG,EAAE,SAAS;AACdC,EAAAA,GAAG,EAAE;AACT,CAAC,CAAC;AAEF,MAAMC,gBAAgB,GAAGX,MAAM,CAACC,MAAM,CAAC;AACnCK,EAAAA,GAAG,EAAE,WAAW;AAChBC,EAAAA,IAAI,EAAE,YAAY;AAClBC,EAAAA,GAAG,EAAE,YAAY;AACjBC,EAAAA,GAAG,EAAE,aAAa;AAClBC,EAAAA,GAAG,EAAE;AACT,CAAC,CAAC;AAEK,SAASE,eAAeA,CAACC,IAAI,GAAGd,cAAc,EAAEe,OAAO,GAAG,EAAE,EAAEC,UAAU,GAAG,gBAAgB,EAClG;AACI,EAAA,MAAMC,MAAM,GAAG;AAAE,IAAA,GAAGjB,cAAc;AAAE,IAAA,IAAIc,IAAI,IAAI,EAAE,CAAC;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,MAAM,CAAC+G,YAAY,CAAC,GAAG7F,KAAK,CAACkG,QAAQ,CAAC/B,MAAM,EAAEA,MAAM,GAAGQ,MAAM,CAAC,CAAC;AAC1E;AAEA,SAASvE,UAAUA,CAACvB,KAAK,EACzB;AACI,EAAA,OAAOA,KAAK,GAAGA,KAAK,CAAC,CAAC,CAAC,CAAC8G,WAAW,EAAE,GAAG9G,KAAK,CAACsH,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO;AACpE;;;;"}
1
+ {"version":3,"file":"helpers.js","sources":["../../../../../src/formats/jpeg/core/helpers.js"],"sourcesContent":["export const OUTPUT_IMAGE = \"image\";\nexport const OUTPUT_TEXTURE = \"texture\";\nexport const OUTPUT_RGBA = \"rgba\";\nexport const OUTPUT_RAW = \"raw\";\nexport const OUTPUT_JSON = \"json\";\n\nimport { canDecodeJpeg, decodeJpegToRgba } from \"./jpeg.js\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_RAW,\n inputType: \"\",\n source: \"\"\n});\n\nconst DEBUG_OUTPUTS = Object.freeze({\n png: \"pngJson\",\n jpeg: \"jpegJson\",\n jpg: \"jpegJson\",\n tga: \"tgaJson\",\n dds: \"ddsJson\"\n});\n\nconst IMAGE_MIME_TYPES = Object.freeze({\n png: \"image/png\",\n jpeg: \"image/jpeg\",\n jpg: \"image/jpeg\",\n tga: \"image/x-tga\",\n dds: \"image/vnd-ms.dds\"\n});\n\n/**\n * Normalizes reader options against their supported defaults for the JPEG format\n * reader.\n */\nexport function normalizeValues(base = DEFAULT_VALUES, options = {}, readerName = \"CjsImageFormat\")\n{\n const values = { ...DEFAULT_VALUES, ...(base || {}), ...(options || {}) };\n values.inputType = normalizeInputType(values.inputType);\n values.emit = normalizeEmit(values.emit, values.inputType, readerName);\n return values;\n}\n\n/** Normalizes the requested input representation for the JPEG format reader. */\nexport function normalizeInputType(inputType)\n{\n if (!inputType) return \"\";\n const value = String(inputType).replace(/^\\./u, \"\").toLowerCase();\n return value === \"jpg\" ? \"jpeg\" : value;\n}\n\n/** Normalizes the requested output representation for the JPEG format reader. */\nexport function normalizeEmit(emit, inputType, readerName)\n{\n if (emit === undefined || emit === null) return OUTPUT_RAW;\n if (emit === OUTPUT_JSON && inputType) return DEBUG_OUTPUTS[inputType] || OUTPUT_JSON;\n if ([ OUTPUT_IMAGE, OUTPUT_RGBA, OUTPUT_RAW, OUTPUT_JSON ].includes(emit)) return emit;\n if (Object.values(DEBUG_OUTPUTS).includes(emit)) return emit;\n throw new TypeError(`${readerName}: unknown emit value ${JSON.stringify(emit)}`);\n}\n\n/** Returns a byte view over the supplied binary input for the JPEG format reader. */\nexport function toBytes(input)\n{\n if (input instanceof Uint8Array) return input;\n if (input instanceof ArrayBuffer) return new Uint8Array(input);\n if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);\n throw new TypeError(\"Image input must be Uint8Array, ArrayBuffer, or DataView\");\n}\n\n/** Inspects input using normalized format options for the JPEG format reader. */\nexport function inspectWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = toBytes(input);\n const detected = inspectBytes(bytes);\n const sourceFormat = expectedType || values.inputType || detected.sourceFormat;\n\n if (expectedType && detected.sourceFormat && detected.sourceFormat !== expectedType)\n {\n throw new TypeError(`CjsFormat${capitalize(expectedType)}: expected ${expectedType}, got ${detected.sourceFormat}`);\n }\n\n return {\n payloadType: sourceFormat === \"dds\" ? \"texture\" : \"image\",\n mediaTypes: sourceFormat === \"dds\" ? [ \"texture\", \"image\" ] : [ \"image\" ],\n sourceFormat,\n byteLength: bytes.byteLength,\n ...detected\n };\n}\n\n/**\n * Reports whether input is supported under normalized format options for the\n * JPEG format reader.\n */\nexport function isSupportedWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n try\n {\n const metadata = inspectWithValues(input, values, expectedType);\n const canDecode = metadata.sourceFormat === \"jpeg\" && canDecodeJpeg(metadata);\n const variants = [\n { kind: \"rgba\", payloadType: \"rgba\", codec: \"rgba8unorm\", supported: canDecode, reason: canDecode ? \"\" : jpegDecodeReason(metadata), containerOnly: false, isDecoded: canDecode, rgbaDecodeSupported: canDecode },\n rawVariant(metadata, canDecode)\n ];\n\n return {\n format: metadata.sourceFormat,\n source: values.source || \"buffer\",\n supported: metadata.sourceFormat ? (variants.some(variant => variant.supported && variant.kind === \"rgba\") ? \"full\" : \"partial\") : \"none\",\n confidence: metadata.sourceFormat ? 1 : 0,\n preferred: variants.find(v => v.supported)?.codec || \"\",\n reason: metadata.sourceFormat ? \"Container/header recognized.\" : \"Unrecognized image format.\",\n metadata,\n variants,\n warnings: [],\n errors: []\n };\n }\n catch (error)\n {\n return {\n format: expectedType || values.inputType || \"\",\n source: values.source || \"buffer\",\n supported: \"none\",\n confidence: 0,\n preferred: \"\",\n reason: error.message,\n metadata: null,\n variants: [],\n warnings: [],\n errors: [ error.message ]\n };\n }\n}\n\n/** Reads input using normalized format options for the JPEG format reader. */\nexport function readWithValues(input, values = DEFAULT_VALUES, expectedType = \"\")\n{\n const bytes = toBytes(input);\n const metadata = inspectWithValues(bytes, values, expectedType);\n\n if (values.emit === OUTPUT_RAW)\n {\n return {\n payloadType: \"raw\",\n sourceFormat: metadata.sourceFormat,\n mimeType: imageMimeType(metadata.sourceFormat),\n containerOnly: true,\n isDecoded: false,\n rgbaDecodeSupported: metadata.sourceFormat === \"jpeg\" && canDecodeJpeg(metadata),\n metadata,\n bytes\n };\n }\n\n if (values.emit === OUTPUT_JSON || values.emit === DEBUG_OUTPUTS[metadata.sourceFormat])\n {\n return metadata;\n }\n\n if ((values.emit === OUTPUT_RGBA || values.emit === OUTPUT_IMAGE) && metadata.sourceFormat === \"jpeg\")\n {\n if (!canDecodeJpeg(metadata))\n {\n const error = new Error(`jpeg: ${jpegDecodeReason(metadata)}`);\n error.code = \"CJS_FORMAT_OUTPUT_UNSUPPORTED\";\n throw error;\n }\n return decodeJpegToRgba(bytes, metadata);\n }\n\n const error = new Error(`${metadata.sourceFormat}: emit \"${values.emit}\" is not implemented yet`);\n error.code = \"CJS_FORMAT_OUTPUT_NOT_IMPLEMENTED\";\n error.sourceFormat = metadata.sourceFormat;\n error.emit = values.emit;\n throw error;\n}\n\nfunction rawVariant(metadata, canDecode)\n{\n return {\n kind: \"raw\",\n payloadType: \"raw\",\n codec: metadata.sourceFormat,\n mimeType: imageMimeType(metadata.sourceFormat),\n supported: true,\n containerOnly: true,\n isDecoded: false,\n rgbaDecodeSupported: metadata.sourceFormat === \"jpeg\" && canDecode === true\n };\n}\n\nfunction imageMimeType(sourceFormat)\n{\n return IMAGE_MIME_TYPES[sourceFormat] || \"application/octet-stream\";\n}\n\n/** Converts a parsed payload into a JSON-safe value for the JPEG format reader. */\nexport function toJsonValue(value)\n{\n if (value instanceof Uint8Array)\n {\n return { byteLength: value.byteLength };\n }\n if (Array.isArray(value)) return value.map(toJsonValue);\n if (value && typeof value === \"object\")\n {\n const output = {};\n for (const [ key, entry ] of Object.entries(value)) output[key] = toJsonValue(entry);\n return output;\n }\n return value;\n}\n\n/**\n * Inspects the supplied bytes without decoding their payload for the JPEG format\n * reader.\n */\nexport function inspectBytes(bytes)\n{\n if (isPNG(bytes)) return inspectPNG(bytes);\n if (isJPEG(bytes)) return inspectJPEG(bytes);\n if (isDDS(bytes)) return inspectDDS(bytes);\n if (isTGA(bytes)) return inspectTGA(bytes);\n return { sourceFormat: \"\", width: 0, height: 0 };\n}\n\n/**\n * Reports whether the supplied bytes begin with a PNG signature for the JPEG\n * format reader.\n */\nexport function isPNG(bytes)\n{\n return bytes.byteLength >= 24 &&\n bytes[0] === 0x89 && bytes[1] === 0x50 && bytes[2] === 0x4e && bytes[3] === 0x47 &&\n bytes[4] === 0x0d && bytes[5] === 0x0a && bytes[6] === 0x1a && bytes[7] === 0x0a;\n}\n\n/**\n * Reports whether the supplied bytes begin with a JPEG signature for the JPEG\n * format reader.\n */\nexport function isJPEG(bytes)\n{\n return bytes.byteLength >= 4 && bytes[0] === 0xff && bytes[1] === 0xd8;\n}\n\n/**\n * Reports whether the supplied bytes begin with a JPEG signature accepted as JPG\n * for the JPEG format reader.\n */\nexport function isJPG(bytes)\n{\n return isJPEG(bytes);\n}\n\n/**\n * Reports whether the supplied bytes begin with a DDS signature for the JPEG\n * format reader.\n */\nexport function isDDS(bytes)\n{\n return bytes.byteLength >= 128 && bytes[0] === 0x44 && bytes[1] === 0x44 && bytes[2] === 0x53 && bytes[3] === 0x20;\n}\n\n/**\n * Reports whether the supplied bytes have a supported TGA header for the JPEG\n * format reader.\n */\nexport function isTGA(bytes)\n{\n if (bytes.byteLength < 18) return false;\n const imageType = bytes[2], width = readU16LE(bytes, 12), height = readU16LE(bytes, 14), bpp = bytes[16];\n return width > 0 && height > 0 && [ 1, 2, 3, 9, 10, 11 ].includes(imageType) && [ 8, 16, 24, 32 ].includes(bpp);\n}\n\nfunction inspectPNG(bytes)\n{\n const colorType = bytes[25], bitDepth = bytes[24];\n return {\n sourceFormat: \"png\",\n width: readU32BE(bytes, 16),\n height: readU32BE(bytes, 20),\n bitDepth,\n colorType,\n channels: pngChannels(colorType),\n pixelFormat: `png-${bitDepth}-${colorType}`,\n isCompressed: false\n };\n}\n\nfunction inspectJPEG(bytes)\n{\n let offset = 2;\n let frame = null;\n const summary = {\n appMarkerCount: 0,\n commentCount: 0,\n hasExif: false,\n hasIccProfile: false\n };\n while (offset + 9 < bytes.byteLength)\n {\n if (bytes[offset] !== 0xff)\n {\n offset++;\n continue;\n }\n const marker = bytes[offset + 1], length = readU16BE(bytes, offset + 2);\n const dataStart = offset + 4;\n const dataEnd = offset + 2 + length;\n if (marker >= 0xe0 && marker <= 0xef)\n {\n summary.appMarkerCount++;\n if (marker === 0xe1 && ascii(bytes, dataStart, Math.min(6, dataEnd - dataStart)) === \"Exif\\0\\0\") summary.hasExif = true;\n if (marker === 0xe2 && ascii(bytes, dataStart, Math.min(12, dataEnd - dataStart)) === \"ICC_PROFILE\\0\") summary.hasIccProfile = true;\n }\n else if (marker === 0xfe)\n {\n summary.commentCount++;\n }\n if ([ 0xc0, 0xc1, 0xc2, 0xc3 ].includes(marker))\n {\n frame = {\n sourceFormat: \"jpeg\",\n width: readU16BE(bytes, offset + 7),\n height: readU16BE(bytes, offset + 5),\n channels: bytes[offset + 9],\n components: bytes[offset + 9],\n precision: bytes[offset + 4],\n marker,\n progressive: marker === 0xc2 || marker === 0xc3,\n pixelFormat: \"jpeg-ycbcr\",\n isCompressed: true\n };\n }\n if (marker === 0xda && frame)\n {\n const scanStart = offset + 4;\n const scanComponents = bytes[scanStart];\n const spectralStart = bytes[scanStart + 1 + scanComponents * 2];\n const spectralEnd = bytes[scanStart + 2 + scanComponents * 2];\n const successive = bytes[scanStart + 3 + scanComponents * 2];\n return {\n ...frame,\n ...summary,\n scanComponents,\n spectralStart,\n spectralEnd,\n successive,\n progressive: frame.progressive || spectralStart !== 0 || spectralEnd !== 63 || successive !== 0\n };\n }\n offset += Math.max(length + 2, 2);\n }\n return frame ? { ...frame, ...summary } : { sourceFormat: \"jpeg\", width: 0, height: 0, channels: 0, pixelFormat: \"jpeg\", isCompressed: true, ...summary };\n}\n\nfunction jpegDecodeReason(metadata)\n{\n if (metadata.sourceFormat !== \"jpeg\") return `${metadata.sourceFormat.toUpperCase()} RGBA decode is not implemented yet.`;\n if (metadata.progressive) return \"Progressive JPEG software decode is not implemented yet.\";\n if (metadata.marker !== undefined && metadata.marker !== 0xc0 && metadata.marker !== 0xc1)\n {\n return \"Only sequential baseline JPEG frames are supported by the software decoder.\";\n }\n if (metadata.precision !== undefined && metadata.precision !== 8)\n {\n return `JPEG sample precision ${metadata.precision} is not supported by the software decoder.`;\n }\n if (metadata.components > 3) return \"CMYK/YCCK JPEG software decode is not implemented yet.\";\n return \"JPEG baseline frame metadata is incomplete or unsupported.\";\n}\n\nfunction inspectDDS(bytes)\n{\n const fourCc = String.fromCharCode(bytes[84], bytes[85], bytes[86], bytes[87]).replace(/\\0+$/u, \"\");\n return {\n sourceFormat: \"dds\",\n width: readU32LE(bytes, 16),\n height: readU32LE(bytes, 12),\n mipCount: Math.max(readU32LE(bytes, 28), 1),\n fourCc,\n textureFormat: fourCc || \"dds-legacy\",\n isCompressed: !!fourCc,\n hasMipMaps: readU32LE(bytes, 28) > 1\n };\n}\n\nfunction inspectTGA(bytes)\n{\n return {\n sourceFormat: \"tga\",\n width: readU16LE(bytes, 12),\n height: readU16LE(bytes, 14),\n channels: Math.max(bytes[16] / 8, 1),\n imageType: bytes[2],\n pixelFormat: `tga-${bytes[16]}`,\n isCompressed: [ 9, 10, 11 ].includes(bytes[2])\n };\n}\n\nfunction pngChannels(colorType)\n{\n if (colorType === 0) return 1;\n if (colorType === 2) return 3;\n if (colorType === 3) return 1;\n if (colorType === 4) return 2;\n if (colorType === 6) return 4;\n return 0;\n}\n\nfunction readU16BE(bytes, offset)\n{\n return (bytes[offset] << 8) | bytes[offset + 1];\n}\n\nfunction readU16LE(bytes, offset)\n{\n return bytes[offset] | (bytes[offset + 1] << 8);\n}\n\nfunction readU32BE(bytes, offset)\n{\n return ((bytes[offset] * 0x1000000) + ((bytes[offset + 1] << 16) | (bytes[offset + 2] << 8) | bytes[offset + 3])) >>> 0;\n}\n\nfunction readU32LE(bytes, offset)\n{\n return (bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16) | (bytes[offset + 3] * 0x1000000)) >>> 0;\n}\n\nfunction ascii(bytes, offset, length)\n{\n return String.fromCharCode(...bytes.subarray(offset, offset + length));\n}\n\nfunction capitalize(value)\n{\n return value ? value[0].toUpperCase() + value.slice(1) : \"Image\";\n}\n"],"names":["OUTPUT_IMAGE","OUTPUT_RGBA","OUTPUT_RAW","OUTPUT_JSON","DEFAULT_VALUES","Object","freeze","emit","inputType","source","DEBUG_OUTPUTS","png","jpeg","jpg","tga","dds","IMAGE_MIME_TYPES","normalizeValues","base","options","readerName","values","normalizeInputType","normalizeEmit","value","String","replace","toLowerCase","undefined","includes","TypeError","JSON","stringify","toBytes","input","Uint8Array","ArrayBuffer","isView","buffer","byteOffset","byteLength","inspectWithValues","expectedType","bytes","detected","inspectBytes","sourceFormat","capitalize","payloadType","mediaTypes","isSupportedWithValues","metadata","canDecode","canDecodeJpeg","variants","kind","codec","supported","reason","jpegDecodeReason","containerOnly","isDecoded","rgbaDecodeSupported","rawVariant","format","some","variant","confidence","preferred","find","v","warnings","errors","error","message","readWithValues","mimeType","imageMimeType","Error","code","decodeJpegToRgba","toJsonValue","Array","isArray","map","output","key","entry","entries","isPNG","inspectPNG","isJPEG","inspectJPEG","isDDS","inspectDDS","isTGA","inspectTGA","width","height","isJPG","imageType","readU16LE","bpp","colorType","bitDepth","readU32BE","channels","pngChannels","pixelFormat","isCompressed","offset","frame","summary","appMarkerCount","commentCount","hasExif","hasIccProfile","marker","length","readU16BE","dataStart","dataEnd","ascii","Math","min","components","precision","progressive","scanStart","scanComponents","spectralStart","spectralEnd","successive","max","toUpperCase","fourCc","fromCharCode","readU32LE","mipCount","textureFormat","hasMipMaps","subarray","slice"],"mappings":";;AAAO,MAAMA,YAAY,GAAG;AAErB,MAAMC,WAAW,GAAG;AACpB,MAAMC,UAAU,GAAG;AACnB,MAAMC,WAAW,GAAG;MAIdC,cAAc,GAAGC,MAAM,CAACC,MAAM,CAAC;AACxCC,EAAAA,IAAI,EAAEL,UAAU;AAChBM,EAAAA,SAAS,EAAE,EAAE;AACbC,EAAAA,MAAM,EAAE;AACZ,CAAC;AAED,MAAMC,aAAa,GAAGL,MAAM,CAACC,MAAM,CAAC;AAChCK,EAAAA,GAAG,EAAE,SAAS;AACdC,EAAAA,IAAI,EAAE,UAAU;AAChBC,EAAAA,GAAG,EAAE,UAAU;AACfC,EAAAA,GAAG,EAAE,SAAS;AACdC,EAAAA,GAAG,EAAE;AACT,CAAC,CAAC;AAEF,MAAMC,gBAAgB,GAAGX,MAAM,CAACC,MAAM,CAAC;AACnCK,EAAAA,GAAG,EAAE,WAAW;AAChBC,EAAAA,IAAI,EAAE,YAAY;AAClBC,EAAAA,GAAG,E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