@tinypoly/gpu-renderer 0.2.4 → 0.3.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/ARCHITECTURE.md +48 -10
- package/README.md +2 -0
- package/dist/accumulator.d.ts.map +1 -1
- package/dist/accumulator.js +1 -0
- package/dist/accumulator.js.map +1 -1
- package/dist/denoise.js +2 -2
- package/dist/denoise.js.map +1 -1
- package/dist/device.d.ts.map +1 -1
- package/dist/device.js +9 -0
- package/dist/device.js.map +1 -1
- package/dist/frameLayout.d.ts.map +1 -1
- package/dist/frameLayout.js +5 -0
- package/dist/frameLayout.js.map +1 -1
- package/dist/geometry.d.ts +48 -8
- package/dist/geometry.d.ts.map +1 -1
- package/dist/geometry.js +409 -134
- package/dist/geometry.js.map +1 -1
- package/dist/grass.d.ts.map +1 -1
- package/dist/grass.js +2 -1
- package/dist/grass.js.map +1 -1
- package/dist/imageResolve.js +2 -2
- package/dist/imageResolve.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/instancing.d.ts +100 -0
- package/dist/instancing.d.ts.map +1 -0
- package/dist/instancing.js +286 -0
- package/dist/instancing.js.map +1 -0
- package/dist/lensPass.d.ts +2 -0
- package/dist/lensPass.d.ts.map +1 -1
- package/dist/lensPass.js +7 -4
- package/dist/lensPass.js.map +1 -1
- package/dist/lights.d.ts.map +1 -1
- package/dist/lights.js +8 -5
- package/dist/lights.js.map +1 -1
- package/dist/memoryProbe.d.ts +76 -0
- package/dist/memoryProbe.d.ts.map +1 -0
- package/dist/memoryProbe.js +197 -0
- package/dist/memoryProbe.js.map +1 -0
- package/dist/oidnPass.d.ts +6 -0
- package/dist/oidnPass.d.ts.map +1 -1
- package/dist/oidnPass.js +18 -1
- package/dist/oidnPass.js.map +1 -1
- package/dist/pathTracePass.d.ts +15 -2
- package/dist/pathTracePass.d.ts.map +1 -1
- package/dist/pathTracePass.js +38 -16
- package/dist/pathTracePass.js.map +1 -1
- package/dist/renderer.d.ts +13 -0
- package/dist/renderer.d.ts.map +1 -1
- package/dist/renderer.js +248 -41
- package/dist/renderer.js.map +1 -1
- package/dist/sceneUpload.d.ts +26 -8
- package/dist/sceneUpload.d.ts.map +1 -1
- package/dist/sceneUpload.js +97 -27
- package/dist/sceneUpload.js.map +1 -1
- package/dist/shaderModule.d.ts.map +1 -1
- package/dist/shaderModule.js +2 -1
- package/dist/shaderModule.js.map +1 -1
- package/dist/skyBake.d.ts.map +1 -1
- package/dist/skyBake.js +5 -3
- package/dist/skyBake.js.map +1 -1
- package/dist/texturePack.d.ts +43 -3
- package/dist/texturePack.d.ts.map +1 -1
- package/dist/texturePack.js +209 -37
- package/dist/texturePack.js.map +1 -1
- package/dist/wgsl/bvh.wgsl.d.ts +5 -1
- package/dist/wgsl/bvh.wgsl.d.ts.map +1 -1
- package/dist/wgsl/bvh.wgsl.js +105 -15
- package/dist/wgsl/bvh.wgsl.js.map +1 -1
- package/dist/wgsl/common.wgsl.d.ts.map +1 -1
- package/dist/wgsl/common.wgsl.js +92 -11
- package/dist/wgsl/common.wgsl.js.map +1 -1
- package/dist/wgsl/lens.wgsl.d.ts +1 -1
- package/dist/wgsl/lens.wgsl.d.ts.map +1 -1
- package/dist/wgsl/lens.wgsl.js +14 -2
- package/dist/wgsl/lens.wgsl.js.map +1 -1
- package/dist/wgsl/surface.wgsl.d.ts +1 -1
- package/dist/wgsl/surface.wgsl.d.ts.map +1 -1
- package/dist/wgsl/surface.wgsl.js +24 -14
- package/dist/wgsl/surface.wgsl.js.map +1 -1
- package/dist/wgsl/texture.wgsl.d.ts +1 -1
- package/dist/wgsl/texture.wgsl.d.ts.map +1 -1
- package/dist/wgsl/texture.wgsl.js +11 -0
- package/dist/wgsl/texture.wgsl.js.map +1 -1
- package/package.json +1 -1
- package/src/accumulator.ts +1 -0
- package/src/denoise.ts +2 -2
- package/src/device.ts +12 -0
- package/src/frameLayout.ts +5 -0
- package/src/geometry.ts +527 -133
- package/src/grass.ts +2 -1
- package/src/imageResolve.ts +2 -2
- package/src/index.ts +1 -0
- package/src/instancing.ts +415 -0
- package/src/lensPass.ts +9 -4
- package/src/lights.ts +9 -5
- package/src/memoryProbe.ts +275 -0
- package/src/oidnPass.ts +21 -1
- package/src/pathTracePass.ts +42 -18
- package/src/renderer.ts +308 -47
- package/src/sceneUpload.ts +139 -36
- package/src/shaderModule.ts +2 -1
- package/src/skyBake.ts +5 -3
- package/src/texturePack.ts +274 -43
- package/src/wgsl/bvh.wgsl.ts +105 -15
- package/src/wgsl/common.wgsl.ts +92 -11
- package/src/wgsl/lens.wgsl.ts +14 -2
- package/src/wgsl/surface.wgsl.ts +24 -14
- package/src/wgsl/texture.wgsl.ts +11 -0
package/ARCHITECTURE.md
CHANGED
|
@@ -27,11 +27,14 @@ stay the algorithmic reference, line by line.
|
|
|
27
27
|
|
|
28
28
|
- `device.ts`: adapter and device acquisition, requested limits, loss handling.
|
|
29
29
|
- `camera.ts`: the camera's matrices. Every ray goes through the inverse of the camera's own projection.
|
|
30
|
-
- `geometry.ts`, `bvh.ts`:
|
|
30
|
+
- `geometry.ts`, `bvh.ts`: the triangle and vertex buffers, and the BVH: built as a binary tree, then laid out in
|
|
31
31
|
64 byte nodes that each hold their two children's boxes, so one read tests both and a leaf is never read. Packing
|
|
32
32
|
also builds what Three draws in screen space (points, lines, sprites, dashes) as triangles facing the camera, applies
|
|
33
33
|
displacement maps, and runs vertex shaders. A plain mesh, with no vertex shader and no displacement, takes a faster
|
|
34
|
-
path that transforms each vertex once into typed arrays and writes exactly what the general one would.
|
|
34
|
+
path that transforms each vertex once into typed arrays and writes exactly what the general one would. Packing is a
|
|
35
|
+
generator: `packGeometry` runs it at once, `packGeometrySliced` hands the page its thread back every few
|
|
36
|
+
milliseconds, which is what the renderer uses.
|
|
37
|
+
- `instancing.ts`: repeated geometry kept once, and the tree over the instances (see below).
|
|
35
38
|
- `bvhBuilder.ts`, `bvhWorker.ts`: the BVH built in a Web Worker from a copy of the positions, for scenes of at least
|
|
36
39
|
`BVH_WORKER_MIN_TRIANGLES`; on the main thread below that, when `bvhWorker` is false, or for good once the worker
|
|
37
40
|
fails to start or load.
|
|
@@ -58,18 +61,51 @@ later rewrites the scheduler, not the BRDFs. The signal to revisit: a kernel pas
|
|
|
58
61
|
falling off a cliff when a lobe is added.
|
|
59
62
|
|
|
60
63
|
**Arrays of the same kind share a binding.** A WebGPU device only has to offer eight storage buffers per shader stage,
|
|
61
|
-
and the kernel wants
|
|
62
|
-
hierarchy's triangle order (both ways)
|
|
63
|
-
|
|
64
|
+
and the kernel wants more arrays than that. The UV sets and the vertex colours go in one buffer; every word that is an
|
|
65
|
+
index in another: the per-triangle material indices, the hierarchy's triangle order (both ways), the instance of each
|
|
66
|
+
instanced triangle, the three vertices of each triangle and the vertices' folded normals, which are bit patterns that a
|
|
67
|
+
float buffer could flush or canonicalize on some drivers. The lookup tables and the texture table sit in front of the
|
|
68
|
+
texels they point at, with the uniform saying where each part begins. The positions are uploaded in the
|
|
64
69
|
hierarchy's leaf order, so a leaf is one run of the buffer; anything that reads a triangle by its own number goes through
|
|
65
70
|
the inverse order. Positions, materials, nodes, lights and the accumulation buffer keep their own.
|
|
66
71
|
Merging costs a scene some headroom against `maxStorageBufferBindingSize`, which is why positions stay separate: they are
|
|
67
72
|
the largest array and the hottest one.
|
|
68
73
|
|
|
74
|
+
**The traversal reads triangles, shading reads vertices.** Positions stay nine floats a triangle in leaf order, so a
|
|
75
|
+
leaf is one run of the buffer and the hottest loop of the kernel has no indirection. Everything else a hit reads
|
|
76
|
+
(normals, UVs, colours) is read once per hit, so it is kept per vertex, and each triangle names its three vertices: a
|
|
77
|
+
smooth mesh shares almost every vertex between six triangles, and the attributes shrink to about a sixth. A normal is
|
|
78
|
+
folded onto an octahedron in two signed 16 bit halves, within a hundredth of a degree. UVs stay 32 bit floats: a tiled
|
|
79
|
+
texture's coordinates run into the tens, where half floats would be off by whole texels.
|
|
80
|
+
|
|
81
|
+
**Repeated geometry is kept once.** A mesh whose triangles another mesh repeats exactly (positions, normals, UVs,
|
|
82
|
+
colours, index and groups, compared by a hash of their contents) becomes an instance of one prototype, stored in object
|
|
83
|
+
space with a hierarchy of its own; each copy keeps its transform and the material of each of its triangles, so copies
|
|
84
|
+
may differ in material. A tree over the instances' boxes sits beside the scene's own under node zero, and a leaf of it
|
|
85
|
+
(count -1) links to an instance: the traversal takes the ray into the instance's space and goes on in its prototype's
|
|
86
|
+
hierarchy, with a marker on the stack that brings it back. The distance along the ray is the same in both spaces, since
|
|
87
|
+
the direction is transformed and not normalized. A hit names a triangle as before, numbered after the scene's own, so
|
|
88
|
+
every reader keeps its `triangle` argument and resolves it once: `instanceOf`, then the stored triangle it repeats.
|
|
89
|
+
|
|
90
|
+
- **What stays flat.** Lights, windows, volumes and grass are found on the CPU among the scene's own triangles, and a
|
|
91
|
+
shader, an object space normal map or a displacement map is tied to one mesh; points, lines, sprites and vertex
|
|
92
|
+
shaders depend on the camera. A mirrored transform, a projective one, or a mesh of fewer than 256 triangles is copied
|
|
93
|
+
as well, the last because entering an instance costs more than its triangles.
|
|
94
|
+
- **Compiled in only where a scene has them**, as `INSTANCES`, which also doubles the traversal stack: the instances'
|
|
95
|
+
tree is split at the median, so its depth is the logarithm of their count, and a prototype's is capped as the scene's
|
|
96
|
+
is. Planar captures trace with the kernel the main scene was compiled with, so they pack instances only when it does.
|
|
97
|
+
- `InstancedMesh`, which the snapshot expands to one mesh per instance sharing the same arrays, becomes instances again
|
|
98
|
+
here.
|
|
99
|
+
|
|
69
100
|
**Textures in a storage buffer, sampled by hand.** Core WebGPU has no binding arrays, and `texture_2d_array` demands one
|
|
70
101
|
size and one format for every layer, which the scene snapshot does not provide (arbitrary sizes, per texture wrap and UV
|
|
71
|
-
matrix, authored mipmaps).
|
|
72
|
-
|
|
102
|
+
matrix, authored mipmaps). The buffer is written to the device a piece at a time, each texture straight from the
|
|
103
|
+
snapshot, so the page never assembles a copy of every texel only to hand it over. A byte texture read through one channel
|
|
104
|
+
alone, which is what every reference to it being a map slot that reads that channel means (a roughness or a bump map),
|
|
105
|
+
keeps that channel, four texels to a word, and the shader hands it back in every channel; one named anywhere else, by a
|
|
106
|
+
light, a shader's uniforms or a planar capture, keeps all four. Compute shaders have no implicit
|
|
107
|
+
derivatives either, so the level of detail is computed by hand regardless and half of a hardware sampler's advantage
|
|
108
|
+
disappears. A fast path can add `texture_2d_array` later, for
|
|
73
109
|
scenes where every texture happens to be uniform.
|
|
74
110
|
|
|
75
111
|
**WGSL lives in `src/wgsl/*.wgsl.ts`, as template literals.** The build is plain `tsc`, and `tsc` does not copy `.wgsl`
|
|
@@ -244,8 +280,9 @@ this table is the only way to know.
|
|
|
244
280
|
|
|
245
281
|
| Works | Notes |
|
|
246
282
|
| --- | --- |
|
|
247
|
-
| Triangle meshes, transformed to world space | Every triangle carries its own three
|
|
248
|
-
|
|
|
283
|
+
| Triangle meshes, transformed to world space | Every triangle carries its own three positions; shading attributes are per vertex |
|
|
284
|
+
| Repeated meshes | Kept once, as instances of a prototype, when nothing about them is read triangle by triangle |
|
|
285
|
+
| `InstancedMesh`, with `instanceColor` | The scene snapshot expands it to one mesh per instance; those become instances again |
|
|
249
286
|
| `SkinnedMesh`, morph targets | The snapshot bakes the deformed positions |
|
|
250
287
|
| Per-group materials, indexed or not, `drawRange` | |
|
|
251
288
|
| Vertex normals, or a face normal when absent; `flatShading` | |
|
|
@@ -418,7 +455,8 @@ packing, buffer layouts and alignment, the scheduler's feedback loop, and the up
|
|
|
418
455
|
renderer. `kernel.test.ts` validates the whole kernel with naga, with translated shaders of every kind in it, so a WGSL
|
|
419
456
|
mistake fails in CI rather than on a device. The hierarchy is checked against
|
|
420
457
|
brute force over every triangle, with a traversal in the test file that mirrors the WGSL one step for step, so a packing
|
|
421
|
-
mistake fails here instead of on a device where nothing can be printed.
|
|
458
|
+
mistake fails here instead of on a device where nothing can be printed. Instances are checked the same way, over the
|
|
459
|
+
very buffers `uploadScene` writes, against the same scene packed flat.
|
|
422
460
|
|
|
423
461
|
GPU suites are named `*.gpu.test.ts` and skip themselves when no adapter is available. They exist to catch WGSL that does
|
|
424
462
|
not compile, which is the most common and most tedious error to find in a browser.
|
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ It is the GPU sibling of [@tinypoly/cpu-renderer](https://github.com/tinypoly/cp
|
|
|
21
21
|
- What a photograph adds, on by default: subsurface scattering, volumes of fog and smoke, aerial perspective, a lens's bloom, aperture rays, chromatic aberration and distortion, a camera's white balance and exposure triangle.
|
|
22
22
|
- Adaptive sampling: pixels whose noise is gone stop taking paths, and the work they leave goes to the dark, glossy and out of focus areas that still need it.
|
|
23
23
|
- Intel's Open Image Denoise on the device, by default, and a variance-guided denoiser (the spatial filter of SVGF, with diffuse and specular light filtered apart as NVIDIA's RELAX does): each signal is separated from its albedo, filtered by an edge-avoiding wavelet that stops at normals, depths and roughness and trusts each pixel as far as its own variance says, and multiplied back, so textures stay sharp, a sharp reflection stays sharp and flat areas keep their exact mean.
|
|
24
|
+
- Large scenes held lightly: a mesh repeated across the scene is kept once and traced as instances, shading attributes are shared per vertex, and a texture read through one channel only (roughness, bump) takes one byte a texel. Packing hands the page its thread back as it goes, and a lost device is acquired again on the next frame.
|
|
24
25
|
- Progressive output: the canvas refines sample by sample, and the render can be paused, resumed and cancelled.
|
|
25
26
|
- No worker pool and no `SharedArrayBuffer`: the scene lives on the device, so the page needs no cross-origin isolation. A single worker builds the BVH of a large scene, so the page keeps responding while it is prepared.
|
|
26
27
|
|
|
@@ -296,6 +297,7 @@ haze.material.userData.cpuRenderer = { volume: { density: 0.05, color: "#ffffff"
|
|
|
296
297
|
| `createDefaultBvhWorker()` | The BVH worker this package ships, started from `new URL("./bvhWorker.js", import.meta.url)`. |
|
|
297
298
|
| `respondToBvhRequest(request)` | The worker's side of the exchange, for a worker of your own: returns the response and the buffers to transfer. |
|
|
298
299
|
| `packGeometry`, `buildBvh`, `packLights`, `packTextures`, `sceneByteLength` | The scene packing, published because the sizes it produces are what a host checks against a device's limits before uploading. |
|
|
300
|
+
| `setMemoryLogging(on)`, `deviceMemory()` | Off by default. When on, each step of a frame logs what the device holds by buffer label, the page's JavaScript heap where the browser tells, and the sizes the step produced: the snapshot, repeated geometry kept as instances, the textures and which channels of each are read, and the slowest meshes to pack. `deviceMemory()` answers the same at any time. |
|
|
299
301
|
|
|
300
302
|
## Bundlers
|
|
301
303
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accumulator.d.ts","sourceRoot":"","sources":["../src/accumulator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,qBAAa,WAAW;IAKV,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;gBAEc,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAM7E,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,+CAA+C;IAC/C,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,wFAAwF;IACxF,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAa9C,KAAK,CAAC,OAAO,EAAE,iBAAiB;IAIhC,OAAO;IAIP,OAAO,CAAC,MAAM;
|
|
1
|
+
{"version":3,"file":"accumulator.d.ts","sourceRoot":"","sources":["../src/accumulator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,qBAAa,WAAW;IAKV,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,MAAM,EAAE,SAAS,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;gBAEc,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAM7E,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,+CAA+C;IAC/C,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED,wFAAwF;IACxF,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO;IAa9C,KAAK,CAAC,OAAO,EAAE,iBAAiB;IAIhC,OAAO;IAIP,OAAO,CAAC,MAAM;CAQf"}
|
package/dist/accumulator.js
CHANGED
|
@@ -48,6 +48,7 @@ export class Accumulator {
|
|
|
48
48
|
}
|
|
49
49
|
create() {
|
|
50
50
|
return this.device.createBuffer({
|
|
51
|
+
label: "accumulation",
|
|
51
52
|
size: this.byteLength,
|
|
52
53
|
// clearBuffer is a copy into the buffer: without COPY_DST it fails validation and clears nothing.
|
|
53
54
|
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST,
|
package/dist/accumulator.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accumulator.js","sourceRoot":"","sources":["../src/accumulator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,OAAO,WAAW;IAKO;IAJ7B,MAAM,CAAY;IAClB,KAAK,CAAS;IACd,MAAM,CAAS;IAEf,YAA6B,MAAiB,EAAE,KAAa,EAAE,MAAc;QAAhD,WAAM,GAAN,MAAM,CAAW;QAC5C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAC9C,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;IAC9B,CAAC;IAED,IAAI,UAAU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AAC,EAAE,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;QAEhG,IAAI,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QAE3E,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QAE5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,KAAK,CAAC,OAA0B;QAC9B,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC;IAED,OAAO;QACL,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;IAEO,MAAM;QACZ,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC;YAC9B,KAAK,EAAE,cAAc;YACrB,IAAI,EAAE,IAAI,CAAC,UAAU;YACrB,kGAAkG;YAClG,KAAK,EAAE,cAAc,CAAC,OAAO,GAAG,cAAc,CAAC,QAAQ,GAAG,cAAc,CAAC,QAAQ;SAClF,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/denoise.js
CHANGED
|
@@ -441,8 +441,8 @@ export class DenoisePass {
|
|
|
441
441
|
for (const buffer of this.buffers)
|
|
442
442
|
buffer.destroy();
|
|
443
443
|
const size = Math.max(16, width * height * 16);
|
|
444
|
-
this.buffers = Array.from({ length: 6 }, () => this.device.createBuffer({ size, usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC }));
|
|
445
|
-
this.buffers.push(this.device.createBuffer({ size: Math.max(16, width * height * 4), usage: GPUBufferUsage.STORAGE }));
|
|
444
|
+
this.buffers = Array.from({ length: 6 }, () => this.device.createBuffer({ label: "svgf", size, usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC }));
|
|
445
|
+
this.buffers.push(this.device.createBuffer({ label: "svgf", size: Math.max(16, width * height * 4), usage: GPUBufferUsage.STORAGE }));
|
|
446
446
|
this.output = this.buffers[4];
|
|
447
447
|
this.groups.clear();
|
|
448
448
|
this.width = width;
|
package/dist/denoise.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"denoise.js","sourceRoot":"","sources":["../src/denoise.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAuCvD,MAAM,CAAC,MAAM,gBAAgB,GAA+B,MAAM,CAAC,MAAM,CAAC;IACxE,SAAS,EAAE,MAAM;IACjB,WAAW,EAAE,EAAE;IACf,QAAQ,EAAE,CAAC;IACX,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,CAAC;CAChB,CAAC,CAAC;AAEH,mEAAmE;AACnE,MAAM,UAAU,aAAa,CAAC,IAAsB,EAAE,QAAmC,EAAE;IACzF,MAAM,MAAM,GAAG,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,EAAE,CAAC;IAEpH,OAAO;QACL,SAAS,EAAE,MAAM,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM;QACxD,WAAW,EAAE,OAAO,MAAM,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC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;IACnE,CAAC;IAED,OAAO;QACL,KAAK,MAAM,MAAM,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;YAAE,MAAM,CAAC,OAAO,EAAE,CAAC;QAEzE,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;IACrB,CAAC;CACF"}
|
package/dist/device.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../src/device.ts"],"names":[],"mappings":"AAAA,8FAA8F;
|
|
1
|
+
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../src/device.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAI9F,yFAAyF;AACzF,MAAM,WAAW,aAAa;IAC5B,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,SAAS,CAAC;IAClB,kGAAkG;IAClG,2BAA2B,EAAE,MAAM,CAAC;IACpC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,2GAA2G;IAC3G,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,aAAa,CAAC,CAanE;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,YAAY,CAAC,CA2ClG"}
|
package/dist/device.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** Acquiring a device, and the questions a host asks before choosing this renderer at all. */
|
|
2
|
+
import { logMemory, toMB, trackDevice } from "./memoryProbe.js";
|
|
2
3
|
/**
|
|
3
4
|
* Whether this context exposes WebGPU at all. It is a cheap, synchronous check for a fallback decision;
|
|
4
5
|
* it does not prove that an adapter exists, which only `requestWebGpuSupport` can tell.
|
|
@@ -49,7 +50,15 @@ export async function requestRenderDevice(options = {}) {
|
|
|
49
50
|
maxComputeInvocationsPerWorkgroup: adapter.limits.maxComputeInvocationsPerWorkgroup,
|
|
50
51
|
},
|
|
51
52
|
});
|
|
53
|
+
trackDevice(device);
|
|
52
54
|
void device.lost.then(info => options.onLost?.(info.message || String(info.reason)));
|
|
55
|
+
const info = adapter.info;
|
|
56
|
+
logMemory("device acquired", {
|
|
57
|
+
adapter: info ? `${info.vendor} ${info.architecture} ${info.device} ${info.description}`.trim() : "unknown",
|
|
58
|
+
maxBufferMB: toMB(device.limits.maxBufferSize),
|
|
59
|
+
maxStorageBindingMB: toMB(device.limits.maxStorageBufferBindingSize),
|
|
60
|
+
shaderF16: requiredFeatures.length > 0,
|
|
61
|
+
});
|
|
53
62
|
return {
|
|
54
63
|
adapter,
|
|
55
64
|
device,
|
package/dist/device.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","sourceRoot":"","sources":["../src/device.ts"],"names":[],"mappings":"AAAA,8FAA8F;
|
|
1
|
+
{"version":3,"file":"device.js","sourceRoot":"","sources":["../src/device.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAE9F,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAuBhE;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,OAAO,SAAS,KAAK,WAAW,IAAI,KAAK,IAAI,SAAS,IAAI,SAAS,CAAC,GAAG,IAAI,IAAI,CAAC;AACzF,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,oB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AAM,YAAY,
|
|
1
|
+
{"version":3,"file":"frameLayout.d.ts","sourceRoot":"","sources":["../src/frameLayout.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,eAAO,MAAM,YAAY,0CAmFvB,CAAC;AAEH,eAAO,MAAM,WAAW,QAAqB,CAAC"}
|
package/dist/frameLayout.js
CHANGED
|
@@ -48,6 +48,11 @@ export const FRAME_LAYOUT = layoutStruct("Frame", [
|
|
|
48
48
|
{ name: "colorOffset", type: "u32", doc: "Where vertex colours start inside the attribute buffer." },
|
|
49
49
|
{ name: "hasColors", type: "u32" },
|
|
50
50
|
{ name: "varyingOffset", type: "u32", doc: "Where shader varyings start inside the attribute buffer." },
|
|
51
|
+
{ name: "sceneTriangles", type: "u32", doc: "Triangles of the scene's own; the instances' are numbered after them." },
|
|
52
|
+
{ name: "instanceOffset", type: "u32", doc: "Where the instance of every instanced triangle starts inside the index buffer." },
|
|
53
|
+
{ name: "cornerOffset", type: "u32", doc: "Where the three vertices of every stored triangle start inside the index buffer." },
|
|
54
|
+
{ name: "normalOffset", type: "u32", doc: "Where the vertices' folded normals start inside the index buffer." },
|
|
55
|
+
{ name: "instanceData", type: "u32", doc: "Where the instances' transforms start in the texture buffer." },
|
|
51
56
|
{ name: "environmentTexture", type: "u32", doc: "The surrounding image, or NO_TEXTURE for the gradient." },
|
|
52
57
|
{ name: "environmentCdf", type: "u32" },
|
|
53
58
|
{ name: "environmentCdfSize", type: "vec2u" },
|
package/dist/frameLayout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameLayout.js","sourceRoot":"","sources":["../src/frameLayout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,EAAE;IAChD,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE;IACxC,EAAE,IAA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EAAE;IAChI,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,+DAA+D,EAAE;IAC9G,EAAE,IAAI,EAAE,oBAAoB,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,yDAAyD,EAAE;IAC7G,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,mGAAmG,EAAE;IAC9I,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,6DAA6D,EAAE;IACzG,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,+FAA+F,EAAE;CAC3I,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,WAAW,GAAG,YAAY,CAAC,KAAK,CAAC"}
|
package/dist/geometry.d.ts
CHANGED
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
import { type CameraMatrices } from "./camera.js";
|
|
2
2
|
import { NO_PROGRAM, type MaterialPlacement, type MaterialProperties } from "./materialLayout.js";
|
|
3
|
+
import { type PackedInstancing } from "./instancing.js";
|
|
3
4
|
import type { ShaderPrograms } from "./shaderProgram.js";
|
|
4
5
|
import type { SerializedMesh, SerializedScene, SerializedTexture, UniformValue } from "./upstream.js";
|
|
5
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* The GPU ready form of a scene's triangles. Positions are nine coordinates per triangle, world space, which is what the
|
|
8
|
+
* traversal reads; everything shading reads is kept per vertex, and each triangle names its three vertices. Geometry the
|
|
9
|
+
* scene repeats is kept once, in `instancing`.
|
|
10
|
+
*/
|
|
6
11
|
export interface PackedGeometry {
|
|
7
|
-
/** Nine coordinates per triangle. */
|
|
12
|
+
/** Nine coordinates per triangle of the scene's own, world space. */
|
|
8
13
|
positions: Float32Array;
|
|
9
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Three vertex numbers per stored triangle: the scene's own first, then every prototype's (see `instancing`), in the
|
|
16
|
+
* order the stored triangles are numbered.
|
|
17
|
+
*/
|
|
18
|
+
corners: Uint32Array;
|
|
19
|
+
/** Three normal components per vertex; zero where the mesh authored a zero normal. */
|
|
10
20
|
normals: Float32Array;
|
|
11
|
-
/**
|
|
21
|
+
/** Four per vertex: two UV sets, which is what Three's map channels need. */
|
|
12
22
|
uvs: Float32Array;
|
|
13
|
-
/**
|
|
23
|
+
/** Four per vertex, RGBA, when any material reads vertex colours; empty otherwise. */
|
|
14
24
|
colors: Float32Array;
|
|
25
|
+
vertexCount: number;
|
|
15
26
|
/** Shader varyings, three corners per triangle of a shader material, laid out as each program asks. */
|
|
16
27
|
varyings: Float32Array;
|
|
17
|
-
/** One material index per triangle. */
|
|
28
|
+
/** One material index per triangle of the scene's own. */
|
|
18
29
|
materials: Uint32Array;
|
|
30
|
+
/** Triangles of the scene's own: what lights, windows, volumes and grass are found among. */
|
|
19
31
|
triangleCount: number;
|
|
32
|
+
/** Repeated geometry, kept once with a transform per copy; null when nothing repeats. */
|
|
33
|
+
instancing: PackedInstancing | null;
|
|
20
34
|
/** Four floats per material: linear rgb and opacity. */
|
|
21
35
|
materialColors: Float32Array;
|
|
22
36
|
/** Four floats per material: linear emissive rgb and its intensity. */
|
|
@@ -34,6 +48,14 @@ export interface PackedGeometry {
|
|
|
34
48
|
*/
|
|
35
49
|
cameraDependent: boolean;
|
|
36
50
|
}
|
|
51
|
+
/** How one mesh was packed, for a host measuring where the time goes. */
|
|
52
|
+
export interface MeshPacked {
|
|
53
|
+
/** Its index among the scene's meshes. */
|
|
54
|
+
mesh: number;
|
|
55
|
+
path: "plain" | "general" | "instance" | "prototype";
|
|
56
|
+
triangles: number;
|
|
57
|
+
ms: number;
|
|
58
|
+
}
|
|
37
59
|
export interface PackOptions {
|
|
38
60
|
/** The index in the texture table of each texture, by id. */
|
|
39
61
|
textures?: ReadonlyMap<string, number>;
|
|
@@ -49,18 +71,36 @@ export interface PackOptions {
|
|
|
49
71
|
extraBase?: number;
|
|
50
72
|
/** Scene fog, which a shader's fog uniforms read. */
|
|
51
73
|
fog?: SerializedScene["fog"];
|
|
74
|
+
/** Whether repeated geometry may become instances. On by default. */
|
|
75
|
+
instancing?: boolean;
|
|
76
|
+
/** Told about every mesh once it is packed. */
|
|
77
|
+
onMesh?: (info: MeshPacked) => void;
|
|
52
78
|
}
|
|
53
79
|
/** The uniforms Three sets on every shader for this camera and mesh. */
|
|
54
80
|
export declare function builtinUniforms(camera: CameraMatrices | undefined, matrixWorld: readonly number[], fog?: SerializedScene["fog"]): Record<string, UniformValue>;
|
|
55
81
|
/**
|
|
56
82
|
* Flattens the scene into triangles, materials resolved and transforms applied. Every triangle carries its own three
|
|
57
|
-
*
|
|
58
|
-
*
|
|
83
|
+
* positions: the traversal reads them straight off the buffer, and sharing them would cost an indirection on the
|
|
84
|
+
* hottest path of the kernel. What shading reads (normals, UVs, colours) is kept per vertex instead, since it is read
|
|
85
|
+
* once a hit, and a mesh that repeats becomes instances of one prototype (see `instancing.ts`).
|
|
59
86
|
*
|
|
60
87
|
* Points, lines and sprites become triangles that face the camera, sized the way Three draws them, so a path has a
|
|
61
88
|
* surface to find; vertex shaders run here, on the CPU renderer's interpreter, and their varyings ride along per corner.
|
|
62
89
|
*/
|
|
63
90
|
export declare function packGeometry(scene: SerializedScene, options?: PackOptions | ReadonlyMap<string, number>): PackedGeometry;
|
|
91
|
+
/**
|
|
92
|
+
* The same packing, handing the thread back between slices: `pause` is awaited whenever the work has held the thread
|
|
93
|
+
* for `sliceMs`, so a large scene does not freeze the page while it packs.
|
|
94
|
+
*/
|
|
95
|
+
export declare function packGeometrySliced(scene: SerializedScene, options: PackOptions, pause: () => Promise<void>, sliceMs?: number): Promise<PackedGeometry>;
|
|
96
|
+
/** The three vertex numbers of a stored triangle. */
|
|
97
|
+
export declare function triangleVertices(geometry: PackedGeometry, triangle: number): [number, number, number];
|
|
98
|
+
/** The normal at one corner of a stored triangle. */
|
|
99
|
+
export declare function cornerNormal(geometry: PackedGeometry, triangle: number, corner: number): number[];
|
|
100
|
+
/** The two UV sets at one corner of a stored triangle, four numbers. */
|
|
101
|
+
export declare function cornerUvs(geometry: PackedGeometry, triangle: number, corner: number): number[];
|
|
102
|
+
/** The colour at one corner of a stored triangle, RGBA, or empty when the scene has no vertex colours. */
|
|
103
|
+
export declare function cornerColor(geometry: PackedGeometry, triangle: number, corner: number): number[];
|
|
64
104
|
/**
|
|
65
105
|
* The attributes of an instanced geometry, which the snapshot keeps as plain attributes with one element per instance
|
|
66
106
|
* rather than per vertex, and how many instances there are.
|
package/dist/geometry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../src/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,
|
|
1
|
+
{"version":3,"file":"geometry.d.ts","sourceRoot":"","sources":["../src/geometry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AACxF,OAAO,EAOL,UAAU,EACV,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAOL,KAAK,gBAAgB,EAEtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,OAAO,KAAK,EAAsB,cAAc,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE1H;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,SAAS,EAAE,YAAY,CAAC;IACxB;;;OAGG;IACH,OAAO,EAAE,WAAW,CAAC;IACrB,sFAAsF;IACtF,OAAO,EAAE,YAAY,CAAC;IACtB,6EAA6E;IAC7E,GAAG,EAAE,YAAY,CAAC;IAClB,sFAAsF;IACtF,MAAM,EAAE,Y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