@aardworx/wombat.rendering 0.9.33 → 0.19.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.
- package/dist/core/renderObject.d.ts +16 -0
- package/dist/core/renderObject.d.ts.map +1 -1
- package/dist/runtime/derivedModes/kernelCodegen.d.ts +90 -0
- package/dist/runtime/derivedModes/kernelCodegen.d.ts.map +1 -0
- package/dist/runtime/derivedModes/kernelCodegen.js +623 -0
- package/dist/runtime/derivedModes/kernelCodegen.js.map +1 -0
- package/dist/runtime/derivedModes/modeKeyCpu.d.ts.map +1 -1
- package/dist/runtime/derivedModes/modeKeyCpu.js +23 -67
- package/dist/runtime/derivedModes/modeKeyCpu.js.map +1 -1
- package/dist/runtime/derivedModes/partitionDispatcher.d.ts +79 -0
- package/dist/runtime/derivedModes/partitionDispatcher.d.ts.map +1 -0
- package/dist/runtime/derivedModes/partitionDispatcher.js +303 -0
- package/dist/runtime/derivedModes/partitionDispatcher.js.map +1 -0
- package/dist/runtime/derivedModes/partitionKernel.d.ts +12 -0
- package/dist/runtime/derivedModes/partitionKernel.d.ts.map +1 -0
- package/dist/runtime/derivedModes/partitionKernel.js +127 -0
- package/dist/runtime/derivedModes/partitionKernel.js.map +1 -0
- package/dist/runtime/derivedModes/partitionKernelLayout.d.ts +4 -0
- package/dist/runtime/derivedModes/partitionKernelLayout.d.ts.map +1 -0
- package/dist/runtime/derivedModes/partitionKernelLayout.js +24 -0
- package/dist/runtime/derivedModes/partitionKernelLayout.js.map +1 -0
- package/dist/runtime/derivedModes/rule.d.ts +38 -86
- package/dist/runtime/derivedModes/rule.d.ts.map +1 -1
- package/dist/runtime/derivedModes/rule.js +34 -74
- package/dist/runtime/derivedModes/rule.js.map +1 -1
- package/dist/runtime/derivedUniforms/dispatch.d.ts +10 -8
- package/dist/runtime/derivedUniforms/dispatch.d.ts.map +1 -1
- package/dist/runtime/derivedUniforms/dispatch.js +31 -18
- package/dist/runtime/derivedUniforms/dispatch.js.map +1 -1
- package/dist/runtime/derivedUniforms/marker.d.ts +90 -11
- package/dist/runtime/derivedUniforms/marker.d.ts.map +1 -1
- package/dist/runtime/derivedUniforms/marker.js +161 -15
- package/dist/runtime/derivedUniforms/marker.js.map +1 -1
- package/dist/runtime/derivedUniforms/sceneIntegration.d.ts +25 -6
- package/dist/runtime/derivedUniforms/sceneIntegration.d.ts.map +1 -1
- package/dist/runtime/derivedUniforms/sceneIntegration.js +61 -20
- package/dist/runtime/derivedUniforms/sceneIntegration.js.map +1 -1
- package/dist/runtime/heapAdapter.d.ts.map +1 -1
- package/dist/runtime/heapAdapter.js +17 -0
- package/dist/runtime/heapAdapter.js.map +1 -1
- package/dist/runtime/heapEligibility.d.ts.map +1 -1
- package/dist/runtime/heapEligibility.js +22 -2
- package/dist/runtime/heapEligibility.js.map +1 -1
- package/dist/runtime/heapScene/chunkedArena.d.ts +76 -0
- package/dist/runtime/heapScene/chunkedArena.d.ts.map +1 -0
- package/dist/runtime/heapScene/chunkedArena.js +223 -0
- package/dist/runtime/heapScene/chunkedArena.js.map +1 -0
- package/dist/runtime/heapScene/freelist.d.ts +55 -0
- package/dist/runtime/heapScene/freelist.d.ts.map +1 -0
- package/dist/runtime/heapScene/freelist.js +188 -0
- package/dist/runtime/heapScene/freelist.js.map +1 -0
- package/dist/runtime/heapScene/growBuffer.d.ts +23 -2
- package/dist/runtime/heapScene/growBuffer.d.ts.map +1 -1
- package/dist/runtime/heapScene/growBuffer.js +35 -3
- package/dist/runtime/heapScene/growBuffer.js.map +1 -1
- package/dist/runtime/heapScene/pools.d.ts +84 -42
- package/dist/runtime/heapScene/pools.d.ts.map +1 -1
- package/dist/runtime/heapScene/pools.js +309 -134
- package/dist/runtime/heapScene/pools.js.map +1 -1
- package/dist/runtime/heapScene.d.ts +24 -0
- package/dist/runtime/heapScene.d.ts.map +1 -1
- package/dist/runtime/heapScene.js +1158 -92
- package/dist/runtime/heapScene.js.map +1 -1
- package/dist/runtime/hybridScene.d.ts +15 -0
- package/dist/runtime/hybridScene.d.ts.map +1 -1
- package/dist/runtime/hybridScene.js +16 -0
- package/dist/runtime/hybridScene.js.map +1 -1
- package/dist/runtime/index.d.ts +4 -3
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +4 -3
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/renderTask.d.ts +5 -0
- package/dist/runtime/renderTask.d.ts.map +1 -1
- package/dist/runtime/renderTask.js +1 -0
- package/dist/runtime/renderTask.js.map +1 -1
- package/dist/runtime/runtime.d.ts +6 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +1 -0
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/textureAtlas/atlasPool.d.ts +12 -0
- package/dist/runtime/textureAtlas/atlasPool.d.ts.map +1 -1
- package/dist/runtime/textureAtlas/atlasPool.js +20 -0
- package/dist/runtime/textureAtlas/atlasPool.js.map +1 -1
- package/package.json +1 -1
- package/src/core/renderObject.ts +16 -0
- package/src/runtime/derivedModes/kernelCodegen.ts +673 -0
- package/src/runtime/derivedModes/modeKeyCpu.ts +22 -60
- package/src/runtime/derivedModes/partitionDispatcher.ts +349 -0
- package/src/runtime/derivedModes/partitionKernelLayout.ts +25 -0
- package/src/runtime/derivedModes/rule.ts +66 -145
- package/src/runtime/derivedUniforms/dispatch.ts +48 -21
- package/src/runtime/derivedUniforms/marker.ts +210 -16
- package/src/runtime/derivedUniforms/sceneIntegration.ts +67 -20
- package/src/runtime/heapAdapter.ts +17 -0
- package/src/runtime/heapEligibility.ts +22 -1
- package/src/runtime/heapScene/chunkedArena.ts +238 -0
- package/src/runtime/heapScene/freelist.ts +196 -0
- package/src/runtime/heapScene/growBuffer.ts +39 -2
- package/src/runtime/heapScene/pools.ts +350 -143
- package/src/runtime/heapScene.ts +1350 -88
- package/src/runtime/hybridScene.ts +31 -0
- package/src/runtime/index.ts +12 -9
- package/src/runtime/renderTask.ts +6 -0
- package/src/runtime/runtime.ts +7 -0
- package/src/runtime/textureAtlas/atlasPool.ts +19 -0
- package/src/runtime/derivedModes/gpuDispatcher.ts +0 -226
- package/src/runtime/derivedModes/gpuKernel.ts +0 -98
|
@@ -26,18 +26,38 @@ export const ALIGN16 = (n: number) => (n + 15) & ~15;
|
|
|
26
26
|
* it allocates, and `ensureCapacity` grows when required. This
|
|
27
27
|
* separates allocation policy from grow policy.
|
|
28
28
|
*/
|
|
29
|
+
/**
|
|
30
|
+
* Default chunk capacity cap when none is provided. We pick 256 MB as
|
|
31
|
+
* a safety ceiling that's well within typical adapter
|
|
32
|
+
* `maxStorageBufferBindingSize` (WebGPU spec minimum is 128 MB; most
|
|
33
|
+
* desktop GPUs expose 2 GiB+, mobile/integrated ≥ 256 MB). Callers
|
|
34
|
+
* that know the adapter limit should pass it explicitly so chunks
|
|
35
|
+
* can grow to whatever the hardware supports — see §3 in
|
|
36
|
+
* `docs/heap-future-work.md` and `runtime/heapScene.ts`'s scene
|
|
37
|
+
* factory where the device limit is threaded in.
|
|
38
|
+
*/
|
|
39
|
+
export const DEFAULT_MAX_BUFFER_BYTES = 256 * 1024 * 1024;
|
|
40
|
+
|
|
29
41
|
export class GrowBuffer {
|
|
30
42
|
private buf: GPUBuffer;
|
|
31
43
|
private cap: number;
|
|
32
44
|
private used = 0;
|
|
33
45
|
private readonly listeners = new Set<() => void>();
|
|
46
|
+
private readonly maxBytes: number;
|
|
34
47
|
constructor(
|
|
35
48
|
private readonly device: GPUDevice,
|
|
36
49
|
private readonly label: string,
|
|
37
50
|
private readonly usage: GPUBufferUsageFlags,
|
|
38
51
|
initialBytes: number,
|
|
52
|
+
maxBytes: number = DEFAULT_MAX_BUFFER_BYTES,
|
|
39
53
|
) {
|
|
40
54
|
this.cap = Math.max(MIN_BUFFER_BYTES, POW2(initialBytes));
|
|
55
|
+
this.maxBytes = Math.max(this.cap, maxBytes);
|
|
56
|
+
if (this.cap > this.maxBytes) {
|
|
57
|
+
throw new Error(
|
|
58
|
+
`GrowBuffer '${label}': initial capacity ${this.cap} exceeds maxBytes ${this.maxBytes}`,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
41
61
|
this.buf = device.createBuffer({
|
|
42
62
|
size: this.cap,
|
|
43
63
|
usage: usage | GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC,
|
|
@@ -46,16 +66,33 @@ export class GrowBuffer {
|
|
|
46
66
|
}
|
|
47
67
|
get buffer(): GPUBuffer { return this.buf; }
|
|
48
68
|
get capacity(): number { return this.cap; }
|
|
69
|
+
get maxCapacity(): number { return this.maxBytes; }
|
|
49
70
|
get usedBytes(): number { return this.used; }
|
|
50
71
|
setUsed(n: number): void { this.used = n; }
|
|
51
72
|
onResize(cb: () => void): IDisposable {
|
|
52
73
|
this.listeners.add(cb);
|
|
53
74
|
return { dispose: () => { this.listeners.delete(cb); } };
|
|
54
75
|
}
|
|
55
|
-
/**
|
|
76
|
+
/**
|
|
77
|
+
* Ensure the buffer is at least `bytes` capacity. Grows by pow2 +
|
|
78
|
+
* copies live tail. Throws if `bytes` exceeds the configured
|
|
79
|
+
* `maxBytes` cap — caller is expected to either open a new chunk
|
|
80
|
+
* (full §3 multi-draw-call path, deferred) or reject the
|
|
81
|
+
* allocation upstream (see `isHeapEligible`'s §2 large-object
|
|
82
|
+
* eject, which keeps multi-MB single ROs out of the heap arena
|
|
83
|
+
* entirely).
|
|
84
|
+
*/
|
|
56
85
|
ensureCapacity(bytes: number): void {
|
|
57
86
|
if (bytes <= this.cap) return;
|
|
58
|
-
|
|
87
|
+
if (bytes > this.maxBytes) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
`GrowBuffer '${this.label}': requested ${bytes} bytes exceeds maxBytes ${this.maxBytes}. ` +
|
|
90
|
+
`This is the adapter's per-binding storage limit — landing larger workloads needs the ` +
|
|
91
|
+
`multi-chunk path (§3 in docs/heap-future-work.md) or upstream eviction via §2.`,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
let newCap = POW2(bytes);
|
|
95
|
+
if (newCap > this.maxBytes) newCap = this.maxBytes;
|
|
59
96
|
const newBuf = this.device.createBuffer({
|
|
60
97
|
size: newCap,
|
|
61
98
|
usage: this.usage | GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC,
|