@carbonenginejs/runtime-resource 0.17.0 → 0.18.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 (29) hide show
  1. package/dist/format/carbonEffect/backendEngineId.js +1 -3
  2. package/dist/format/carbonEffect/backendEngineId.js.map +1 -1
  3. package/dist/format/carbonEffect/carbonEffectBackendBlock.js +2 -1
  4. package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
  5. package/dist/format/carbonEffect/carbonEffectResourceTransform.js +1 -1
  6. package/dist/format/carbonEffect/carbonEffectResourceTransform.js.map +1 -1
  7. package/dist/format/effect/effectPermutationGraph.js +46 -29
  8. package/dist/format/effect/effectPermutationGraph.js.map +1 -1
  9. package/dist/formats/hlsl/core/detailMapFamily.js +1 -1
  10. package/dist/formats/hlsl/core/detailMapFamily.js.map +1 -1
  11. package/dist/formats/hlsl/core/localLightFamily.js +1 -1
  12. package/dist/formats/hlsl/core/localLightFamily.js.map +1 -1
  13. package/dist/formats/webgl/core/effectPackage.js +2 -3
  14. package/dist/formats/webgl/core/effectPackage.js.map +1 -1
  15. package/dist/formats/webgl/core/glslBackendBlock.js +6 -5
  16. package/dist/formats/webgl/core/glslBackendBlock.js.map +1 -1
  17. package/dist/formats/webgl/core/glslBackendBodySet.js +0 -1
  18. package/dist/formats/webgl/core/glslBackendBodySet.js.map +1 -1
  19. package/dist/formats/webgpu/CjsWebgpuFormat.js +161 -163
  20. package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  21. package/dist/formats/webgpu/core/effectBackendBodySet.js +21 -22
  22. package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
  23. package/dist/formats/webgpu/core/helpers.js +111 -99
  24. package/dist/formats/webgpu/core/helpers.js.map +1 -1
  25. package/dist/formats/webgpu/core/packageEffect.js +30 -32
  26. package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
  27. package/docs/formats/webgpu/formats/carbon-webgpu.md +11 -4
  28. package/docs/formats/webgpu/reference/api.md +7 -6
  29. package/package.json +2 -2
@@ -5,18 +5,18 @@ import { buildWgslBindingPlan } from './core/wgsl/buildWgslBindingPlan.js';
5
5
  import { buildWgslSet } from './core/wgsl/buildWgslSet.js';
6
6
  import { buildEffectPackage } from './core/packageEffect.js';
7
7
  import { FORMAT_WEBGPU_PACKAGE_VERSION } from './core/packageMetadata.js';
8
- import { DEFAULT_VALUES, normalizeValues, validateClassKey, validateClass, readWithValues, inspectWithValues, analyzeEffectWithValues, toJsonValue, isCarbonWebgpu, OUTPUT_JSON, OUTPUT_RAW, CARBON_WEBGPU_FORMAT, CARBON_WEBGPU_ANALYSIS_FORMAT } from './core/helpers.js';
8
+ import { DEFAULT_VALUES, normalizeValues, validateClassKey, validateClass, readWithValues, inspectWithValues, analyzeEffectWithValues, toJsonValue, isCarbonWebgpu, OUTPUT_JSON, CARBON_WEBGPU_FORMAT, CARBON_WEBGPU_ANALYSIS_FORMAT } from './core/helpers.js';
9
9
 
10
10
  const FORMAT_NAME = "CjsWebgpuFormat";
11
11
 
12
- /**
13
- * CarbonEngineJS-facing format surface for `.carbonwebgpu` WebGPU packages, plus an
14
- * offline effect-analysis helper built on the runtime-resource HLSL and DXBC
15
- * format subpaths.
16
- *
17
- * The package owns read/build, normalized shader analysis, and the current
18
- * bounded DXBC-to-WGSL profiles. Broader shader-semantic coverage remains an
19
- * explicit qualification ladder.
12
+ /**
13
+ * CarbonEngineJS-facing format surface for `.carbonwebgpu` WebGPU packages, plus an
14
+ * offline effect-analysis helper built on the runtime-resource HLSL and DXBC
15
+ * format subpaths.
16
+ *
17
+ * The package owns read/build, normalized shader analysis, and the current
18
+ * bounded DXBC-to-WGSL profiles. Broader shader-semantic coverage remains an
19
+ * explicit qualification ladder.
20
20
  */
21
21
  class CjsWebgpuFormat {
22
22
  #emit = DEFAULT_VALUES.emit;
@@ -26,20 +26,20 @@ class CjsWebgpuFormat {
26
26
  #schema = DEFAULT_VALUES.schema;
27
27
  #classes = {};
28
28
 
29
- /**
30
- * Create a reusable format profile.
31
- *
32
- * @param {object} [options] Default format values.
29
+ /**
30
+ * Create a reusable format profile.
31
+ *
32
+ * @param {object} [options] Default format values.
33
33
  */
34
34
  constructor(options = {}) {
35
35
  this.SetValues(options);
36
36
  }
37
37
 
38
- /**
39
- * Set format values for this reusable profile.
40
- *
41
- * @param {object} [options] Values to merge into the profile.
42
- * @returns {CjsWebgpuFormat} This format profile.
38
+ /**
39
+ * Set format values for this reusable profile.
40
+ *
41
+ * @param {object} [options] Values to merge into the profile.
42
+ * @returns {CjsWebgpuFormat} This format profile.
43
43
  */
44
44
  SetValues(options = {}) {
45
45
  const values = normalizeValues(this.GetValues(), options, CLASS_KEYS, FORMAT_NAME);
@@ -52,11 +52,11 @@ class CjsWebgpuFormat {
52
52
  return this;
53
53
  }
54
54
 
55
- /**
56
- * Get this profile's current values, optionally with per-call overrides.
57
- *
58
- * @param {object} [options] Optional values to merge into a copy.
59
- * @returns {object} A copy of the effective values.
55
+ /**
56
+ * Get this profile's current values, optionally with per-call overrides.
57
+ *
58
+ * @param {object} [options] Optional values to merge into a copy.
59
+ * @returns {object} A copy of the effective values.
60
60
  */
61
61
  GetValues(options = {}) {
62
62
  return normalizeValues({
@@ -69,11 +69,11 @@ class CjsWebgpuFormat {
69
69
  }, options, CLASS_KEYS, FORMAT_NAME);
70
70
  }
71
71
 
72
- /**
73
- * Set multiple node-class constructors for this profile.
74
- *
75
- * @param {object} [classes] Map of node class keys to constructors.
76
- * @returns {CjsWebgpuFormat} This format profile.
72
+ /**
73
+ * Set multiple node-class constructors for this profile.
74
+ *
75
+ * @param {object} [classes] Map of node class keys to constructors.
76
+ * @returns {CjsWebgpuFormat} This format profile.
77
77
  */
78
78
  SetClasses(classes = {}) {
79
79
  return this.SetValues({
@@ -81,12 +81,12 @@ class CjsWebgpuFormat {
81
81
  });
82
82
  }
83
83
 
84
- /**
85
- * Set one node-class constructor for this profile.
86
- *
87
- * @param {string} type Node class key.
88
- * @param {Function|null|undefined} Class constructor to use, or nullish to delete.
89
- * @returns {CjsWebgpuFormat} This format profile.
84
+ /**
85
+ * Set one node-class constructor for this profile.
86
+ *
87
+ * @param {string} type Node class key.
88
+ * @param {Function|null|undefined} Class constructor to use, or nullish to delete.
89
+ * @returns {CjsWebgpuFormat} This format profile.
90
90
  */
91
91
  SetClass(type, Class) {
92
92
  validateClassKey(CLASS_KEYS, type, FORMAT_NAME);
@@ -102,68 +102,68 @@ class CjsWebgpuFormat {
102
102
  return this;
103
103
  }
104
104
 
105
- /**
106
- * Get a configured node-class constructor.
107
- *
108
- * @param {string} type Node class key.
109
- * @returns {Function|undefined} The registered constructor, if any.
105
+ /**
106
+ * Get a configured node-class constructor.
107
+ *
108
+ * @param {string} type Node class key.
109
+ * @returns {Function|undefined} The registered constructor, if any.
110
110
  */
111
111
  GetClass(type) {
112
112
  validateClassKey(CLASS_KEYS, type, FORMAT_NAME);
113
113
  return this.#classes[type];
114
114
  }
115
115
 
116
- /**
117
- * Whether this format profile has a constructor registered for a node key.
118
- *
119
- * @param {string} type Node class key.
120
- * @returns {boolean} True when a constructor is registered.
116
+ /**
117
+ * Whether this format profile has a constructor registered for a node key.
118
+ *
119
+ * @param {string} type Node class key.
120
+ * @returns {boolean} True when a constructor is registered.
121
121
  */
122
122
  HasClass(type) {
123
123
  return !!this.GetClass(type);
124
124
  }
125
125
 
126
- /**
127
- * Read a Carbon WebGPU package with this profile's values.
128
- *
129
- * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.
130
- * @param {object} [options] Per-call value overrides.
131
- * @returns {object} Plain JSON data, or the raw package instance when emit is "raw".
126
+ /**
127
+ * Read a Carbon WebGPU package with this profile's values.
128
+ *
129
+ * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.
130
+ * @param {object} [options] Per-call value overrides.
131
+ * @returns {object} Plain JSON data: the container-backed views plus the complete backend body set.
132
132
  */
133
133
  Read(input, options = {}) {
134
134
  return readWithValues(input, this.GetValues(options));
135
135
  }
136
136
 
137
- /**
138
- * Inspect a Carbon WebGPU package without building the full JSON shape.
139
- *
140
- * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.
141
- * @param {object} [options] Per-call value overrides.
142
- * @returns {object} Plain summary data.
137
+ /**
138
+ * Inspect a Carbon WebGPU package without building the full JSON shape.
139
+ *
140
+ * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.
141
+ * @param {object} [options] Per-call value overrides.
142
+ * @returns {object} Plain summary data.
143
143
  */
144
144
  Inspect(input, options = {}) {
145
145
  return inspectWithValues(input, this.GetValues(options));
146
146
  }
147
147
 
148
- /**
149
- * Analyzes one compiled effect payload into a normalized WebGPU-facing
150
- * document using the current profile's values.
151
- *
152
- * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Tr2 effect bytes.
153
- * @param {object} [options] Per-call value overrides.
154
- * @returns {object} Plain JSON-compatible analysis data.
148
+ /**
149
+ * Analyzes one compiled effect payload into a normalized WebGPU-facing
150
+ * document using the current profile's values.
151
+ *
152
+ * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Tr2 effect bytes.
153
+ * @param {object} [options] Per-call value overrides.
154
+ * @returns {object} Plain JSON-compatible analysis data.
155
155
  */
156
156
  AnalyzeEffect(input, options = {}) {
157
157
  return analyzeEffectWithValues(input, this.GetValues(options));
158
158
  }
159
159
 
160
- /**
161
- * Builds a Carbon WebGPU package with complete version-15 source reflection and
162
- * selected-body WebGPU output from compiled Tr2 effect bytes.
163
- *
164
- * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.
165
- * @param {object} [options] Source, body-mode, permutation, and stage-selection policy.
166
- * @returns {object} Package bytes plus inspection and provenance documents.
160
+ /**
161
+ * Builds a Carbon WebGPU package with complete version-15 source reflection and
162
+ * selected-body WebGPU output from compiled Tr2 effect bytes.
163
+ *
164
+ * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.
165
+ * @param {object} [options] Source, body-mode, permutation, and stage-selection policy.
166
+ * @returns {object} Package bytes plus inspection and provenance documents.
167
167
  */
168
168
  BuildEffect(input, options = {}) {
169
169
  const values = this.GetValues();
@@ -174,179 +174,177 @@ class CjsWebgpuFormat {
174
174
  });
175
175
  }
176
176
 
177
- /**
178
- * Lowers DXBC bytes or decoded instructions into the front-end shader IR.
179
- *
180
- * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC input.
181
- * @param {object} [options] IR provenance options.
182
- * @returns {object} Frozen shader IR program.
177
+ /**
178
+ * Lowers DXBC bytes or decoded instructions into the front-end shader IR.
179
+ *
180
+ * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC input.
181
+ * @param {object} [options] IR provenance options.
182
+ * @returns {object} Frozen shader IR program.
183
183
  */
184
184
  BuildShaderIr(input, options = {}) {
185
185
  return lowerDxbcToIr(input, options);
186
186
  }
187
187
 
188
- /**
189
- * Emits WGSL for the currently supported typed shader slice.
190
- *
191
- * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC or shader IR.
192
- * @param {object} [options] Source/provenance options.
193
- * @returns {object} Frozen WGSL shader descriptor.
188
+ /**
189
+ * Emits WGSL for the currently supported typed shader slice.
190
+ *
191
+ * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC or shader IR.
192
+ * @param {object} [options] Source/provenance options.
193
+ * @returns {object} Frozen WGSL shader descriptor.
194
194
  */
195
195
  BuildWgsl(input, options = {}) {
196
196
  return buildWgsl(input, options);
197
197
  }
198
198
 
199
- /**
200
- * Assign one canonical numeric binding layout across shader stages in a pass.
201
- * Unshared D3D tuples remain stage-scoped unless shared explicitly.
202
- *
203
- * @param {object[]} programs Complete CJS shader IR stage set for one pass.
204
- * @param {object} [options] Pass-level binding policy.
205
- * @param {string[]} [options.sharedIdentities] Compatible D3D identities
206
- * confirmed to represent one resource across stages.
207
- * @returns {object} Frozen CJS_WGSL_BINDING_PLAN document.
199
+ /**
200
+ * Assign one canonical numeric binding layout across shader stages in a pass.
201
+ * Unshared D3D tuples remain stage-scoped unless shared explicitly.
202
+ *
203
+ * @param {object[]} programs Complete CJS shader IR stage set for one pass.
204
+ * @param {object} [options] Pass-level binding policy.
205
+ * @param {string[]} [options.sharedIdentities] Compatible D3D identities
206
+ * confirmed to represent one resource across stages.
207
+ * @returns {object} Frozen CJS_WGSL_BINDING_PLAN document.
208
208
  */
209
209
  BuildWgslBindingPlan(programs, options = {}) {
210
210
  return buildWgslBindingPlan(programs, options);
211
211
  }
212
212
 
213
- /**
214
- * Assembles emitted shader descriptors into a portable WGSL set.
215
- *
216
- * @param {object[]} entries Canonically keyed emitted shader descriptors.
217
- * @returns {object} Frozen CJS_WGSL_SET document.
213
+ /**
214
+ * Assembles emitted shader descriptors into a portable WGSL set.
215
+ *
216
+ * @param {object[]} entries Canonically keyed emitted shader descriptors.
217
+ * @returns {object} Frozen CJS_WGSL_SET document.
218
218
  */
219
219
  BuildWgslSet(entries) {
220
220
  return buildWgslSet(entries);
221
221
  }
222
222
 
223
- /**
224
- * Convert format output to JSON-compatible data.
225
- *
226
- * @param {any} value Format output to convert.
227
- * @returns {any} Plain JSON-compatible data.
223
+ /**
224
+ * Convert format output to JSON-compatible data.
225
+ *
226
+ * @param {any} value Format output to convert.
227
+ * @returns {any} Plain JSON-compatible data.
228
228
  */
229
229
  ToJSON(value) {
230
230
  return toJsonValue(value);
231
231
  }
232
232
 
233
- /**
234
- * Static payload sniff. Static methods use camelCase by convention.
235
- *
236
- * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Candidate bytes.
237
- * @returns {boolean} True when the payload has Carbon's version-15 shape.
233
+ /**
234
+ * Static payload sniff. Static methods use camelCase by convention.
235
+ *
236
+ * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Candidate bytes.
237
+ * @returns {boolean} True when the payload has Carbon's version-15 shape.
238
238
  */
239
239
  static isCarbonWebgpu(input) {
240
240
  return isCarbonWebgpu(input);
241
241
  }
242
242
 
243
- /**
244
- * Static one-shot read.
245
- *
246
- * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.
247
- * @param {object} [options] Format values.
248
- * @returns {object} Plain JSON data, or the raw package instance when emit is "raw".
243
+ /**
244
+ * Static one-shot read.
245
+ *
246
+ * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.
247
+ * @param {object} [options] Format values.
248
+ * @returns {object} Plain JSON data: the container-backed views plus the complete backend body set.
249
249
  */
250
250
  static read(input, options = {}) {
251
251
  return readWithValues(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME));
252
252
  }
253
253
 
254
- /**
255
- * Static one-shot inspection.
256
- *
257
- * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.
258
- * @param {object} [options] Format values.
259
- * @returns {object} Plain summary data.
254
+ /**
255
+ * Static one-shot inspection.
256
+ *
257
+ * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.
258
+ * @param {object} [options] Format values.
259
+ * @returns {object} Plain summary data.
260
260
  */
261
261
  static inspect(input, options = {}) {
262
262
  return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME));
263
263
  }
264
264
 
265
- /**
266
- * Static one-shot effect analysis.
267
- *
268
- * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Tr2 effect bytes.
269
- * @param {object} [options] Format values.
270
- * @returns {object} Plain JSON-compatible analysis data.
265
+ /**
266
+ * Static one-shot effect analysis.
267
+ *
268
+ * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Tr2 effect bytes.
269
+ * @param {object} [options] Format values.
270
+ * @returns {object} Plain JSON-compatible analysis data.
271
271
  */
272
272
  static analyzeEffect(input, options = {}) {
273
273
  return analyzeEffectWithValues(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME));
274
274
  }
275
275
 
276
- /**
277
- * Static selected-body Carbon WebGPU builder.
278
- *
279
- * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.
280
- * @param {object} [options] Source, body-mode, permutation, and stage-selection policy.
281
- * @returns {object} Package bytes plus inspection and provenance documents.
276
+ /**
277
+ * Static selected-body Carbon WebGPU builder.
278
+ *
279
+ * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.
280
+ * @param {object} [options] Source, body-mode, permutation, and stage-selection policy.
281
+ * @returns {object} Package bytes plus inspection and provenance documents.
282
282
  */
283
283
  static buildEffect(input, options = {}) {
284
284
  return buildEffectPackage(input, options);
285
285
  }
286
286
 
287
- /**
288
- * Static DXBC-to-front-end-IR helper.
289
- *
290
- * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC input.
291
- * @param {object} [options] IR provenance options.
292
- * @returns {object} Frozen shader IR program.
287
+ /**
288
+ * Static DXBC-to-front-end-IR helper.
289
+ *
290
+ * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC input.
291
+ * @param {object} [options] IR provenance options.
292
+ * @returns {object} Frozen shader IR program.
293
293
  */
294
294
  static buildShaderIr(input, options = {}) {
295
295
  return lowerDxbcToIr(input, options);
296
296
  }
297
297
 
298
- /**
299
- * Static WGSL emission helper for the currently supported typed slice.
300
- *
301
- * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC or shader IR.
302
- * @param {object} [options] Source/provenance options.
303
- * @returns {object} Frozen WGSL shader descriptor.
298
+ /**
299
+ * Static WGSL emission helper for the currently supported typed slice.
300
+ *
301
+ * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC or shader IR.
302
+ * @param {object} [options] Source/provenance options.
303
+ * @returns {object} Frozen WGSL shader descriptor.
304
304
  */
305
305
  static buildWgsl(input, options = {}) {
306
306
  return buildWgsl(input, options);
307
307
  }
308
308
 
309
- /**
310
- * Static pass-global WGSL binding-plan helper. Unshared D3D tuples remain
311
- * stage-scoped unless listed in options.sharedIdentities.
312
- *
313
- * @param {object[]} programs Complete CJS shader IR stage set for one pass.
314
- * @param {object} [options] Pass-level binding policy.
315
- * @param {string[]} [options.sharedIdentities] Compatible D3D identities
316
- * confirmed to represent one resource across stages.
317
- * @returns {object} Frozen CJS_WGSL_BINDING_PLAN document.
309
+ /**
310
+ * Static pass-global WGSL binding-plan helper. Unshared D3D tuples remain
311
+ * stage-scoped unless listed in options.sharedIdentities.
312
+ *
313
+ * @param {object[]} programs Complete CJS shader IR stage set for one pass.
314
+ * @param {object} [options] Pass-level binding policy.
315
+ * @param {string[]} [options.sharedIdentities] Compatible D3D identities
316
+ * confirmed to represent one resource across stages.
317
+ * @returns {object} Frozen CJS_WGSL_BINDING_PLAN document.
318
318
  */
319
319
  static buildWgslBindingPlan(programs, options = {}) {
320
320
  return buildWgslBindingPlan(programs, options);
321
321
  }
322
322
 
323
- /**
324
- * Static WGSL-set assembly helper.
325
- *
326
- * @param {object[]} entries Canonically keyed emitted shader descriptors.
327
- * @returns {object} Frozen CJS_WGSL_SET document.
323
+ /**
324
+ * Static WGSL-set assembly helper.
325
+ *
326
+ * @param {object[]} entries Canonically keyed emitted shader descriptors.
327
+ * @returns {object} Frozen CJS_WGSL_SET document.
328
328
  */
329
329
  static buildWgslSet(entries) {
330
330
  return buildWgslSet(entries);
331
331
  }
332
332
 
333
- /**
334
- * Static JSON-compatible conversion.
335
- *
336
- * @param {any} value Format output to convert.
337
- * @returns {any} Plain JSON-compatible data.
333
+ /**
334
+ * Static JSON-compatible conversion.
335
+ *
336
+ * @param {any} value Format output to convert.
337
+ * @returns {any} Plain JSON-compatible data.
338
338
  */
339
339
  static toJSON(value) {
340
340
  return toJsonValue(value);
341
341
  }
342
342
  static OUTPUT_JSON = OUTPUT_JSON;
343
- static OUTPUT_RAW = OUTPUT_RAW;
344
343
  static CLASS_KEYS = CLASS_KEYS;
345
344
  static type = Object.freeze(["shader"]);
346
345
  static mediaTypes = Object.freeze(["shader"]);
347
346
  static inputTypes = Object.freeze(["carbonwebgpu"]);
348
347
  static outputTypes = Object.freeze([OUTPUT_JSON]);
349
- static debugOutputTypes = Object.freeze([OUTPUT_RAW]);
350
348
  static implementationStatus = "partial";
351
349
  static format = CARBON_WEBGPU_FORMAT;
352
350
  static analysisFormat = CARBON_WEBGPU_ANALYSIS_FORMAT;
@@ -1 +1 @@
1
- {"version":3,"file":"CjsWebgpuFormat.js","sources":["../../../../src/formats/webgpu/CjsWebgpuFormat.js"],"sourcesContent":["import { CLASS_KEYS } from \"./core/schema.js\";\nimport { lowerDxbcToIr } from \"./core/ir/lowerDxbcToIr.js\";\nimport { buildWgsl } from \"./core/wgsl/emitWgsl.js\";\nimport { buildWgslBindingPlan } from \"./core/wgsl/buildWgslBindingPlan.js\";\nimport { buildWgslSet } from \"./core/wgsl/buildWgslSet.js\";\nimport { buildEffectPackage } from \"./core/packageEffect.js\";\nimport { FORMAT_WEBGPU_PACKAGE_VERSION } from \"./core/packageMetadata.js\";\nimport {\n CARBON_WEBGPU_ANALYSIS_FORMAT,\n CARBON_WEBGPU_FORMAT,\n DEFAULT_VALUES,\n OUTPUT_JSON,\n OUTPUT_RAW,\n analyzeEffectWithValues,\n inspectWithValues,\n isCarbonWebgpu,\n normalizeValues,\n readWithValues,\n toJsonValue,\n validateClass,\n validateClassKey\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsWebgpuFormat\";\n\n/**\n * CarbonEngineJS-facing format surface for `.carbonwebgpu` WebGPU packages, plus an\n * offline effect-analysis helper built on the runtime-resource HLSL and DXBC\n * format subpaths.\n *\n * The package owns read/build, normalized shader analysis, and the current\n * bounded DXBC-to-WGSL profiles. Broader shader-semantic coverage remains an\n * explicit qualification ladder.\n */\nexport class CjsWebgpuFormat\n{\n #emit = DEFAULT_VALUES.emit;\n #source = DEFAULT_VALUES.source;\n #decodeInstructions = DEFAULT_VALUES.decodeInstructions;\n #permutation = DEFAULT_VALUES.permutation;\n #schema = DEFAULT_VALUES.schema;\n #classes = {};\n\n /**\n * Create a reusable format profile.\n *\n * @param {object} [options] Default format values.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Set format values for this reusable profile.\n *\n * @param {object} [options] Values to merge into the profile.\n * @returns {CjsWebgpuFormat} This format profile.\n */\n SetValues(options = {})\n {\n const values = normalizeValues(this.GetValues(), options, CLASS_KEYS, FORMAT_NAME);\n this.#emit = values.emit;\n this.#source = values.source;\n this.#decodeInstructions = values.decodeInstructions;\n this.#permutation = values.permutation;\n this.#schema = values.schema;\n this.#classes = values.classes;\n return this;\n }\n\n /**\n * Get this profile's current values, optionally with per-call overrides.\n *\n * @param {object} [options] Optional values to merge into a copy.\n * @returns {object} A copy of the effective values.\n */\n GetValues(options = {})\n {\n return normalizeValues({\n emit: this.#emit,\n source: this.#source,\n decodeInstructions: this.#decodeInstructions,\n permutation: this.#permutation,\n schema: this.#schema,\n classes: this.#classes\n }, options, CLASS_KEYS, FORMAT_NAME);\n }\n\n /**\n * Set multiple node-class constructors for this profile.\n *\n * @param {object} [classes] Map of node class keys to constructors.\n * @returns {CjsWebgpuFormat} This format profile.\n */\n SetClasses(classes = {})\n {\n return this.SetValues({ classes });\n }\n\n /**\n * Set one node-class constructor for this profile.\n *\n * @param {string} type Node class key.\n * @param {Function|null|undefined} Class constructor to use, or nullish to delete.\n * @returns {CjsWebgpuFormat} This format profile.\n */\n SetClass(type, Class)\n {\n validateClassKey(CLASS_KEYS, type, FORMAT_NAME);\n if (Class === null || Class === undefined)\n {\n delete this.#classes[type];\n return this;\n }\n\n validateClass(CLASS_KEYS, type, Class, FORMAT_NAME);\n this.#classes = { ...this.#classes, [type]: Class };\n return this;\n }\n\n /**\n * Get a configured node-class constructor.\n *\n * @param {string} type Node class key.\n * @returns {Function|undefined} The registered constructor, if any.\n */\n GetClass(type)\n {\n validateClassKey(CLASS_KEYS, type, FORMAT_NAME);\n return this.#classes[type];\n }\n\n /**\n * Whether this format profile has a constructor registered for a node key.\n *\n * @param {string} type Node class key.\n * @returns {boolean} True when a constructor is registered.\n */\n HasClass(type)\n {\n return !!this.GetClass(type);\n }\n\n /**\n * Read a Carbon WebGPU package with this profile's values.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.\n * @param {object} [options] Per-call value overrides.\n * @returns {object} Plain JSON data, or the raw package instance when emit is \"raw\".\n */\n Read(input, options = {})\n {\n return readWithValues(input, this.GetValues(options));\n }\n\n /**\n * Inspect a Carbon WebGPU package without building the full JSON shape.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.\n * @param {object} [options] Per-call value overrides.\n * @returns {object} Plain summary data.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options));\n }\n\n /**\n * Analyzes one compiled effect payload into a normalized WebGPU-facing\n * document using the current profile's values.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Tr2 effect bytes.\n * @param {object} [options] Per-call value overrides.\n * @returns {object} Plain JSON-compatible analysis data.\n */\n AnalyzeEffect(input, options = {})\n {\n return analyzeEffectWithValues(input, this.GetValues(options));\n }\n\n /**\n * Builds a Carbon WebGPU package with complete version-15 source reflection and\n * selected-body WebGPU output from compiled Tr2 effect bytes.\n *\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.\n * @param {object} [options] Source, body-mode, permutation, and stage-selection policy.\n * @returns {object} Package bytes plus inspection and provenance documents.\n */\n BuildEffect(input, options = {})\n {\n const values = this.GetValues();\n\n return buildEffectPackage(input, {\n source: values.source,\n permutation: values.permutation,\n ...options\n });\n }\n\n /**\n * Lowers DXBC bytes or decoded instructions into the front-end shader IR.\n *\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC input.\n * @param {object} [options] IR provenance options.\n * @returns {object} Frozen shader IR program.\n */\n BuildShaderIr(input, options = {})\n {\n return lowerDxbcToIr(input, options);\n }\n\n /**\n * Emits WGSL for the currently supported typed shader slice.\n *\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC or shader IR.\n * @param {object} [options] Source/provenance options.\n * @returns {object} Frozen WGSL shader descriptor.\n */\n BuildWgsl(input, options = {})\n {\n return buildWgsl(input, options);\n }\n\n /**\n * Assign one canonical numeric binding layout across shader stages in a pass.\n * Unshared D3D tuples remain stage-scoped unless shared explicitly.\n *\n * @param {object[]} programs Complete CJS shader IR stage set for one pass.\n * @param {object} [options] Pass-level binding policy.\n * @param {string[]} [options.sharedIdentities] Compatible D3D identities\n * confirmed to represent one resource across stages.\n * @returns {object} Frozen CJS_WGSL_BINDING_PLAN document.\n */\n BuildWgslBindingPlan(programs, options = {})\n {\n return buildWgslBindingPlan(programs, options);\n }\n\n /**\n * Assembles emitted shader descriptors into a portable WGSL set.\n *\n * @param {object[]} entries Canonically keyed emitted shader descriptors.\n * @returns {object} Frozen CJS_WGSL_SET document.\n */\n BuildWgslSet(entries)\n {\n return buildWgslSet(entries);\n }\n\n /**\n * Convert format output to JSON-compatible data.\n *\n * @param {any} value Format output to convert.\n * @returns {any} Plain JSON-compatible data.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Static payload sniff. Static methods use camelCase by convention.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Candidate bytes.\n * @returns {boolean} True when the payload has Carbon's version-15 shape.\n */\n static isCarbonWebgpu(input)\n {\n return isCarbonWebgpu(input);\n }\n\n /**\n * Static one-shot read.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.\n * @param {object} [options] Format values.\n * @returns {object} Plain JSON data, or the raw package instance when emit is \"raw\".\n */\n static read(input, options = {})\n {\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME));\n }\n\n /**\n * Static one-shot inspection.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.\n * @param {object} [options] Format values.\n * @returns {object} Plain summary data.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME));\n }\n\n /**\n * Static one-shot effect analysis.\n *\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Tr2 effect bytes.\n * @param {object} [options] Format values.\n * @returns {object} Plain JSON-compatible analysis data.\n */\n static analyzeEffect(input, options = {})\n {\n return analyzeEffectWithValues(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME));\n }\n\n /**\n * Static selected-body Carbon WebGPU builder.\n *\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.\n * @param {object} [options] Source, body-mode, permutation, and stage-selection policy.\n * @returns {object} Package bytes plus inspection and provenance documents.\n */\n static buildEffect(input, options = {})\n {\n return buildEffectPackage(input, options);\n }\n\n /**\n * Static DXBC-to-front-end-IR helper.\n *\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC input.\n * @param {object} [options] IR provenance options.\n * @returns {object} Frozen shader IR program.\n */\n static buildShaderIr(input, options = {})\n {\n return lowerDxbcToIr(input, options);\n }\n\n /**\n * Static WGSL emission helper for the currently supported typed slice.\n *\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC or shader IR.\n * @param {object} [options] Source/provenance options.\n * @returns {object} Frozen WGSL shader descriptor.\n */\n static buildWgsl(input, options = {})\n {\n return buildWgsl(input, options);\n }\n\n /**\n * Static pass-global WGSL binding-plan helper. Unshared D3D tuples remain\n * stage-scoped unless listed in options.sharedIdentities.\n *\n * @param {object[]} programs Complete CJS shader IR stage set for one pass.\n * @param {object} [options] Pass-level binding policy.\n * @param {string[]} [options.sharedIdentities] Compatible D3D identities\n * confirmed to represent one resource across stages.\n * @returns {object} Frozen CJS_WGSL_BINDING_PLAN document.\n */\n static buildWgslBindingPlan(programs, options = {})\n {\n return buildWgslBindingPlan(programs, options);\n }\n\n /**\n * Static WGSL-set assembly helper.\n *\n * @param {object[]} entries Canonically keyed emitted shader descriptors.\n * @returns {object} Frozen CJS_WGSL_SET document.\n */\n static buildWgslSet(entries)\n {\n return buildWgslSet(entries);\n }\n\n /**\n * Static JSON-compatible conversion.\n *\n * @param {any} value Format output to convert.\n * @returns {any} Plain JSON-compatible data.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n static OUTPUT_JSON = OUTPUT_JSON;\n static OUTPUT_RAW = OUTPUT_RAW;\n static CLASS_KEYS = CLASS_KEYS;\n static type = Object.freeze([ \"shader\" ]);\n static mediaTypes = Object.freeze([ \"shader\" ]);\n static inputTypes = Object.freeze([ \"carbonwebgpu\" ]);\n static outputTypes = Object.freeze([ OUTPUT_JSON ]);\n static debugOutputTypes = Object.freeze([ OUTPUT_RAW ]);\n static implementationStatus = \"partial\";\n static format = CARBON_WEBGPU_FORMAT;\n static analysisFormat = CARBON_WEBGPU_ANALYSIS_FORMAT;\n static packageVersion = FORMAT_WEBGPU_PACKAGE_VERSION;\n}\n\nexport default CjsWebgpuFormat;\n"],"names":["FORMAT_NAME","CjsWebgpuFormat","DEFAULT_VALUES","emit","source","decodeInstructions","permutation","schema","constructor","options","SetValues","values","normalizeValues","GetValues","CLASS_KEYS","classes","SetClasses","SetClass","type","Class","validateClassKey","undefined","validateClass","GetClass","HasClass","Read","input","readWithValues","Inspect","inspectWithValues","AnalyzeEffect","analyzeEffectWithValues","BuildEffect","buildEffectPackage","BuildShaderIr","lowerDxbcToIr","BuildWgsl","buildWgsl","BuildWgslBindingPlan","programs","buildWgslBindingPlan","BuildWgslSet","entries","buildWgslSet","ToJSON","value","toJsonValue","isCarbonWebgpu","read","inspect","analyzeEffect","buildEffect","buildShaderIr","toJSON","OUTPUT_JSON","OUTPUT_RAW","Object","freeze","mediaTypes","inputTypes","outputTypes","debugOutputTypes","implementationStatus","format","CARBON_WEBGPU_FORMAT","analysisFormat","CARBON_WEBGPU_ANALYSIS_FORMAT","packageVersion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EAC9B,OAAOI,IAAI,GAAGsC,MAAM,CAACC,MAAM,CAAC,CAAE,QAAQ,CAAE,CAAC;EACzC,OAAOC,UAAU,GAAGF,MAAM,CAACC,MAAM,CAAC,CAAE,QAAQ,CAAE,CAAC;EAC/C,OAAOE,UAAU,GAAGH,MAAM,CAACC,MAAM,CAAC,CAAE,cAAc,CAAE,CAAC;EACrD,OAAOG,WAAW,GAAGJ,MAAM,CAACC,MAAM,CAAC,CAAEH,WAAW,CAAE,CAAC;EACnD,OAAOO,gBAAgB,GAAGL,MAAM,CAACC,MAAM,CAAC,CAAEF,UAAU,CAAE,CAAC;EACvD,OAAOO,oBAAoB,GAAG,SAAS;EACvC,OAAOC,MAAM,GAAGC,oBAAoB;EACpC,OAAOC,cAAc,GAAGC,6BAA6B;EACrD,OAAOC,cAAc,GAAGC,6BAA6B;AACzD;;;;"}
1
+ {"version":3,"file":"CjsWebgpuFormat.js","sources":["../../../../src/formats/webgpu/CjsWebgpuFormat.js"],"sourcesContent":["import { CLASS_KEYS } from \"./core/schema.js\";\r\nimport { lowerDxbcToIr } from \"./core/ir/lowerDxbcToIr.js\";\r\nimport { buildWgsl } from \"./core/wgsl/emitWgsl.js\";\r\nimport { buildWgslBindingPlan } from \"./core/wgsl/buildWgslBindingPlan.js\";\r\nimport { buildWgslSet } from \"./core/wgsl/buildWgslSet.js\";\r\nimport { buildEffectPackage } from \"./core/packageEffect.js\";\r\nimport { FORMAT_WEBGPU_PACKAGE_VERSION } from \"./core/packageMetadata.js\";\r\nimport {\r\n CARBON_WEBGPU_ANALYSIS_FORMAT,\r\n CARBON_WEBGPU_FORMAT,\r\n DEFAULT_VALUES,\r\n OUTPUT_JSON,\r\n analyzeEffectWithValues,\r\n inspectWithValues,\r\n isCarbonWebgpu,\r\n normalizeValues,\r\n readWithValues,\r\n toJsonValue,\r\n validateClass,\r\n validateClassKey\r\n} from \"./core/helpers.js\";\r\n\r\nconst FORMAT_NAME = \"CjsWebgpuFormat\";\r\n\r\n/**\r\n * CarbonEngineJS-facing format surface for `.carbonwebgpu` WebGPU packages, plus an\r\n * offline effect-analysis helper built on the runtime-resource HLSL and DXBC\r\n * format subpaths.\r\n *\r\n * The package owns read/build, normalized shader analysis, and the current\r\n * bounded DXBC-to-WGSL profiles. Broader shader-semantic coverage remains an\r\n * explicit qualification ladder.\r\n */\r\nexport class CjsWebgpuFormat\r\n{\r\n #emit = DEFAULT_VALUES.emit;\r\n #source = DEFAULT_VALUES.source;\r\n #decodeInstructions = DEFAULT_VALUES.decodeInstructions;\r\n #permutation = DEFAULT_VALUES.permutation;\r\n #schema = DEFAULT_VALUES.schema;\r\n #classes = {};\r\n\r\n /**\r\n * Create a reusable format profile.\r\n *\r\n * @param {object} [options] Default format values.\r\n */\r\n constructor(options = {})\r\n {\r\n this.SetValues(options);\r\n }\r\n\r\n /**\r\n * Set format values for this reusable profile.\r\n *\r\n * @param {object} [options] Values to merge into the profile.\r\n * @returns {CjsWebgpuFormat} This format profile.\r\n */\r\n SetValues(options = {})\r\n {\r\n const values = normalizeValues(this.GetValues(), options, CLASS_KEYS, FORMAT_NAME);\r\n this.#emit = values.emit;\r\n this.#source = values.source;\r\n this.#decodeInstructions = values.decodeInstructions;\r\n this.#permutation = values.permutation;\r\n this.#schema = values.schema;\r\n this.#classes = values.classes;\r\n return this;\r\n }\r\n\r\n /**\r\n * Get this profile's current values, optionally with per-call overrides.\r\n *\r\n * @param {object} [options] Optional values to merge into a copy.\r\n * @returns {object} A copy of the effective values.\r\n */\r\n GetValues(options = {})\r\n {\r\n return normalizeValues({\r\n emit: this.#emit,\r\n source: this.#source,\r\n decodeInstructions: this.#decodeInstructions,\r\n permutation: this.#permutation,\r\n schema: this.#schema,\r\n classes: this.#classes\r\n }, options, CLASS_KEYS, FORMAT_NAME);\r\n }\r\n\r\n /**\r\n * Set multiple node-class constructors for this profile.\r\n *\r\n * @param {object} [classes] Map of node class keys to constructors.\r\n * @returns {CjsWebgpuFormat} This format profile.\r\n */\r\n SetClasses(classes = {})\r\n {\r\n return this.SetValues({ classes });\r\n }\r\n\r\n /**\r\n * Set one node-class constructor for this profile.\r\n *\r\n * @param {string} type Node class key.\r\n * @param {Function|null|undefined} Class constructor to use, or nullish to delete.\r\n * @returns {CjsWebgpuFormat} This format profile.\r\n */\r\n SetClass(type, Class)\r\n {\r\n validateClassKey(CLASS_KEYS, type, FORMAT_NAME);\r\n if (Class === null || Class === undefined)\r\n {\r\n delete this.#classes[type];\r\n return this;\r\n }\r\n\r\n validateClass(CLASS_KEYS, type, Class, FORMAT_NAME);\r\n this.#classes = { ...this.#classes, [type]: Class };\r\n return this;\r\n }\r\n\r\n /**\r\n * Get a configured node-class constructor.\r\n *\r\n * @param {string} type Node class key.\r\n * @returns {Function|undefined} The registered constructor, if any.\r\n */\r\n GetClass(type)\r\n {\r\n validateClassKey(CLASS_KEYS, type, FORMAT_NAME);\r\n return this.#classes[type];\r\n }\r\n\r\n /**\r\n * Whether this format profile has a constructor registered for a node key.\r\n *\r\n * @param {string} type Node class key.\r\n * @returns {boolean} True when a constructor is registered.\r\n */\r\n HasClass(type)\r\n {\r\n return !!this.GetClass(type);\r\n }\r\n\r\n /**\r\n * Read a Carbon WebGPU package with this profile's values.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.\r\n * @param {object} [options] Per-call value overrides.\r\n * @returns {object} Plain JSON data: the container-backed views plus the complete backend body set.\r\n */\r\n Read(input, options = {})\r\n {\r\n return readWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Inspect a Carbon WebGPU package without building the full JSON shape.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.\r\n * @param {object} [options] Per-call value overrides.\r\n * @returns {object} Plain summary data.\r\n */\r\n Inspect(input, options = {})\r\n {\r\n return inspectWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Analyzes one compiled effect payload into a normalized WebGPU-facing\r\n * document using the current profile's values.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Tr2 effect bytes.\r\n * @param {object} [options] Per-call value overrides.\r\n * @returns {object} Plain JSON-compatible analysis data.\r\n */\r\n AnalyzeEffect(input, options = {})\r\n {\r\n return analyzeEffectWithValues(input, this.GetValues(options));\r\n }\r\n\r\n /**\r\n * Builds a Carbon WebGPU package with complete version-15 source reflection and\r\n * selected-body WebGPU output from compiled Tr2 effect bytes.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.\r\n * @param {object} [options] Source, body-mode, permutation, and stage-selection policy.\r\n * @returns {object} Package bytes plus inspection and provenance documents.\r\n */\r\n BuildEffect(input, options = {})\r\n {\r\n const values = this.GetValues();\r\n\r\n return buildEffectPackage(input, {\r\n source: values.source,\r\n permutation: values.permutation,\r\n ...options\r\n });\r\n }\r\n\r\n /**\r\n * Lowers DXBC bytes or decoded instructions into the front-end shader IR.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC input.\r\n * @param {object} [options] IR provenance options.\r\n * @returns {object} Frozen shader IR program.\r\n */\r\n BuildShaderIr(input, options = {})\r\n {\r\n return lowerDxbcToIr(input, options);\r\n }\r\n\r\n /**\r\n * Emits WGSL for the currently supported typed shader slice.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC or shader IR.\r\n * @param {object} [options] Source/provenance options.\r\n * @returns {object} Frozen WGSL shader descriptor.\r\n */\r\n BuildWgsl(input, options = {})\r\n {\r\n return buildWgsl(input, options);\r\n }\r\n\r\n /**\r\n * Assign one canonical numeric binding layout across shader stages in a pass.\r\n * Unshared D3D tuples remain stage-scoped unless shared explicitly.\r\n *\r\n * @param {object[]} programs Complete CJS shader IR stage set for one pass.\r\n * @param {object} [options] Pass-level binding policy.\r\n * @param {string[]} [options.sharedIdentities] Compatible D3D identities\r\n * confirmed to represent one resource across stages.\r\n * @returns {object} Frozen CJS_WGSL_BINDING_PLAN document.\r\n */\r\n BuildWgslBindingPlan(programs, options = {})\r\n {\r\n return buildWgslBindingPlan(programs, options);\r\n }\r\n\r\n /**\r\n * Assembles emitted shader descriptors into a portable WGSL set.\r\n *\r\n * @param {object[]} entries Canonically keyed emitted shader descriptors.\r\n * @returns {object} Frozen CJS_WGSL_SET document.\r\n */\r\n BuildWgslSet(entries)\r\n {\r\n return buildWgslSet(entries);\r\n }\r\n\r\n /**\r\n * Convert format output to JSON-compatible data.\r\n *\r\n * @param {any} value Format output to convert.\r\n * @returns {any} Plain JSON-compatible data.\r\n */\r\n ToJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n /**\r\n * Static payload sniff. Static methods use camelCase by convention.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Candidate bytes.\r\n * @returns {boolean} True when the payload has Carbon's version-15 shape.\r\n */\r\n static isCarbonWebgpu(input)\r\n {\r\n return isCarbonWebgpu(input);\r\n }\r\n\r\n /**\r\n * Static one-shot read.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.\r\n * @param {object} [options] Format values.\r\n * @returns {object} Plain JSON data: the container-backed views plus the complete backend body set.\r\n */\r\n static read(input, options = {})\r\n {\r\n return readWithValues(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * Static one-shot inspection.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Carbon WebGPU package bytes.\r\n * @param {object} [options] Format values.\r\n * @returns {object} Plain summary data.\r\n */\r\n static inspect(input, options = {})\r\n {\r\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * Static one-shot effect analysis.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|Buffer|DataView} input Tr2 effect bytes.\r\n * @param {object} [options] Format values.\r\n * @returns {object} Plain JSON-compatible analysis data.\r\n */\r\n static analyzeEffect(input, options = {})\r\n {\r\n return analyzeEffectWithValues(input, normalizeValues(DEFAULT_VALUES, options, CLASS_KEYS, FORMAT_NAME));\r\n }\r\n\r\n /**\r\n * Static selected-body Carbon WebGPU builder.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView} input Compiled effect bytes.\r\n * @param {object} [options] Source, body-mode, permutation, and stage-selection policy.\r\n * @returns {object} Package bytes plus inspection and provenance documents.\r\n */\r\n static buildEffect(input, options = {})\r\n {\r\n return buildEffectPackage(input, options);\r\n }\r\n\r\n /**\r\n * Static DXBC-to-front-end-IR helper.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC input.\r\n * @param {object} [options] IR provenance options.\r\n * @returns {object} Frozen shader IR program.\r\n */\r\n static buildShaderIr(input, options = {})\r\n {\r\n return lowerDxbcToIr(input, options);\r\n }\r\n\r\n /**\r\n * Static WGSL emission helper for the currently supported typed slice.\r\n *\r\n * @param {Uint8Array|ArrayBuffer|ArrayBufferView|object} input DXBC or shader IR.\r\n * @param {object} [options] Source/provenance options.\r\n * @returns {object} Frozen WGSL shader descriptor.\r\n */\r\n static buildWgsl(input, options = {})\r\n {\r\n return buildWgsl(input, options);\r\n }\r\n\r\n /**\r\n * Static pass-global WGSL binding-plan helper. Unshared D3D tuples remain\r\n * stage-scoped unless listed in options.sharedIdentities.\r\n *\r\n * @param {object[]} programs Complete CJS shader IR stage set for one pass.\r\n * @param {object} [options] Pass-level binding policy.\r\n * @param {string[]} [options.sharedIdentities] Compatible D3D identities\r\n * confirmed to represent one resource across stages.\r\n * @returns {object} Frozen CJS_WGSL_BINDING_PLAN document.\r\n */\r\n static buildWgslBindingPlan(programs, options = {})\r\n {\r\n return buildWgslBindingPlan(programs, options);\r\n }\r\n\r\n /**\r\n * Static WGSL-set assembly helper.\r\n *\r\n * @param {object[]} entries Canonically keyed emitted shader descriptors.\r\n * @returns {object} Frozen CJS_WGSL_SET document.\r\n */\r\n static buildWgslSet(entries)\r\n {\r\n return buildWgslSet(entries);\r\n }\r\n\r\n /**\r\n * Static JSON-compatible conversion.\r\n *\r\n * @param {any} value Format output to convert.\r\n * @returns {any} Plain JSON-compatible data.\r\n */\r\n static toJSON(value)\r\n {\r\n return toJsonValue(value);\r\n }\r\n\r\n static OUTPUT_JSON = OUTPUT_JSON;\r\n static CLASS_KEYS = CLASS_KEYS;\r\n static type = Object.freeze([ \"shader\" ]);\r\n static mediaTypes = Object.freeze([ \"shader\" ]);\r\n static inputTypes = Object.freeze([ \"carbonwebgpu\" ]);\r\n static outputTypes = Object.freeze([ OUTPUT_JSON ]);\r\n static implementationStatus = \"partial\";\r\n static format = CARBON_WEBGPU_FORMAT;\r\n static analysisFormat = CARBON_WEBGPU_ANALYSIS_FORMAT;\r\n static packageVersion = FORMAT_WEBGPU_PACKAGE_VERSION;\r\n}\r\n\r\nexport default CjsWebgpuFormat;\r\n"],"names":["FORMAT_NAME","CjsWebgpuFormat","DEFAULT_VALUES","emit","source","decodeInstructions","permutation","schema","constructor","options","SetValues","values","normalizeValues","GetValues","CLASS_KEYS","classes","SetClasses","SetClass","type","Class","validateClassKey","undefined","validateClass","GetClass","HasClass","Read","input","readWithValues","Inspect","inspectWithValues","AnalyzeEffect","analyzeEffectWithValues","BuildEffect","buildEffectPackage","BuildShaderIr","lowerDxbcToIr","BuildWgsl","buildWgsl","BuildWgslBindingPlan","programs","buildWgslBindingPlan","BuildWgslSet","entries","buildWgslSet","ToJSON","value","toJsonValue","isCarbonWebgpu","read","inspect","analyzeEffect","buildEffect","buildShaderIr","toJSON","OUTPUT_JSON","Object","freeze","mediaTypes","inputTypes","outputTypes","implementationStatus","format","CARBON_WEBGPU_FORMAT","analysisFormat","CARBON_WEBGPU_ANALYSIS_FORMAT","packageVersion","FORMAT_WEBGPU_PACKAGE_VERSION"],"mappings":";;;;;;;;;AAsBA,MAAMA,WAAW,GAAG,iBAAiB;;AAErC;AACA;AACA;AACA;AACA;AACA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CAAC;EAC/C,OAAOE,UAAU,GAAGH,MAAM,CAACC,MAAM,CAAC,CAAE,cAAc,CAAE,CAAC;EACrD,OAAOG,WAAW,GAAGJ,MAAM,CAACC,MAAM,CAAC,CAAEF,WAAW,CAAE,CAAC;EACnD,OAAOM,oBAAoB,GAAG,SAAS;EACvC,OAAOC,MAAM,GAAGC,oBAAoB;EACpC,OAAOC,cAAc,GAAGC,6BAA6B;EACrD,OAAOC,cAAc,GAAGC,6BAA6B;AACzD;;;;"}
@@ -12,17 +12,16 @@ import { selectEffectStages } from './packageEffectSelection.js';
12
12
  import { compareUtf8 } from '../../../format/compareUtf8.js';
13
13
  import { isParticleClearEffectCandidate, preflightParticleClearEffectProfile, particleClearEffectProofFor } from './wgsl/lowerParticleClearComputePrograms.js';
14
14
 
15
- const EFFECT_BACKEND_BODY_SET_CHUNK = "WGSB";
16
15
  const EFFECT_BACKEND_BODY_SET_FORMAT = "CJS_WGSL_BODY_SET";
17
16
  const EFFECT_BACKEND_BODY_SET_VERSION = 1;
18
17
 
19
- /**
20
- * One translation unit is exactly one pass of one body: the binding plan, the
21
- * resource-transform plan, and every stage's emitted WGSL are derived together.
22
- * Bodies that share an identical pass signature therefore share one unit.
23
- *
24
- * @param {object} pass Pass entry carrying its ordered stage records.
25
- * @returns {string} Stable signature for the pass translation unit.
18
+ /**
19
+ * One translation unit is exactly one pass of one body: the binding plan, the
20
+ * resource-transform plan, and every stage's emitted WGSL are derived together.
21
+ * Bodies that share an identical pass signature therefore share one unit.
22
+ *
23
+ * @param {object} pass Pass entry carrying its ordered stage records.
24
+ * @returns {string} Stable signature for the pass translation unit.
26
25
  */
27
26
  function passUnitSignature(pass) {
28
27
  return JSON.stringify({
@@ -157,19 +156,19 @@ function translatePassUnit(pass, programForKey, source, bindingPolicy) {
157
156
  })));
158
157
  }
159
158
 
160
- /**
161
- * Translate every unique source body into backend programs, layouts, and
162
- * resource transforms, sharing one translation unit between bodies whose pass
163
- * is byte-for-byte identical.
164
- *
165
- * A body that cannot be lowered is retained as an explicitly unsupported
166
- * in-memory record carrying its reason. Portable source reflection is built
167
- * separately from the same effect; this body-set document does not store it.
168
- *
169
- * @param {object} effectRes Loaded version-15 `Tr2EffectRes`.
170
- * @param {object} permutationGraph Validated `PGRF` document.
171
- * @param {object} [options] Source label, stage selection, and binding policy.
172
- * @returns {object} Frozen `CJS_WGSL_BODY_SET` document.
159
+ /**
160
+ * Translate every unique source body into backend programs, layouts, and
161
+ * resource transforms, sharing one translation unit between bodies whose pass
162
+ * is byte-for-byte identical.
163
+ *
164
+ * A body that cannot be lowered is retained as an explicitly unsupported
165
+ * in-memory record carrying its reason. Portable source reflection is built
166
+ * separately from the same effect; this body-set document does not store it.
167
+ *
168
+ * @param {object} effectRes Loaded version-15 `Tr2EffectRes`.
169
+ * @param {object} permutationGraph Validated `PGRF` document.
170
+ * @param {object} [options] Source label, stage selection, and binding policy.
171
+ * @returns {object} Frozen `CJS_WGSL_BODY_SET` document.
173
172
  */
174
173
  function buildEffectBackendBodySet(effectRes, permutationGraph, options = {}) {
175
174
  const source = options.source || "memory";
@@ -302,5 +301,5 @@ function buildEffectBackendBodySet(effectRes, permutationGraph, options = {}) {
302
301
  });
303
302
  }
304
303
 
305
- export { EFFECT_BACKEND_BODY_SET_CHUNK, EFFECT_BACKEND_BODY_SET_FORMAT, EFFECT_BACKEND_BODY_SET_VERSION, buildEffectBackendBodySet };
304
+ export { EFFECT_BACKEND_BODY_SET_FORMAT, EFFECT_BACKEND_BODY_SET_VERSION, buildEffectBackendBodySet };
306
305
  //# sourceMappingURL=effectBackendBodySet.js.map