@aardworx/wombat.rendering 0.21.5 → 0.21.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"flattenTree.d.ts","sourceRoot":"","sources":["../../src/runtime/flattenTree.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAQ,KAAK,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AA6CxD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,CA0BtE"}
1
+ {"version":3,"file":"flattenTree.d.ts","sourceRoot":"","sources":["../../src/runtime/flattenTree.ts"],"names":[],"mappings":"AAyBA,OAAO,EAGyD,KAAK,IAAI,EACxE,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAiHxD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,CA0BtE"}
@@ -7,13 +7,22 @@
7
7
  // (separate Render passes, in the Command list's declared order).
8
8
  //
9
9
  // Reactive variants (`Adaptive`, `OrderedFromList`, `UnorderedFromSet`)
10
- // stay reactive: marks propagate through `bind` / `collect`, and the
10
+ // stay reactive: marks propagate through the fused reader, and the
11
11
  // resulting aset reflects current tree state without a manual rebuild.
12
12
  //
13
13
  // `OrderedFromList`'s `alist<RenderTree>` is converted via
14
14
  // `AListBridges.toASet` — this drops index/order info, which we
15
15
  // wouldn't honor anyway.
16
- import { ASet } from "@aardworx/wombat.adaptive";
16
+ //
17
+ // FUSION: a reactive child-set used to lower through FIVE aset stages
18
+ // (`filter(static).collectSeq(...)` ∪ `filter(!static).collect(...)`),
19
+ // each with its own History + full per-element state — at collection
20
+ // scale that is several complete N-element states of pure plumbing.
21
+ // `FlattenChildSetReader` fuses them into ONE reader: static subtrees
22
+ // (the overwhelmingly common case) enumerate their RenderObjects
23
+ // directly; reactive subtrees get an inner reader exactly like
24
+ // `ASet.collect`'s. One History, one state, two caches.
25
+ import { ASet, AbstractDirtyReader, Cache, HashSetDelta, SetOperation, hashSetDeltaMonoid, } from "@aardworx/wombat.adaptive";
17
26
  import { AListBridges } from "@aardworx/wombat.adaptive";
18
27
  /** True when `tree` contains no reactive nodes — its RenderObjects can
19
28
  * be enumerated as a plain iterable (no inner aset / reader needed). */
@@ -46,15 +55,70 @@ function* staticObjects(tree) {
46
55
  throw new Error(`staticObjects: reactive node '${tree.kind}'`);
47
56
  }
48
57
  }
49
- /** Flatten a reactive container of subtrees. The static children go
50
- * through `collectSeq` (plain iterables ONE reader for the whole
51
- * set, instead of a ConstantAset + reader + subscription PER LEAF,
52
- * which at heap scale was megabytes of ballast); reactive children
53
- * keep the full `collect`. */
58
+ const INNER_TAG = "FlattenInnerReader";
59
+ const _tagIsInnerTag = (tag) => tag === INNER_TAG;
60
+ /**
61
+ * Fused flattener for a reactive container of subtrees. Per child
62
+ * delta: a STATIC subtree contributes its objects directly (cached as
63
+ * an array so removal emits exactly what addition emitted); a
64
+ * reactive subtree contributes through an inner reader with
65
+ * `ASet.collect`'s dirty-tracking protocol.
66
+ */
67
+ class FlattenChildSetReader extends AbstractDirtyReader {
68
+ _reader;
69
+ _static;
70
+ _inner;
71
+ constructor(children) {
72
+ super(hashSetDeltaMonoid(), _tagIsInnerTag);
73
+ this._reader = children.getReader();
74
+ this._static = new Cache((t) => [...staticObjects(t)]);
75
+ this._inner = new Cache((t) => {
76
+ const r = flattenRenderTree(t).getReader();
77
+ r.tag = INNER_TAG;
78
+ return r;
79
+ });
80
+ }
81
+ compute(tok, dirty) {
82
+ let deltas = this._reader.getChanges(tok).collect((d) => {
83
+ const t = d.value;
84
+ if (d.count === 1) {
85
+ if (isStaticTree(t)) {
86
+ let out = HashSetDelta.empty();
87
+ for (const ro of this._static.invoke(t))
88
+ out = out.add(SetOperation.add(ro));
89
+ return out;
90
+ }
91
+ const r = this._inner.invoke(t);
92
+ dirty.delete(r);
93
+ return r.getChanges(tok);
94
+ }
95
+ if (d.count === -1) {
96
+ if (isStaticTree(t)) {
97
+ let out = HashSetDelta.empty();
98
+ for (const ro of this._static.revokeUnsafe(t))
99
+ out = out.add(SetOperation.rem(ro));
100
+ return out;
101
+ }
102
+ const r = this._inner.tryRevokeAndGetDeleted(t);
103
+ if (r === undefined)
104
+ return HashSetDelta.empty();
105
+ dirty.delete(r.value);
106
+ if (r.deleted) {
107
+ r.value.outputs.remove(this);
108
+ return r.value.state.removeAll();
109
+ }
110
+ return r.value.getChanges(tok);
111
+ }
112
+ throw new Error("flattenTree: unexpected delta count");
113
+ });
114
+ for (const d of dirty) {
115
+ deltas = deltas.combine(d.getChanges(tok));
116
+ }
117
+ return deltas;
118
+ }
119
+ }
54
120
  function flattenChildSet(children) {
55
- const staticPart = children.filter(isStaticTree).collectSeq(staticObjects);
56
- const reactivePart = children.filter(t => !isStaticTree(t)).collect(flattenRenderTree);
57
- return ASet.union(staticPart, reactivePart);
121
+ return ASet.ofReader(() => new FlattenChildSetReader(children));
58
122
  }
59
123
  export function flattenRenderTree(tree) {
60
124
  switch (tree.kind) {
@@ -1 +1 @@
1
- {"version":3,"file":"flattenTree.js","sourceRoot":"","sources":["../../src/runtime/flattenTree.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,EAAE;AACF,iEAAiE;AACjE,mEAAmE;AACnE,iEAAiE;AACjE,iEAAiE;AACjE,kEAAkE;AAClE,EAAE;AACF,wEAAwE;AACxE,qEAAqE;AACrE,uEAAuE;AACvE,EAAE;AACF,2DAA2D;AAC3D,gEAAgE;AAChE,yBAAyB;AAEzB,OAAO,EAAE,IAAI,EAAa,MAAM,2BAA2B,CAA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C;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,EAAE,CAAC;KAC/D,CAAC,CAAC;IACH,OAAO,IAAI,IAAI,CAAC;CACjB;AAQD,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,oBAAoB,EAC/B,IAAI,EAAE,UAAU,EAChB,IAAI,GAAE,yBAA8B,GACnC,WAAW,CA4Mb"}
@@ -1,19 +1,19 @@
1
1
  // hybridScene — composes the heap-bucket fast path with the legacy
2
2
  // per-RO path into a single render-pass renderer.
3
3
  //
4
- // Pipeline:
4
+ // Pipeline (fused — one aset stage per backend):
5
5
  // 1. `flattenRenderTree(tree)` → `aset<RenderObject>` (drops intra-
6
6
  // pass ordering by contract).
7
- // 2. `partitionA(aset, isHeapEligible)` (heapAset, legacyAset).
7
+ // 2. `flat.chooseA(ro => elig(ro).map(e => e ? spec : undefined))`
8
+ // → `aset<HeapDrawSpec>` fed to `buildHeapScene`; the adapter is
9
+ // memoized per-RO so the same RO always maps to the same spec
10
+ // object (delta-driven removal identifies the right entry).
8
11
  // Reactive: an RO migrates when its eligibility predicate marks
9
12
  // (e.g. an `aval<IBuffer>` flips host↔gpu).
10
- // 3. `heapAset.map(renderObjectToHeapSpec)` `aset<HeapDrawSpec>`,
11
- // fed to `buildHeapScene`. The adapter is memoized per-RO so
12
- // the same RO always maps to the same spec object — needed for
13
- // delta-driven removal to identify the right entry.
14
- // 4. `legacyAset` wrapped as `RenderTree.unorderedFromSet(map(leaf))`
15
- // and fed to `ScenePass`. Same NodeWalker machinery that the
16
- // legacy `RenderTask` uses.
13
+ // 3. `flat.chooseA(ro => elig(ro).map(e => e ? undefined : leaf))`
14
+ // wrapped as `RenderTree.unorderedFromSet` and fed to
15
+ // `ScenePass`. Same NodeWalker machinery as the legacy
16
+ // `RenderTask`.
17
17
  //
18
18
  // Per-frame:
19
19
  // - `update(token)` runs both backends' update phases (CPU work
@@ -44,21 +44,25 @@ export function compileHybridScene(device, signature, tree, opts = {}) {
44
44
  const fragmentOutputLayout = opts.fragmentOutputLayout ?? defaultFragmentOutputLayout(signature);
45
45
  const compileEffect = opts.compileEffect ?? ((e, _sig) => e.compile({ target: "wgsl", fragmentOutputLayout }));
46
46
  // ─── Partition ───────────────────────────────────────────────────
47
- // Memoize the eligibility predicate per-RO so the two filterA calls
48
- // share one underlying observation. Without this, both calls would
49
- // build independent custom-avals with overlapping subscriptions.
50
- // The per-RO eligibility is ANDed with the global `heapEnabled`
51
- // toggle — flipping that off forces every RO to legacy.
47
+ // Memoize the eligibility predicate per-RO so both partition sides
48
+ // share one underlying observation. The per-RO eligibility is ANDed
49
+ // with the global `heapEnabled` toggle — flipping that off forces
50
+ // every RO to legacy.
51
+ //
52
+ // FUSION: each side is ONE `chooseA` straight off `flat` — the old
53
+ // `filterA(elig)` + `choose(spec)` (heap) and `filterA(notElig)` +
54
+ // `map(leaf)` (legacy) pipelines carried an intermediate aset each,
55
+ // i.e. a full History + per-element state of pure plumbing, plus a
56
+ // negation aval per RO. `chooseA`'s per-element wrapper rides
57
+ // `elig(ro).map(...)`, which for a CONSTANT eligibility (asserted
58
+ // rows under a constant `heapEnabled`, or fully-static ROs)
59
+ // collapses to a lazy constant — no adaptive node, no edges.
52
60
  const heapEnabled = opts.heapEnabled ?? AVal.constant(true);
53
- // Producer-asserted ROs (`heapAsserted: true`) skip the per-RO
54
- // predicate entirely — they all share these TWO scene-level avals
55
- // instead of two live avals each (see RenderObject.heapAsserted).
56
- const notHeapEnabled = heapEnabled.isConstant
57
- ? AVal.constant(!heapEnabled.force( /* allow-force */))
58
- : heapEnabled.map(b => !b);
59
61
  const eligCache = new WeakMap();
60
- const notEligCache = new WeakMap();
61
62
  const elig = (ro) => {
63
+ // Producer-asserted ROs (`heapAsserted: true`) skip the per-RO
64
+ // predicate entirely — they all share the scene-level toggle aval
65
+ // (see RenderObject.heapAsserted).
62
66
  if (ro.heapAsserted === true)
63
67
  return heapEnabled;
64
68
  let av = eligCache.get(ro);
@@ -73,20 +77,7 @@ export function compileHybridScene(device, signature, tree, opts = {}) {
73
77
  }
74
78
  return av;
75
79
  };
76
- const notElig = (ro) => {
77
- if (ro.heapAsserted === true)
78
- return notHeapEnabled;
79
- let av = notEligCache.get(ro);
80
- if (av === undefined) {
81
- const e = elig(ro);
82
- av = e.isConstant ? AVal.constant(!e.force( /* allow-force */)) : e.map(b => !b);
83
- notEligCache.set(ro, av);
84
- }
85
- return av;
86
- };
87
80
  const flat = flattenRenderTree(tree);
88
- const heapAset = flat.filterA(ro => elig(ro));
89
- const legacyAset = flat.filterA(ro => notElig(ro));
90
81
  // ─── Atlas pool ──────────────────────────────────────────────────
91
82
  // Per-scene Tier-S atlas pool. Owned by this hybrid scene; disposed
92
83
  // alongside the heap path. The adapter consults it to classify
@@ -109,7 +100,7 @@ export function compileHybridScene(device, signature, tree, opts = {}) {
109
100
  // usually have freed atlas space). It costs a missing tile for a frame or two;
110
101
  // the alternative was an exception in the frame callback, which killed the
111
102
  // render loop outright.
112
- const heapSpecAset = heapAset.choose((ro) => {
103
+ const specOf = (ro) => {
113
104
  let spec = specCache.get(ro);
114
105
  if (spec === undefined) {
115
106
  const built = renderObjectToHeapSpec(ro, AdaptiveToken.top, atlasPool, {
@@ -121,7 +112,9 @@ export function compileHybridScene(device, signature, tree, opts = {}) {
121
112
  specCache.set(ro, spec);
122
113
  }
123
114
  return spec;
124
- });
115
+ };
116
+ // ONE fused stage: eligibility routes straight into the spec.
117
+ const heapSpecAset = flat.chooseA((ro) => elig(ro).map((e) => (e ? specOf(ro) : undefined)));
125
118
  const heapScene = buildHeapScene(device, signature, heapSpecAset, {
126
119
  fragmentOutputLayout,
127
120
  atlasPool,
@@ -137,7 +130,18 @@ export function compileHybridScene(device, signature, tree, opts = {}) {
137
130
  // path inherits the same "no order inside a pass" contract. Re-using
138
131
  // the existing NodeWalker machinery means RO preparation, caching,
139
132
  // and resource ref-counting all behave exactly as the master path.
140
- const legacyTree = RenderTree.unorderedFromSet(legacyAset.map(ro => RenderTree.leaf(ro)));
133
+ // ONE fused stage (ineligible leaf); the leaf wrapper is memoized
134
+ // so eligibility flips re-emit the identical tree object.
135
+ const leafCache = new WeakMap();
136
+ const leafOf = (ro) => {
137
+ let l = leafCache.get(ro);
138
+ if (l === undefined) {
139
+ l = RenderTree.leaf(ro);
140
+ leafCache.set(ro, l);
141
+ }
142
+ return l;
143
+ };
144
+ const legacyTree = RenderTree.unorderedFromSet(flat.chooseA((ro) => elig(ro).map((e) => (e ? undefined : leafOf(ro)))));
141
145
  const scenePass = new ScenePass(device, signature, legacyTree, compileEffect);
142
146
  // DEBUG registry: per-hybrid-scene live draw counts (heap vs legacy) so
143
147
  // multi-task pipelines (OIT) can be inspected from the console.
@@ -1 +1 @@
1
- {"version":3,"file":"hybridScene.js","sourceRoot":"","sources":["../../src/runtime/hybridScene.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,kDAAkD;AAClD,EAAE;AACF,YAAY;AACZ,sEAAsE;AACtE,mCAAmC;AACnC,oEAAoE;AACpE,qEAAqE;AACrE,iDAAiD;AACjD,sEAAsE;AACtE,kEAAkE;AAClE,oEAAoE;AACpE,yDAAyD;AACzD,wEAAwE;AACxE,kEAAkE;AAClE,iCAAiC;AACjC,EAAE;AACF,aAAa;AACb,kEAAkE;AAClE,4CAA4C;AAC5C,gEAAgE;AAChE,oDAAoD;AACpD,EAAE;AACF,iEAAiE;AACjE,oEAAoE;AACpE,kEAAkE;AAClE,sEAAsE;AACtE,+BAA+B;AAE/B,OAAO,EACL,IAAI,EAAE,IAAI,EAAE,aAAa,GAC1B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD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CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACxC,CAAC;QACD,iBAAiB,CAAC,OAAgB;YAChC,OAAQ,SAED,CAAC,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC5C,CAAC;QACD,sBAAsB,CAAC,OAAgB;YACrC,OAAQ,SAED,CAAC,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QACjD,CAAC;QACD,OAAO;YACL,SAAS,CAAC,OAAO,EAAE,CAAC;YACpB,SAAS,CAAC,OAAO,EAAE,CAAC;YACpB,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,qEAAqE;AACrE,MAAM,cAAc,GAA8B,SAAS,CAAC;AAC5D,KAAK,cAAc,CAAC;AACpB,iFAAiF;AACjF,KAAK,IAAI,CAAC"}
1
+ {"version":3,"file":"hybridScene.js","sourceRoot":"","sources":["../../src/runtime/hybridScene.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,kDAAkD;AAClD,EAAE;AACF,iDAAiD;AACjD,sEAAsE;AACtE,mCAAmC;AACnC,qEAAqE;AACrE,sEAAsE;AACtE,mEAAmE;AACnE,iEAAiE;AACjE,qEAAqE;AACrE,iDAAiD;AACjD,qEAAqE;AACrE,2DAA2D;AAC3D,4DAA4D;AAC5D,qBAAqB;AACrB,EAAE;AACF,aAAa;AACb,kEAAkE;AAClE,4CAA4C;AAC5C,gEAAgE;AAChE,oDAAoD;AACpD,EAAE;AACF,iEAAiE;AACjE,oEAAoE;AACpE,kEAAkE;AAClE,sEAAsE;AACtE,+BAA+B;AAE/B,OAAO,EACL,IAAI,EAAE,IAAI,EAAE,aAAa,GAC1B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,C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C,CAAC;QACD,sBAAsB,CAAC,OAAgB;YACrC,OAAQ,SAED,CAAC,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC;QACjD,CAAC;QACD,OAAO;YACL,SAAS,CAAC,OAAO,EAAE,CAAC;YACpB,SAAS,CAAC,OAAO,EAAE,CAAC;YACpB,SAAS,CAAC,OAAO,EAAE,CAAC;QACtB,CAAC;KACF,CAAC;AACJ,CAAC;AAED,qEAAqE;AACrE,MAAM,cAAc,GAA8B,SAAS,CAAC;AAC5D,KAAK,cAAc,CAAC;AACpB,iFAAiF;AACjF,KAAK,IAAI,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aardworx/wombat.rendering",
3
- "version": "0.21.5",
3
+ "version": "0.21.7",
4
4
  "description": "WebGPU rendering layer for the Wombat TypeScript stack — RenderObject/RenderTask/runtime + window glue, port of Aardvark.Rendering's lower layers on top of WebGPU and wombat.shader.",
5
5
  "license": "MIT",
6
6
  "author": "krauthaufen",
@@ -65,5 +65,8 @@
65
65
  "publishConfig": {
66
66
  "access": "public"
67
67
  },
68
- "private": false
68
+ "private": false,
69
+ "scripts": {
70
+ "prepublishOnly": "cd ../.. && npm run typecheck && npm run build"
71
+ }
69
72
  }
@@ -7,14 +7,27 @@
7
7
  // (separate Render passes, in the Command list's declared order).
8
8
  //
9
9
  // Reactive variants (`Adaptive`, `OrderedFromList`, `UnorderedFromSet`)
10
- // stay reactive: marks propagate through `bind` / `collect`, and the
10
+ // stay reactive: marks propagate through the fused reader, and the
11
11
  // resulting aset reflects current tree state without a manual rebuild.
12
12
  //
13
13
  // `OrderedFromList`'s `alist<RenderTree>` is converted via
14
14
  // `AListBridges.toASet` — this drops index/order info, which we
15
15
  // wouldn't honor anyway.
16
+ //
17
+ // FUSION: a reactive child-set used to lower through FIVE aset stages
18
+ // (`filter(static).collectSeq(...)` ∪ `filter(!static).collect(...)`),
19
+ // each with its own History + full per-element state — at collection
20
+ // scale that is several complete N-element states of pure plumbing.
21
+ // `FlattenChildSetReader` fuses them into ONE reader: static subtrees
22
+ // (the overwhelmingly common case) enumerate their RenderObjects
23
+ // directly; reactive subtrees get an inner reader exactly like
24
+ // `ASet.collect`'s. One History, one state, two caches.
16
25
 
17
- import { ASet, type aset } from "@aardworx/wombat.adaptive";
26
+ import {
27
+ ASet, AbstractDirtyReader, Cache, HashSetDelta, SetOperation,
28
+ hashSetDeltaMonoid,
29
+ type AbstractReader, type AdaptiveToken, type IHashSetReader, type aset,
30
+ } from "@aardworx/wombat.adaptive";
18
31
  import { AListBridges } from "@aardworx/wombat.adaptive";
19
32
  import type { RenderObject } from "../core/renderObject.js";
20
33
  import type { RenderTree } from "../core/renderTree.js";
@@ -51,15 +64,83 @@ function* staticObjects(tree: RenderTree): Iterable<RenderObject> {
51
64
  }
52
65
  }
53
66
 
54
- /** Flatten a reactive container of subtrees. The static children go
55
- * through `collectSeq` (plain iterables ONE reader for the whole
56
- * set, instead of a ConstantAset + reader + subscription PER LEAF,
57
- * which at heap scale was megabytes of ballast); reactive children
58
- * keep the full `collect`. */
67
+ const INNER_TAG = "FlattenInnerReader";
68
+ const _tagIsInnerTag = (tag: unknown): boolean => tag === INNER_TAG;
69
+
70
+ /**
71
+ * Fused flattener for a reactive container of subtrees. Per child
72
+ * delta: a STATIC subtree contributes its objects directly (cached as
73
+ * an array so removal emits exactly what addition emitted); a
74
+ * reactive subtree contributes through an inner reader with
75
+ * `ASet.collect`'s dirty-tracking protocol.
76
+ */
77
+ class FlattenChildSetReader extends AbstractDirtyReader<
78
+ IHashSetReader<RenderObject>,
79
+ HashSetDelta<RenderObject>
80
+ > {
81
+ private readonly _reader: IHashSetReader<RenderTree>;
82
+ private readonly _static: Cache<RenderTree, RenderObject[]>;
83
+ private readonly _inner: Cache<RenderTree, IHashSetReader<RenderObject>>;
84
+
85
+ constructor(children: aset<RenderTree>) {
86
+ super(hashSetDeltaMonoid<RenderObject>(), _tagIsInnerTag);
87
+ this._reader = children.getReader();
88
+ this._static = new Cache<RenderTree, RenderObject[]>(
89
+ (t) => [...staticObjects(t)],
90
+ );
91
+ this._inner = new Cache<RenderTree, IHashSetReader<RenderObject>>(
92
+ (t) => {
93
+ const r = flattenRenderTree(t).getReader();
94
+ r.tag = INNER_TAG;
95
+ return r;
96
+ },
97
+ );
98
+ }
99
+
100
+ override compute(
101
+ tok: AdaptiveToken,
102
+ dirty: Set<IHashSetReader<RenderObject>>,
103
+ ): HashSetDelta<RenderObject> {
104
+ let deltas = this._reader.getChanges(tok).collect((d) => {
105
+ const t = d.value;
106
+ if (d.count === 1) {
107
+ if (isStaticTree(t)) {
108
+ let out = HashSetDelta.empty<RenderObject>();
109
+ for (const ro of this._static.invoke(t)) out = out.add(SetOperation.add(ro));
110
+ return out;
111
+ }
112
+ const r = this._inner.invoke(t);
113
+ dirty.delete(r);
114
+ return r.getChanges(tok);
115
+ }
116
+ if (d.count === -1) {
117
+ if (isStaticTree(t)) {
118
+ let out = HashSetDelta.empty<RenderObject>();
119
+ for (const ro of this._static.revokeUnsafe(t)) out = out.add(SetOperation.rem(ro));
120
+ return out;
121
+ }
122
+ const r = this._inner.tryRevokeAndGetDeleted(t);
123
+ if (r === undefined) return HashSetDelta.empty<RenderObject>();
124
+ dirty.delete(r.value);
125
+ if (r.deleted) {
126
+ r.value.outputs.remove(this);
127
+ return r.value.state.removeAll();
128
+ }
129
+ return r.value.getChanges(tok);
130
+ }
131
+ throw new Error("flattenTree: unexpected delta count");
132
+ });
133
+ for (const d of dirty) {
134
+ deltas = deltas.combine(d.getChanges(tok));
135
+ }
136
+ return deltas;
137
+ }
138
+ }
139
+
59
140
  function flattenChildSet(children: aset<RenderTree>): aset<RenderObject> {
60
- const staticPart = children.filter(isStaticTree).collectSeq(staticObjects);
61
- const reactivePart = children.filter(t => !isStaticTree(t)).collect(flattenRenderTree);
62
- return ASet.union(staticPart, reactivePart);
141
+ return ASet.ofReader(
142
+ () => new FlattenChildSetReader(children) as unknown as AbstractReader<HashSetDelta<RenderObject>>,
143
+ );
63
144
  }
64
145
 
65
146
  export function flattenRenderTree(tree: RenderTree): aset<RenderObject> {
@@ -1,19 +1,19 @@
1
1
  // hybridScene — composes the heap-bucket fast path with the legacy
2
2
  // per-RO path into a single render-pass renderer.
3
3
  //
4
- // Pipeline:
4
+ // Pipeline (fused — one aset stage per backend):
5
5
  // 1. `flattenRenderTree(tree)` → `aset<RenderObject>` (drops intra-
6
6
  // pass ordering by contract).
7
- // 2. `partitionA(aset, isHeapEligible)` (heapAset, legacyAset).
7
+ // 2. `flat.chooseA(ro => elig(ro).map(e => e ? spec : undefined))`
8
+ // → `aset<HeapDrawSpec>` fed to `buildHeapScene`; the adapter is
9
+ // memoized per-RO so the same RO always maps to the same spec
10
+ // object (delta-driven removal identifies the right entry).
8
11
  // Reactive: an RO migrates when its eligibility predicate marks
9
12
  // (e.g. an `aval<IBuffer>` flips host↔gpu).
10
- // 3. `heapAset.map(renderObjectToHeapSpec)` `aset<HeapDrawSpec>`,
11
- // fed to `buildHeapScene`. The adapter is memoized per-RO so
12
- // the same RO always maps to the same spec object — needed for
13
- // delta-driven removal to identify the right entry.
14
- // 4. `legacyAset` wrapped as `RenderTree.unorderedFromSet(map(leaf))`
15
- // and fed to `ScenePass`. Same NodeWalker machinery that the
16
- // legacy `RenderTask` uses.
13
+ // 3. `flat.chooseA(ro => elig(ro).map(e => e ? undefined : leaf))`
14
+ // wrapped as `RenderTree.unorderedFromSet` and fed to
15
+ // `ScenePass`. Same NodeWalker machinery as the legacy
16
+ // `RenderTask`.
17
17
  //
18
18
  // Per-frame:
19
19
  // - `update(token)` runs both backends' update phases (CPU work
@@ -196,21 +196,25 @@ export function compileHybridScene(
196
196
  e.compile({ target: "wgsl", fragmentOutputLayout }));
197
197
 
198
198
  // ─── Partition ───────────────────────────────────────────────────
199
- // Memoize the eligibility predicate per-RO so the two filterA calls
200
- // share one underlying observation. Without this, both calls would
201
- // build independent custom-avals with overlapping subscriptions.
202
- // The per-RO eligibility is ANDed with the global `heapEnabled`
203
- // toggle — flipping that off forces every RO to legacy.
199
+ // Memoize the eligibility predicate per-RO so both partition sides
200
+ // share one underlying observation. The per-RO eligibility is ANDed
201
+ // with the global `heapEnabled` toggle — flipping that off forces
202
+ // every RO to legacy.
203
+ //
204
+ // FUSION: each side is ONE `chooseA` straight off `flat` — the old
205
+ // `filterA(elig)` + `choose(spec)` (heap) and `filterA(notElig)` +
206
+ // `map(leaf)` (legacy) pipelines carried an intermediate aset each,
207
+ // i.e. a full History + per-element state of pure plumbing, plus a
208
+ // negation aval per RO. `chooseA`'s per-element wrapper rides
209
+ // `elig(ro).map(...)`, which for a CONSTANT eligibility (asserted
210
+ // rows under a constant `heapEnabled`, or fully-static ROs)
211
+ // collapses to a lazy constant — no adaptive node, no edges.
204
212
  const heapEnabled = opts.heapEnabled ?? AVal.constant(true);
205
- // Producer-asserted ROs (`heapAsserted: true`) skip the per-RO
206
- // predicate entirely — they all share these TWO scene-level avals
207
- // instead of two live avals each (see RenderObject.heapAsserted).
208
- const notHeapEnabled = heapEnabled.isConstant
209
- ? AVal.constant(!heapEnabled.force(/* allow-force */))
210
- : heapEnabled.map(b => !b);
211
213
  const eligCache = new WeakMap<RenderObject, aval<boolean>>();
212
- const notEligCache = new WeakMap<RenderObject, aval<boolean>>();
213
214
  const elig = (ro: RenderObject): aval<boolean> => {
215
+ // Producer-asserted ROs (`heapAsserted: true`) skip the per-RO
216
+ // predicate entirely — they all share the scene-level toggle aval
217
+ // (see RenderObject.heapAsserted).
214
218
  if (ro.heapAsserted === true) return heapEnabled;
215
219
  let av = eligCache.get(ro);
216
220
  if (av === undefined) {
@@ -224,20 +228,8 @@ export function compileHybridScene(
224
228
  }
225
229
  return av;
226
230
  };
227
- const notElig = (ro: RenderObject): aval<boolean> => {
228
- if (ro.heapAsserted === true) return notHeapEnabled;
229
- let av = notEligCache.get(ro);
230
- if (av === undefined) {
231
- const e = elig(ro);
232
- av = e.isConstant ? AVal.constant(!e.force(/* allow-force */)) : e.map(b => !b);
233
- notEligCache.set(ro, av);
234
- }
235
- return av;
236
- };
237
231
 
238
232
  const flat = flattenRenderTree(tree);
239
- const heapAset = flat.filterA(ro => elig(ro));
240
- const legacyAset = flat.filterA(ro => notElig(ro));
241
233
 
242
234
  // ─── Atlas pool ──────────────────────────────────────────────────
243
235
  // Per-scene Tier-S atlas pool. Owned by this hybrid scene; disposed
@@ -262,7 +254,7 @@ export function compileHybridScene(
262
254
  // usually have freed atlas space). It costs a missing tile for a frame or two;
263
255
  // the alternative was an exception in the frame callback, which killed the
264
256
  // render loop outright.
265
- const heapSpecAset = heapAset.choose((ro: RenderObject) => {
257
+ const specOf = (ro: RenderObject): HeapDrawSpec | undefined => {
266
258
  let spec = specCache.get(ro);
267
259
  if (spec === undefined) {
268
260
  const built = renderObjectToHeapSpec(ro, AdaptiveToken.top, atlasPool, {
@@ -273,7 +265,10 @@ export function compileHybridScene(
273
265
  specCache.set(ro, spec);
274
266
  }
275
267
  return spec;
276
- });
268
+ };
269
+ // ONE fused stage: eligibility routes straight into the spec.
270
+ const heapSpecAset = flat.chooseA((ro: RenderObject) =>
271
+ elig(ro).map((e) => (e ? specOf(ro) : undefined)));
277
272
 
278
273
  const heapScene: HeapScene = buildHeapScene(device, signature, heapSpecAset, {
279
274
  fragmentOutputLayout,
@@ -291,8 +286,17 @@ export function compileHybridScene(
291
286
  // path inherits the same "no order inside a pass" contract. Re-using
292
287
  // the existing NodeWalker machinery means RO preparation, caching,
293
288
  // and resource ref-counting all behave exactly as the master path.
294
- const legacyTree: RenderTree =
295
- RenderTree.unorderedFromSet(legacyAset.map(ro => RenderTree.leaf(ro)));
289
+ // ONE fused stage (ineligible → leaf); the leaf wrapper is memoized
290
+ // so eligibility flips re-emit the identical tree object.
291
+ const leafCache = new WeakMap<RenderObject, RenderTree>();
292
+ const leafOf = (ro: RenderObject): RenderTree => {
293
+ let l = leafCache.get(ro);
294
+ if (l === undefined) { l = RenderTree.leaf(ro); leafCache.set(ro, l); }
295
+ return l;
296
+ };
297
+ const legacyTree: RenderTree = RenderTree.unorderedFromSet(
298
+ flat.chooseA((ro: RenderObject) =>
299
+ elig(ro).map((e) => (e ? undefined : leafOf(ro)))));
296
300
  const scenePass = new ScenePass(device, signature, legacyTree, compileEffect);
297
301
  // DEBUG registry: per-hybrid-scene live draw counts (heap vs legacy) so
298
302
  // multi-task pipelines (OIT) can be inspected from the console.