@pmndrs/vdb 0.1.0 → 0.2.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/CHANGELOG.md +592 -2
- package/README.md +85 -37
- package/THIRD_PARTY_NOTICES.md +197 -29
- package/dist/core/compute/atlas.d.ts +10 -2
- package/dist/core/compute/atlas.js +6 -1
- package/dist/core/compute/atlas.js.map +1 -1
- package/dist/core/compute/index.d.ts +3 -3
- package/dist/core/compute/index.js +2 -2
- package/dist/core/compute/index.js.map +1 -1
- package/dist/core/compute/majorant-build.d.ts +45 -0
- package/dist/core/compute/majorant-build.js +193 -0
- package/dist/core/compute/majorant-build.js.map +1 -0
- package/dist/core/compute/multi-scale.d.ts +155 -0
- package/dist/core/compute/multi-scale.js +684 -0
- package/dist/core/compute/multi-scale.js.map +1 -0
- package/dist/core/compute/pyramid.d.ts +22 -7
- package/dist/core/compute/pyramid.js +22 -9
- package/dist/core/compute/pyramid.js.map +1 -1
- package/dist/core/compute/shared.d.ts +1 -0
- package/dist/core/compute/shared.js.map +1 -1
- package/dist/core/compute/stats.d.ts +10 -3
- package/dist/core/compute/stats.js +6 -1
- package/dist/core/compute/stats.js.map +1 -1
- package/dist/core/compute/value-transform.d.ts +8 -1
- package/dist/core/compute/value-transform.js +9 -3
- package/dist/core/compute/value-transform.js.map +1 -1
- package/dist/core/errors.d.ts +10 -0
- package/dist/core/errors.js +8 -0
- package/dist/core/errors.js.map +1 -1
- package/dist/core/frame/emission.d.ts +85 -0
- package/dist/core/frame/emission.js +422 -0
- package/dist/core/frame/emission.js.map +1 -0
- package/dist/core/frame/environment.d.ts +47 -0
- package/dist/core/frame/environment.js +178 -0
- package/dist/core/frame/environment.js.map +1 -0
- package/dist/core/frame/index.d.ts +39 -0
- package/dist/core/frame/index.js +27 -0
- package/dist/core/frame/index.js.map +1 -0
- package/dist/core/frame/kernels.d.ts +115 -0
- package/dist/core/frame/kernels.js +496 -0
- package/dist/core/frame/kernels.js.map +1 -0
- package/dist/core/frame/limits.d.ts +67 -0
- package/dist/core/frame/limits.js +109 -0
- package/dist/core/frame/limits.js.map +1 -0
- package/dist/core/frame/phase.d.ts +17 -0
- package/dist/core/frame/phase.js +53 -0
- package/dist/core/frame/phase.js.map +1 -0
- package/dist/core/frame/pipelines.d.ts +49 -0
- package/dist/core/frame/pipelines.js +147 -0
- package/dist/core/frame/pipelines.js.map +1 -0
- package/dist/core/frame/renderer.d.ts +122 -0
- package/dist/core/frame/renderer.js +1712 -0
- package/dist/core/frame/renderer.js.map +1 -0
- package/dist/core/frame/resources.d.ts +71 -0
- package/dist/core/frame/resources.js +100 -0
- package/dist/core/frame/resources.js.map +1 -0
- package/dist/core/frame/scattering.d.ts +97 -0
- package/dist/core/frame/scattering.js +332 -0
- package/dist/core/frame/scattering.js.map +1 -0
- package/dist/core/frame/settings.d.ts +243 -0
- package/dist/core/frame/settings.js +67 -0
- package/dist/core/frame/settings.js.map +1 -0
- package/dist/core/frame/shadows.d.ts +55 -0
- package/dist/core/frame/shadows.js +460 -0
- package/dist/core/frame/shadows.js.map +1 -0
- package/dist/core/frame/types.d.ts +415 -0
- package/dist/core/frame/types.js +49 -0
- package/dist/core/frame/types.js.map +1 -0
- package/dist/core/frame/uniforms.d.ts +105 -0
- package/dist/core/frame/uniforms.js +276 -0
- package/dist/core/frame/uniforms.js.map +1 -0
- package/dist/core/frame/wgsl/chunks.d.ts +4 -0
- package/dist/core/frame/wgsl/chunks.js +728 -0
- package/dist/core/frame/wgsl/chunks.js.map +1 -0
- package/dist/core/frame/wgsl/emission.d.ts +82 -0
- package/dist/core/frame/wgsl/emission.js +353 -0
- package/dist/core/frame/wgsl/emission.js.map +1 -0
- package/dist/core/frame/wgsl/environment.d.ts +42 -0
- package/dist/core/frame/wgsl/environment.js +711 -0
- package/dist/core/frame/wgsl/environment.js.map +1 -0
- package/dist/core/frame/wgsl/gather.d.ts +55 -0
- package/dist/core/frame/wgsl/gather.js +850 -0
- package/dist/core/frame/wgsl/gather.js.map +1 -0
- package/dist/core/frame/wgsl/integrate.d.ts +78 -0
- package/dist/core/frame/wgsl/integrate.js +213 -0
- package/dist/core/frame/wgsl/integrate.js.map +1 -0
- package/dist/core/frame/wgsl/lighting.d.ts +103 -0
- package/dist/core/frame/wgsl/lighting.js +1636 -0
- package/dist/core/frame/wgsl/lighting.js.map +1 -0
- package/dist/core/frame/wgsl/occluders.d.ts +20 -0
- package/dist/core/frame/wgsl/occluders.js +95 -0
- package/dist/core/frame/wgsl/occluders.js.map +1 -0
- package/dist/core/frame/wgsl/resolve.d.ts +19 -0
- package/dist/core/frame/wgsl/resolve.js +205 -0
- package/dist/core/frame/wgsl/resolve.js.map +1 -0
- package/dist/core/frame/wgsl/shadows.d.ts +35 -0
- package/dist/core/frame/wgsl/shadows.js +328 -0
- package/dist/core/frame/wgsl/shadows.js.map +1 -0
- package/dist/core/half.d.ts +11 -0
- package/dist/core/half.js +22 -0
- package/dist/core/half.js.map +1 -0
- package/dist/core/index.d.ts +25 -3
- package/dist/core/index.js +23 -4
- package/dist/core/index.js.map +1 -1
- package/dist/core/internal.d.ts +17 -1
- package/dist/core/internal.js +18 -1
- package/dist/core/internal.js.map +1 -1
- package/dist/core/pool/image-header.d.ts +13 -2
- package/dist/core/pool/image-header.js +24 -5
- package/dist/core/pool/image-header.js.map +1 -1
- package/dist/core/pool/layout.d.ts +35 -1
- package/dist/core/pool/layout.js +51 -2
- package/dist/core/pool/layout.js.map +1 -1
- package/dist/core/pool/limits.d.ts +1 -0
- package/dist/core/pool/limits.js +1 -0
- package/dist/core/pool/limits.js.map +1 -1
- package/dist/core/pool/pool.d.ts +120 -15
- package/dist/core/pool/pool.js +255 -24
- package/dist/core/pool/pool.js.map +1 -1
- package/dist/core/reference/index.d.ts +6 -0
- package/dist/core/reference/index.js +7 -0
- package/dist/core/reference/index.js.map +1 -0
- package/dist/core/reference/renderer.d.ts +105 -0
- package/dist/core/reference/renderer.js +474 -0
- package/dist/core/reference/renderer.js.map +1 -0
- package/dist/core/reference/wgsl.d.ts +65 -0
- package/dist/core/reference/wgsl.js +803 -0
- package/dist/core/reference/wgsl.js.map +1 -0
- package/dist/{three → core}/sequence.d.ts +32 -2
- package/dist/{three → core}/sequence.js +24 -2
- package/dist/core/sequence.js.map +1 -0
- package/dist/core/source/brick-cache.d.ts +165 -0
- package/dist/core/source/brick-cache.js +627 -0
- package/dist/core/source/brick-cache.js.map +1 -0
- package/dist/core/source/dense-fill.d.ts +53 -0
- package/dist/core/source/dense-fill.js +377 -0
- package/dist/core/source/dense-fill.js.map +1 -0
- package/dist/core/source/dense.d.ts +33 -2
- package/dist/core/source/dense.js +121 -24
- package/dist/core/source/dense.js.map +1 -1
- package/dist/core/source/sparse-wgsl.d.ts +92 -0
- package/dist/core/source/sparse-wgsl.js +481 -0
- package/dist/core/source/sparse-wgsl.js.map +1 -0
- package/dist/core/source/sparse.d.ts +192 -0
- package/dist/core/source/sparse.js +762 -0
- package/dist/core/source/sparse.js.map +1 -0
- package/dist/core/source/types.d.ts +59 -2
- package/dist/core/source/types.js.map +1 -1
- package/dist/core/surface/index.d.ts +10 -0
- package/dist/core/surface/index.js +9 -0
- package/dist/core/surface/index.js.map +1 -0
- package/dist/core/surface/level-set-pass.d.ts +140 -0
- package/dist/core/surface/level-set-pass.js +291 -0
- package/dist/core/surface/level-set-pass.js.map +1 -0
- package/dist/core/surface/level-set-wgsl.d.ts +46 -0
- package/dist/core/surface/level-set-wgsl.js +99 -0
- package/dist/core/surface/level-set-wgsl.js.map +1 -0
- package/dist/core/surface/points.d.ts +109 -0
- package/dist/core/surface/points.js +226 -0
- package/dist/core/surface/points.js.map +1 -0
- package/dist/core/types.d.ts +12 -3
- package/dist/core/types.js +6 -2
- package/dist/core/types.js.map +1 -1
- package/dist/core/wgsl/api.d.ts +29 -5
- package/dist/core/wgsl/api.js +110 -27
- package/dist/core/wgsl/api.js.map +1 -1
- package/dist/core/wgsl/generate.d.ts +8 -0
- package/dist/core/wgsl/generate.js +195 -22
- package/dist/core/wgsl/generate.js.map +1 -1
- package/dist/core/wgsl/lean.d.ts +50 -0
- package/dist/core/wgsl/lean.js +327 -0
- package/dist/core/wgsl/lean.js.map +1 -0
- package/dist/core/wgsl/level-set.d.ts +5 -1
- package/dist/core/wgsl/level-set.js +11 -5
- package/dist/core/wgsl/level-set.js.map +1 -1
- package/dist/core/wgsl/majorant.d.ts +62 -0
- package/dist/core/wgsl/majorant.js +381 -0
- package/dist/core/wgsl/majorant.js.map +1 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.d.ts +2 -2
- package/dist/core/wgsl/pnanovdb.chunks.generated.js +15 -12
- package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -1
- package/dist/core/wgsl/types.d.ts +97 -3
- package/dist/core/wgsl/types.js.map +1 -1
- package/dist/three/coarse-first.d.ts +53 -8
- package/dist/three/coarse-first.js +24 -6
- package/dist/three/coarse-first.js.map +1 -1
- package/dist/three/compute.d.ts +12 -2
- package/dist/three/compute.js +16 -6
- package/dist/three/compute.js.map +1 -1
- package/dist/three/device.d.ts +7 -0
- package/dist/three/device.js +3 -0
- package/dist/three/device.js.map +1 -1
- package/dist/three/frame/core-environment.d.ts +38 -0
- package/dist/three/frame/core-environment.js +154 -0
- package/dist/three/frame/core-environment.js.map +1 -0
- package/dist/three/frame/core-integrate-material.d.ts +34 -0
- package/dist/three/frame/core-integrate-material.js +162 -0
- package/dist/three/frame/core-integrate-material.js.map +1 -0
- package/dist/three/frame/core-occluders.d.ts +53 -0
- package/dist/three/frame/core-occluders.js +193 -0
- package/dist/three/frame/core-occluders.js.map +1 -0
- package/dist/three/frame/core-structs.d.ts +34 -0
- package/dist/three/frame/core-structs.js +61 -0
- package/dist/three/frame/core-structs.js.map +1 -0
- package/dist/three/frame/core-textures.d.ts +41 -0
- package/dist/three/frame/core-textures.js +114 -0
- package/dist/three/frame/core-textures.js.map +1 -0
- package/dist/three/frame/emission-light.d.ts +64 -114
- package/dist/three/frame/emission-light.js +188 -567
- package/dist/three/frame/emission-light.js.map +1 -1
- package/dist/three/frame/index.d.ts +11 -31
- package/dist/three/frame/index.js +9 -29
- package/dist/three/frame/index.js.map +1 -1
- package/dist/three/frame/medium.d.ts +12 -0
- package/dist/three/frame/medium.js.map +1 -1
- package/dist/three/frame/renderer.d.ts +58 -454
- package/dist/three/frame/renderer.js +409 -1427
- package/dist/three/frame/renderer.js.map +1 -1
- package/dist/three/frame/spectrum.d.ts +0 -14
- package/dist/three/frame/spectrum.js +2 -23
- package/dist/three/frame/spectrum.js.map +1 -1
- package/dist/three/frame/three-internals.d.ts +3 -8
- package/dist/three/frame/three-internals.js +13 -11
- package/dist/three/frame/three-internals.js.map +1 -1
- package/dist/three/frame/volume-shadows.d.ts +93 -107
- package/dist/three/frame/volume-shadows.js +278 -631
- package/dist/three/frame/volume-shadows.js.map +1 -1
- package/dist/three/frame/volume.d.ts +91 -33
- package/dist/three/frame/volume.js +63 -51
- package/dist/three/frame/volume.js.map +1 -1
- package/dist/three/grid-node.d.ts +34 -1
- package/dist/three/grid-node.js +36 -1
- package/dist/three/grid-node.js.map +1 -1
- package/dist/three/index.d.ts +20 -11
- package/dist/three/index.js +21 -12
- package/dist/three/index.js.map +1 -1
- package/dist/three/internal.d.ts +14 -8
- package/dist/three/internal.js +11 -7
- package/dist/three/internal.js.map +1 -1
- package/dist/three/level-set-material.d.ts +81 -8
- package/dist/three/level-set-material.js +162 -125
- package/dist/three/level-set-material.js.map +1 -1
- package/dist/three/level-set-physical-material.d.ts +154 -0
- package/dist/three/level-set-physical-material.js +253 -0
- package/dist/three/level-set-physical-material.js.map +1 -0
- package/dist/three/level-set-velocity.d.ts +94 -0
- package/dist/three/level-set-velocity.js +208 -0
- package/dist/three/level-set-velocity.js.map +1 -0
- package/dist/three/material.d.ts +141 -11
- package/dist/three/material.js +161 -18
- package/dist/three/material.js.map +1 -1
- package/dist/three/points.d.ts +60 -4
- package/dist/three/points.js +140 -9
- package/dist/three/points.js.map +1 -1
- package/dist/three/sparse-source.d.ts +49 -117
- package/dist/three/sparse-source.js +109 -580
- package/dist/three/sparse-source.js.map +1 -1
- package/dist/three/volume-source.d.ts +11 -156
- package/dist/three/volume-source.js +29 -272
- package/dist/three/volume-source.js.map +1 -1
- package/dist/tools/cpu/brick-atlas.d.ts +36 -0
- package/dist/tools/cpu/brick-atlas.js +129 -0
- package/dist/tools/cpu/brick-atlas.js.map +1 -0
- package/dist/tools/cpu/compute.d.ts +23 -4
- package/dist/tools/cpu/compute.js +35 -14
- package/dist/tools/cpu/compute.js.map +1 -1
- package/dist/tools/cpu/lean-reads.d.ts +81 -0
- package/dist/tools/cpu/lean-reads.js +262 -0
- package/dist/tools/cpu/lean-reads.js.map +1 -0
- package/dist/tools/cpu/level-set.d.ts +42 -3
- package/dist/tools/cpu/level-set.js +59 -7
- package/dist/tools/cpu/level-set.js.map +1 -1
- package/dist/tools/cpu/majorant.d.ts +265 -0
- package/dist/tools/cpu/majorant.js +541 -0
- package/dist/tools/cpu/majorant.js.map +1 -0
- package/dist/tools/cpu/march.d.ts +93 -2
- package/dist/tools/cpu/march.js +165 -14
- package/dist/tools/cpu/march.js.map +1 -1
- package/dist/tools/cpu/mesh-decimate.d.ts +124 -0
- package/dist/tools/cpu/mesh-decimate.js +1225 -0
- package/dist/tools/cpu/mesh-decimate.js.map +1 -0
- package/dist/tools/cpu/points.d.ts +29 -0
- package/dist/tools/cpu/points.js +38 -0
- package/dist/tools/cpu/points.js.map +1 -0
- package/dist/tools/cpu/read-value.d.ts +19 -6
- package/dist/tools/cpu/read-value.js +32 -17
- package/dist/tools/cpu/read-value.js.map +1 -1
- package/dist/tools/cpu/sample-trilinear.d.ts +17 -4
- package/dist/tools/cpu/sample-trilinear.js +19 -7
- package/dist/tools/cpu/sample-trilinear.js.map +1 -1
- package/dist/tools/cpu/stride-tables.d.ts +2 -2
- package/dist/tools/cpu/stride-tables.generated.d.ts +6 -5
- package/dist/tools/cpu/stride-tables.generated.js +7 -6
- package/dist/tools/cpu/stride-tables.generated.js.map +1 -1
- package/dist/tools/cpu/stride-tables.js +1 -1
- package/dist/tools/cpu/stride-tables.js.map +1 -1
- package/dist/tools/cpu/surface-nets.d.ts +90 -0
- package/dist/tools/cpu/surface-nets.js +597 -0
- package/dist/tools/cpu/surface-nets.js.map +1 -0
- package/dist/tools/errors.d.ts +9 -0
- package/dist/tools/errors.js +9 -0
- package/dist/tools/errors.js.map +1 -1
- package/dist/tools/frame/ambient.d.ts +98 -0
- package/dist/tools/frame/ambient.js +274 -0
- package/dist/tools/frame/ambient.js.map +1 -0
- package/dist/tools/frame/blackbody.d.ts +15 -0
- package/dist/tools/frame/blackbody.js +35 -0
- package/dist/tools/frame/blackbody.js.map +1 -1
- package/dist/tools/frame/brick-cache.d.ts +165 -0
- package/dist/tools/frame/brick-cache.js +326 -0
- package/dist/tools/frame/brick-cache.js.map +1 -0
- package/dist/tools/frame/emission.d.ts +9 -0
- package/dist/tools/frame/emission.js +9 -1
- package/dist/tools/frame/emission.js.map +1 -1
- package/dist/tools/frame/environment-gpu.d.ts +111 -0
- package/dist/tools/frame/environment-gpu.js +280 -0
- package/dist/tools/frame/environment-gpu.js.map +1 -0
- package/dist/tools/frame/environment.d.ts +3 -2
- package/dist/tools/frame/environment.js +8 -4
- package/dist/tools/frame/environment.js.map +1 -1
- package/dist/tools/frame/froxel.d.ts +58 -0
- package/dist/tools/frame/froxel.js +115 -0
- package/dist/tools/frame/froxel.js.map +1 -0
- package/dist/tools/frame/grid.d.ts +90 -0
- package/dist/tools/frame/grid.js +112 -13
- package/dist/tools/frame/grid.js.map +1 -1
- package/dist/tools/frame/index.d.ts +14 -0
- package/dist/tools/frame/index.js +45 -4
- package/dist/tools/frame/index.js.map +1 -1
- package/dist/tools/frame/medium.d.ts +16 -0
- package/dist/tools/frame/medium.js +3 -1
- package/dist/tools/frame/medium.js.map +1 -1
- package/dist/tools/frame/mie.d.ts +9 -0
- package/dist/tools/frame/mie.js +18 -0
- package/dist/tools/frame/mie.js.map +1 -1
- package/dist/tools/frame/mlp-nn.d.ts +36 -0
- package/dist/tools/frame/mlp-nn.js +159 -0
- package/dist/tools/frame/mlp-nn.js.map +1 -0
- package/dist/tools/frame/mlp-tza.d.ts +29 -0
- package/dist/tools/frame/mlp-tza.js +186 -0
- package/dist/tools/frame/mlp-tza.js.map +1 -0
- package/dist/tools/frame/mlp.d.ts +183 -0
- package/dist/tools/frame/mlp.js +434 -0
- package/dist/tools/frame/mlp.js.map +1 -0
- package/dist/tools/frame/ms-exit.d.ts +42 -0
- package/dist/tools/frame/ms-exit.js +90 -0
- package/dist/tools/frame/ms-exit.js.map +1 -0
- package/dist/tools/frame/multi-scale.d.ts +152 -0
- package/dist/tools/frame/multi-scale.js +302 -0
- package/dist/tools/frame/multi-scale.js.map +1 -0
- package/dist/tools/frame/neural-weights.d.ts +6 -5
- package/dist/tools/frame/neural-weights.js +234 -235
- package/dist/tools/frame/neural-weights.js.map +1 -1
- package/dist/tools/frame/neural.js +1 -1
- package/dist/tools/frame/neural.js.map +1 -1
- package/dist/tools/frame/occluders.d.ts +51 -0
- package/dist/tools/frame/occluders.js +72 -0
- package/dist/tools/frame/occluders.js.map +1 -0
- package/dist/tools/frame/pyramid-layout.d.ts +17 -0
- package/dist/tools/frame/pyramid-layout.js +47 -0
- package/dist/tools/frame/pyramid-layout.js.map +1 -1
- package/dist/tools/frame/shadows.d.ts +110 -0
- package/dist/tools/frame/shadows.js +286 -0
- package/dist/tools/frame/shadows.js.map +1 -1
- package/dist/tools/frame/sparse.d.ts +82 -0
- package/dist/tools/frame/sparse.js +242 -1
- package/dist/tools/frame/sparse.js.map +1 -1
- package/dist/tools/frame/spectral-stack.d.ts +159 -0
- package/dist/tools/frame/spectral-stack.js +391 -0
- package/dist/tools/frame/spectral-stack.js.map +1 -0
- package/dist/tools/frame/spectral.d.ts +21 -2
- package/dist/tools/frame/spectral.js +30 -8
- package/dist/tools/frame/spectral.js.map +1 -1
- package/dist/tools/frame/stack.d.ts +115 -0
- package/dist/tools/frame/stack.js +290 -0
- package/dist/tools/frame/stack.js.map +1 -0
- package/dist/tools/frame/view.d.ts +131 -0
- package/dist/tools/frame/view.js +337 -0
- package/dist/tools/frame/view.js.map +1 -0
- package/dist/tools/index.d.ts +66 -15
- package/dist/tools/index.js +55 -11
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/internal.d.ts +58 -17
- package/dist/tools/internal.js +65 -11
- package/dist/tools/internal.js.map +1 -1
- package/dist/tools/nanovdb/build-from-vdb.d.ts +11 -2
- package/dist/tools/nanovdb/build-from-vdb.js +10 -2
- package/dist/tools/nanovdb/build-from-vdb.js.map +1 -1
- package/dist/tools/nanovdb/bytes.d.ts +17 -4
- package/dist/tools/nanovdb/bytes.js +46 -3
- package/dist/tools/nanovdb/bytes.js.map +1 -1
- package/dist/tools/nanovdb/coarse-first.d.ts +19 -3
- package/dist/tools/nanovdb/coarse-first.js +7 -1
- package/dist/tools/nanovdb/coarse-first.js.map +1 -1
- package/dist/tools/nanovdb/half.d.ts +22 -0
- package/dist/tools/nanovdb/half.js +73 -0
- package/dist/tools/nanovdb/half.js.map +1 -0
- package/dist/tools/nanovdb/index.d.ts +3 -1
- package/dist/tools/nanovdb/index.js +2 -1
- package/dist/tools/nanovdb/index.js.map +1 -1
- package/dist/tools/nanovdb/inspect.d.ts +10 -1
- package/dist/tools/nanovdb/inspect.js +8 -1
- package/dist/tools/nanovdb/inspect.js.map +1 -1
- package/dist/tools/nanovdb/leaf-codec.d.ts +35 -1
- package/dist/tools/nanovdb/leaf-codec.js +40 -4
- package/dist/tools/nanovdb/leaf-codec.js.map +1 -1
- package/dist/tools/nanovdb/quantize.d.ts +39 -10
- package/dist/tools/nanovdb/quantize.js +96 -44
- package/dist/tools/nanovdb/quantize.js.map +1 -1
- package/dist/tools/nanovdb/resample.d.ts +20 -3
- package/dist/tools/nanovdb/resample.js +20 -7
- package/dist/tools/nanovdb/resample.js.map +1 -1
- package/dist/tools/nanovdb/serialize.d.ts +34 -3
- package/dist/tools/nanovdb/serialize.js +51 -7
- package/dist/tools/nanovdb/serialize.js.map +1 -1
- package/dist/tools/nanovdb/stats.d.ts +34 -5
- package/dist/tools/nanovdb/stats.js +87 -11
- package/dist/tools/nanovdb/stats.js.map +1 -1
- package/dist/tools/nanovdb/transform.d.ts +4 -0
- package/dist/tools/nanovdb/transform.js +3 -0
- package/dist/tools/nanovdb/transform.js.map +1 -1
- package/dist/tools/nanovdb/tree.d.ts +14 -3
- package/dist/tools/nanovdb/tree.js +25 -13
- package/dist/tools/nanovdb/tree.js.map +1 -1
- package/dist/tools/nanovdb/write-nvdb.d.ts +47 -12
- package/dist/tools/nanovdb/write-nvdb.js +108 -28
- package/dist/tools/nanovdb/write-nvdb.js.map +1 -1
- package/dist/tools/nvdb-file.d.ts +77 -7
- package/dist/tools/nvdb-file.js +177 -20
- package/dist/tools/nvdb-file.js.map +1 -1
- package/dist/tools/nvdb-stream.d.ts +23 -7
- package/dist/tools/nvdb-stream.js +78 -34
- package/dist/tools/nvdb-stream.js.map +1 -1
- package/dist/tools/reference/analytic.d.ts +41 -0
- package/dist/tools/reference/analytic.js +95 -0
- package/dist/tools/reference/analytic.js.map +1 -0
- package/dist/tools/reference/environment.d.ts +62 -0
- package/dist/tools/reference/environment.js +154 -0
- package/dist/tools/reference/environment.js.map +1 -0
- package/dist/tools/reference/index.d.ts +12 -0
- package/dist/tools/reference/index.js +13 -0
- package/dist/tools/reference/index.js.map +1 -0
- package/dist/tools/reference/media.d.ts +14 -0
- package/dist/tools/reference/media.js +30 -0
- package/dist/tools/reference/media.js.map +1 -0
- package/dist/tools/reference/rng.d.ts +20 -0
- package/dist/tools/reference/rng.js +30 -0
- package/dist/tools/reference/rng.js.map +1 -0
- package/dist/tools/reference/scene.d.ts +312 -0
- package/dist/tools/reference/scene.js +169 -0
- package/dist/tools/reference/scene.js.map +1 -0
- package/dist/tools/reference/tables.d.ts +98 -0
- package/dist/tools/reference/tables.js +264 -0
- package/dist/tools/reference/tables.js.map +1 -0
- package/dist/tools/reference/trace.d.ts +160 -0
- package/dist/tools/reference/trace.js +497 -0
- package/dist/tools/reference/trace.js.map +1 -0
- package/dist/tools/vdb/blosc-write.d.ts +43 -0
- package/dist/tools/vdb/blosc-write.js +197 -0
- package/dist/tools/vdb/blosc-write.js.map +1 -0
- package/dist/tools/vdb/blosc.d.ts +35 -5
- package/dist/tools/vdb/blosc.js +82 -26
- package/dist/tools/vdb/blosc.js.map +1 -1
- package/dist/tools/vdb/blosclz.d.ts +33 -0
- package/dist/tools/vdb/blosclz.js +112 -0
- package/dist/tools/vdb/blosclz.js.map +1 -0
- package/dist/tools/vdb/byte-reader.d.ts +13 -3
- package/dist/tools/vdb/byte-reader.js +26 -4
- package/dist/tools/vdb/byte-reader.js.map +1 -1
- package/dist/tools/vdb/compression.d.ts +13 -5
- package/dist/tools/vdb/compression.js +13 -2
- package/dist/tools/vdb/compression.js.map +1 -1
- package/dist/tools/vdb/grid.js +8 -2
- package/dist/tools/vdb/grid.js.map +1 -1
- package/dist/tools/vdb/index.d.ts +2 -1
- package/dist/tools/vdb/index.js.map +1 -1
- package/dist/tools/vdb/lz4.d.ts +30 -0
- package/dist/tools/vdb/lz4.js +228 -0
- package/dist/tools/vdb/lz4.js.map +1 -0
- package/dist/tools/vdb/metadata.js +1 -1
- package/dist/tools/vdb/metadata.js.map +1 -1
- package/dist/tools/vdb/parse.d.ts +24 -2
- package/dist/tools/vdb/parse.js +102 -32
- package/dist/tools/vdb/parse.js.map +1 -1
- package/dist/tools/vdb/point-render-data.d.ts +49 -1
- package/dist/tools/vdb/point-render-data.js +91 -11
- package/dist/tools/vdb/point-render-data.js.map +1 -1
- package/dist/tools/vdb/points.d.ts +26 -0
- package/dist/tools/vdb/points.js +46 -5
- package/dist/tools/vdb/points.js.map +1 -1
- package/dist/tools/vdb/types.d.ts +59 -2
- package/dist/tools/vdb/types.js.map +1 -1
- package/dist/tools/wvdb/bake.d.ts +38 -9
- package/dist/tools/wvdb/bake.js +63 -13
- package/dist/tools/wvdb/bake.js.map +1 -1
- package/dist/tools/wvdb/dense.d.ts +80 -1
- package/dist/tools/wvdb/dense.js +67 -8
- package/dist/tools/wvdb/dense.js.map +1 -1
- package/dist/tools/wvdb/format.d.ts +59 -0
- package/dist/tools/wvdb/format.js +3 -0
- package/dist/tools/wvdb/format.js.map +1 -1
- package/dist/tools/wvdb/index.d.ts +1 -0
- package/dist/tools/wvdb/index.js +1 -0
- package/dist/tools/wvdb/index.js.map +1 -1
- package/dist/tools/wvdb/level-set.d.ts +10 -2
- package/dist/tools/wvdb/level-set.js.map +1 -1
- package/dist/tools/wvdb/nanovdb.d.ts +6 -1
- package/dist/tools/wvdb/nanovdb.js +5 -1
- package/dist/tools/wvdb/nanovdb.js.map +1 -1
- package/dist/tools/wvdb/partial.d.ts +74 -0
- package/dist/tools/wvdb/partial.js +233 -0
- package/dist/tools/wvdb/partial.js.map +1 -0
- package/dist/tools/wvdb/read.d.ts +77 -1
- package/dist/tools/wvdb/read.js +30 -7
- package/dist/tools/wvdb/read.js.map +1 -1
- package/dist/tools/wvdb/write.d.ts +23 -1
- package/dist/tools/wvdb/write.js +8 -1
- package/dist/tools/wvdb/write.js.map +1 -1
- package/package.json +2 -1
- package/vendor/VENDOR.md +21 -6
- package/vendor/pnanovdb.wgsl +52 -14
- package/dist/three/frame/blackbody.d.ts +0 -42
- package/dist/three/frame/blackbody.js +0 -74
- package/dist/three/frame/blackbody.js.map +0 -1
- package/dist/three/frame/chunks.d.ts +0 -157
- package/dist/three/frame/chunks.js +0 -559
- package/dist/three/frame/chunks.js.map +0 -1
- package/dist/three/frame/density-material.d.ts +0 -53
- package/dist/three/frame/density-material.js +0 -353
- package/dist/three/frame/density-material.js.map +0 -1
- package/dist/three/frame/environment-grid-material.d.ts +0 -21
- package/dist/three/frame/environment-grid-material.js +0 -184
- package/dist/three/frame/environment-grid-material.js.map +0 -1
- package/dist/three/frame/environment-material.d.ts +0 -22
- package/dist/three/frame/environment-material.js +0 -87
- package/dist/three/frame/environment-material.js.map +0 -1
- package/dist/three/frame/grid-mip-material.d.ts +0 -12
- package/dist/three/frame/grid-mip-material.js +0 -61
- package/dist/three/frame/grid-mip-material.js.map +0 -1
- package/dist/three/frame/inject-material.d.ts +0 -56
- package/dist/three/frame/inject-material.js +0 -424
- package/dist/three/frame/inject-material.js.map +0 -1
- package/dist/three/frame/integrate-material.d.ts +0 -26
- package/dist/three/frame/integrate-material.js +0 -198
- package/dist/three/frame/integrate-material.js.map +0 -1
- package/dist/three/frame/layout.d.ts +0 -34
- package/dist/three/frame/layout.js +0 -48
- package/dist/three/frame/layout.js.map +0 -1
- package/dist/three/frame/lighting-material.d.ts +0 -41
- package/dist/three/frame/lighting-material.js +0 -257
- package/dist/three/frame/lighting-material.js.map +0 -1
- package/dist/three/frame/lights.d.ts +0 -11
- package/dist/three/frame/lights.js +0 -16
- package/dist/three/frame/lights.js.map +0 -1
- package/dist/three/frame/neural.d.ts +0 -14
- package/dist/three/frame/neural.js +0 -105
- package/dist/three/frame/neural.js.map +0 -1
- package/dist/three/frame/phase.d.ts +0 -44
- package/dist/three/frame/phase.js +0 -80
- package/dist/three/frame/phase.js.map +0 -1
- package/dist/three/frame/shadow-density-material.d.ts +0 -30
- package/dist/three/frame/shadow-density-material.js +0 -123
- package/dist/three/frame/shadow-density-material.js.map +0 -1
- package/dist/three/frame/temporal-material.d.ts +0 -29
- package/dist/three/frame/temporal-material.js +0 -152
- package/dist/three/frame/temporal-material.js.map +0 -1
- package/dist/three/frame/transmittance-material.d.ts +0 -31
- package/dist/three/frame/transmittance-material.js +0 -315
- package/dist/three/frame/transmittance-material.js.map +0 -1
- package/dist/three/frame/view.d.ts +0 -103
- package/dist/three/frame/view.js +0 -296
- package/dist/three/frame/view.js.map +0 -1
- package/dist/three/frame/volume-shadow-material.d.ts +0 -36
- package/dist/three/frame/volume-shadow-material.js +0 -128
- package/dist/three/frame/volume-shadow-material.js.map +0 -1
- package/dist/three/sequence.js.map +0 -1
|
@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CAAC;YAAE,CAAC,EAAE,OAAO,EAAE,CAAC;QACvG,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO;YAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC/E,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;IACxB,CAAC;CACF","sourcesContent":["/**\n * K3.2f: the brick cache of the core sparse source (`vdbSparseSource`, internal option `brickCache`; design in\n * docs/archive/handoffs/K3-2d.md, built and measured in K3-2f.md). CPU side and twins: `tools/frame/brick-cache.ts`.\n *\n * The level-0 density samples of a sparse source read the tree: 8 lower-node lookups and value decodes per sample\n * (K3.2d). The cache decodes the 8³ blocks the frames touch into a dense atlas of 9³ bricks (the block plus a\n * +x/+y/+z apron, so the 8 taps of every sample based in the block sit in one brick) and keeps a page table:\n *\n * - **Pages buffer** (storage, read): a header of 4 words per volume slot (first page, pages per axis; first page\n * `0xffffffff` = no pages, the volume reads the tree), then one word per page: 0 = not resident, else brick slot + 1.\n * - **Marks buffer** (storage, read_write): one bit per page, set by the sampler on every page it reads (resident or\n * not). `update()` copies it into a readback buffer and clears it; once mapped, {@link VDBBrickResidency} gives the\n * marked pages without a brick a slot (least recently marked out first) and the next `update()` records the fills.\n * - **Atlas**: `'f32'`: r32float, filled through a storage texture, sampled with 8 `textureLoad`s and the vendored\n * lerp order: bit-identical to the tree sampler. `'f16'`: r16float (core WebGPU has no r16float storage texture:\n * f16 words in a staging buffer, then one `copyBufferToTexture` per brick), sampled with ONE hardware-filtered fetch;\n * not identical (f16 values, quantized filter weights on some GPUs): the bound is `vdbBrickHalfBound`.\n *\n * A page that is not resident is a miss: the sampler reads the tree, so the f32 cache is exact from the first frame\n * and only gets faster; a page marked in frame k is resident from about frame k + 2 (the marks' readback latency).\n * An image change (`imageRevision`) drops the volume's bricks; a layout change (volumes added, removed or re-laid\n * out) keeps the bricks of volumes whose page range is unchanged.\n */\n\nimport { VDBError } from \"../errors.js\";\nimport type { VDBGridPool, VDBGridInfo } from \"../pool/pool.js\";\nimport type { VDBGridTypeName } from \"../types.js\";\nimport { vdbModuleEntries, vdbModuleWgsl } from \"../wgsl/generate.js\";\nimport { COMPUTE_SLOT } from \"../compute/shared.js\";\nimport {\n VDBBrickResidency,\n VDB_BRICK_KERNELS,\n VDB_BRICK_NO_PAGES,\n VDB_BRICK_SIDE,\n vdbBrickMarkSections,\n vdbBrickOrigin,\n vdbBrickPageLayout,\n vdbBrickPolicyPages,\n type VDBBrickKernels,\n type VDBBrickPageLayout,\n} from \"../../tools/frame/brick-cache.js\";\n\n/** The atlas format of the cache. */\nexport type VDBSparseBrickMode = \"f32\" | \"f16\";\n\n/** Internal options of the brick cache (`VDBSparseSourceInternalOptions`). */\nexport interface VDBSparseBrickOptions {\n /** `'f32'` (bit-identical to the tree) or `'f16'` (one filtered fetch; bounded). */\n readonly mode: VDBSparseBrickMode;\n /** Most bricks the atlas may hold (default: what fits in 64 MiB of atlas, rows padded to 256 bytes). */\n readonly capacity?: number;\n /** Most bricks filled per `update()` (default 1024 for f32, 256 for f16: its staging is 20.25 KiB a brick). */\n readonly budget?: number;\n /** Most pages over all volumes; volumes past it read the tree (default 2²², 16 MiB of page table). */\n readonly pagesMax?: number;\n /** K3.2f-e: which kernels' marks take bricks (`'all'`, default; else the gather's only). */\n readonly kernels?: VDBBrickKernels;\n /** K3.2f-e: one marks section per kernel, counted per kernel (`kernelMarks`). Default false (one section). */\n readonly markStats?: boolean;\n}\n\n/** K3.2f-e: one kernel's marks in the last applied observation (with `brickMarkStats`). */\nexport interface VDBSparseBrickKernelCounters {\n /** Pages it marked (read at level 0) in the window. */\n readonly marked: number;\n /**\n * The most pages it marked in any one observation so far: its working set when it runs (the 'frame' grid density\n * and emission passes run only when their grids are redrawn, so the last window may hold none of their marks).\n */\n readonly markedPeak: number;\n /** Of those, pages without a brick when the observation was applied (it read the tree there). */\n readonly misses: number;\n /** Pages no other kernel marked in the window. */\n readonly only: number;\n /** Of its marked pages, the ones given a brick by this observation; and the total over all observations. */\n readonly fillsLast: number;\n readonly fills: number;\n}\n\n/** K3.2f-e: the marks per kernel (with `brickMarkStats`; null without). */\nexport interface VDBSparseBrickKernelMarks {\n /** Pages any kernel marked in the window, and the most in any one observation so far. */\n readonly union: number;\n readonly unionPeak: number;\n readonly gather: VDBSparseBrickKernelCounters;\n readonly grid: VDBSparseBrickKernelCounters;\n readonly emission: VDBSparseBrickKernelCounters;\n}\n\n/** What the cache did (K3.2f counters; `vdbSparseBrickCacheInfo`). */\nexport interface VDBSparseBrickCounters {\n readonly mode: VDBSparseBrickMode;\n /** Atlas slots now (grows by layers up to `capacityMax`). */\n readonly capacity: number;\n readonly capacityMax: number;\n /** Pages over all volumes, and the volumes that have none (past `pagesMax`). */\n readonly pages: number;\n readonly volumesWithoutPages: number;\n /** Pages with a brick. */\n readonly resident: number;\n /** The last observation: pages the sampler marked, marked pages without a brick, misses left without one. */\n readonly marked: number;\n readonly misses: number;\n readonly overflow: number;\n /** Totals: bricks filled, bricks evicted, observations applied, bricks dropped by image or layout changes. */\n readonly fills: number;\n readonly fillsLast: number;\n readonly evictions: number;\n readonly observations: number;\n readonly dropped: number;\n /** GPU bytes the cache allocated. */\n readonly bytes: { readonly atlas: number; readonly pages: number; readonly marks: number; readonly staging: number; readonly readback: number; readonly jobs: number };\n /** K3.2f-e: which kernels' marks take bricks, and the marks per kernel (null without `brickMarkStats`). */\n readonly kernels: VDBBrickKernels;\n readonly kernelMarks: VDBSparseBrickKernelMarks | null;\n}\n\nconst BUFFER = { MAP_READ: 0x1, COPY_SRC: 0x4, COPY_DST: 0x8, STORAGE: 0x80 } as const;\nconst TEXTURE = { COPY_SRC: 0x1, COPY_DST: 0x2, TEXTURE_BINDING: 0x4, STORAGE_BINDING: 0x8 } as const;\nconst STAGE_COMPUTE = 0x4;\n/** Bricks per atlas row and column (the atlas grows along z, one layer of 16 × 16 bricks at a time). */\nconst ATLAS_BRICKS_XY = 16;\nconst LAYER = ATLAS_BRICKS_XY * ATLAS_BRICKS_XY;\n/** f16 staging: one brick is 81 rows of 256 bytes (64 words): 9 texels of 2 bytes per row, padded. */\nconst STAGING_ROW_WORDS = 64;\nconst STAGING_BRICK_BYTES = VDB_BRICK_SIDE * VDB_BRICK_SIDE * STAGING_ROW_WORDS * 4;\nconst DEFAULT_ATLAS_BYTES = 64 * 1024 * 1024;\nconst DEFAULT_PAGES_MAX = 1 << 22;\nconst align = (n: number, a: number) => Math.ceil(n / a) * a;\n\nconst bad = (message: string) => new VDBError(\"VDB_BAD_OPTION\", `vdbSparseSource: ${message}`);\n\n/** Bytes of the zero-filled atlas (Dawn clears a new texture through one buffer, rows padded to 256 bytes; Traps). */\nfunction atlasClearBytes(mode: VDBSparseBrickMode, layers: number): number {\n const row = align(ATLAS_BRICKS_XY * VDB_BRICK_SIDE * (mode === \"f32\" ? 4 : 2), 256);\n return row * ATLAS_BRICKS_XY * VDB_BRICK_SIDE * layers * VDB_BRICK_SIDE;\n}\n\n/** The fill kernels: one workgroup per brick, the 9³ tree values through `vdbReadValue` (twin `vdbBrickFillCpu`). */\nexport function vdbBrickFillWgsl(mode: VDBSparseBrickMode, types: readonly VDBGridTypeName[]): string {\n const out =\n mode === \"f32\"\n ? `@group(1) @binding(1) var brickOut: texture_storage_3d<r32float, write>;`\n : `@group(1) @binding(1) var<storage, read_write> brickOut: array<u32>;`;\n const body =\n mode === \"f32\"\n ? ` let n = textureDimensions(brickOut) / 9u;\n let o = vec3u(slot % n.x, (slot / n.x) % n.y, slot / (n.x * n.y)) * 9u;\n for (var i = lid.x; i < 729u; i += 64u) {\n let l = vec3u(i % 9u, (i / 9u) % 9u, i / 81u);\n textureStore(brickOut, o + l, vec4f(vdbReadValue(&acc, origin + vec3i(l)), 0.0, 0.0, 0.0));\n }`\n : ` // 81 rows of 5 words (texels 2w, 2w + 1; texel 9 is padding) at 64 words a row.\n for (var i = lid.x; i < 405u; i += 64u) {\n let w = i % 5u;\n let row = i / 5u;\n let ijk = origin + vec3i(vec3u(2u * w, row % 9u, row / 9u));\n let lo = brickHalf(vdbReadValue(&acc, ijk));\n var hi = 0u;\n if w < 4u {\n hi = brickHalf(vdbReadValue(&acc, ijk + vec3i(1, 0, 0)));\n }\n brickOut[wid.x * ${VDB_BRICK_SIDE * VDB_BRICK_SIDE * STAGING_ROW_WORDS}u + row * ${STAGING_ROW_WORDS}u + w] = lo | (hi << 16u);\n }`;\n const half =\n mode === \"f16\"\n ? `\n// f32 -> f16 bits, round to nearest even (tools vdbFloatToHalf, after NanoVDB HalfLite; as K7.3's msHalf).\nfn brickHalf(v: f32) -> u32 {\n let bits = bitcast<u32>(v);\n let ui = bits & 0x7fffffffu;\n var h = (bits >> 16u) & 0x8000u;\n if ui >= 0x38800000u {\n if ui >= 0x7f800000u {\n h = h | 0x7c00u;\n if ui == 0x7f800000u {\n return h;\n }\n let m = (ui & 0x7fffffu) >> 13u;\n return h | m | select(0u, 1u, m == 0u);\n }\n if ui > 0x477fefffu {\n return h | 0x7c00u;\n }\n let r = ui - 0x38000000u;\n return h | ((r + 0x00000fffu + ((r >> 13u) & 1u)) >> 13u);\n }\n if ui < 0x33000001u {\n return h;\n }\n let shift = 0x7eu - (ui >> 23u);\n let m = 0x800000u | (ui & 0x7fffffu);\n let r = m << (32u - shift);\n h = h | (m >> shift);\n if r > 0x80000000u || (r == 0x80000000u && (h & 1u) != 0u) {\n h = h + 1u;\n }\n return h;\n}`\n : \"\";\n return `${vdbModuleWgsl({ slot: COMPUTE_SLOT, types, profile: \"read\" })}\n// K3.2f brick fill (${mode}): job = (brick origin xyz, slot), then (grid id, 0, 0, 0).\n@group(1) @binding(0) var<storage, read> brickJobs: array<vec4i>;\n${out}\n${half}\n@compute @workgroup_size(64)\nfn vdbBrickFillCs(@builtin(workgroup_id) wid: vec3u, @builtin(local_invocation_id) lid: vec3u) {\n let a = brickJobs[2u * wid.x];\n let origin = a.xyz;\n let slot = u32(a.w);\n var acc = vdbAccessorInit(u32(brickJobs[2u * wid.x + 1u].x));\n${body}\n}\n`;\n}\n\ninterface FillPipeline {\n readonly pipeline: GPUComputePipeline;\n readonly group0: GPUBindGroupLayout;\n readonly group1: GPUBindGroupLayout;\n}\n\nconst fillPipelines = new WeakMap<GPUDevice, Map<string, FillPipeline>>();\n\nfunction fillPipeline(device: GPUDevice, mode: VDBSparseBrickMode, types: readonly VDBGridTypeName[]): FillPipeline {\n let byKey = fillPipelines.get(device);\n if (!byKey) fillPipelines.set(device, (byKey = new Map()));\n const key = `${mode}:${types.join(\",\")}`;\n const hit = byKey.get(key);\n if (hit) return hit;\n const group0 = device.createBindGroupLayout({ label: `vdb brick fill ${mode} group 0`, entries: vdbModuleEntries({ slot: COMPUTE_SLOT, visibility: STAGE_COMPUTE }) });\n const group1 = device.createBindGroupLayout({\n label: `vdb brick fill ${mode} group 1`,\n entries: [\n { binding: 0, visibility: STAGE_COMPUTE, buffer: { type: \"read-only-storage\" } },\n mode === \"f32\"\n ? { binding: 1, visibility: STAGE_COMPUTE, storageTexture: { access: \"write-only\", format: \"r32float\", viewDimension: \"3d\" } }\n : { binding: 1, visibility: STAGE_COMPUTE, buffer: { type: \"storage\" } },\n ],\n });\n const module = device.createShaderModule({ label: `vdb brick fill ${mode}`, code: vdbBrickFillWgsl(mode, types) });\n const pipeline = device.createComputePipeline({\n label: `vdb brick fill ${mode}`,\n layout: device.createPipelineLayout({ bindGroupLayouts: [group0, group1] }),\n compute: { module, entryPoint: \"vdbBrickFillCs\" },\n });\n const p = { pipeline, group0, group1 };\n byKey.set(key, p);\n return p;\n}\n\n/** A volume of the source, as the cache sees it. */\nexport interface VDBBrickVolume {\n readonly v: number;\n readonly removed: boolean;\n readonly ids: { readonly density: number };\n readonly indexBox: { readonly min: readonly number[]; readonly max: readonly number[] };\n}\n\ninterface Region {\n readonly volume: VDBBrickVolume;\n readonly gridId: number;\n readonly layout: VDBBrickPageLayout;\n /** First page (global), or -1 when the volume has no pages. */\n readonly base: number;\n /** The density imageRevision the bricks hold (-1: none yet). */\n revision: number;\n /** The grid is resident with that revision: its pages may be filled. */\n ready: boolean;\n}\n\ninterface MarksReadback {\n readonly buffer: GPUBuffer;\n readonly epoch: number;\n readonly recordedAt: number;\n mapping: Promise<void> | null;\n}\n\n/** The cache of one sparse source (owned by it; see the file comment). */\nexport class VDBSparseBrickCache {\n readonly mode: VDBSparseBrickMode;\n readonly #device: GPUDevice;\n readonly #pool: VDBGridPool;\n readonly #types: readonly VDBGridTypeName[];\n readonly #label: string;\n readonly #maxVolumes: number;\n readonly #budget: number;\n readonly #pagesMax: number;\n readonly #capacityMax: number;\n readonly #retire: (destroy: () => void) => void;\n readonly #rebind: () => void;\n readonly #residency: VDBBrickResidency;\n /** K3.2f-e: the residency policy and the marks sections (1, or one per kernel with `markStats`). */\n readonly #kernels: VDBBrickKernels;\n readonly #sections: number;\n #kernelMarks: { union: number; unionPeak: number; byKernel: { marked: number; markedPeak: number; misses: number; only: number; fillsLast: number; fills: number }[] } | null = null;\n #regions: Region[] = [];\n #pages = 0;\n /** CPU mirror of the pages buffer (header, then entries) and its dirty word range. */\n #table: Uint32Array<ArrayBuffer>;\n #dirty: [number, number] = [0, 0];\n #pagesBuffer: GPUBuffer;\n #marks: GPUBuffer;\n #atlas: GPUTexture;\n #layers = 1;\n #sampler: GPUSampler | null;\n #staging: GPUBuffer | null = null;\n #jobs: GPUBuffer | null = null;\n #readback: MarksReadback | null = null;\n #spare: GPUBuffer | null = null;\n #observation: { bits: Uint32Array; epoch: number } | null = null;\n #epoch = 0;\n #updates = 0;\n /** The update at which the marks buffer was last cleared or made (its marks start after it). */\n #marksFrom = 1;\n readonly #mappings = new Set<Promise<void>>();\n #counters = { marked: 0, misses: 0, overflow: 0, fills: 0, fillsLast: 0, evictions: 0, observations: 0, dropped: 0 };\n\n constructor(\n device: GPUDevice,\n pool: VDBGridPool,\n o: VDBSparseBrickOptions & { types: readonly VDBGridTypeName[]; maxVolumes: number; label: string },\n hooks: { retire: (destroy: () => void) => void; rebind: () => void },\n ) {\n if (o.mode !== \"f32\" && o.mode !== \"f16\") throw bad(`brickCache must be 'off', 'f32' or 'f16', got ${JSON.stringify(o.mode)}.`);\n this.mode = o.mode;\n this.#device = device;\n this.#pool = pool;\n this.#types = o.types;\n this.#label = `${o.label} bricks`;\n this.#maxVolumes = o.maxVolumes;\n this.#retire = hooks.retire;\n this.#rebind = hooks.rebind;\n const limits = (device.limits ?? {}) as { maxTextureDimension3D?: number; maxBufferSize?: number };\n const maxLayers = Math.max(1, Math.floor((limits.maxTextureDimension3D ?? 2048) / VDB_BRICK_SIDE));\n // Dawn's zero-fill of a new texture goes through one buffer of its padded size: stay under half maxBufferSize.\n const clearCap = Math.max(1, Math.floor(Math.min(DEFAULT_ATLAS_BYTES, (limits.maxBufferSize ?? 268435456) / 2) / atlasClearBytes(o.mode, 1)));\n const layersMax = Math.min(maxLayers, clearCap);\n const capacity = o.capacity ?? layersMax * LAYER;\n if (!Number.isInteger(capacity) || capacity < 1) throw bad(`brickCapacity must be a positive integer, got ${o.capacity}.`);\n this.#capacityMax = Math.min(capacity, maxLayers * LAYER);\n this.#budget = o.budget ?? (o.mode === \"f32\" ? 1024 : 256);\n if (!Number.isInteger(this.#budget) || this.#budget < 1 || this.#budget > 65535) throw bad(`brickBudget must be an integer in [1, 65535], got ${o.budget}.`);\n this.#kernels = o.kernels ?? \"all\";\n if (this.#kernels !== \"all\" && this.#kernels !== \"gather-marks\" && this.#kernels !== \"gather-only\") throw bad(`brickKernels must be 'all', 'gather-marks' or 'gather-only', got ${JSON.stringify(o.kernels)}.`);\n this.#sections = o.markStats ? VDB_BRICK_KERNELS.length : 1;\n if (o.markStats) this.#kernelMarks = { union: 0, unionPeak: 0, byKernel: VDB_BRICK_KERNELS.map(() => ({ marked: 0, markedPeak: 0, misses: 0, only: 0, fillsLast: 0, fills: 0 })) };\n this.#pagesMax = o.pagesMax ?? DEFAULT_PAGES_MAX;\n if (!Number.isInteger(this.#pagesMax) || this.#pagesMax < 0) throw bad(`brickPagesMax must be a non-negative integer, got ${o.pagesMax}.`);\n this.#residency = new VDBBrickResidency(Math.min(LAYER, this.#capacityMax));\n this.#table = new Uint32Array(4 * this.#maxVolumes).fill(VDB_BRICK_NO_PAGES);\n this.#pagesBuffer = this.#newPages(this.#table.length);\n this.#dirty = [0, this.#table.length];\n this.#marks = this.#newMarks(0);\n this.#atlas = this.#newAtlas(1);\n this.#sampler =\n o.mode === \"f16\"\n ? device.createSampler({\n label: `${this.#label} sampler`,\n magFilter: \"linear\",\n minFilter: \"linear\",\n mipmapFilter: \"nearest\",\n addressModeU: \"clamp-to-edge\",\n addressModeV: \"clamp-to-edge\",\n addressModeW: \"clamp-to-edge\",\n })\n : null;\n }\n\n #newPages(words: number): GPUBuffer {\n return this.#device.createBuffer({ label: `${this.#label} pages`, size: align(words * 4, 16), usage: BUFFER.STORAGE | BUFFER.COPY_DST });\n }\n\n /** Bytes of one marks section for `pages` (K3.2f-e: the buffer holds `#sections` of them; the WGSL splits it by `arrayLength`). */\n static #sectionBytes(pages: number): number {\n return Math.max(16, align(Math.ceil(pages / 32) * 4, 16));\n }\n\n #newMarks(pages: number): GPUBuffer {\n return this.#device.createBuffer({ label: `${this.#label} marks`, size: this.#sections * VDBSparseBrickCache.#sectionBytes(pages), usage: BUFFER.STORAGE | BUFFER.COPY_SRC | BUFFER.COPY_DST });\n }\n\n #newAtlas(layers: number): GPUTexture {\n const n = ATLAS_BRICKS_XY * VDB_BRICK_SIDE;\n return this.#device.createTexture({\n label: `${this.#label} atlas`,\n size: [n, n, layers * VDB_BRICK_SIDE],\n dimension: \"3d\",\n format: this.mode === \"f32\" ? \"r32float\" : \"r16float\",\n usage: TEXTURE.TEXTURE_BINDING | TEXTURE.COPY_SRC | TEXTURE.COPY_DST | (this.mode === \"f32\" ? TEXTURE.STORAGE_BINDING : 0),\n });\n }\n\n /** The atlas (for probes and readbacks). */\n get atlas(): GPUTexture {\n return this.#atlas;\n }\n\n /** Pages buffer words before the first page entry (the per-volume header). */\n get headerWords(): number {\n return 4 * this.#maxVolumes;\n }\n\n /** The CPU mirror of the pages buffer (header, then entries), for tests. */\n get table(): Uint32Array {\n return this.#table;\n }\n\n /** The page layout of a volume slot and its first page (-1: no pages), for tests and probes. */\n region(v: number): { base: number; layout: VDBBrickPageLayout; gridId: number } | null {\n const r = this.#regions.find((x) => x.volume.v === v);\n return r ? { base: r.base, layout: r.layout, gridId: r.gridId } : null;\n }\n\n get counters(): VDBSparseBrickCounters {\n const t = this.#atlas;\n const c = this.#counters;\n const km = this.#kernelMarks;\n const kernelMarks: VDBSparseBrickKernelMarks | null = km\n ? ({ union: km.union, unionPeak: km.unionPeak, ...Object.fromEntries(VDB_BRICK_KERNELS.map((k, i) => [k, { ...km.byKernel[i]! }])) } as unknown as VDBSparseBrickKernelMarks)\n : null;\n return {\n mode: this.mode,\n capacity: this.#residency.capacity,\n capacityMax: this.#capacityMax,\n pages: this.#pages,\n volumesWithoutPages: this.#regions.filter((r) => r.base < 0).length,\n resident: this.#residency.resident,\n marked: c.marked,\n misses: c.misses,\n overflow: c.overflow,\n fills: c.fills,\n fillsLast: c.fillsLast,\n evictions: c.evictions,\n observations: c.observations,\n dropped: c.dropped,\n bytes: {\n atlas: t.width * t.height * t.depthOrArrayLayers * (this.mode === \"f32\" ? 4 : 2),\n pages: this.#pagesBuffer.size,\n marks: this.#marks.size,\n staging: this.#staging?.size ?? 0,\n readback: (this.#readback?.buffer.size ?? 0) + (this.#spare?.size ?? 0),\n jobs: this.#jobs?.size ?? 0,\n },\n kernels: this.#kernels,\n kernelMarks,\n };\n }\n\n // ---- layout ----\n\n /** Re-lays the page ranges out over `volumes` (slot order); keeps the bricks of unchanged ranges. */\n layout(volumes: readonly VDBBrickVolume[]): void {\n const old = this.#regions;\n const next: Region[] = [];\n let pages = 0;\n for (const volume of [...volumes].sort((a, b) => a.v - b.v)) {\n const layout = vdbBrickPageLayout(volume.indexBox);\n const fits = pages + layout.count <= this.#pagesMax;\n const prev = old.find((r) => r.volume === volume);\n const same = prev && prev.base >= 0 && fits && prev.gridId === volume.ids.density && prev.layout.blockMin.every((x, a) => x === layout.blockMin[a]) && prev.layout.dims.every((x, a) => x === layout.dims[a]);\n next.push({ volume, gridId: volume.ids.density, layout, base: fits ? pages : -1, revision: same ? prev.revision : -1, ready: same ? prev.ready : false });\n if (fits) pages += layout.count;\n }\n // Pages of kept regions move to their new base; every other brick is freed.\n const to = (page: number): number => {\n const r = old.find((x) => x.base >= 0 && page >= x.base && page < x.base + x.layout.count);\n const n = r ? next.find((x) => x.volume === r.volume && x.revision >= 0 && x.base >= 0) : undefined;\n return r && n ? page - r.base + n.base : -1;\n };\n this.#counters.dropped += this.#residency.drop((page) => to(page) >= 0).length;\n this.#residency.remap(to);\n this.#regions = next;\n const sectionBytes = this.#marks.size / this.#sections;\n const grewMarks = Math.ceil(pages / 32) * 4 > sectionBytes;\n this.#pages = pages;\n this.#epoch++;\n this.#observation = null;\n // The whole table again: the header, then each resident page's slot.\n const table = new Uint32Array(this.headerWords + pages).fill(0);\n table.fill(VDB_BRICK_NO_PAGES, 0, this.headerWords);\n for (const r of next) {\n if (r.base < 0) continue;\n table.set([r.base, ...r.layout.dims], 4 * r.volume.v);\n }\n for (const [page, slot] of this.#residency.entries()) table[this.headerWords + page] = slot + 1;\n this.#table = table;\n this.#dirty = [0, table.length];\n if (table.length * 4 > this.#pagesBuffer.size) {\n const old = this.#pagesBuffer;\n this.#retire(() => old.destroy());\n this.#pagesBuffer = this.#newPages(table.length + (table.length >> 1));\n this.#rebind();\n }\n // New page numbers: the marks of the old layout mean nothing now, start from a clear buffer.\n const oldMarks = this.#marks;\n this.#retire(() => oldMarks.destroy());\n this.#marks = this.#newMarks(grewMarks ? pages + (pages >> 1) : Math.max(pages, (sectionBytes / 4) * 32));\n // layout() runs in the source's update just before this cache's: that update's frame is the first to mark it.\n this.#marksFrom = this.#updates + 1;\n this.#rebind();\n }\n\n // ---- per update ----\n\n #setEntry(page: number, value: number): void {\n const w = this.headerWords + page;\n this.#table[w] = value;\n this.#dirty = this.#dirty[0] === this.#dirty[1] ? [w, w + 1] : [Math.min(this.#dirty[0], w), Math.max(this.#dirty[1], w + 1)];\n }\n\n /** Drops a region's bricks (its image changed). */\n #dropRegion(r: Region): void {\n if (r.base < 0) return;\n const dropped = this.#residency.drop((page) => page < r.base || page >= r.base + r.layout.count);\n for (const page of dropped) this.#setEntry(page, 0);\n this.#counters.dropped += dropped.length;\n }\n\n /** Grows the atlas by layers (copying the old one) so `slots` fit, up to the capacity; returns the new capacity. */\n #grow(encoder: GPUCommandEncoder, slots: number): void {\n const want = Math.min(this.#capacityMax, slots);\n if (want <= this.#residency.capacity) return;\n let layers = this.#layers;\n while (layers * LAYER < want) layers *= 2;\n layers = Math.min(layers, Math.ceil(this.#capacityMax / LAYER));\n const old = this.#atlas;\n const next = this.#newAtlas(layers);\n encoder.copyTextureToTexture({ texture: old }, { texture: next }, [old.width, old.height, old.depthOrArrayLayers]);\n this.#retire(() => old.destroy());\n this.#atlas = next;\n this.#layers = layers;\n this.#residency.grow(Math.min(this.#capacityMax, layers * LAYER));\n this.#rebind();\n }\n\n /**\n * One update (after the pool's, in the same encoder): drops the bricks of changed images, applies the last marks\n * (allocations, evictions, fills recorded into `encoder`), writes the page table, and copies this window's marks out.\n */\n update(encoder: GPUCommandEncoder): void {\n this.#updates++;\n for (const r of this.#regions) {\n let info: VDBGridInfo;\n try {\n info = this.#pool.info(r.gridId);\n } catch {\n r.ready = false;\n continue;\n }\n if (info.imageRevision !== r.revision) {\n if (r.revision >= 0) this.#dropRegion(r);\n r.ready = false;\n if (info.resident) {\n r.revision = info.imageRevision;\n r.ready = true;\n }\n } else if (!info.resident) {\n r.ready = false;\n } else {\n r.ready = true;\n }\n }\n const obs = this.#observation;\n if (obs && obs.epoch === this.#epoch) {\n this.#observation = null;\n this.#apply(encoder, obs.bits);\n }\n if (this.#dirty[1] > this.#dirty[0]) {\n const [lo, hi] = this.#dirty;\n this.#device.queue.writeBuffer(this.#pagesBuffer, lo * 4, new Uint8Array(this.#table.buffer as ArrayBuffer, lo * 4, (hi - lo) * 4));\n this.#dirty = [0, 0];\n }\n this.#marksOut(encoder);\n }\n\n #apply(encoder: GPUCommandEncoder, bits: Uint32Array): void {\n const ready = this.#regions.filter((r) => r.ready && r.base >= 0);\n // Only pages of resident images take a brick (the others keep reading the tree).\n const isReady = (page: number) => ready.some((r) => page >= r.base && page < r.base + r.layout.count);\n // K3.2f-e: the marks of each section (one per kernel with markStats), then the pages the policy gives bricks to.\n const sections = vdbBrickMarkSections(bits, this.#sections, this.#pages).map((list) => list.filter(isReady));\n const marked = vdbBrickPolicyPages(this.#kernels, sections);\n let missing = 0;\n for (const page of marked) if (this.#residency.slotOf(page) < 0) missing++;\n const kernelMisses = this.#kernelMarks ? sections.map((list) => list.reduce((n, page) => n + (this.#residency.slotOf(page) < 0 ? 1 : 0), 0)) : null;\n if (this.#residency.resident + Math.min(missing, this.#budget) > this.#residency.capacity) this.#grow(encoder, this.#residency.resident + Math.min(missing, this.#budget));\n const o = this.#residency.observe(marked, this.#updates, this.#budget);\n if (this.#kernelMarks && kernelMisses) this.#countKernels(sections, kernelMisses, o.allocated);\n const c = this.#counters;\n c.observations++;\n c.marked = marked.length;\n c.misses = o.misses;\n c.overflow = o.overflow;\n c.evictions += o.evicted.length;\n c.fillsLast = o.allocated.length;\n for (const page of o.evicted) this.#setEntry(page, 0);\n if (o.allocated.length === 0) return;\n const jobs = new Int32Array(o.allocated.length * 8);\n o.allocated.forEach(([page, slot], j) => {\n const r = ready.find((x) => page >= x.base && page < x.base + x.layout.count)!;\n const origin = vdbBrickOrigin(r.layout, page - r.base);\n jobs.set([origin[0], origin[1], origin[2], slot, r.gridId, 0, 0, 0], j * 8);\n this.#setEntry(page, slot + 1);\n });\n this.#fill(encoder, jobs, o.allocated.map(([, slot]) => slot));\n c.fills += o.allocated.length;\n }\n\n /** K3.2f-e: the per-kernel counters of one observation (`markStats`). */\n #countKernels(sections: readonly (readonly number[])[], misses: readonly number[], allocated: readonly (readonly [number, number])[]): void {\n const km = this.#kernelMarks!;\n // A bit per kernel for each page any kernel marked.\n const who = new Uint8Array(this.#pages);\n sections.forEach((list, k) => {\n for (const page of list) who[page]! |= 1 << k;\n });\n let union = 0;\n for (let page = 0; page < who.length; page++) if (who[page] !== 0) union++;\n km.union = union;\n km.unionPeak = Math.max(km.unionPeak, union);\n const filled = new Set(allocated.map(([page]) => page));\n sections.forEach((list, k) => {\n const c = km.byKernel[k]!;\n c.marked = list.length;\n c.markedPeak = Math.max(c.markedPeak, list.length);\n c.misses = misses[k]!;\n c.only = list.reduce((n, page) => n + (who[page] === 1 << k ? 1 : 0), 0);\n c.fillsLast = list.reduce((n, page) => n + (filled.has(page) ? 1 : 0), 0);\n c.fills += c.fillsLast;\n });\n }\n\n #fill(encoder: GPUCommandEncoder, jobs: Int32Array, slots: readonly number[]): void {\n const device = this.#device;\n const count = slots.length;\n if (!this.#jobs || this.#jobs.size < jobs.byteLength) {\n const old = this.#jobs;\n if (old) this.#retire(() => old.destroy());\n this.#jobs = device.createBuffer({ label: `${this.#label} jobs`, size: align(Math.max(jobs.byteLength, this.#budget * 32), 16), usage: BUFFER.STORAGE | BUFFER.COPY_DST });\n }\n device.queue.writeBuffer(this.#jobs, 0, new Uint8Array(jobs.buffer as ArrayBuffer));\n if (this.mode === \"f16\" && (!this.#staging || this.#staging.size < count * STAGING_BRICK_BYTES)) {\n const old = this.#staging;\n if (old) this.#retire(() => old.destroy());\n this.#staging = device.createBuffer({ label: `${this.#label} staging`, size: Math.max(count, Math.min(this.#budget, 64)) * STAGING_BRICK_BYTES, usage: BUFFER.STORAGE | BUFFER.COPY_SRC });\n }\n const p = fillPipeline(device, this.mode, this.#types);\n const group0 = device.createBindGroup({ label: `${this.#label} fill group 0`, layout: p.group0, entries: [this.#pool.bindGroupEntry(COMPUTE_SLOT)] });\n const group1 = device.createBindGroup({\n label: `${this.#label} fill group 1`,\n layout: p.group1,\n entries: [\n { binding: 0, resource: { buffer: this.#jobs, size: align(jobs.byteLength, 16) } },\n { binding: 1, resource: this.mode === \"f32\" ? this.#atlas.createView({ dimension: \"3d\" }) : { buffer: this.#staging! } },\n ],\n });\n const pass = encoder.beginComputePass({ label: `${this.#label} fill` });\n pass.setPipeline(p.pipeline);\n pass.setBindGroup(0, group0);\n pass.setBindGroup(1, group1);\n pass.dispatchWorkgroups(count);\n pass.end();\n if (this.mode === \"f16\") {\n slots.forEach((slot, j) => {\n const origin = [slot % ATLAS_BRICKS_XY, Math.floor(slot / ATLAS_BRICKS_XY) % ATLAS_BRICKS_XY, Math.floor(slot / LAYER)].map((c) => c * VDB_BRICK_SIDE);\n encoder.copyBufferToTexture(\n { buffer: this.#staging!, offset: j * STAGING_BRICK_BYTES, bytesPerRow: STAGING_ROW_WORDS * 4, rowsPerImage: VDB_BRICK_SIDE },\n { texture: this.#atlas, origin: { x: origin[0]!, y: origin[1]!, z: origin[2]! } },\n [VDB_BRICK_SIDE, VDB_BRICK_SIDE, VDB_BRICK_SIDE],\n );\n });\n }\n }\n\n /** The marks readback: map one copied in an earlier (submitted) update, or copy this window's marks and clear them. */\n #marksOut(encoder: GPUCommandEncoder): void {\n const r = this.#readback;\n if (r) {\n if (!r.mapping && r.recordedAt < this.#updates) {\n const mapping = r.buffer\n .mapAsync(0x1)\n .then(() => {\n const bits = new Uint32Array(r.buffer.getMappedRange().slice(0));\n r.buffer.unmap();\n if (r.epoch === this.#epoch) this.#observation = { bits, epoch: r.epoch };\n })\n .catch(() => {})\n .finally(() => {\n this.#mappings.delete(mapping);\n if (this.#readback === r) this.#readback = null;\n if (r.buffer.size === this.#marks.size && !this.#spare) this.#spare = r.buffer;\n else this.#retire(() => r.buffer.destroy());\n });\n r.mapping = mapping;\n this.#mappings.add(mapping);\n }\n return;\n }\n // An observation not applied yet: its marks are still the newest; copy again after it is applied.\n // Nor before a frame has sampled since the marks were cleared (the copy would be empty).\n if (this.#observation || this.#pages === 0 || this.#updates <= this.#marksFrom) return;\n const size = this.#marks.size;\n let buffer = this.#spare;\n this.#spare = null;\n if (!buffer || buffer.size !== size) {\n if (buffer) {\n const b = buffer;\n this.#retire(() => b.destroy());\n }\n buffer = this.#device.createBuffer({ label: `${this.#label} marks readback`, size, usage: BUFFER.MAP_READ | BUFFER.COPY_DST });\n }\n encoder.copyBufferToBuffer(this.#marks, 0, buffer, 0, size);\n encoder.clearBuffer(this.#marks, 0, size);\n this.#marksFrom = this.#updates;\n this.#readback = { buffer, epoch: this.#epoch, recordedAt: this.#updates, mapping: null };\n }\n\n /** Resolves when the marks readback in flight has landed. */\n async settled(): Promise<void> {\n while (this.#mappings.size) await Promise.all([...this.#mappings]);\n }\n\n // ---- group 2 ----\n\n layoutEntries(b: { pages: number; marks: number; atlas: number; sampler: number | null }, visibility: GPUShaderStageFlags): GPUBindGroupLayoutEntry[] {\n const out: GPUBindGroupLayoutEntry[] = [\n { binding: b.pages, visibility, buffer: { type: \"read-only-storage\" } },\n { binding: b.marks, visibility, buffer: { type: \"storage\" } },\n { binding: b.atlas, visibility, texture: { sampleType: this.mode === \"f32\" ? \"unfilterable-float\" : \"float\", viewDimension: \"3d\" } },\n ];\n if (b.sampler !== null) out.push({ binding: b.sampler, visibility, sampler: { type: \"filtering\" } });\n return out;\n }\n\n bindEntries(b: { pages: number; marks: number; atlas: number; sampler: number | null }): GPUBindGroupEntry[] {\n const out: GPUBindGroupEntry[] = [\n { binding: b.pages, resource: { buffer: this.#pagesBuffer } },\n { binding: b.marks, resource: { buffer: this.#marks } },\n { binding: b.atlas, resource: this.#atlas.createView({ dimension: \"3d\" }) },\n ];\n if (b.sampler !== null) out.push({ binding: b.sampler, resource: this.#sampler! });\n return out;\n }\n\n dispose(): void {\n for (const b of [this.#pagesBuffer, this.#marks, this.#staging, this.#jobs, this.#spare]) b?.destroy();\n if (this.#readback && !this.#readback.mapping) this.#readback.buffer.destroy();\n this.#atlas.destroy();\n }\n}\n"]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { WvdbDenseTexture } from "../../tools/wvdb/dense.js";
|
|
2
|
+
/** The WGSL of the fill and mip kernels (exported for probes and tests). */
|
|
3
|
+
export declare function vdbDenseFillWgsl(): string;
|
|
4
|
+
/** Where everything sits in the fill buffer of one texture (bytes), and the dispatches. */
|
|
5
|
+
export interface VDBDenseFillLayout {
|
|
6
|
+
readonly key: string;
|
|
7
|
+
readonly texelBytes: number;
|
|
8
|
+
readonly dims: readonly [number, number, number];
|
|
9
|
+
readonly srcDims: readonly [number, number, number];
|
|
10
|
+
readonly pendingByte: number;
|
|
11
|
+
readonly pendingWords: number;
|
|
12
|
+
readonly coarseByte: number;
|
|
13
|
+
readonly fineByte: number;
|
|
14
|
+
readonly mapByte: number;
|
|
15
|
+
readonly mapRow: number;
|
|
16
|
+
/** The atlas rows (null without a mip atlas). */
|
|
17
|
+
readonly atlas: {
|
|
18
|
+
readonly byte: number;
|
|
19
|
+
readonly row: number;
|
|
20
|
+
readonly dimensions: readonly [number, number, number];
|
|
21
|
+
readonly levels: number;
|
|
22
|
+
} | null;
|
|
23
|
+
/** Level 1 of the pending bricks from the coarse texels (`fill.mips` 'coarse' and a halving size). */
|
|
24
|
+
readonly coarseMips: boolean;
|
|
25
|
+
/** Buffer bytes. */
|
|
26
|
+
readonly size: number;
|
|
27
|
+
}
|
|
28
|
+
/** The fill buffer layout of `tex` (which must carry a `fill`). */
|
|
29
|
+
export declare function vdbDenseFillLayout(tex: WvdbDenseTexture): VDBDenseFillLayout;
|
|
30
|
+
/** True when `layout`'s buffer fits the device's storage binding and buffer limits (else fill on the CPU). */
|
|
31
|
+
export declare function vdbDenseFillFits(device: GPUDevice, layout: VDBDenseFillLayout): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* The GPU fill of one dense channel's textures (see the file comment). Keeps its buffer while the layout stays
|
|
34
|
+
* (the pages of one LOD), and the coarse texels it last wrote (pages share one coarse array).
|
|
35
|
+
*/
|
|
36
|
+
export declare class VDBDenseFiller {
|
|
37
|
+
#private;
|
|
38
|
+
/** Fills run (for tests and probes). */
|
|
39
|
+
runs: number;
|
|
40
|
+
constructor(device: GPUDevice, label: string);
|
|
41
|
+
/** Pipeline validation of the kernels (null = valid). */
|
|
42
|
+
get error(): Promise<GPUError | null>;
|
|
43
|
+
/** Bytes of this filler's buffers. */
|
|
44
|
+
get gpuBytes(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Fills `map` (and `mip`, the atlas texture, when `tex` has one) with `tex` and its pending bricks upsampled, and
|
|
47
|
+
* submits the work. `tex.fill` must be set; `map`/`mip` must have `tex`'s sizes and `COPY_DST`.
|
|
48
|
+
* @returns the buffers it replaced (the caller retires them).
|
|
49
|
+
*/
|
|
50
|
+
fill(map: GPUTexture, mip: GPUTexture | null, tex: WvdbDenseTexture): GPUBuffer[];
|
|
51
|
+
/** The buffers this filler holds (the caller retires them), and forget them. */
|
|
52
|
+
release(): GPUBuffer[];
|
|
53
|
+
}
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
|
|
2
|
+
// src/three-openvdb/wvdb/wvdbKernel.js upsample L122–188 (a multi-page LOD shows the previous LOD upsampled in the
|
|
3
|
+
// bricks not decoded yet), src/three-openvdb/frame/webgpu/frameMipmaps.js downsample L20–62 and packAtlas L65–88.
|
|
4
|
+
// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
|
|
5
|
+
// Changes: WGSL compute instead of his worker / CPU loops; integer weights (8 fractional bits) so the CPU twin
|
|
6
|
+
// (`tools/wvdb/partial.ts` wvdbUpsampleTexels, `wvdbMipAtlas`) agrees byte for byte; only pending bricks upsample.
|
|
7
|
+
// Divergences: DIVERGES.md (K4.22 row).
|
|
8
|
+
/**
|
|
9
|
+
* K4.22: the dense source's GPU fill of a partially streamed `.wvdb` LOD (`WvdbDenseTexture.fill`). One storage
|
|
10
|
+
* buffer holds, at byte offsets: the pending-brick bits, the coarser LOD's texels, the partial LOD's texels (both
|
|
11
|
+
* tight, as the host has them), then the texture's rows and the mip atlas's rows padded to 256 bytes (copy layout).
|
|
12
|
+
* One compute pass:
|
|
13
|
+
*
|
|
14
|
+
* 1. `vdbDenseFillCs`, one thread per texel: a pending brick's texel is the coarse texels' trilinear upsample
|
|
15
|
+
* (his `axis`: centres aligned, edges clamped; weights in 1/256, the sum rounded half up once), any other texel
|
|
16
|
+
* is the host's; written into the cleared row region with `atomicOr` per byte.
|
|
17
|
+
* 2. `vdbDenseMipCs`, one dispatch per mip level, one thread per texel: his box downsample (`(sum of 8 + 4) >> 3`,
|
|
18
|
+
* edge taps clamped) of the level below, into the atlas at his x offset (`atlasWidth − atlasWidth / 2^(l−1)`).
|
|
19
|
+
* With `mips: 'coarse'` (the default fill) level 1 of a pending brick is the coarser LOD's texel instead: the LOD
|
|
20
|
+
* the bake box-filtered from this one, so a far view of a pending brick reads it, not a blur of its upsample.
|
|
21
|
+
*
|
|
22
|
+
* Then `copyBufferToTexture` into the source's texture and atlas. The work is submitted at once (the source's
|
|
23
|
+
* `replace` acts on the queue, as `writeTexture` does), so a later `replace` lands after it. r8unorm is not a
|
|
24
|
+
* storage-texture format in core WebGPU, hence the buffer and the copies (Traps: the f16 multi-scale chain does
|
|
25
|
+
* the same). A texture whose buffer would pass `maxStorageBufferBindingSize` or `maxBufferSize` is filled on the
|
|
26
|
+
* CPU by the twin instead (`vdbDenseFillFits`).
|
|
27
|
+
*/
|
|
28
|
+
import { VDBError } from "../errors.js";
|
|
29
|
+
import { USAGE, WORKGROUP_AXIS } from "../compute/shared.js";
|
|
30
|
+
import { wvdbFillCoarseMips } from "../../tools/wvdb/partial.js";
|
|
31
|
+
const W = WORKGROUP_AXIS;
|
|
32
|
+
const STAGE_COMPUTE = 0x4;
|
|
33
|
+
/** Uniform slot stride (minUniformBufferOffsetAlignment's default). */
|
|
34
|
+
const SLOT = 256;
|
|
35
|
+
const PARAMS_BYTES = 96;
|
|
36
|
+
const BRICK = 8;
|
|
37
|
+
const FILL_WGSL = /* wgsl */ `
|
|
38
|
+
struct VdbDenseFillParams {
|
|
39
|
+
dims: vec3u,
|
|
40
|
+
texelBytes: u32,
|
|
41
|
+
srcDims: vec3u,
|
|
42
|
+
pendingWord: u32,
|
|
43
|
+
bricks: vec3u,
|
|
44
|
+
coarseByte: u32,
|
|
45
|
+
fineByte: u32,
|
|
46
|
+
dstByte: u32,
|
|
47
|
+
dstRow: u32,
|
|
48
|
+
dstRows: u32,
|
|
49
|
+
dstX: u32,
|
|
50
|
+
srcByte: u32,
|
|
51
|
+
srcRow: u32,
|
|
52
|
+
srcRows: u32,
|
|
53
|
+
srcX: u32,
|
|
54
|
+
coarseMip: u32,
|
|
55
|
+
pad1: u32,
|
|
56
|
+
pad2: u32,
|
|
57
|
+
};
|
|
58
|
+
@group(0) @binding(0) var<uniform> vdbFillP: VdbDenseFillParams;
|
|
59
|
+
@group(0) @binding(1) var<storage, read_write> vdbFillBuf: array<atomic<u32>>;
|
|
60
|
+
|
|
61
|
+
// Byte b of the buffer, and an OR of v into byte b (the row regions are cleared before the pass).
|
|
62
|
+
fn vdbFillLoad(b: u32) -> u32 {
|
|
63
|
+
return (atomicLoad(&vdbFillBuf[b >> 2u]) >> ((b & 3u) * 8u)) & 0xffu;
|
|
64
|
+
}
|
|
65
|
+
fn vdbFillStore(b: u32, v: u32) {
|
|
66
|
+
atomicOr(&vdbFillBuf[b >> 2u], (v & 0xffu) << ((b & 3u) * 8u));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// His upsample axis in integers: target texel i of size reads clamp((i + 1/2) src / size - 1/2, 0, src - 1);
|
|
70
|
+
// returns (lower tap, upper tap, upper weight in 1/256, the exact fraction rounded half up).
|
|
71
|
+
fn vdbFillAxis(i: u32, size: u32, src: u32) -> vec3u {
|
|
72
|
+
let den = 2u * size;
|
|
73
|
+
let num = min(u32(max(i32((2u * i + 1u) * src) - i32(size), 0)), (src - 1u) * den);
|
|
74
|
+
let lo = num / den;
|
|
75
|
+
let r = num - lo * den;
|
|
76
|
+
return vec3u(lo, min(lo + 1u, src - 1u), (r * 256u + size) / den);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
fn vdbFillTap(i: u32, c: u32) -> u32 {
|
|
80
|
+
return vdbFillLoad(vdbFillP.coarseByte + i * vdbFillP.texelBytes + c);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@compute @workgroup_size(${W}, ${W}, ${W})
|
|
84
|
+
fn vdbDenseFillCs(@builtin(global_invocation_id) id: vec3u) {
|
|
85
|
+
let p = vdbFillP;
|
|
86
|
+
if any(id >= p.dims) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
let brick = (id.x >> 3u) + p.bricks.x * ((id.y >> 3u) + p.bricks.y * (id.z >> 3u));
|
|
90
|
+
let pending = (atomicLoad(&vdbFillBuf[p.pendingWord + (brick >> 5u)]) >> (brick & 31u)) & 1u;
|
|
91
|
+
let dst = p.dstByte + (id.z * p.dstRows + id.y) * p.dstRow + (p.dstX + id.x) * p.texelBytes;
|
|
92
|
+
if pending == 0u {
|
|
93
|
+
let src = p.fineByte + ((id.z * p.dims.y + id.y) * p.dims.x + id.x) * p.texelBytes;
|
|
94
|
+
for (var c = 0u; c < p.texelBytes; c++) {
|
|
95
|
+
vdbFillStore(dst + c, vdbFillLoad(src + c));
|
|
96
|
+
}
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
let ax = vdbFillAxis(id.x, p.dims.x, p.srcDims.x);
|
|
100
|
+
let ay = vdbFillAxis(id.y, p.dims.y, p.srcDims.y);
|
|
101
|
+
let az = vdbFillAxis(id.z, p.dims.z, p.srcDims.z);
|
|
102
|
+
let r00 = (ay.x + az.x * p.srcDims.y) * p.srcDims.x;
|
|
103
|
+
let r10 = (ay.y + az.x * p.srcDims.y) * p.srcDims.x;
|
|
104
|
+
let r01 = (ay.x + az.y * p.srcDims.y) * p.srcDims.x;
|
|
105
|
+
let r11 = (ay.y + az.y * p.srcDims.y) * p.srcDims.x;
|
|
106
|
+
for (var c = 0u; c < p.texelBytes; c++) {
|
|
107
|
+
let c00 = vdbFillTap(ax.x + r00, c) * (256u - ax.z) + vdbFillTap(ax.y + r00, c) * ax.z;
|
|
108
|
+
let c10 = vdbFillTap(ax.x + r10, c) * (256u - ax.z) + vdbFillTap(ax.y + r10, c) * ax.z;
|
|
109
|
+
let c01 = vdbFillTap(ax.x + r01, c) * (256u - ax.z) + vdbFillTap(ax.y + r01, c) * ax.z;
|
|
110
|
+
let c11 = vdbFillTap(ax.x + r11, c) * (256u - ax.z) + vdbFillTap(ax.y + r11, c) * ax.z;
|
|
111
|
+
let c0 = c00 * (256u - ay.z) + c10 * ay.z;
|
|
112
|
+
let c1 = c01 * (256u - ay.z) + c11 * ay.z;
|
|
113
|
+
vdbFillStore(dst + c, (c0 * (256u - az.z) + c1 * az.z + 0x800000u) >> 24u);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
fn vdbMipTap(x: u32, y: u32, z: u32, c: u32) -> u32 {
|
|
118
|
+
let p = vdbFillP;
|
|
119
|
+
return vdbFillLoad(p.srcByte + (z * p.srcRows + y) * p.srcRow + (p.srcX + x) * p.texelBytes + c);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@compute @workgroup_size(${W}, ${W}, ${W})
|
|
123
|
+
fn vdbDenseMipCs(@builtin(global_invocation_id) id: vec3u) {
|
|
124
|
+
let p = vdbFillP;
|
|
125
|
+
if any(id >= p.dims) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
let s = p.srcDims - vec3u(1u);
|
|
129
|
+
let x0 = min(id.x * 2u, s.x);
|
|
130
|
+
let x1 = min(id.x * 2u + 1u, s.x);
|
|
131
|
+
let y0 = min(id.y * 2u, s.y);
|
|
132
|
+
let y1 = min(id.y * 2u + 1u, s.y);
|
|
133
|
+
let z0 = min(id.z * 2u, s.z);
|
|
134
|
+
let z1 = min(id.z * 2u + 1u, s.z);
|
|
135
|
+
let dst = p.dstByte + (id.z * p.dstRows + id.y) * p.dstRow + (p.dstX + id.x) * p.texelBytes;
|
|
136
|
+
if p.coarseMip != 0u {
|
|
137
|
+
// Level 1 of a pending brick: the coarser LOD's texel (its size is level 1's). Children 2x, 2x + 1 share a brick.
|
|
138
|
+
let brick = ((id.x * 2u) >> 3u) + p.bricks.x * (((id.y * 2u) >> 3u) + p.bricks.y * ((id.z * 2u) >> 3u));
|
|
139
|
+
if ((atomicLoad(&vdbFillBuf[p.pendingWord + (brick >> 5u)]) >> (brick & 31u)) & 1u) != 0u {
|
|
140
|
+
let src = p.coarseByte + ((id.z * p.dims.y + id.y) * p.dims.x + id.x) * p.texelBytes;
|
|
141
|
+
for (var c = 0u; c < p.texelBytes; c++) {
|
|
142
|
+
vdbFillStore(dst + c, vdbFillLoad(src + c));
|
|
143
|
+
}
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
for (var c = 0u; c < p.texelBytes; c++) {
|
|
148
|
+
let sum = vdbMipTap(x0, y0, z0, c) + vdbMipTap(x1, y0, z0, c) + vdbMipTap(x0, y1, z0, c) + vdbMipTap(x1, y1, z0, c)
|
|
149
|
+
+ vdbMipTap(x0, y0, z1, c) + vdbMipTap(x1, y0, z1, c) + vdbMipTap(x0, y1, z1, c) + vdbMipTap(x1, y1, z1, c);
|
|
150
|
+
vdbFillStore(dst + c, (sum + 4u) >> 3u);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
154
|
+
/** The WGSL of the fill and mip kernels (exported for probes and tests). */
|
|
155
|
+
export function vdbDenseFillWgsl() {
|
|
156
|
+
return FILL_WGSL;
|
|
157
|
+
}
|
|
158
|
+
const align = (n, a) => Math.ceil(n / a) * a;
|
|
159
|
+
const levelSize = (size, level) => Math.max(1, Math.ceil(size / 2 ** level));
|
|
160
|
+
/** The fill buffer layout of `tex` (which must carry a `fill`). */
|
|
161
|
+
export function vdbDenseFillLayout(tex) {
|
|
162
|
+
const fill = tex.fill;
|
|
163
|
+
if (!fill)
|
|
164
|
+
throw new VDBError("VDB_BAD_OPTION", "vdbDenseFillLayout: the texture has no fill.");
|
|
165
|
+
const tb = tex.texelBytes;
|
|
166
|
+
const dims = [...tex.dimensions];
|
|
167
|
+
const srcDims = [...fill.from.dimensions];
|
|
168
|
+
const bricks = dims.map((d) => Math.ceil(d / BRICK));
|
|
169
|
+
const pendingWords = Math.ceil((bricks[0] * bricks[1] * bricks[2]) / 32);
|
|
170
|
+
const coarseByte = align(pendingWords * 4, 16);
|
|
171
|
+
const fineByte = coarseByte + align(srcDims[0] * srcDims[1] * srcDims[2] * tb, 16);
|
|
172
|
+
const mapByte = align(fineByte + dims[0] * dims[1] * dims[2] * tb, 256);
|
|
173
|
+
const mapRow = align(dims[0] * tb, 256);
|
|
174
|
+
let end = mapByte + mapRow * dims[1] * dims[2];
|
|
175
|
+
let atlas = null;
|
|
176
|
+
if (tex.mip) {
|
|
177
|
+
const a = tex.mip.dimensions;
|
|
178
|
+
atlas = { byte: align(end, 256), row: align(a[0] * tb, 256), dimensions: [a[0], a[1], a[2]], levels: tex.mip.levels };
|
|
179
|
+
end = atlas.byte + atlas.row * a[1] * a[2];
|
|
180
|
+
}
|
|
181
|
+
const coarseMips = !!atlas && wvdbFillCoarseMips(tex);
|
|
182
|
+
return {
|
|
183
|
+
key: `${dims.join("x")}|${srcDims.join("x")}|${tb}|${atlas ? `${atlas.dimensions.join("x")}:${atlas.levels}` : "-"}|${coarseMips ? "coarse" : "box"}`,
|
|
184
|
+
texelBytes: tb,
|
|
185
|
+
dims,
|
|
186
|
+
srcDims,
|
|
187
|
+
pendingByte: 0,
|
|
188
|
+
pendingWords,
|
|
189
|
+
coarseByte,
|
|
190
|
+
fineByte,
|
|
191
|
+
mapByte,
|
|
192
|
+
mapRow,
|
|
193
|
+
atlas,
|
|
194
|
+
coarseMips,
|
|
195
|
+
size: align(end, 4),
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
/** The dispatches of a layout: the fill, then one per mip level (level 1 reads the texture rows, then the atlas). */
|
|
199
|
+
function dispatchesOf(l) {
|
|
200
|
+
const [w, h, d] = l.dims;
|
|
201
|
+
const bricks = l.dims.map((v) => Math.ceil(v / BRICK));
|
|
202
|
+
const params = (o) => {
|
|
203
|
+
const u = new Uint32Array(PARAMS_BYTES / 4);
|
|
204
|
+
const vec = (at, v) => u.set(v, at);
|
|
205
|
+
vec(0, o.dims ?? [0, 0, 0]);
|
|
206
|
+
u[3] = l.texelBytes;
|
|
207
|
+
vec(4, o.srcDims ?? [0, 0, 0]);
|
|
208
|
+
u[7] = l.pendingByte / 4;
|
|
209
|
+
vec(8, bricks);
|
|
210
|
+
u[11] = l.coarseByte;
|
|
211
|
+
u[12] = l.fineByte;
|
|
212
|
+
u[13] = o.dstByte;
|
|
213
|
+
u[14] = o.dstRow;
|
|
214
|
+
u[15] = o.dstRows;
|
|
215
|
+
u[16] = o.dstX ?? 0;
|
|
216
|
+
u[17] = o.srcByte ?? 0;
|
|
217
|
+
u[18] = o.srcRow ?? 0;
|
|
218
|
+
u[19] = o.srcRows ?? 0;
|
|
219
|
+
u[20] = o.srcX ?? 0;
|
|
220
|
+
u[21] = o.coarseMip ?? 0;
|
|
221
|
+
return u;
|
|
222
|
+
};
|
|
223
|
+
const out = [{ entry: "fill", dims: [w, h, d], params: params({ dims: l.dims, srcDims: l.srcDims, dstByte: l.mapByte, dstRow: l.mapRow, dstRows: h, dstX: 0 }) }];
|
|
224
|
+
const a = l.atlas;
|
|
225
|
+
if (a) {
|
|
226
|
+
const aw = a.dimensions[0];
|
|
227
|
+
const xOf = (level) => aw - aw / 2 ** (level - 1);
|
|
228
|
+
for (let level = 1; level <= a.levels; level++) {
|
|
229
|
+
const dims = [levelSize(w, level), levelSize(h, level), levelSize(d, level)];
|
|
230
|
+
const src = level === 1 ? { srcByte: l.mapByte, srcRow: l.mapRow, srcRows: h, srcX: 0 } : { srcByte: a.byte, srcRow: a.row, srcRows: a.dimensions[1], srcX: xOf(level - 1) };
|
|
231
|
+
const srcDims = [levelSize(w, level - 1), levelSize(h, level - 1), levelSize(d, level - 1)];
|
|
232
|
+
const coarseMip = level === 1 && l.coarseMips ? 1 : 0;
|
|
233
|
+
out.push({ entry: "mip", dims, params: params({ dims, srcDims, dstByte: a.byte, dstRow: a.row, dstRows: a.dimensions[1], dstX: xOf(level), coarseMip, ...src }) });
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
return out;
|
|
237
|
+
}
|
|
238
|
+
/** True when `layout`'s buffer fits the device's storage binding and buffer limits (else fill on the CPU). */
|
|
239
|
+
export function vdbDenseFillFits(device, layout) {
|
|
240
|
+
const limits = device.limits ?? {};
|
|
241
|
+
const binding = limits.maxStorageBufferBindingSize ?? 128 * 1024 * 1024;
|
|
242
|
+
const buffer = limits.maxBufferSize ?? 256 * 1024 * 1024;
|
|
243
|
+
return layout.size <= binding && layout.size <= buffer;
|
|
244
|
+
}
|
|
245
|
+
const pipelines = new WeakMap();
|
|
246
|
+
function fillPipelines(device) {
|
|
247
|
+
const cached = pipelines.get(device);
|
|
248
|
+
if (cached)
|
|
249
|
+
return cached;
|
|
250
|
+
device.pushErrorScope("validation");
|
|
251
|
+
const group0 = device.createBindGroupLayout({
|
|
252
|
+
label: "vdb dense fill group 0",
|
|
253
|
+
entries: [
|
|
254
|
+
{ binding: 0, visibility: STAGE_COMPUTE, buffer: { type: "uniform", hasDynamicOffset: true, minBindingSize: PARAMS_BYTES } },
|
|
255
|
+
{ binding: 1, visibility: STAGE_COMPUTE, buffer: { type: "storage" } },
|
|
256
|
+
],
|
|
257
|
+
});
|
|
258
|
+
const module = device.createShaderModule({ label: "vdb dense fill", code: FILL_WGSL });
|
|
259
|
+
const layout = device.createPipelineLayout({ label: "vdb dense fill", bindGroupLayouts: [group0] });
|
|
260
|
+
const make = (entryPoint) => device.createComputePipeline({ label: `vdb dense fill ${entryPoint}`, layout, compute: { module, entryPoint } });
|
|
261
|
+
const error = device.popErrorScope().then((e) => {
|
|
262
|
+
if (e)
|
|
263
|
+
console.error(`@pmndrs/vdb vdbDenseSource: the fill kernels are invalid: ${e.message}`);
|
|
264
|
+
return e;
|
|
265
|
+
});
|
|
266
|
+
const p = { fill: make("vdbDenseFillCs"), mip: make("vdbDenseMipCs"), group0, error };
|
|
267
|
+
pipelines.set(device, p);
|
|
268
|
+
return p;
|
|
269
|
+
}
|
|
270
|
+
/** Writes `data` at `offset` (bytes) with `writeBuffer`'s 4-byte size rule: the tail goes through a padded word. */
|
|
271
|
+
function writeBytes(device, buffer, offset, data) {
|
|
272
|
+
const body = data.byteLength & ~3;
|
|
273
|
+
if (body > 0)
|
|
274
|
+
device.queue.writeBuffer(buffer, offset, data, 0, body);
|
|
275
|
+
if (body < data.byteLength) {
|
|
276
|
+
const tail = new Uint8Array(4);
|
|
277
|
+
tail.set(data.subarray(body));
|
|
278
|
+
device.queue.writeBuffer(buffer, offset + body, tail);
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The GPU fill of one dense channel's textures (see the file comment). Keeps its buffer while the layout stays
|
|
283
|
+
* (the pages of one LOD), and the coarse texels it last wrote (pages share one coarse array).
|
|
284
|
+
*/
|
|
285
|
+
export class VDBDenseFiller {
|
|
286
|
+
#device;
|
|
287
|
+
#label;
|
|
288
|
+
#layout = null;
|
|
289
|
+
#buffer = null;
|
|
290
|
+
#params = null;
|
|
291
|
+
#group = null;
|
|
292
|
+
#dispatches = [];
|
|
293
|
+
#coarse = null;
|
|
294
|
+
/** Fills run (for tests and probes). */
|
|
295
|
+
runs = 0;
|
|
296
|
+
constructor(device, label) {
|
|
297
|
+
this.#device = device;
|
|
298
|
+
this.#label = label;
|
|
299
|
+
}
|
|
300
|
+
/** Pipeline validation of the kernels (null = valid). */
|
|
301
|
+
get error() {
|
|
302
|
+
return fillPipelines(this.#device).error;
|
|
303
|
+
}
|
|
304
|
+
/** Bytes of this filler's buffers. */
|
|
305
|
+
get gpuBytes() {
|
|
306
|
+
return (this.#buffer?.size ?? 0) + (this.#params?.size ?? 0);
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Fills `map` (and `mip`, the atlas texture, when `tex` has one) with `tex` and its pending bricks upsampled, and
|
|
310
|
+
* submits the work. `tex.fill` must be set; `map`/`mip` must have `tex`'s sizes and `COPY_DST`.
|
|
311
|
+
* @returns the buffers it replaced (the caller retires them).
|
|
312
|
+
*/
|
|
313
|
+
fill(map, mip, tex) {
|
|
314
|
+
const fill = tex.fill;
|
|
315
|
+
const device = this.#device;
|
|
316
|
+
const layout = vdbDenseFillLayout(tex);
|
|
317
|
+
const retired = [];
|
|
318
|
+
if (!this.#layout || this.#layout.key !== layout.key) {
|
|
319
|
+
if (this.#buffer)
|
|
320
|
+
retired.push(this.#buffer, this.#params);
|
|
321
|
+
this.#layout = layout;
|
|
322
|
+
this.#dispatches = dispatchesOf(layout);
|
|
323
|
+
this.#buffer = device.createBuffer({ label: `${this.#label} fill`, size: layout.size, usage: USAGE.STORAGE | USAGE.COPY_DST | USAGE.COPY_SRC });
|
|
324
|
+
this.#params = device.createBuffer({ label: `${this.#label} fill params`, size: this.#dispatches.length * SLOT, usage: USAGE.UNIFORM | USAGE.COPY_DST });
|
|
325
|
+
const bytes = new Uint8Array(this.#dispatches.length * SLOT);
|
|
326
|
+
this.#dispatches.forEach((d, i) => bytes.set(new Uint8Array(d.params.buffer), i * SLOT));
|
|
327
|
+
device.queue.writeBuffer(this.#params, 0, bytes);
|
|
328
|
+
const p = fillPipelines(device);
|
|
329
|
+
this.#group = device.createBindGroup({
|
|
330
|
+
label: `${this.#label} fill group`,
|
|
331
|
+
layout: p.group0,
|
|
332
|
+
entries: [
|
|
333
|
+
{ binding: 0, resource: { buffer: this.#params, size: PARAMS_BYTES } },
|
|
334
|
+
{ binding: 1, resource: { buffer: this.#buffer } },
|
|
335
|
+
],
|
|
336
|
+
});
|
|
337
|
+
this.#coarse = null;
|
|
338
|
+
}
|
|
339
|
+
const buffer = this.#buffer;
|
|
340
|
+
const l = this.#layout;
|
|
341
|
+
device.queue.writeBuffer(buffer, l.pendingByte, new Uint32Array(fill.pending.subarray(0, l.pendingWords)));
|
|
342
|
+
if (this.#coarse !== fill.from.data) {
|
|
343
|
+
writeBytes(device, buffer, l.coarseByte, fill.from.data);
|
|
344
|
+
this.#coarse = fill.from.data;
|
|
345
|
+
}
|
|
346
|
+
writeBytes(device, buffer, l.fineByte, tex.data);
|
|
347
|
+
const p = fillPipelines(device);
|
|
348
|
+
const encoder = device.createCommandEncoder({ label: `${this.#label} fill` });
|
|
349
|
+
encoder.clearBuffer(buffer, l.mapByte, l.size - l.mapByte);
|
|
350
|
+
const pass = encoder.beginComputePass({ label: `${this.#label} fill` });
|
|
351
|
+
this.#dispatches.forEach((d, i) => {
|
|
352
|
+
pass.setPipeline(d.entry === "fill" ? p.fill : p.mip);
|
|
353
|
+
pass.setBindGroup(0, this.#group, [i * SLOT]);
|
|
354
|
+
pass.dispatchWorkgroups(Math.ceil(d.dims[0] / W), Math.ceil(d.dims[1] / W), Math.ceil(d.dims[2] / W));
|
|
355
|
+
});
|
|
356
|
+
pass.end();
|
|
357
|
+
const [w, h, d] = l.dims;
|
|
358
|
+
encoder.copyBufferToTexture({ buffer, offset: l.mapByte, bytesPerRow: l.mapRow, rowsPerImage: h }, { texture: map }, [w, h, d]);
|
|
359
|
+
if (l.atlas && mip) {
|
|
360
|
+
const [aw, ah, ad] = l.atlas.dimensions;
|
|
361
|
+
encoder.copyBufferToTexture({ buffer, offset: l.atlas.byte, bytesPerRow: l.atlas.row, rowsPerImage: ah }, { texture: mip }, [aw, ah, ad]);
|
|
362
|
+
}
|
|
363
|
+
device.queue.submit([encoder.finish()]);
|
|
364
|
+
this.runs++;
|
|
365
|
+
return retired;
|
|
366
|
+
}
|
|
367
|
+
/** The buffers this filler holds (the caller retires them), and forget them. */
|
|
368
|
+
release() {
|
|
369
|
+
const out = this.#buffer ? [this.#buffer, this.#params] : [];
|
|
370
|
+
this.#buffer = this.#params = null;
|
|
371
|
+
this.#group = null;
|
|
372
|
+
this.#layout = null;
|
|
373
|
+
this.#coarse = null;
|
|
374
|
+
return out;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=dense-fill.js.map
|