@aardworx/wombat.rendering 0.19.10 → 0.19.12

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 (52) hide show
  1. package/dist/core/renderObject.d.ts +9 -0
  2. package/dist/core/renderObject.d.ts.map +1 -1
  3. package/dist/resources/preparedRenderObject.d.ts +11 -1
  4. package/dist/resources/preparedRenderObject.d.ts.map +1 -1
  5. package/dist/resources/preparedRenderObject.js +51 -3
  6. package/dist/resources/preparedRenderObject.js.map +1 -1
  7. package/dist/runtime/derivedModes/axisEnum.d.ts +21 -0
  8. package/dist/runtime/derivedModes/axisEnum.d.ts.map +1 -0
  9. package/dist/runtime/derivedModes/axisEnum.js +64 -0
  10. package/dist/runtime/derivedModes/axisEnum.js.map +1 -0
  11. package/dist/runtime/derivedModes/cpuEval.d.ts +11 -0
  12. package/dist/runtime/derivedModes/cpuEval.d.ts.map +1 -0
  13. package/dist/runtime/derivedModes/cpuEval.js +98 -0
  14. package/dist/runtime/derivedModes/cpuEval.js.map +1 -0
  15. package/dist/runtime/derivedUniforms/codegen.d.ts +11 -0
  16. package/dist/runtime/derivedUniforms/codegen.d.ts.map +1 -1
  17. package/dist/runtime/derivedUniforms/codegen.js +59 -2
  18. package/dist/runtime/derivedUniforms/codegen.js.map +1 -1
  19. package/dist/runtime/derivedUniforms/cpuEval.d.ts +12 -1
  20. package/dist/runtime/derivedUniforms/cpuEval.d.ts.map +1 -1
  21. package/dist/runtime/derivedUniforms/cpuEval.js +15 -9
  22. package/dist/runtime/derivedUniforms/cpuEval.js.map +1 -1
  23. package/dist/runtime/derivedUniforms/dispatch.d.ts.map +1 -1
  24. package/dist/runtime/derivedUniforms/dispatch.js +21 -11
  25. package/dist/runtime/derivedUniforms/dispatch.js.map +1 -1
  26. package/dist/runtime/derivedUniforms/sceneIntegration.d.ts +24 -1
  27. package/dist/runtime/derivedUniforms/sceneIntegration.d.ts.map +1 -1
  28. package/dist/runtime/derivedUniforms/sceneIntegration.js +57 -6
  29. package/dist/runtime/derivedUniforms/sceneIntegration.js.map +1 -1
  30. package/dist/runtime/derivedUniforms/slots.d.ts +6 -0
  31. package/dist/runtime/derivedUniforms/slots.d.ts.map +1 -1
  32. package/dist/runtime/derivedUniforms/slots.js +14 -0
  33. package/dist/runtime/derivedUniforms/slots.js.map +1 -1
  34. package/dist/runtime/heapAdapter.d.ts.map +1 -1
  35. package/dist/runtime/heapAdapter.js +1 -0
  36. package/dist/runtime/heapAdapter.js.map +1 -1
  37. package/dist/runtime/heapScene.d.ts +11 -1
  38. package/dist/runtime/heapScene.d.ts.map +1 -1
  39. package/dist/runtime/heapScene.js +6 -0
  40. package/dist/runtime/heapScene.js.map +1 -1
  41. package/package.json +1 -1
  42. package/src/core/renderObject.ts +9 -0
  43. package/src/resources/preparedRenderObject.ts +42 -1
  44. package/src/runtime/derivedModes/axisEnum.ts +65 -0
  45. package/src/runtime/derivedModes/cpuEval.ts +104 -0
  46. package/src/runtime/derivedUniforms/codegen.ts +61 -2
  47. package/src/runtime/derivedUniforms/cpuEval.ts +25 -3
  48. package/src/runtime/derivedUniforms/dispatch.ts +20 -10
  49. package/src/runtime/derivedUniforms/sceneIntegration.ts +75 -6
  50. package/src/runtime/derivedUniforms/slots.ts +15 -0
  51. package/src/runtime/heapAdapter.ts +1 -0
  52. package/src/runtime/heapScene.ts +15 -0
@@ -87,6 +87,21 @@ export class ConstituentSlots {
87
87
  this.mirror = new Float32Array(initialCapacity * 32);
88
88
  }
89
89
 
90
+ /** Allocate a fwd+inv slot pair for a GPU-WRITTEN output (not keyed by any
91
+ * aval, never dirty-tracked or CPU-uploaded). Used for a per-RO `Model`
92
+ * produced by the transform-propagation chain pass and then consumed by §7
93
+ * as a constituent. Free with `freeOutputPair`. */
94
+ allocOutputPair(): PairedSlots {
95
+ const fwd = this.pool.alloc() as SlotIndex;
96
+ const inv = this.pool.alloc() as SlotIndex;
97
+ this.ensureCapacity(this.pool.highWaterMark);
98
+ return { fwd, inv };
99
+ }
100
+ freeOutputPair(p: PairedSlots): void {
101
+ this.pool.release(p.fwd);
102
+ this.pool.release(p.inv);
103
+ }
104
+
90
105
  acquire(av: aval<Trafo3d>): PairedSlots {
91
106
  let entry = this.byAval.get(av);
92
107
  if (entry === undefined) {
@@ -464,6 +464,7 @@ export function renderObjectToHeapSpec(
464
464
  ...geom,
465
465
  ...(textures !== undefined ? { textures } : {}),
466
466
  ...(ro.modeRules !== undefined ? { modeRules: ro.modeRules } : {}),
467
+ ...(ro.modelChain !== undefined ? { modelChain: ro.modelChain } : {}),
467
468
  // Pass `active` through unforced so the heap path can subscribe
468
469
  // and react to flips without re-running the spec adapter.
469
470
  ...(ro.active !== undefined ? { active: ro.active } : {}),
@@ -530,6 +530,16 @@ export interface HeapDrawSpec {
530
530
  readonly depthWrite?: import("./derivedModes/rule.js").DerivedModeRule<"depthWrite">;
531
531
  readonly alphaToCoverage?: import("./derivedModes/rule.js").DerivedModeRule<"alphaToCoverage">;
532
532
  };
533
+ /**
534
+ * GPU transform propagation: this RO's `Model` ancestor trafo chain (root→
535
+ * leaf, constant runs folded) as `aval<Trafo3d>` links. When present, the §7
536
+ * compute pass composes a per-RO Model constituent from these on the GPU
537
+ * (instead of the RO supplying a single composed `ModelTrafo` aval), and the
538
+ * standard recipes / custom rules derive ModelView / inverses / NormalMatrix
539
+ * from it. Eliminates the CPU fan-out of a shared root trafo over many ROs.
540
+ * See docs/gpu-transform-propagation.md.
541
+ */
542
+ readonly modelChain?: readonly aval<Trafo3d>[];
533
543
  }
534
544
 
535
545
  export interface HeapSceneStats {
@@ -1193,6 +1203,10 @@ export function buildHeapScene(
1193
1203
  // just means "this RO doesn't supply the base trafos", so the field falls back to its
1194
1204
  // packed `spec.inputs` value (or errors later if there is none — same as without §7).
1195
1205
  for (const inp of inputsOf(rule.ir)) {
1206
+ // `Model` may be supplied by the GPU transform-propagation chain rather
1207
+ // than a ModelTrafo aval — treat it as bound when a modelChain is present
1208
+ // (registerRoDerivations points the §7 Model leaf at the chain output).
1209
+ if (inp.name === "Model" && spec.modelChain !== undefined) continue;
1196
1210
  const specName = STANDARD_TRAFO_LEAVES.get(inp.name) ?? inp.name;
1197
1211
  const lv = spec.inputs[specName];
1198
1212
  if (lv === undefined || isDerivedRule(lv)) {
@@ -3415,6 +3429,7 @@ export function buildHeapScene(
3415
3429
  const reg = registerRoDerivations(derivedScene, {}, {
3416
3430
  rules: ruleSubset,
3417
3431
  trafoAvals,
3432
+ ...(spec.modelChain !== undefined ? { modelChain: spec.modelChain } : {}),
3418
3433
  hostUniformOffset: (n) => {
3419
3434
  const r = perDrawRefs.get(n);
3420
3435
  return r === undefined ? undefined : r + ALLOC_HEADER_PAD_TO;