@carbonenginejs/runtime-resource 0.12.2 → 0.14.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 (238) hide show
  1. package/README.md +21 -0
  2. package/dist/CjsResMan.js +393 -29
  3. package/dist/CjsResMan.js.map +1 -1
  4. package/dist/format/carbonEffect/CjsCarbonEffectReader.js +165 -118
  5. package/dist/format/carbonEffect/CjsCarbonEffectReader.js.map +1 -1
  6. package/dist/format/carbonEffect/buildCarbonEffectContainer.js +182 -0
  7. package/dist/format/carbonEffect/buildCarbonEffectContainer.js.map +1 -0
  8. package/dist/format/carbonEffect/carbonEffectBackendBlock.js +7 -113
  9. package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
  10. package/dist/format/carbonEffect/carbonEffectRecords.js +258 -66
  11. package/dist/format/carbonEffect/carbonEffectRecords.js.map +1 -1
  12. package/dist/format/carbonEffect/carbonEffectResourceTransform.js +197 -0
  13. package/dist/format/carbonEffect/carbonEffectResourceTransform.js.map +1 -0
  14. package/dist/format/effect/effectBodyInventory.js +146 -0
  15. package/dist/format/effect/effectBodyInventory.js.map +1 -0
  16. package/dist/format/effect/effectPermutationGraph.js +13 -13
  17. package/dist/format/effect/effectPermutationGraph.js.map +1 -1
  18. package/dist/format/index.js +4 -4
  19. package/dist/formats/black/CjsBlackFormat.js +19 -1
  20. package/dist/formats/black/CjsBlackFormat.js.map +1 -1
  21. package/dist/formats/bnk/CjsBnkFormat.js +28 -9
  22. package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
  23. package/dist/formats/bnk/core/busNodes.js +252 -0
  24. package/dist/formats/bnk/core/busNodes.js.map +1 -0
  25. package/dist/formats/bnk/core/effectNodes.js +147 -0
  26. package/dist/formats/bnk/core/effectNodes.js.map +1 -0
  27. package/dist/formats/bnk/core/eventAction.js +135 -24
  28. package/dist/formats/bnk/core/eventAction.js.map +1 -1
  29. package/dist/formats/bnk/core/globalSettings.js +215 -0
  30. package/dist/formats/bnk/core/globalSettings.js.map +1 -0
  31. package/dist/formats/bnk/core/helpers.js +37 -5
  32. package/dist/formats/bnk/core/helpers.js.map +1 -1
  33. package/dist/formats/bnk/core/musicNodes.js +43 -19
  34. package/dist/formats/bnk/core/musicNodes.js.map +1 -1
  35. package/dist/formats/bnk/core/nodeBase.js +28 -7
  36. package/dist/formats/bnk/core/nodeBase.js.map +1 -1
  37. package/dist/formats/dds/core/helpers.js +40 -1
  38. package/dist/formats/dds/core/helpers.js.map +1 -1
  39. package/dist/formats/dxbc/CjsDxbcFormat.js +45 -0
  40. package/dist/formats/dxbc/CjsDxbcFormat.js.map +1 -1
  41. package/dist/formats/dxbc/core/disassemble.js +240 -0
  42. package/dist/formats/dxbc/core/disassemble.js.map +1 -0
  43. package/dist/formats/gltf/CjsGltfFormat.js +1 -39
  44. package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
  45. package/dist/formats/gltf/core/helpers.js +1 -21
  46. package/dist/formats/gltf/core/helpers.js.map +1 -1
  47. package/dist/formats/hlsl/CjsHlslFormat.js +0 -21
  48. package/dist/formats/hlsl/CjsHlslFormat.js.map +1 -1
  49. package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js +118 -49
  50. package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -1
  51. package/dist/formats/hlsl/core/detailMapFamily.js +128 -0
  52. package/dist/formats/hlsl/core/detailMapFamily.js.map +1 -0
  53. package/dist/formats/hlsl/core/localLightFamily.js +133 -0
  54. package/dist/formats/hlsl/core/localLightFamily.js.map +1 -0
  55. package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js +79 -73
  56. package/dist/formats/hlsl/core/tr2/resources/HlslEffectRes.js.map +1 -1
  57. package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js +8 -1
  58. package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js.map +1 -1
  59. package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js +11 -691
  60. package/dist/formats/hlsl/core/tr2/shader/HlslEffectDescription.js.map +1 -1
  61. package/dist/formats/index.js +4 -2
  62. package/dist/formats/index.js.map +1 -1
  63. package/dist/formats/obj/CjsObjFormat.js +1 -22
  64. package/dist/formats/obj/CjsObjFormat.js.map +1 -1
  65. package/dist/formats/obj/core/helpers.js +1 -21
  66. package/dist/formats/obj/core/helpers.js.map +1 -1
  67. package/dist/formats/pickle/CjsPickleFormat.js +214 -0
  68. package/dist/formats/pickle/CjsPickleFormat.js.map +1 -0
  69. package/dist/formats/pickle/core/CjsPickleProtocol0Reader.js +551 -0
  70. package/dist/formats/pickle/core/CjsPickleProtocol0Reader.js.map +1 -0
  71. package/dist/formats/pickle/index.js +2 -0
  72. package/dist/formats/pickle/index.js.map +1 -0
  73. package/dist/formats/red/core/redGraph.js +11 -8
  74. package/dist/formats/red/core/redGraph.js.map +1 -1
  75. package/dist/formats/stl/CjsStlFormat.js +1 -46
  76. package/dist/formats/stl/CjsStlFormat.js.map +1 -1
  77. package/dist/formats/stl/core/helpers.js +1 -21
  78. package/dist/formats/stl/core/helpers.js.map +1 -1
  79. package/dist/formats/webgl/CjsWebglFormat.js +33 -55
  80. package/dist/formats/webgl/CjsWebglFormat.js.map +1 -1
  81. package/dist/formats/webgl/core/buildGlslEffectContainer.js +70 -0
  82. package/dist/formats/webgl/core/buildGlslEffectContainer.js.map +1 -0
  83. package/dist/formats/webgl/core/effectPackage.js +216 -108
  84. package/dist/formats/webgl/core/effectPackage.js.map +1 -1
  85. package/dist/formats/webgl/core/errors.js +1 -1
  86. package/dist/formats/webgl/core/errors.js.map +1 -1
  87. package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +166 -24
  88. package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  89. package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +63 -5
  90. package/dist/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
  91. package/dist/formats/webgl/core/glsl/packedLightFixups.js +98 -0
  92. package/dist/formats/webgl/core/glsl/packedLightFixups.js.map +1 -0
  93. package/dist/formats/webgl/core/glslBackendBlock.js +552 -0
  94. package/dist/formats/webgl/core/glslBackendBlock.js.map +1 -0
  95. package/dist/formats/webgl/core/glslBackendBodySet.js +243 -0
  96. package/dist/formats/webgl/core/glslBackendBodySet.js.map +1 -0
  97. package/dist/formats/webgl/core/{cewgCompleteness.js → glslEffectCompleteness.js} +12 -8
  98. package/dist/formats/webgl/core/glslEffectCompleteness.js.map +1 -0
  99. package/dist/formats/webgl/core/helpers.js +33 -172
  100. package/dist/formats/webgl/core/helpers.js.map +1 -1
  101. package/dist/formats/webgl/core/inspectGlslEffectContainer.js +122 -0
  102. package/dist/formats/webgl/core/inspectGlslEffectContainer.js.map +1 -0
  103. package/dist/formats/webgl/core/readGlslEffectContainer.js +249 -0
  104. package/dist/formats/webgl/core/readGlslEffectContainer.js.map +1 -0
  105. package/dist/formats/webgpu/CjsWebgpuFormat.js +15 -15
  106. package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  107. package/dist/formats/webgpu/core/buildCarbonEffectContainer.js +37 -145
  108. package/dist/formats/webgpu/core/buildCarbonEffectContainer.js.map +1 -1
  109. package/dist/formats/webgpu/core/{cewgpu/CewgpuContainer.js → carbonWebgpu/CarbonWebgpuContainer.js} +13 -27
  110. package/dist/formats/webgpu/core/carbonWebgpu/CarbonWebgpuContainer.js.map +1 -0
  111. package/dist/formats/webgpu/core/{cewgpu → carbonWebgpu}/containerViews.js +1 -1
  112. package/dist/formats/webgpu/core/carbonWebgpu/containerViews.js.map +1 -0
  113. package/dist/formats/webgpu/core/{cewgpu → carbonWebgpu}/validateContainer.js +4 -4
  114. package/dist/formats/webgpu/core/carbonWebgpu/validateContainer.js.map +1 -0
  115. package/dist/formats/webgpu/core/effectBackendBodySet.js +18 -18
  116. package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
  117. package/dist/formats/webgpu/core/errors.js +1 -1
  118. package/dist/formats/webgpu/core/errors.js.map +1 -1
  119. package/dist/formats/webgpu/core/helpers.js +22 -22
  120. package/dist/formats/webgpu/core/helpers.js.map +1 -1
  121. package/dist/formats/webgpu/core/packageEffect.js +11 -15
  122. package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
  123. package/dist/formats/webgpu/core/packageEffectSelection.js +1 -1
  124. package/dist/formats/webgpu/core/packageEffectSelection.js.map +1 -1
  125. package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +23 -23
  126. package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -1
  127. package/dist/formats/webgpu/core/wgsl/buildWgslSet.js +6 -6
  128. package/dist/formats/webgpu/core/wgsl/buildWgslSet.js.map +1 -1
  129. package/dist/formats/yaml/CjsYamlFormat.js +3 -3
  130. package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
  131. package/dist/formats/yaml/core/CjsYamlReader.js +4 -6
  132. package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
  133. package/dist/formats/yaml/core/helpers.js +27 -1
  134. package/dist/formats/yaml/core/helpers.js.map +1 -1
  135. package/dist/index.js +2 -0
  136. package/dist/index.js.map +1 -1
  137. package/dist/resource/CjsLoadingObject.js +19 -0
  138. package/dist/resource/CjsLoadingObject.js.map +1 -0
  139. package/dist/resource/CjsResource.js +4 -0
  140. package/dist/resource/CjsResource.js.map +1 -1
  141. package/dist/resource/ResourceHandlerMode.js +14 -0
  142. package/dist/resource/ResourceHandlerMode.js.map +1 -0
  143. package/dist/resource/index.js +2 -0
  144. package/dist/resource/index.js.map +1 -1
  145. package/dist/resource/shader/Tr2EffectRes.js +118 -213
  146. package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
  147. package/dist/resource/shader/Tr2Shader.js +37 -15
  148. package/dist/resource/shader/Tr2Shader.js.map +1 -1
  149. package/dist/resource/shader/reflection/Tr2EffectConstant.js +37 -29
  150. package/dist/resource/shader/reflection/Tr2EffectConstant.js.map +1 -1
  151. package/dist/resource/shader/reflection/Tr2EffectDescription.js +39 -34
  152. package/dist/resource/shader/reflection/Tr2EffectDescription.js.map +1 -1
  153. package/dist/resource/shader/reflection/Tr2EffectLibrary.js +51 -30
  154. package/dist/resource/shader/reflection/Tr2EffectLibrary.js.map +1 -1
  155. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js +45 -25
  156. package/dist/resource/shader/reflection/Tr2EffectParameterAnnotation.js.map +1 -1
  157. package/dist/resource/shader/reflection/Tr2EffectResource.js +51 -17
  158. package/dist/resource/shader/reflection/Tr2EffectResource.js.map +1 -1
  159. package/dist/resource/shader/reflection/Tr2EffectStageInput.js +219 -88
  160. package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
  161. package/dist/resource/shader/reflection/Tr2EffectTechnique.js +28 -18
  162. package/dist/resource/shader/reflection/Tr2EffectTechnique.js.map +1 -1
  163. package/dist/resource/shader/reflection/Tr2Pass.js +96 -39
  164. package/dist/resource/shader/reflection/Tr2Pass.js.map +1 -1
  165. package/dist/resource/shader/reflection/carbonRecordFields.js +159 -0
  166. package/dist/resource/shader/reflection/carbonRecordFields.js.map +1 -0
  167. package/dist/resource/shader/reflection/shaderStage.js +22 -0
  168. package/dist/resource/shader/reflection/shaderStage.js.map +1 -0
  169. package/dist/resource/shader/sampler/Tr2SamplerSetup.js +68 -10
  170. package/dist/resource/shader/sampler/Tr2SamplerSetup.js.map +1 -1
  171. package/dist/worker/CjsResManMainThreadLoader.js +9 -7
  172. package/dist/worker/CjsResManMainThreadLoader.js.map +1 -1
  173. package/dist/worker/CjsResManWorker.js +5 -4
  174. package/dist/worker/CjsResManWorker.js.map +1 -1
  175. package/dist/worker/CjsResManWorkerLoader.js +9 -6
  176. package/dist/worker/CjsResManWorkerLoader.js.map +1 -1
  177. package/docs/README.md +2 -2
  178. package/docs/architecture.md +12 -3
  179. package/docs/concepts/resource-lifecycle.md +9 -8
  180. package/docs/concepts/shader-resource-model.md +14 -17
  181. package/docs/concepts/writing-an-engine-adapter.md +1 -1
  182. package/docs/formats/README.md +4 -2
  183. package/docs/formats/carbon-effect-container.md +127 -26
  184. package/docs/formats/dxbc/architecture.md +1 -1
  185. package/docs/formats/dxbc/reference/api.md +28 -0
  186. package/docs/formats/hlsl/README.md +3 -3
  187. package/docs/formats/hlsl/architecture.md +8 -9
  188. package/docs/formats/hlsl/guides/hydrating-json-output.md +3 -5
  189. package/docs/formats/hlsl/guides/reading-effects.md +5 -1
  190. package/docs/formats/hlsl/reference/advanced-analysis.md +20 -25
  191. package/docs/formats/hlsl/reference/api.md +0 -7
  192. package/docs/formats/hlsl/reference/json-graph.md +1 -4
  193. package/docs/formats/pickle.md +82 -0
  194. package/docs/formats/webgl/README.md +71 -13
  195. package/docs/formats/webgl/architecture.md +16 -17
  196. package/docs/formats/webgl/carbon-constant-layouts.md +3 -3
  197. package/docs/formats/webgl/decl-io.md +3 -3
  198. package/docs/formats/webgl/memory-structured.md +27 -8
  199. package/docs/formats/webgl/texture-sample.md +1 -1
  200. package/docs/formats/webgpu/README.md +3 -3
  201. package/docs/formats/webgpu/architecture.md +5 -6
  202. package/docs/formats/webgpu/formats/{cewgpu.md → carbon-webgpu.md} +10 -11
  203. package/docs/formats/webgpu/guides/effect-packaging.md +6 -8
  204. package/docs/formats/webgpu/reference/api.md +11 -12
  205. package/docs/formats/webgpu/reference/wgsl-compatibility.md +11 -8
  206. package/docs/formats/wwise.md +63 -2
  207. package/docs/reference/classes/core.md +10 -0
  208. package/docs/reference/classes/formats.md +40 -48
  209. package/docs/reference/classes/resources.md +2 -2
  210. package/docs/reference/queues.md +88 -4
  211. package/docs/reference/workers.md +7 -0
  212. package/package.json +61 -61
  213. package/dist/format/carbonEffect/carbonDescriptionFromPortable.js +0 -372
  214. package/dist/format/carbonEffect/carbonDescriptionFromPortable.js.map +0 -1
  215. package/dist/format/effect/effectReflectionPackage.js +0 -636
  216. package/dist/format/effect/effectReflectionPackage.js.map +0 -1
  217. package/dist/formats/hlsl/core/HlslReader.js +0 -16
  218. package/dist/formats/hlsl/core/HlslReader.js.map +0 -1
  219. package/dist/formats/hlsl/core/portableReflection.js +0 -848
  220. package/dist/formats/hlsl/core/portableReflection.js.map +0 -1
  221. package/dist/formats/hlsl/portable.js +0 -2
  222. package/dist/formats/hlsl/portable.js.map +0 -1
  223. package/dist/formats/webgl/core/cewg/CewgPackage.js +0 -340
  224. package/dist/formats/webgl/core/cewg/CewgPackage.js.map +0 -1
  225. package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js +0 -104
  226. package/dist/formats/webgl/core/cewg/CewgPackageBuilder.js.map +0 -1
  227. package/dist/formats/webgl/core/cewg/binary.js +0 -19
  228. package/dist/formats/webgl/core/cewg/binary.js.map +0 -1
  229. package/dist/formats/webgl/core/cewgCompleteness.js.map +0 -1
  230. package/dist/formats/webgl/core/effectPackageValidation.js +0 -331
  231. package/dist/formats/webgl/core/effectPackageValidation.js.map +0 -1
  232. package/dist/formats/webgpu/core/cewgpu/CewgpuContainer.js.map +0 -1
  233. package/dist/formats/webgpu/core/cewgpu/containerViews.js.map +0 -1
  234. package/dist/formats/webgpu/core/cewgpu/validateContainer.js.map +0 -1
  235. package/dist/resource/shader/portable.js +0 -33
  236. package/dist/resource/shader/portable.js.map +0 -1
  237. package/docs/formats/hlsl/reference/portable-reflection.md +0 -141
  238. package/docs/formats/webgl/effect-reflection.md +0 -127
@@ -1,29 +1,23 @@
1
- import { CewgPackage } from './cewg/CewgPackage.js';
2
- import { CewgPackageBuilder } from './cewg/CewgPackageBuilder.js';
3
1
  import { DxbcGlslEmitter } from './glsl/DxbcGlslEmitter.js';
4
- import { WebglReadError } from './errors.js';
5
- import { validateEffectPackageEnvelope } from './effectPackageValidation.js';
2
+ import { applyPackedLightFixups } from './glsl/packedLightFixups.js';
3
+ import { looksLikeCarbonEffectContainer } from '../../../format/carbonEffect/CjsCarbonEffectReader.js';
6
4
 
7
5
  /**
8
- * Internal read-pipeline glue for CjsWebglFormat.
6
+ * Internal glue for CjsWebglFormat.
9
7
  *
10
- * Keeps the public class file small: input/option normalization, the shared
11
- * CEWG package read path used by both the instance and the static one-shots,
12
- * package construction, DXBC-to-GLSL emission, and JSON conversion all live
13
- * here. The CEWG container parser lives under src/core/cewg (internal parsing
14
- * machinery, not part of this package's public surface); the GLSL emitter
15
- * lives under src/core/glsl.
8
+ * Keeps the public class file small: input/option normalization, DXBC-to-GLSL
9
+ * emission, and JSON conversion live here. Reading an effect is
10
+ * `readGlslEffectContainer` and summarising one is `inspectGlslEffectContainer`;
11
+ * neither needs glue, so neither is wrapped here. The GLSL emitter lives under
12
+ * src/formats/webgl/core/glsl.
16
13
  */
17
14
 
18
15
  const OUTPUT_JSON = "json";
19
- const OUTPUT_RAW = "raw";
20
- const CEWG_MAGIC = "CEWG";
21
- const CEWG_FORMAT = "CEWG";
22
16
  const DEFAULT_VALUES = Object.freeze({
23
17
  emit: OUTPUT_JSON,
24
18
  source: "memory"
25
19
  });
26
- const VALID_EMITS = new Set([OUTPUT_JSON, OUTPUT_RAW]);
20
+ const VALID_EMITS = new Set([OUTPUT_JSON]);
27
21
  const OPTION_KEYS = new Set(["emit", "source"]);
28
22
 
29
23
  /**
@@ -48,7 +42,7 @@ function normalizeValues(base, options = {}, readerName = "CjsWebglFormat") {
48
42
  ...options
49
43
  };
50
44
  if (!VALID_EMITS.has(values.emit)) {
51
- throw new TypeError(`${readerName}: emit must be "${OUTPUT_JSON}" or "${OUTPUT_RAW}", got ${JSON.stringify(values.emit)}`);
45
+ throw new TypeError(`${readerName}: emit must be "${OUTPUT_JSON}", got ${JSON.stringify(values.emit)}`);
52
46
  }
53
47
  if (typeof values.source !== "string" || !values.source) {
54
48
  values.source = DEFAULT_VALUES.source;
@@ -69,171 +63,28 @@ function toBytes(input) {
69
63
  if (input instanceof Uint8Array) return input;
70
64
  if (typeof ArrayBuffer !== "undefined" && input instanceof ArrayBuffer) return new Uint8Array(input);
71
65
  if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
72
- throw new TypeError("CjsWebglFormat: input must be CEWG package bytes (Uint8Array, Buffer, DataView or ArrayBuffer)");
66
+ throw new TypeError("CjsWebglFormat: input must be effect container bytes (Uint8Array, Buffer, DataView or ArrayBuffer)");
73
67
  }
74
68
 
75
69
  /**
76
- * Sniffs whether a payload starts with the CEWG container magic.
70
+ * Reports whether a payload has the Carbon effect container shape.
71
+ *
72
+ * A shape check, not an identity check: our files are stock Carbon containers,
73
+ * so nothing in the bytes distinguishes a WebGL one from a shipped
74
+ * `effect.dx11`. Identity comes from the path the file was resolved through.
77
75
  *
78
76
  * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Candidate payload.
79
- * @returns {boolean} True when the payload looks like a CEWG package.
77
+ * @returns {boolean} True when the payload has the container shape.
80
78
  */
81
- function isCewg(input) {
79
+ function isWebglEffectContainer(input) {
82
80
  try {
83
- const bytes = toBytes(input);
84
- return bytes.length >= CEWG_MAGIC.length && CEWG_MAGIC.split("").every((char, index) => bytes[index] === char.charCodeAt(0));
81
+ return looksLikeCarbonEffectContainer(toBytes(input));
85
82
  } catch {
86
83
  return false;
87
84
  }
88
85
  }
89
-
90
- /**
91
- * The shared read path used by the instance Read/Inspect and the static
92
- * one-shots: normalizes input bytes and loads a CewgPackage.
93
- *
94
- * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input CEWG package payload.
95
- * @param {object} values Normalized format values.
96
- * @returns {CewgPackage} The loaded package.
97
- */
98
- function readRaw(input, values) {
99
- const bytes = toBytes(input);
100
- const pkg = new CewgPackage();
101
- const ok = pkg.Read(bytes, {
102
- sourcePath: values.source
103
- });
104
- if (!ok) {
105
- throw new WebglReadError(pkg.readError ? pkg.readError.message : "Failed to read CEWG package", {
106
- source: values.source,
107
- cause: pkg.readError || null
108
- });
109
- }
110
- try {
111
- validateEffectPackageEnvelope(pkg);
112
- } catch (error) {
113
- throw new WebglReadError(error.message, {
114
- source: values.source,
115
- cause: error
116
- });
117
- }
118
- return pkg;
119
- }
120
-
121
- /**
122
- * Reads the `GLSL` chunk's shader records, when present.
123
- *
124
- * @param {CewgPackage} pkg Loaded package.
125
- * @returns {object[]} Shader records, or an empty array when absent.
126
- */
127
- function glslShaders(pkg) {
128
- const glslJson = pkg.glslJson;
129
- return Array.isArray(glslJson?.shaders) ? glslJson.shaders : [];
130
- }
131
-
132
- /**
133
- * Reads the `GLSL` chunk's stage records, when present.
134
- *
135
- * @param {CewgPackage} pkg Loaded package.
136
- * @returns {object[]} Stage records, or an empty array when absent.
137
- */
138
- function glslStages(pkg) {
139
- const glslJson = pkg.glslJson;
140
- return Array.isArray(glslJson?.stages) ? glslJson.stages : [];
141
- }
142
-
143
- /**
144
- * Converts a loaded package to the documented plain JSON shape.
145
- *
146
- * @param {CewgPackage} pkg Loaded package.
147
- * @returns {object} Plain JSON data.
148
- */
149
- function packageToJson(pkg) {
150
- return toJsonValue({
151
- format: CEWG_FORMAT,
152
- version: pkg.version,
153
- sourcePath: pkg.sourcePath,
154
- chunks: pkg.chunks.map(({
155
- tag,
156
- size,
157
- offset
158
- }) => ({
159
- tag,
160
- size,
161
- offset
162
- })),
163
- info: pkg.info,
164
- metadata: pkg.metadata,
165
- permutationGraph: pkg.permutationGraph,
166
- reflection: pkg.reflection,
167
- reflectionBlobByteLength: pkg.reflectionBlobBytes?.byteLength ?? 0,
168
- glsl: pkg.glslJson !== null ? pkg.glslJson : pkg.glsl,
169
- shaders: glslShaders(pkg)
170
- });
171
- }
172
-
173
- /**
174
- * Shared read entry honouring the emit mode.
175
- *
176
- * `emit: "raw"` returns the live CewgPackage instance — internal, unstable,
177
- * not schema-guaranteed. `emit: "json"` (the default) returns the documented
178
- * plain-data package shape: parsed INFO/META/GLSL chunks plus a flat shader
179
- * record list.
180
- *
181
- * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input CEWG package payload.
182
- * @param {object} values Normalized format values.
183
- * @returns {CewgPackage|object} The raw package instance, or the documented JSON shape.
184
- */
185
- function readWithValues(input, values) {
186
- const pkg = readRaw(input, values);
187
- return values.emit === OUTPUT_RAW ? pkg : packageToJson(pkg);
188
- }
189
-
190
- /**
191
- * Cheap inspection: version, chunk tags/sizes, and GLSL shader/stage counts,
192
- * without building the full JSON package shape.
193
- *
194
- * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input CEWG package payload.
195
- * @param {object} values Normalized format values.
196
- * @returns {object} Plain summary data.
197
- */
198
- function inspectWithValues(input, values) {
199
- const pkg = readRaw(input, values);
200
- const info = pkg.info;
201
- const permutationGraph = pkg.permutationGraph;
202
- return {
203
- source: values.source,
204
- isCewg: true,
205
- version: pkg.version,
206
- chunks: pkg.chunks.map(({
207
- tag,
208
- size,
209
- offset
210
- }) => ({
211
- tag,
212
- size,
213
- offset
214
- })),
215
- shaderCount: glslShaders(pkg).length,
216
- stageCount: glslStages(pkg).length,
217
- permutationCount: permutationGraph?.variants?.length ?? 0,
218
- uniqueBodyCount: permutationGraph?.bodies?.length ?? 0,
219
- reflectionBodyCount: info?.effectReflection?.bodyCount ?? 0,
220
- reflectionSourceProgramCount: info?.effectReflection?.sourceProgramCount ?? 0,
221
- reflectionBlobCount: info?.effectReflection?.blobCount ?? 0,
222
- reflectionBlobByteLength: info?.effectReflection?.blobByteLength ?? 0
223
- };
224
- }
225
-
226
- /**
227
- * Assembles a CEWG package from ordered chunk payloads.
228
- *
229
- * @param {Array<[string, string|object|Uint8Array|ArrayBuffer|ArrayBufferView]>} chunks Ordered package chunks.
230
- * @returns {Uint8Array} Package bytes.
231
- */
232
- function buildPackage(chunks) {
233
- return CewgPackageBuilder.build(chunks);
234
- }
235
- const EMIT_GLSL_OPTION_KEYS = new Set(["constantBufferStyle", "pixelConstantBufferRemap", "samplerName", "vertexStructuredCapacity", "dataTextureWidth", "stubResourceRegisters", "lightConstantBuffer", "lightPackedTexture", "pairVaryings", "source"]);
236
- const EMIT_GLSL_PROFILE_KEYS = new Set(["constantBufferStyle", "pixelConstantBufferRemap", "samplerName", "vertexStructuredCapacity", "dataTextureWidth", "stubResourceRegisters", "lightConstantBuffer", "lightPackedTexture"]);
86
+ const EMIT_GLSL_OPTION_KEYS = new Set(["constantBufferStyle", "pixelConstantBufferRemap", "samplerName", "vertexStructuredCapacity", "dataTextureWidth", "stubResourceRegisters", "neutralResourceRegisters", "detailMapArrayRegisters", "lightConstantBuffer", "lightPackedTexture", "pairVaryings", "source"]);
87
+ const EMIT_GLSL_PROFILE_KEYS = new Set(["constantBufferStyle", "pixelConstantBufferRemap", "samplerName", "vertexStructuredCapacity", "dataTextureWidth", "stubResourceRegisters", "neutralResourceRegisters", "detailMapArrayRegisters", "lightConstantBuffer", "lightPackedTexture"]);
237
88
 
238
89
  /**
239
90
  * Translates one DXBC stage into GLSL ES 3.00 source, sharing one core path
@@ -267,10 +118,20 @@ function emitGlslWithOptions(dxbcBytes, options = {}) {
267
118
  const emitter = new DxbcGlslEmitter({
268
119
  profile
269
120
  });
270
- return emitter.Emit(dxbcBytes, {
121
+ const result = emitter.Emit(dxbcBytes, {
271
122
  source: options.source,
272
123
  pairVaryings: options.pairVaryings
273
124
  });
125
+
126
+ // The packed local-light lowering leaves two idioms that must not reach a
127
+ // driver: a flag mask round-tripped through a float, and an all-bits mask
128
+ // stored as a float and then used for branch control, where 0xFFFFFFFF is a
129
+ // NaN. Applied here rather than at a call site so every caller gets them.
130
+ if (!options.lightPackedTexture) return result;
131
+ return {
132
+ ...result,
133
+ source: applyPackedLightFixups(result.source, result.stageName)
134
+ };
274
135
  }
275
136
 
276
137
  /**
@@ -302,5 +163,5 @@ function toJsonValue(value) {
302
163
  return null;
303
164
  }
304
165
 
305
- export { CEWG_FORMAT, CEWG_MAGIC, DEFAULT_VALUES, OUTPUT_JSON, OUTPUT_RAW, WebglReadError, buildPackage, emitGlslWithOptions, inspectWithValues, isCewg, normalizeValues, packageToJson, readRaw, readWithValues, toBytes, toJsonValue };
166
+ export { DEFAULT_VALUES, OUTPUT_JSON, emitGlslWithOptions, isWebglEffectContainer, normalizeValues, toBytes, toJsonValue };
306
167
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sources":["../../../../../src/formats/webgl/core/helpers.js"],"sourcesContent":["/**\n * Internal read-pipeline glue for CjsWebglFormat.\n *\n * Keeps the public class file small: input/option normalization, the shared\n * CEWG package read path used by both the instance and the static one-shots,\n * package construction, DXBC-to-GLSL emission, and JSON conversion all live\n * here. The CEWG container parser lives under src/core/cewg (internal parsing\n * machinery, not part of this package's public surface); the GLSL emitter\n * lives under src/core/glsl.\n */\n\nimport { CewgPackage } from \"./cewg/CewgPackage.js\";\nimport { CewgPackageBuilder } from \"./cewg/CewgPackageBuilder.js\";\nimport { DxbcGlslEmitter } from \"./glsl/DxbcGlslEmitter.js\";\nimport { WebglReadError } from \"./errors.js\";\nimport { validateEffectPackageEnvelope } from \"./effectPackageValidation.js\";\n\nexport const OUTPUT_JSON = \"json\";\nexport const OUTPUT_RAW = \"raw\";\nexport const CEWG_MAGIC = \"CEWG\";\nexport const CEWG_FORMAT = \"CEWG\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_JSON,\n source: \"memory\"\n});\n\nconst VALID_EMITS = new Set([ OUTPUT_JSON, OUTPUT_RAW ]);\nconst OPTION_KEYS = new Set([ \"emit\", \"source\" ]);\n\n/**\n * Merge format values over a base set and validate them.\n *\n * @param {object} base Current values.\n * @param {object} [options] Values to merge in.\n * @param {string} [readerName] Reader name used in error messages.\n * @returns {object} A validated copy of the merged values.\n */\nexport function normalizeValues(base, options = {}, readerName = \"CjsWebglFormat\")\n{\n if (!options || typeof options !== \"object\")\n {\n throw new TypeError(`${readerName}: options must be an object`);\n }\n for (const key of Object.keys(options))\n {\n if (!OPTION_KEYS.has(key))\n {\n throw new TypeError(`${readerName}: unknown option ${JSON.stringify(key)}`);\n }\n }\n\n const values = { ...base, ...options };\n\n if (!VALID_EMITS.has(values.emit))\n {\n throw new TypeError(`${readerName}: emit must be \"${OUTPUT_JSON}\" or \"${OUTPUT_RAW}\", got ${JSON.stringify(values.emit)}`);\n }\n if (typeof values.source !== \"string\" || !values.source)\n {\n values.source = DEFAULT_VALUES.source;\n }\n\n return {\n emit: values.emit,\n source: values.source\n };\n}\n\n/**\n * Normalize caller input into a Uint8Array of package/DXBC bytes.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Candidate payload.\n * @returns {Uint8Array} The payload bytes.\n */\nexport function toBytes(input)\n{\n if (input instanceof Uint8Array) return input;\n if (typeof ArrayBuffer !== \"undefined\" && 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(\"CjsWebglFormat: input must be CEWG package bytes (Uint8Array, Buffer, DataView or ArrayBuffer)\");\n}\n\n/**\n * Sniffs whether a payload starts with the CEWG container magic.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Candidate payload.\n * @returns {boolean} True when the payload looks like a CEWG package.\n */\nexport function isCewg(input)\n{\n try\n {\n const bytes = toBytes(input);\n return bytes.length >= CEWG_MAGIC.length\n && CEWG_MAGIC.split(\"\").every((char, index) => bytes[index] === char.charCodeAt(0));\n }\n catch\n {\n return false;\n }\n}\n\n/**\n * The shared read path used by the instance Read/Inspect and the static\n * one-shots: normalizes input bytes and loads a CewgPackage.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input CEWG package payload.\n * @param {object} values Normalized format values.\n * @returns {CewgPackage} The loaded package.\n */\nexport function readRaw(input, values)\n{\n const bytes = toBytes(input);\n const pkg = new CewgPackage();\n const ok = pkg.Read(bytes, { sourcePath: values.source });\n\n if (!ok)\n {\n throw new WebglReadError(\n pkg.readError ? pkg.readError.message : \"Failed to read CEWG package\",\n {\n source: values.source,\n cause: pkg.readError || null\n }\n );\n }\n\n try\n {\n validateEffectPackageEnvelope(pkg);\n }\n catch (error)\n {\n throw new WebglReadError(error.message, {\n source: values.source,\n cause: error\n });\n }\n\n return pkg;\n}\n\n/**\n * Reads the `GLSL` chunk's shader records, when present.\n *\n * @param {CewgPackage} pkg Loaded package.\n * @returns {object[]} Shader records, or an empty array when absent.\n */\nfunction glslShaders(pkg)\n{\n const glslJson = pkg.glslJson;\n return Array.isArray(glslJson?.shaders) ? glslJson.shaders : [];\n}\n\n/**\n * Reads the `GLSL` chunk's stage records, when present.\n *\n * @param {CewgPackage} pkg Loaded package.\n * @returns {object[]} Stage records, or an empty array when absent.\n */\nfunction glslStages(pkg)\n{\n const glslJson = pkg.glslJson;\n return Array.isArray(glslJson?.stages) ? glslJson.stages : [];\n}\n\n/**\n * Converts a loaded package to the documented plain JSON shape.\n *\n * @param {CewgPackage} pkg Loaded package.\n * @returns {object} Plain JSON data.\n */\nexport function packageToJson(pkg)\n{\n return toJsonValue({\n format: CEWG_FORMAT,\n version: pkg.version,\n sourcePath: pkg.sourcePath,\n chunks: pkg.chunks.map(({ tag, size, offset }) => ({ tag, size, offset })),\n info: pkg.info,\n metadata: pkg.metadata,\n permutationGraph: pkg.permutationGraph,\n reflection: pkg.reflection,\n reflectionBlobByteLength: pkg.reflectionBlobBytes?.byteLength ?? 0,\n glsl: pkg.glslJson !== null ? pkg.glslJson : pkg.glsl,\n shaders: glslShaders(pkg)\n });\n}\n\n/**\n * Shared read entry honouring the emit mode.\n *\n * `emit: \"raw\"` returns the live CewgPackage instance — internal, unstable,\n * not schema-guaranteed. `emit: \"json\"` (the default) returns the documented\n * plain-data package shape: parsed INFO/META/GLSL chunks plus a flat shader\n * record list.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input CEWG package payload.\n * @param {object} values Normalized format values.\n * @returns {CewgPackage|object} The raw package instance, or the documented JSON shape.\n */\nexport function readWithValues(input, values)\n{\n const pkg = readRaw(input, values);\n return values.emit === OUTPUT_RAW ? pkg : packageToJson(pkg);\n}\n\n/**\n * Cheap inspection: version, chunk tags/sizes, and GLSL shader/stage counts,\n * without building the full JSON package shape.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input CEWG package payload.\n * @param {object} values Normalized format values.\n * @returns {object} Plain summary data.\n */\nexport function inspectWithValues(input, values)\n{\n const pkg = readRaw(input, values);\n const info = pkg.info;\n const permutationGraph = pkg.permutationGraph;\n return {\n source: values.source,\n isCewg: true,\n version: pkg.version,\n chunks: pkg.chunks.map(({ tag, size, offset }) => ({ tag, size, offset })),\n shaderCount: glslShaders(pkg).length,\n stageCount: glslStages(pkg).length,\n permutationCount: permutationGraph?.variants?.length ?? 0,\n uniqueBodyCount: permutationGraph?.bodies?.length ?? 0,\n reflectionBodyCount: info?.effectReflection?.bodyCount ?? 0,\n reflectionSourceProgramCount:\n info?.effectReflection?.sourceProgramCount ?? 0,\n reflectionBlobCount: info?.effectReflection?.blobCount ?? 0,\n reflectionBlobByteLength:\n info?.effectReflection?.blobByteLength ?? 0\n };\n}\n\n/**\n * Assembles a CEWG package from ordered chunk payloads.\n *\n * @param {Array<[string, string|object|Uint8Array|ArrayBuffer|ArrayBufferView]>} chunks Ordered package chunks.\n * @returns {Uint8Array} Package bytes.\n */\nexport function buildPackage(chunks)\n{\n return CewgPackageBuilder.build(chunks);\n}\n\nconst EMIT_GLSL_OPTION_KEYS = new Set([\n \"constantBufferStyle\",\n \"pixelConstantBufferRemap\",\n \"samplerName\",\n \"vertexStructuredCapacity\",\n \"dataTextureWidth\",\n \"stubResourceRegisters\",\n \"lightConstantBuffer\",\n \"lightPackedTexture\",\n \"pairVaryings\",\n \"source\"\n]);\n\nconst EMIT_GLSL_PROFILE_KEYS = new Set([\n \"constantBufferStyle\",\n \"pixelConstantBufferRemap\",\n \"samplerName\",\n \"vertexStructuredCapacity\",\n \"dataTextureWidth\",\n \"stubResourceRegisters\",\n \"lightConstantBuffer\",\n \"lightPackedTexture\"\n]);\n\n/**\n * Translates one DXBC stage into GLSL ES 3.00 source, sharing one core path\n * between `CjsWebglFormat.emitGlsl` (static) and `EmitGlsl` (instance).\n *\n * `options` is a flat bag combining the emitter's ccpwgl-profile constructor\n * bits (`constantBufferStyle`, `pixelConstantBufferRemap`, `samplerName`,\n * `vertexStructuredCapacity`, `dataTextureWidth`) with its per-call Emit\n * options (`pairVaryings`, `source`); omitted keys keep the emitter's\n * existing defaults exactly.\n *\n * @param {ArrayBuffer|ArrayBufferView|Uint8Array} dxbcBytes DXBC container bytes.\n * @param {object} [options] Combined profile/emit options.\n * @returns {{source:string,stageName:string,inputs:object[],outputs:object[],bindings:object[],warnings:string[],computeFragment:(object|undefined)}}\n * GLSL text plus the IO contract the packaging layer records; compute\n * stages add the emitter's `computeFragment` host contract.\n */\nexport function emitGlslWithOptions(dxbcBytes, options = {})\n{\n if (!options || typeof options !== \"object\")\n {\n throw new TypeError(\"CjsWebglFormat: emitGlsl options must be an object\");\n }\n for (const key of Object.keys(options))\n {\n if (!EMIT_GLSL_OPTION_KEYS.has(key))\n {\n throw new TypeError(`CjsWebglFormat: unknown emitGlsl option ${JSON.stringify(key)}`);\n }\n }\n\n const profile = {};\n for (const key of EMIT_GLSL_PROFILE_KEYS)\n {\n if (Object.prototype.hasOwnProperty.call(options, key)) profile[key] = options[key];\n }\n\n const emitter = new DxbcGlslEmitter({ profile });\n return emitter.Emit(dxbcBytes, {\n source: options.source,\n pairVaryings: options.pairVaryings\n });\n}\n\n/**\n * Deep-convert a value to plain JSON-compatible data. Typed arrays become\n * plain number arrays; Maps/Sets become objects/arrays; class instances\n * with toJSON are honoured.\n *\n * @param {any} value Value to convert.\n * @returns {any} Plain data.\n */\nexport function toJsonValue(value)\n{\n if (value === null || value === undefined) return value ?? null;\n if (typeof value === \"number\" || typeof value === \"string\" || typeof value === \"boolean\") return value;\n if (typeof value === \"bigint\") return value.toString();\n if (ArrayBuffer.isView(value)) return Array.from(value);\n if (Array.isArray(value)) return value.map(toJsonValue);\n if (value instanceof Map)\n {\n const out = {};\n for (const [ key, entry ] of value) out[key] = toJsonValue(entry);\n return out;\n }\n if (value instanceof Set) return Array.from(value, toJsonValue);\n if (typeof value === \"object\")\n {\n if (typeof value.toJSON === \"function\") return toJsonValue(value.toJSON());\n const out = {};\n for (const key of Object.keys(value)) out[key] = toJsonValue(value[key]);\n return out;\n }\n return null;\n}\n\nexport { WebglReadError };\n"],"names":["OUTPUT_JSON","OUTPUT_RAW","CEWG_MAGIC","CEWG_FORMAT","DEFAULT_VALUES","Object","freeze","emit","source","VALID_EMITS","Set","OPTION_KEYS","normalizeValues","base","options","readerName","TypeError","key","keys","has","JSON","stringify","values","toBytes","input","Uint8Array","ArrayBuffer","isView","buffer","byteOffset","byteLength","isCewg","bytes","length","split","every","char","index","charCodeAt","readRaw","pkg","CewgPackage","ok","Read","sourcePath","WebglReadError","readError","message","cause","validateEffectPackageEnvelope","error","glslShaders","glslJson","Array","isArray","shaders","glslStages","stages","packageToJson","toJsonValue","format","version","chunks","map","tag","size","offset","info","metadata","permutationGraph","reflection","reflectionBlobByteLength","reflectionBlobBytes","glsl","readWithValues","inspectWithValues","shaderCount","stageCount","permutationCount","variants","uniqueBodyCount","bodies","reflectionBodyCount","effectReflection","bodyCount","reflectionSourceProgramCount","sourceProgramCount","reflectionBlobCount","blobCount","blobByteLength","buildPackage","CewgPackageBuilder","build","EMIT_GLSL_OPTION_KEYS","EMIT_GLSL_PROFILE_KEYS","emitGlslWithOptions","dxbcBytes","profile","prototype","hasOwnProperty","call","emitter","DxbcGlslEmitter","Emit","pairVaryings","value","undefined","toString","from","Map","out","entry","toJSON"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQO,MAAMA,WAAW,GAAG;AACpB,MAAMC,UAAU,GAAG;AACnB,MAAMC,UAAU,GAAG;AACnB,MAAMC,WAAW,GAAG;MAEdC,cAAc,GAAGC,MAAM,CAACC,MAAM,CAAC;AACxCC,EAAAA,IAAI,EAAEP,WAAW;AACjBQ,EAAAA,MAAM,EAAE;AACZ,CAAC;AAED,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAAC,CAAEV,WAAW,EA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7F,GAAG,CAAC,GAAG0C,WAAW,CAAC8C,KAAK,CAACxF,GAAG,CAAC,CAAC;AACxE,IAAA,OAAO6F,GAAG;AACd,EAAA;AACA,EAAA,OAAO,IAAI;AACf;;;;"}
1
+ {"version":3,"file":"helpers.js","sources":["../../../../../src/formats/webgl/core/helpers.js"],"sourcesContent":["/**\n * Internal glue for CjsWebglFormat.\n *\n * Keeps the public class file small: input/option normalization, DXBC-to-GLSL\n * emission, and JSON conversion live here. Reading an effect is\n * `readGlslEffectContainer` and summarising one is `inspectGlslEffectContainer`;\n * neither needs glue, so neither is wrapped here. The GLSL emitter lives under\n * src/formats/webgl/core/glsl.\n */\n\nimport { DxbcGlslEmitter } from \"./glsl/DxbcGlslEmitter.js\";\nimport { applyPackedLightFixups } from \"./glsl/packedLightFixups.js\";\nimport { WebglReadError } from \"./errors.js\";\nimport {\n looksLikeCarbonEffectContainer\n} from \"../../../format/carbonEffect/CjsCarbonEffectReader.js\";\n\nexport const OUTPUT_JSON = \"json\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_JSON,\n source: \"memory\"\n});\n\nconst VALID_EMITS = new Set([ OUTPUT_JSON ]);\nconst OPTION_KEYS = new Set([ \"emit\", \"source\" ]);\n\n/**\n * Merge format values over a base set and validate them.\n *\n * @param {object} base Current values.\n * @param {object} [options] Values to merge in.\n * @param {string} [readerName] Reader name used in error messages.\n * @returns {object} A validated copy of the merged values.\n */\nexport function normalizeValues(base, options = {}, readerName = \"CjsWebglFormat\")\n{\n if (!options || typeof options !== \"object\")\n {\n throw new TypeError(`${readerName}: options must be an object`);\n }\n for (const key of Object.keys(options))\n {\n if (!OPTION_KEYS.has(key))\n {\n throw new TypeError(`${readerName}: unknown option ${JSON.stringify(key)}`);\n }\n }\n\n const values = { ...base, ...options };\n\n if (!VALID_EMITS.has(values.emit))\n {\n throw new TypeError(`${readerName}: emit must be \"${OUTPUT_JSON}\", got ${JSON.stringify(values.emit)}`);\n }\n if (typeof values.source !== \"string\" || !values.source)\n {\n values.source = DEFAULT_VALUES.source;\n }\n\n return {\n emit: values.emit,\n source: values.source\n };\n}\n\n/**\n * Normalize caller input into a Uint8Array of package/DXBC bytes.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Candidate payload.\n * @returns {Uint8Array} The payload bytes.\n */\nexport function toBytes(input)\n{\n if (input instanceof Uint8Array) return input;\n if (typeof ArrayBuffer !== \"undefined\" && 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(\"CjsWebglFormat: input must be effect container bytes (Uint8Array, Buffer, DataView or ArrayBuffer)\");\n}\n\n/**\n * Reports whether a payload has the Carbon effect container shape.\n *\n * A shape check, not an identity check: our files are stock Carbon containers,\n * so nothing in the bytes distinguishes a WebGL one from a shipped\n * `effect.dx11`. Identity comes from the path the file was resolved through.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Candidate payload.\n * @returns {boolean} True when the payload has the container shape.\n */\nexport function isWebglEffectContainer(input)\n{\n try\n {\n return looksLikeCarbonEffectContainer(toBytes(input));\n }\n catch\n {\n return false;\n }\n}\n\nconst EMIT_GLSL_OPTION_KEYS = new Set([\n \"constantBufferStyle\",\n \"pixelConstantBufferRemap\",\n \"samplerName\",\n \"vertexStructuredCapacity\",\n \"dataTextureWidth\",\n \"stubResourceRegisters\",\n \"neutralResourceRegisters\",\n \"detailMapArrayRegisters\",\n \"lightConstantBuffer\",\n \"lightPackedTexture\",\n \"pairVaryings\",\n \"source\"\n]);\n\nconst EMIT_GLSL_PROFILE_KEYS = new Set([\n \"constantBufferStyle\",\n \"pixelConstantBufferRemap\",\n \"samplerName\",\n \"vertexStructuredCapacity\",\n \"dataTextureWidth\",\n \"stubResourceRegisters\",\n \"neutralResourceRegisters\",\n \"detailMapArrayRegisters\",\n \"lightConstantBuffer\",\n \"lightPackedTexture\"\n]);\n\n/**\n * Translates one DXBC stage into GLSL ES 3.00 source, sharing one core path\n * between `CjsWebglFormat.emitGlsl` (static) and `EmitGlsl` (instance).\n *\n * `options` is a flat bag combining the emitter's ccpwgl-profile constructor\n * bits (`constantBufferStyle`, `pixelConstantBufferRemap`, `samplerName`,\n * `vertexStructuredCapacity`, `dataTextureWidth`) with its per-call Emit\n * options (`pairVaryings`, `source`); omitted keys keep the emitter's\n * existing defaults exactly.\n *\n * @param {ArrayBuffer|ArrayBufferView|Uint8Array} dxbcBytes DXBC container bytes.\n * @param {object} [options] Combined profile/emit options.\n * @returns {{source:string,stageName:string,inputs:object[],outputs:object[],bindings:object[],warnings:string[],computeFragment:(object|undefined)}}\n * GLSL text plus the IO contract the packaging layer records; compute\n * stages add the emitter's `computeFragment` host contract.\n */\nexport function emitGlslWithOptions(dxbcBytes, options = {})\n{\n if (!options || typeof options !== \"object\")\n {\n throw new TypeError(\"CjsWebglFormat: emitGlsl options must be an object\");\n }\n for (const key of Object.keys(options))\n {\n if (!EMIT_GLSL_OPTION_KEYS.has(key))\n {\n throw new TypeError(`CjsWebglFormat: unknown emitGlsl option ${JSON.stringify(key)}`);\n }\n }\n\n const profile = {};\n for (const key of EMIT_GLSL_PROFILE_KEYS)\n {\n if (Object.prototype.hasOwnProperty.call(options, key)) profile[key] = options[key];\n }\n\n const emitter = new DxbcGlslEmitter({ profile });\n const result = emitter.Emit(dxbcBytes, {\n source: options.source,\n pairVaryings: options.pairVaryings\n });\n\n // The packed local-light lowering leaves two idioms that must not reach a\n // driver: a flag mask round-tripped through a float, and an all-bits mask\n // stored as a float and then used for branch control, where 0xFFFFFFFF is a\n // NaN. Applied here rather than at a call site so every caller gets them.\n if (!options.lightPackedTexture) return result;\n\n return {\n ...result,\n source: applyPackedLightFixups(result.source, result.stageName)\n };\n}\n\n/**\n * Deep-convert a value to plain JSON-compatible data. Typed arrays become\n * plain number arrays; Maps/Sets become objects/arrays; class instances\n * with toJSON are honoured.\n *\n * @param {any} value Value to convert.\n * @returns {any} Plain data.\n */\nexport function toJsonValue(value)\n{\n if (value === null || value === undefined) return value ?? null;\n if (typeof value === \"number\" || typeof value === \"string\" || typeof value === \"boolean\") return value;\n if (typeof value === \"bigint\") return value.toString();\n if (ArrayBuffer.isView(value)) return Array.from(value);\n if (Array.isArray(value)) return value.map(toJsonValue);\n if (value instanceof Map)\n {\n const out = {};\n for (const [ key, entry ] of value) out[key] = toJsonValue(entry);\n return out;\n }\n if (value instanceof Set) return Array.from(value, toJsonValue);\n if (typeof value === \"object\")\n {\n if (typeof value.toJSON === \"function\") return toJsonValue(value.toJSON());\n const out = {};\n for (const key of Object.keys(value)) out[key] = toJsonValue(value[key]);\n return out;\n }\n return null;\n}\n\nexport { WebglReadError };\n"],"names":["OUTPUT_JSON","DEFAULT_VALUES","Object","freeze","emit","source","VALID_EMITS","Set","OPTION_KEYS","normalizeValues","base","options","readerName","TypeError","key","keys","has","JSON","stringify","values","toBytes","input","Uint8Array","ArrayBuffer","isView","buffer","byteOffset","byteLength","isWebglEffectContainer","looksLikeCarbonEffectContainer","EMIT_GLSL_OPTION_KEYS","EMIT_GLSL_PROFILE_KEYS","emitGlslWithOptions","dxbcBytes","profile","prototype","hasOwnProperty","call","emitter","DxbcGlslEmitter","result","Emit","pairVaryings","lightPackedTexture","applyPackedLightFixups","stageName","toJsonValue","value","undefined","toString","Array","from","isArray","map","Map","out","entry","toJSON"],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASO,MAAMA,WAAW,GAAG;MAEdC,cAAc,GAAGC,MAAM,CAACC,MAAM,CAAC;AACxCC,EAAAA,IAAI,EAAEJ,WAAW;AACjBK,EAAAA,MAAM,EAAE;AACZ,CAAC;AAED,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAAC,CAAEP,WAAW,CAAE,CAAC;AAC5C,MAAMQ,WAAW,GAAG,IAAID,GAAG,CAAC,CAAE,MAAM,EAAE,QAAQ,CAAE,CAAC;;AAEjD;AACA;AACA;AACA;AACA;AACA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
2
+ import { hlslShaderStageName } from '../../hlsl/core/tr2/HlslRenderContextEnum.js';
3
+
4
+ /**
5
+ * Cheap inspection of a WebGL effect container.
6
+ *
7
+ * The chunk package's inspection reported tags, offsets and sizes, because a
8
+ * chunk file's structure *was* a list of tagged byte ranges. A Carbon v15
9
+ * container has no such list, so none of that vocabulary is carried across. A
10
+ * `chunks` array describing a container would be a lie, and a believed one.
11
+ *
12
+ * What a container's structure actually is: an arena of strings, a set of
13
+ * permutation axes, and an offset table whose rows point at description bodies —
14
+ * with rows deliberately aliased onto one body when permutations share a
15
+ * translation. So that is what this reports: how many rows, how many distinct
16
+ * bodies they resolve to, how much of the file is arena, and what the axes are.
17
+ *
18
+ * `uniqueBodyCount` and `aliasedRowCount` come from the reader's own structural
19
+ * diagnostics rather than being recomputed here — the reader already validates
20
+ * every row's byte range while building them, so a second walk could only
21
+ * disagree with the thing that already refused to construct.
22
+ *
23
+ * Body decoding is done once per *distinct* body offset, not once per row.
24
+ * Effects here reach 4,096 permutations over a few dozen bodies, so decoding per
25
+ * row would make an inspection call cost more than the packaging that produced
26
+ * the file.
27
+ */
28
+
29
+ /**
30
+ * Counts programs and backend blocks across the container's distinct bodies.
31
+ *
32
+ * A stage slot with zero-length `shaderData` is a declared stage that carries no
33
+ * stored program — the shape `buildCarbonEffectContainer` emits for a body the
34
+ * translator could not lower. Counting those separately is the whole point: a
35
+ * container with every stage present and every program empty would otherwise
36
+ * inspect identically to a complete one.
37
+ *
38
+ * @param {CjsCarbonEffectReader} reader Container reader.
39
+ * @returns {{programCount:number, emptyProgramCount:number, backendBlockCount:number,
40
+ * techniqueCount:number, passCount:number, stageNames:string[]}} Body tallies.
41
+ */
42
+ function inspectBodies(reader) {
43
+ const seenOffsets = new Set();
44
+ const stageNames = new Set();
45
+ let programCount = 0;
46
+ let emptyProgramCount = 0;
47
+ let backendBlockCount = 0;
48
+ let techniqueCount = 0;
49
+ let passCount = 0;
50
+ for (let index = 0; index < reader.records.length; index += 1) {
51
+ const {
52
+ offset
53
+ } = reader.records[index];
54
+ if (seenOffsets.has(offset)) continue;
55
+ seenOffsets.add(offset);
56
+ const description = reader.readDescription(index, {
57
+ backend: true
58
+ });
59
+ for (const technique of description.techniques) {
60
+ techniqueCount += 1;
61
+ for (const pass of technique.passes) {
62
+ passCount += 1;
63
+ if (pass.backendBlock?.size) backendBlockCount += 1;
64
+ for (const stage of pass.stages) {
65
+ stageNames.add(hlslShaderStageName(stage.type));
66
+ if (stage.shaderData?.size) programCount += 1;else emptyProgramCount += 1;
67
+ }
68
+ }
69
+ }
70
+ }
71
+ return {
72
+ programCount,
73
+ emptyProgramCount,
74
+ backendBlockCount,
75
+ techniqueCount,
76
+ passCount,
77
+ stageNames: [...stageNames].sort()
78
+ };
79
+ }
80
+
81
+ /**
82
+ * Inspects WebGL effect container bytes.
83
+ *
84
+ * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Container payload.
85
+ * @param {object} [values] Normalized format values.
86
+ * @param {string} [values.source] Source name, for diagnostics.
87
+ * @returns {object} Plain summary data.
88
+ */
89
+ function inspectGlslEffectContainer(input, values = {}) {
90
+ const source = values.source ?? "memory";
91
+ const reader = new CjsCarbonEffectReader(input, {
92
+ source
93
+ });
94
+ const bodies = inspectBodies(reader);
95
+ return {
96
+ source,
97
+ isContainer: true,
98
+ version: reader.version,
99
+ compilerVersion: [...reader.compilerVersion],
100
+ byteLength: reader.bytes.length,
101
+ arenaByteLength: reader.stringTableSize,
102
+ // The offset table, and what it resolves to. `recordCount` counts rows;
103
+ // `uniqueBodyCount` counts the bodies those rows point at. The gap
104
+ // between them is the sharing, which is the container's whole reason for
105
+ // being cheaper than one file per permutation.
106
+ recordCount: reader.diagnostics.recordCount,
107
+ permutationProduct: reader.diagnostics.permutationProduct,
108
+ dense: reader.diagnostics.dense,
109
+ uniqueBodyCount: reader.diagnostics.uniqueBodyCount,
110
+ aliasedRowCount: reader.diagnostics.aliasedRowCount,
111
+ permutationAxes: reader.permutations.map(axis => ({
112
+ name: axis.name.value,
113
+ type: axis.type,
114
+ defaultOption: axis.defaultOption,
115
+ options: axis.options.map(option => option.value)
116
+ })),
117
+ ...bodies
118
+ };
119
+ }
120
+
121
+ export { inspectGlslEffectContainer };
122
+ //# sourceMappingURL=inspectGlslEffectContainer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspectGlslEffectContainer.js","sources":["../../../../../src/formats/webgl/core/inspectGlslEffectContainer.js"],"sourcesContent":["import { CjsCarbonEffectReader } from \"../../../format/carbonEffect/CjsCarbonEffectReader.js\";\nimport { hlslShaderStageName } from \"../../hlsl/core/tr2/HlslRenderContextEnum.js\";\n\n/**\n * Cheap inspection of a WebGL effect container.\n *\n * The chunk package's inspection reported tags, offsets and sizes, because a\n * chunk file's structure *was* a list of tagged byte ranges. A Carbon v15\n * container has no such list, so none of that vocabulary is carried across. A\n * `chunks` array describing a container would be a lie, and a believed one.\n *\n * What a container's structure actually is: an arena of strings, a set of\n * permutation axes, and an offset table whose rows point at description bodies —\n * with rows deliberately aliased onto one body when permutations share a\n * translation. So that is what this reports: how many rows, how many distinct\n * bodies they resolve to, how much of the file is arena, and what the axes are.\n *\n * `uniqueBodyCount` and `aliasedRowCount` come from the reader's own structural\n * diagnostics rather than being recomputed here — the reader already validates\n * every row's byte range while building them, so a second walk could only\n * disagree with the thing that already refused to construct.\n *\n * Body decoding is done once per *distinct* body offset, not once per row.\n * Effects here reach 4,096 permutations over a few dozen bodies, so decoding per\n * row would make an inspection call cost more than the packaging that produced\n * the file.\n */\n\n/**\n * Counts programs and backend blocks across the container's distinct bodies.\n *\n * A stage slot with zero-length `shaderData` is a declared stage that carries no\n * stored program — the shape `buildCarbonEffectContainer` emits for a body the\n * translator could not lower. Counting those separately is the whole point: a\n * container with every stage present and every program empty would otherwise\n * inspect identically to a complete one.\n *\n * @param {CjsCarbonEffectReader} reader Container reader.\n * @returns {{programCount:number, emptyProgramCount:number, backendBlockCount:number,\n * techniqueCount:number, passCount:number, stageNames:string[]}} Body tallies.\n */\nfunction inspectBodies(reader)\n{\n const seenOffsets = new Set();\n const stageNames = new Set();\n let programCount = 0;\n let emptyProgramCount = 0;\n let backendBlockCount = 0;\n let techniqueCount = 0;\n let passCount = 0;\n\n for (let index = 0; index < reader.records.length; index += 1)\n {\n const { offset } = reader.records[index];\n if (seenOffsets.has(offset)) continue;\n seenOffsets.add(offset);\n\n const description = reader.readDescription(index, { backend: true });\n for (const technique of description.techniques)\n {\n techniqueCount += 1;\n for (const pass of technique.passes)\n {\n passCount += 1;\n if (pass.backendBlock?.size) backendBlockCount += 1;\n for (const stage of pass.stages)\n {\n stageNames.add(hlslShaderStageName(stage.type));\n if (stage.shaderData?.size) programCount += 1;\n else emptyProgramCount += 1;\n }\n }\n }\n }\n\n return {\n programCount,\n emptyProgramCount,\n backendBlockCount,\n techniqueCount,\n passCount,\n stageNames: [ ...stageNames ].sort()\n };\n}\n\n/**\n * Inspects WebGL effect container bytes.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Container payload.\n * @param {object} [values] Normalized format values.\n * @param {string} [values.source] Source name, for diagnostics.\n * @returns {object} Plain summary data.\n */\nexport function inspectGlslEffectContainer(input, values = {})\n{\n const source = values.source ?? \"memory\";\n const reader = new CjsCarbonEffectReader(input, { source });\n const bodies = inspectBodies(reader);\n\n return {\n source,\n isContainer: true,\n version: reader.version,\n compilerVersion: [ ...reader.compilerVersion ],\n byteLength: reader.bytes.length,\n arenaByteLength: reader.stringTableSize,\n\n // The offset table, and what it resolves to. `recordCount` counts rows;\n // `uniqueBodyCount` counts the bodies those rows point at. The gap\n // between them is the sharing, which is the container's whole reason for\n // being cheaper than one file per permutation.\n recordCount: reader.diagnostics.recordCount,\n permutationProduct: reader.diagnostics.permutationProduct,\n dense: reader.diagnostics.dense,\n uniqueBodyCount: reader.diagnostics.uniqueBodyCount,\n aliasedRowCount: reader.diagnostics.aliasedRowCount,\n\n permutationAxes: reader.permutations.map((axis) => ({\n name: axis.name.value,\n type: axis.type,\n defaultOption: axis.defaultOption,\n options: axis.options.map((option) => option.value)\n })),\n\n ...bodies\n };\n}\n\nexport default inspectGlslEffectContainer;\n"],"names":["inspectBodies","reader","seenOffsets","Set","stageNames","programCount","emptyProgramCount","backendBlockCount","techniqueCount","passCount","index","records","length","offset","has","add","description","readDescription","backend","technique","techniques","pass","passes","backendBlock","size","stage","stages","hlslShaderStageName","type","shaderData","sort","inspectGlslEffectContainer","input","values","source","CjsCarbonEffectReader","bodies","isContainer","version","compilerVersion","byteLength","bytes","arenaByteLength","stringTableSize","recordCount","diagnostics","permutationProduct","dense","uniqueBodyCount","aliasedRowCount","permutationAxes","permutations","map","axis","name","value","defaultOption","options","option"],"mappings":";;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,aAAaA,CAACC,MAAM,EAC7B;AACI,EAAA,MAAMC,WAAW,GAAG,IAAIC,GAAG,EAAE;AAC7B,EAAA,MAAMC,UAAU,GAAG,IAAID,GAAG,EAAE;EAC5B,IAAIE,YAAY,GAAG,CAAC;EACpB,IAAIC,iBAAiB,GAAG,CAAC;EACzB,IAAIC,iBAAiB,GAAG,CAAC;EACzB,IAAIC,cAAc,GAAG,CAAC;EACtB,IAAIC,SAAS,GAAG,CAAC;AAEjB,EAAA,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGT,MAAM,CAACU,OAAO,CAACC,MAAM,EAAEF,KAAK,IAAI,CAAC,EAC7D;IACI,MAAM;AAAEG,MAAAA;AAAO,KAAC,GAAGZ,MAAM,CAACU,OAAO,CAACD,KAAK,CAAC;AACxC,IAAA,IAAIR,WAAW,CAACY,GAAG,CAACD,MAAM,CAAC,EAAE;AAC7BX,IAAAA,WAAW,CAACa,GAAG,CAACF,MAAM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