@carbonenginejs/runtime 0.1.0-alpha.1 → 0.1.0-alpha.3

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 (49) hide show
  1. package/dist/global/model/CjsModel.js +3 -1
  2. package/dist/global/model/CjsModel.js.map +1 -1
  3. package/dist/global/model/document/CjsDocumentHydrator.js +5 -1
  4. package/dist/global/model/document/CjsDocumentHydrator.js.map +1 -1
  5. package/dist/global/schema/CjsSchema.js +100 -2
  6. package/dist/global/schema/CjsSchema.js.map +1 -1
  7. package/dist/global/schema/hydration.js +16 -0
  8. package/dist/global/schema/hydration.js.map +1 -1
  9. package/dist/index.js +2 -0
  10. package/dist/index.js.map +1 -1
  11. package/dist/resource/CjsResMan.js +177 -4
  12. package/dist/resource/CjsResMan.js.map +1 -1
  13. package/dist/resource/format/CjsBlueReader.js +8 -1
  14. package/dist/resource/format/CjsBlueReader.js.map +1 -1
  15. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js +23 -5
  16. package/dist/resource/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  17. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js +12 -3
  18. package/dist/resource/formats/webgl/core/glsl/DxbcGlslOperandFormatter.js.map +1 -1
  19. package/dist/resource/index.js +2 -0
  20. package/dist/resource/index.js.map +1 -1
  21. package/dist/resource/texture/SolidColorTextureConstructor.js +46 -0
  22. package/dist/resource/texture/SolidColorTextureConstructor.js.map +1 -0
  23. package/dist/resource/texture/TriTextureRes.js +43 -0
  24. package/dist/resource/texture/TriTextureRes.js.map +1 -1
  25. package/dist/resource/texture/index.js +2 -0
  26. package/dist/resource/texture/index.js.map +1 -1
  27. package/dist/resource/texture/solidColorTexture.js +111 -0
  28. package/dist/resource/texture/solidColorTexture.js.map +1 -0
  29. package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js +19 -8
  30. package/dist/trinity/eve/attachment/decal/EveSpaceObjectDecal.js.map +1 -1
  31. package/dist/trinity/eve/child/EveChildMesh.js +17 -3
  32. package/dist/trinity/eve/child/EveChildMesh.js.map +1 -1
  33. package/dist/trinity/eve/locator/EveLocatorSets.js +12 -3
  34. package/dist/trinity/eve/locator/EveLocatorSets.js.map +1 -1
  35. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js +15 -2
  36. package/dist/trinity/eve/spaceObject/EveSpaceObject2.js.map +1 -1
  37. package/dist/trinity/eve/spaceObject/IEveSpaceObject2ParentData.js +44 -52
  38. package/dist/trinity/eve/spaceObject/IEveSpaceObject2ParentData.js.map +1 -1
  39. package/docs/resource/concepts/resource-lifecycle.md +10 -8
  40. package/docs/resource/formats/geometry-interchange.md +50 -0
  41. package/docs/resource/formats/webgl/decl-io.md +241 -397
  42. package/docs/resource/formats/webgl/memory-structured.md +91 -128
  43. package/docs/resource/formats/webgl/texture-sample.md +306 -469
  44. package/docs/resource/formats/webgpu/reference/wgsl-compatibility.md +54 -85
  45. package/docs/resource/reference/classes/texture.md +11 -1
  46. package/docs/resource/reference/motherlode-cache.md +24 -11
  47. package/docs/resource/reference/queues.md +23 -1
  48. package/docs/trinityal/reference/classes/dropped.md +11 -1
  49. package/package.json +1 -1
@@ -191,54 +191,40 @@ pixel `usampler2D` data textures (see `DxbcGlslEmitter.js` `dcl_resource_structu
191
191
  pixel branch), which compiles but consumes a texture unit each; on real drivers
192
192
  the `_depth` quad variants overflow `MAX_TEXTURE_IMAGE_UNITS`(16).
193
193
 
194
- **Superseded (2026-08-02) — the lights fit, and are kept.** The two light
195
- buffers now lower to a single packed `RGBA32UI` data texture rather than one
196
- texture each, which frees two units, and the `Detail1/2/3Map` textures merge into
197
- one array texture, which frees one or two more. Both `.sm_depth` quad variants
198
- land at or under 16 with lighting intact: `unpackedskinned_quaddetailv5` at 15,
199
- `unpackedskinned_quadheatdetailv5` at 16. See
200
- `/docs/contracts/webgl2-texture-budget.md`. Dropping the lights is still
201
- available as `--stub-light-resources` for isolating a lighting problem, but it is
202
- no longer the answer to the budget. The paragraph below describes that opt-in
203
- path and remains accurate.
204
-
205
- **Earlier resolution (2026-07-08) — stub, not rewrite.** Since Carbon WebGL does not
206
- support this tiled lighting, the packager can DROP it instead of lowering it. Run
207
- `packageTr2WebglEffect.js --stub-light-resources`: it resolves the light resource
208
- names (`LightBuffer`, `LightIndexBuffer`, `LightProfileArray`) to `t#` registers
209
- from the Carbon `.sm` reflection (RDEF is stripped, so names live only there —
210
- and the registers vary per permutation, so this is name-driven, not fixed to
211
- sb11/sb12/s13) and passes them to `emitGlsl` as `stubResourceRegisters`. The
212
- emitter then drops their decl+binding and lowers reads to `uintBitsToFloat(0u)`
213
- (structured) / `vec4(0.0)` (sampled) — zeroing the per-tile light count makes the
214
- light loop dead. The packager also strips those `resource` bindings from the
215
- manifest JSON (`stripLightResourcesFromManifest`) so the Carbon WebGL runtime does not
216
- synthesize a texture def (glType 0 → "Invalid shader texture definition") for the
217
- now-undeclared light buffers. Opt-in, default off; every other package is
218
- unchanged. A functional light constant-buffer path remains possible but was not
219
- built.
194
+ **Superseded 2026-08-02 — keep the lights.** The recorded packed `RGBA32UI`
195
+ light texture and merged `Detail1/2/3Map` array put the `.sm_depth` variants
196
+ `unpackedskinned_quaddetailv5` at 15 texture units and
197
+ `unpackedskinned_quadheatdetailv5` at 16, lighting intact. Budget accounting
198
+ belongs to `/docs/contracts/webgl2-texture-budget.md`, not this opcode study.
199
+ `--stub-light-resources` remains an opt-in diagnostic, not the budget solution.
200
+
201
+ **Earlier 2026-07-08 stub path (default off):**
202
+ `packageTr2WebglEffect.js --stub-light-resources` resolves `LightBuffer`,
203
+ `LightIndexBuffer` and `LightProfileArray` from Carbon `.sm` reflection into
204
+ `emitGlsl`'s `stubResourceRegisters`. With RDEF stripped, names exist only in
205
+ that reflection; registers vary per permutation, not fixed sb11/sb12/s13.
206
+ The emitter removes selected declarations/bindings and returns
207
+ `uintBitsToFloat(0u)` for structured reads or `vec4(0.0)` for samples.
208
+ Zero per-tile count kills the light loop. `stripLightResourcesFromManifest`
209
+ removes matching JSON `resource` bindings, avoiding synthesis of an undeclared
210
+ glType-0 texture ("Invalid shader texture definition"). Other packages are
211
+ unchanged. The earlier study recorded a possible, unbuilt light-constant-buffer
212
+ alternative; that historical statement is not current implementation status.
220
213
 
221
214
  Tested by `test/glsl-emitter.test.js` (synthetic pixel shaders with a structured
222
215
  buffer / sampler2DArray: declared by default, dropped + no binding when the
223
216
  register is in `stubResourceRegisters`, and only listed registers dropped) and
224
217
  `test/stub-light-resources.test.js` (the packager's `resolveStubLightRegisters`
225
218
  name→register resolution and `stripLightResourcesFromManifest` manifest filter,
226
- in `scripts/stubLightResources.js`).
227
-
228
- ### Type rules
229
- - Struct index operand: read as int/uint (both flags set in HLSLcc; pick uint by
230
- default for ES 3.00).
231
- - Byte-offset operand: uint unless the operand's own declared type is signed int.
232
- - Result component type follows the *destination* register's inferred type
233
- (float → `uintBitsToFloat`, int → `int(...)`, uint → passthrough), **not** the
234
- source resource's declared return type — this is purely dest-driven, matching
235
- the "everything is `float vec4`, bitcast at use" register model this project
236
- already commits to.
237
- - This is a data-movement instruction, not a comparison — it does not produce a
238
- 0xFFFFFFFF/0 mask.
239
-
240
- ### Helpers needed
241
- - `structuredLoadComponent(bufName, structIndex, byteOffset, component, destType)`
219
+ in `scripts/stubLightResources.js`).
220
+
221
+ ### Type rules
222
+ Section A owns index/offset signedness and destination-driven casts. The source
223
+ resource's declared return type does **not** determine the result type.
224
+ This load moves data; it does not produce a 0xFFFFFFFF/0 comparison mask.
225
+
226
+ ### Helpers needed
227
+ - `structuredLoadComponent(bufName, structIndex, byteOffset, component, destType)`
242
228
  — reference-only (HLSLcc SSBO shape), needed if the emitter ever targets a
243
229
  non-WebGL2 backend or documents the pre-rewrite intermediate form.
244
230
  - `lowerBoneTransformsToCb3` (package-time text pass; port of
@@ -326,27 +312,20 @@ counter if the source operand has more than one swizzle element, else always
326
312
  - No destination register write, so `_sat` never applies (DXBC does not attach
327
313
  `_sat` to store instructions).
328
314
  - Per-component write masking must exactly follow `psDest->ui32CompMask`
329
- (`OPERAND_4_COMPONENT_MASK_MODE`), not the source operand's own mask.
330
-
331
- ### WebGL2 notes
332
- `store_structured` requires a writable UAV, which in turn requires an SSBO
333
- (`buffer`, not `readonly buffer`) — completely unavailable in GLSL ES 3.00. No
334
- package-time rewrite analogous to the `cb3` skinning path exists for writes
335
- (there is no ccpwgl uniform target that plausibly receives a per-invocation
336
- compute-style scatter write). **This opcode is out of scope for the WebGL2
337
- emitter.** The 930 corpus instances should be treated as evidence this opcode
338
- occurs in DX11 stages that are not shipped to the current WebGL2 vs/ps target
339
- (the sampled corpus instance is `createhistograms.sm_depth`, tagged
340
- `stageName: "geometry"` in `dx11-instruction-coverage.json` but much more
341
- plausibly a mislabeled compute shader given the histogram-building workload
342
- and its co-occurring `sync`/`dcl_thread_group`-shaped instruction in the same
343
- file — see the `atomic_iadd` section for the one confirmed **non**-compute
344
- counterexample in this family, `lensflareoccludert`, which is a pixel shader,
345
- not compute); the emitter should detect and refuse rather than attempt
346
- emission.
347
-
348
- ### Confidence
349
- **Medium** on the HLSLcc reference lowering itself (directly read from source);
315
+ (`OPERAND_4_COMPONENT_MASK_MODE`), not the source operand's own mask.
316
+
317
+ ### WebGL2 notes
318
+ The study excludes this writable-UAV/SSBO opcode: detect and refuse it.
319
+ There is no `cb3`-like write rewrite or CCPWGL uniform target for
320
+ per-invocation scatter writes. Of 930 instances, the sampled
321
+ `createhistograms.sm_depth` is tagged `stageName: "geometry"` in
322
+ `dx11-instruction-coverage.json`, but its workload and accompanying
323
+ `sync`/`dcl_thread_group` suggest mislabeled compute. See the atomic
324
+ section for the scanner-label limitation and confirmed pixel counterexample;
325
+ neither establishes a VS/PS `store_structured` path.
326
+
327
+ ### Confidence
328
+ **Medium** on the HLSLcc reference lowering itself (directly read from source);
350
329
  **high** on the WebGL2-scope conclusion (no counter-evidence of a vs/ps
351
330
  `store_structured` shipping shader was found in the decision corpus, and the
352
331
  project's own draft transpiler already special-cases the sibling UAV write
@@ -483,28 +462,23 @@ Identical bitcast-by-destination-type rule as `ld_structured` (float →
483
462
 
484
463
  ### Edge cases
485
464
  Same swizzle-indirection caveat as `ld_structured` (component addressing follows
486
- the resource operand's own swizzle if present).
487
-
488
- ### WebGL2 notes
489
- Same SSBO unavailability as `ld_structured` section A/C. No `cb3`-style rewrite
490
- is known or defined for raw-buffer reads — the `BoneTransforms` rewrite is
491
- specific to the structured-buffer `t0_buf[idx].value[...]` shape, not the flat
492
- `t0_buf[...]` raw shape. **Out of scope for the WebGL2 emitter** unless/until a
493
- specific raw-buffer resource is proven to need a package-time ABI rewrite
494
- analogous to skinning.
495
-
496
- The corpus table's "vs/ps" stage claim was overreach: the only sampled
497
- instance in `dx11-instruction-coverage.json`'s `allOpcodeExamples` is
498
- `graphics\effect.dx11\managed\space\specialfx\particles\gpu\emit.sm_depth`
499
- tagged `stageName: "geometry"`, paired with the sibling `store_raw` opcode in
500
- the exact same file/technique (also tagged `"geometry"`) — a GPU particle
501
- emission pass, which is much more plausibly a compute-style workload than a
502
- genuine vertex/pixel `ByteAddressBuffer` read. Do not assume `ld_raw` is
503
- `vs/ps`-reachable without a concrete counter-example (unlike `atomic_iadd`,
504
- which has one — see that section).
505
-
506
- ### Confidence
507
- **Medium** — HLSLcc source lowering is directly read and clear, but no shipping
465
+ the resource operand's own swizzle if present).
466
+
467
+ ### WebGL2 notes
468
+ The study excludes raw-buffer reads absent a proven resource-specific rewrite.
469
+ The retired `BoneTransforms` splice matched `t0_buf[idx].value[...]`,
470
+ not flat `t0_buf[...]`; it cannot be assumed to cover raw buffers.
471
+
472
+ The earlier VS/PS claim was overreach. The sole sampled
473
+ `dx11-instruction-coverage.json` / `allOpcodeExamples` entry is
474
+ `graphics\effect.dx11\managed\space\specialfx\particles\gpu\emit.sm_depth`,
475
+ paired with `store_raw` in the same file/technique, both tagged
476
+ `stageName: "geometry"`. The particle-emission workload suggests compute,
477
+ not a confirmed VS/PS read. The atomic section owns the scanner caveat and
478
+ its distinct pixel counterexample; do not transfer that evidence to `ld_raw`.
479
+
480
+ ### Confidence
481
+ **Medium** — HLSLcc source lowering is directly read and clear, but no shipping
508
482
  corpus evidence of `ld_raw` reaching a WebGL2-validated vs/ps program was found
509
483
  (only 54 instances total, none flagged in the skinning/JointMat decision
510
484
  trail); the sole sampled corpus example is paired with `store_raw` in a
@@ -714,26 +688,23 @@ returnType)`.
714
688
  ### Edge cases
715
689
  Requires resource-binding reflection (return type, dimension) exactly like
716
690
  `store_uav_typed` — doubly blocked when `RDEF` is stripped, independent of the
717
- image-type gap below.
718
-
719
- ### WebGL2 notes
720
- `imageLoad` and image sampler types (`image2D` etc.) are ES 3.10+-only.
721
- **Fully out of scope for the WebGL2 emitter.** Matches the draft transpiler's
722
- explicit blocker (`Dx11GlesDraftTranspiler.js:129`) and the
723
- `TRANSPILING-GAPS.md` UAV decision. With only 18 corpus instances (vs.
724
- `store_uav_typed`'s 642), this is very likely the read side of a small set of
725
- compute/UAV effects rather than any vs/ps-reachable code path — but the
726
- concrete sampled instance (`dx11-instruction-coverage.json`, `allOpcodeExamples`)
727
- is `graphics\effect.dx11\managed\space\postprocess\measureexposure.sm_depth`
728
- (a tone-mapping average-luminance compute pass), **not** `lensflareoccludert`.
729
- `lensflareoccludert` is confirmed by `TRANSPILING-GAPS.md:100-114` to carry
730
- `dcl_unordered_access_view_typed`/`atomic_iadd` (and per this family's own
731
- corpus scan, `atomic_iadd` there is a **pixel**-stage instance — see that
732
- section); do not conflate the two effects or assume `ld_uav_typed`'s
733
- compute-only reasoning transfers to `atomic_iadd`.
734
-
735
- ### Confidence
736
- **High** — same corroboration as `store_uav_typed`, corrected to cite the
691
+ image-type gap below.
692
+
693
+ ### WebGL2 notes
694
+ The study excludes `imageLoad`/image types from ES300, matching
695
+ `Dx11GlesDraftTranspiler.js:129` and the `TRANSPILING-GAPS.md` UAV
696
+ decision. Its 18 instances (versus 642 stores) suggest a small compute/UAV set,
697
+ not a proven VS/PS path. The sampled `dx11-instruction-coverage.json` /
698
+ `allOpcodeExamples` entry is
699
+ `graphics\effect.dx11\managed\space\postprocess\measureexposure.sm_depth`
700
+ (tone-mapping average-luminance compute), **not** `lensflareoccludert`.
701
+ The corpus table and atomic section retain that separate effect's confirmed pixel-stage
702
+ `dcl_unordered_access_view_typed`/`atomic_iadd` evidence
703
+ (`TRANSPILING-GAPS.md:100-114`); do not conflate the effects or transfer
704
+ compute-only reasoning between them.
705
+
706
+ ### Confidence
707
+ **High** — same corroboration as `store_uav_typed`, corrected to cite the
737
708
  right sampled effect (`measureexposure.sm_depth`, not `lensflareoccludert`).
738
709
 
739
710
  ---
@@ -787,29 +758,21 @@ below. Non-skinning structured loads are not generally refused: see the
787
758
  pixel-stage lowering and packed-light closure above.
788
759
 
789
760
  **Retired WebGL2 text-rewrite helpers:**
790
- 1. `lowerBoneTransformsToCb3` — package-time text-rewrite pass that removes the
791
- HLSLcc `t0` SSBO declaration, grows `cb3.data[]` to at least 200 `vec4`s,
792
- strips the native bone-ring-buffer offset add, and rewrites each 4-component
793
- `t0_buf[idx].value[...]` row load to `cb3.data[26 + idx*3 + row]` (optionally
794
- swizzled). Port of `lowerWebgl2SkinningAbi` +
795
- `lowerStructuredBoneLoad` in `scripts/packageTr2WebglEffect.js:826-902`.
796
- 2. `lowerBlendIndicesToFloatAttribute` — package-time rewrite of
797
- `uvec4`/`ivec4`/etc. `in_BLENDINDICES<n>` vertex inputs to `vec<N>`, part of
798
- the same pass (`packageTr2WebglEffect.js:840-843`).
799
-
800
- **Reference-only helpers** (mirror HLSLcc's non-WebGL2 SSBO/UAV/atomic/compute
801
- lowering, useful for documentation, debugging, and any future non-WebGL2
802
- backend, but must never be emitted as final WebGL2 output):
803
- 3. `structuredLoadComponent(bufName, structIndex, byteOffset, component, destType)`
804
- 4. `structuredStoreComponent(bufName, structIndex, byteOffset, component, value, srcType)`
805
- 5. `rawLoadComponent(bufName, byteOffset, component, destType)`
806
- 6. `rawStoreComponent(bufName, byteOffset, component, value, srcType)`
807
- 7. `imageLoadTyped(uav, addr, returnType)`
808
- 8. `imageStoreTyped(uav, addr, value, returnType)`
809
- 9. `atomicUavOrTgsmOp(func, dest, addr, src, compare?, returnsPrevious?)`
810
-
811
- **Detection/refusal helpers** (must run before emission; there is no GLSL ES
812
- 3.00 lowering to fall back to):
761
+ `lowerBoneTransformsToCb3` ports `lowerWebgl2SkinningAbi` +
762
+ `lowerStructuredBoneLoad` (`scripts/packageTr2WebglEffect.js:826-902`);
763
+ `lowerBlendIndicesToFloatAttribute` is the same pass's float-input rewrite
764
+ (`packageTr2WebglEffect.js:840-843`). The historical section above owns their
765
+ constraints; the pinned recipe owns the ordered operations, including
766
+ `cb3.data[26 + idx*3 + row]` and optional swizzling. They are not pending helpers.
767
+
768
+ **Reference-only helpers:** each opcode's “Helpers needed” subsection owns
769
+ its signature. These describe non-WebGL2 SSBO/UAV/atomic lowering for debugging
770
+ or a possible other backend, not final WebGL2 output: structured load/store,
771
+ raw load/store, typed image load/store and `atomicUavOrTgsmOp` (its
772
+ `compare` and `returnsPrevious` parameters are optional).
773
+
774
+ **Detection/refusal helpers** (must run before emission; there is no GLSL ES
775
+ 3.00 lowering to fall back to):
813
776
  10. `refuseComputeOnlyOpcode(opcodeName)` — for `sync`, `store_structured`
814
777
  (non-skinning), `store_raw`, `store_uav_typed`, `ld_uav_typed`,
815
778
  `atomic_iadd`, `imm_atomic_iadd`, `imm_atomic_exch`, `atomic_umax`,