@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
package/dist/core/pool/pool.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
* `VDBGridPool`: many NanoVDB grids in one `GPUBuffer` behind a grid table
|
|
3
3
|
* (docs/dev/design/K1-core.md §1, §4; D8, D10).
|
|
4
4
|
*
|
|
5
|
-
* Model: CPU calls (`add`, `replace`, `remove`, `setTransform`, `setMajorant
|
|
6
|
-
* stage changes and return at once; `update(encoder)` applies them
|
|
5
|
+
* Model: CPU calls (`add`, `replace`, `remove`, `setTransform`, `setMajorant`,
|
|
6
|
+
* `buildMajorant`) stage changes and return at once; `update(encoder)` applies them
|
|
7
|
+
* (and records the staged GPU majorant builds, P1.15). Growth and
|
|
7
8
|
* compaction happen only in `update`, by a new buffer plus copies of the ranges
|
|
8
9
|
* that were resident before that update; `version` bumps then (and when a
|
|
9
10
|
* failed growth rolls back to the previous buffer).
|
|
@@ -19,10 +20,13 @@
|
|
|
19
20
|
* have passed, and `queue.onSubmittedWorkDone()` asked at that point resolves.
|
|
20
21
|
*/
|
|
21
22
|
import { VDBError } from "../errors.js";
|
|
23
|
+
import { brickMajorantLayout } from "../../tools/cpu/majorant.js";
|
|
24
|
+
import { VDBToolsError } from "../../tools/errors.js";
|
|
25
|
+
import { MAJORANT_BUILD_MAX_LOG2, MAJORANT_BUILD_PARAMS_BYTES, majorantBuildPipeline, packMajorantBuild, } from "../compute/majorant-build.js";
|
|
22
26
|
import { applyAffine, composeGridAffines } from "./affine.js";
|
|
23
27
|
import { RangeAllocator } from "./allocator.js";
|
|
24
28
|
import { gridClassName, readImageHeader } from "./image-header.js";
|
|
25
|
-
import { VDB_GPU_LAYOUT_VERSION, VDB_POOL_HEADER_WORDS, VDB_POOL_RECORD_WORDS, align32, dataStartOffset, encodeHeader, encodeRecord, recordByteOffset, } from "./layout.js";
|
|
29
|
+
import { VDB_GPU_LAYOUT_VERSION, VDB_MAJORANT_HEADER_BYTES, VDB_POOL_HEADER_WORDS, VDB_POOL_RECORD_WORDS, align32, dataStartOffset, encodeHeader, encodeMajorantRange, encodeRecord, recordByteOffset, } from "./layout.js";
|
|
26
30
|
import { BUFFER_USAGE, POOL_BUFFER_USAGE, deviceByteLimit, floor32, requiredLimits, unsupportedReason, watchDevice, } from "./limits.js";
|
|
27
31
|
/** Updates a retired buffer must outlive before the pool asks the queue about it (one update of slack to submit). */
|
|
28
32
|
const RETIRE_AFTER_UPDATES = 2;
|
|
@@ -42,7 +46,11 @@ function copyTransform(m) {
|
|
|
42
46
|
return null;
|
|
43
47
|
return Float64Array.from(m);
|
|
44
48
|
}
|
|
45
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Checks a brick majorant and packs its range (P1.3: header, upper bounds, optional lower bounds;
|
|
51
|
+
* `encodeMajorantRange`). Without `origin` the cells start at the grid's `indexBBoxMin - 1`.
|
|
52
|
+
*/
|
|
53
|
+
function validateMajorant(m, header) {
|
|
46
54
|
if (typeof m !== "object" || m === null)
|
|
47
55
|
badOption("majorant must be { brickLog2, dims, data } or null.");
|
|
48
56
|
checkCount("majorant.brickLog2", m.brickLog2, 0);
|
|
@@ -60,10 +68,75 @@ function validateMajorant(m) {
|
|
|
60
68
|
if (m.data.length !== cells) {
|
|
61
69
|
badOption(`majorant.data has ${m.data.length} values; dims ${dims.join("x")} need ${cells}. Rebuild the majorant.`);
|
|
62
70
|
}
|
|
63
|
-
|
|
71
|
+
if (m.minima !== undefined) {
|
|
72
|
+
if (!(m.minima instanceof Float32Array))
|
|
73
|
+
badOption("majorant.minima must be a Float32Array (or absent).");
|
|
74
|
+
if (m.minima.length !== cells)
|
|
75
|
+
badOption(`majorant.minima has ${m.minima.length} values; dims ${dims.join("x")} need ${cells}. Rebuild the majorant.`);
|
|
76
|
+
}
|
|
77
|
+
let origin;
|
|
78
|
+
if (m.origin === undefined) {
|
|
79
|
+
const lo = header.indexBBoxMin;
|
|
80
|
+
origin = [lo[0] - 1, lo[1] - 1, lo[2] - 1];
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
if ((!Array.isArray(m.origin) && !ArrayBuffer.isView(m.origin)) || m.origin.length !== 3)
|
|
84
|
+
badOption("majorant.origin must be [x, y, z].");
|
|
85
|
+
origin = [m.origin[0], m.origin[1], m.origin[2]];
|
|
86
|
+
origin.forEach((v, k) => {
|
|
87
|
+
if (!Number.isInteger(v) || v < -(2 ** 31) || v >= 2 ** 31)
|
|
88
|
+
badOption(`majorant.origin[${k}] must be a 32-bit integer, got ${String(v)}.`);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const minima = m.minima !== undefined;
|
|
92
|
+
const bytes = VDB_MAJORANT_HEADER_BYTES + cells * 4 * (minima ? 2 : 1);
|
|
64
93
|
if (bytes > 2 ** 32 - 32)
|
|
65
94
|
badOption(`majorant needs ${bytes} bytes; the pool addresses ranges with 32 bits.`);
|
|
66
|
-
|
|
95
|
+
const pending = encodeMajorantRange({ origin, dims, data: m.data, minima: m.minima });
|
|
96
|
+
return { brickLog2: m.brickLog2, dims, origin, minima, bytes, pending, retained: null, range: null, resident: false, gpu: null };
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Lays out a GPU-built brick majorant for `header` (P1.15): the CPU twin's layout (`brickMajorantLayout`, so origin and
|
|
100
|
+
* dims equal `tools` `vdbBrickMajorant`'s), no data; `update` records the build.
|
|
101
|
+
*/
|
|
102
|
+
function gpuMajorant(options, header) {
|
|
103
|
+
let layout;
|
|
104
|
+
try {
|
|
105
|
+
layout = brickMajorantLayout(header.indexBBoxMin, header.indexBBoxMax, options);
|
|
106
|
+
}
|
|
107
|
+
catch (e) {
|
|
108
|
+
if (e instanceof VDBToolsError)
|
|
109
|
+
badOption(`buildMajorant: ${e.message.replace(/^.*?vdbBrickMajorant: /, "")}`);
|
|
110
|
+
throw e;
|
|
111
|
+
}
|
|
112
|
+
if (layout.brickLog2 > MAJORANT_BUILD_MAX_LOG2) {
|
|
113
|
+
badOption(`buildMajorant: brickLog2 ${layout.brickLog2} is over the GPU builder's ${MAJORANT_BUILD_MAX_LOG2} (one workgroup reads (B + 1)³ taps per cell). ` +
|
|
114
|
+
"Build it on the CPU (tools vdbBrickMajorant) and pass it to setMajorant.");
|
|
115
|
+
}
|
|
116
|
+
const minima = options.minima === true;
|
|
117
|
+
const cells = layout.dims[0] * layout.dims[1] * layout.dims[2];
|
|
118
|
+
const bytes = VDB_MAJORANT_HEADER_BYTES + cells * 4 * (minima ? 2 : 1);
|
|
119
|
+
if (bytes > 2 ** 32 - 32)
|
|
120
|
+
badOption(`buildMajorant: the majorant needs ${bytes} bytes; the pool addresses ranges with 32 bits.`);
|
|
121
|
+
const gpu = {
|
|
122
|
+
options: { ...options },
|
|
123
|
+
zero: layout.zero,
|
|
124
|
+
pathtracer: layout.align === "pathtracer",
|
|
125
|
+
resolution: layout.resolution,
|
|
126
|
+
stale: true,
|
|
127
|
+
};
|
|
128
|
+
return {
|
|
129
|
+
brickLog2: layout.brickLog2,
|
|
130
|
+
dims: layout.dims,
|
|
131
|
+
origin: layout.origin,
|
|
132
|
+
minima,
|
|
133
|
+
bytes,
|
|
134
|
+
pending: null,
|
|
135
|
+
retained: null,
|
|
136
|
+
range: null,
|
|
137
|
+
resident: false,
|
|
138
|
+
gpu,
|
|
139
|
+
};
|
|
67
140
|
}
|
|
68
141
|
/**
|
|
69
142
|
* `queue.writeBuffer` for any typed array. The WebGPU typings want an
|
|
@@ -73,11 +146,11 @@ function validateMajorant(m) {
|
|
|
73
146
|
function write(queue, buffer, offset, data) {
|
|
74
147
|
queue.writeBuffer(buffer, offset, data);
|
|
75
148
|
}
|
|
76
|
-
function checkValueMax(v) {
|
|
149
|
+
function checkValueMax(v, what = "valueMax must be a number") {
|
|
77
150
|
if (v === undefined)
|
|
78
151
|
return undefined;
|
|
79
152
|
if (typeof v !== "number" || Number.isNaN(v))
|
|
80
|
-
badOption(
|
|
153
|
+
badOption(`${what}, got ${String(v)}.`);
|
|
81
154
|
return v;
|
|
82
155
|
}
|
|
83
156
|
/**
|
|
@@ -109,6 +182,17 @@ export class VDBGridPool {
|
|
|
109
182
|
#dirtyRecords = new Set();
|
|
110
183
|
#headerDirty = true;
|
|
111
184
|
#disposed = false;
|
|
185
|
+
/**
|
|
186
|
+
* Use {@link VDBGridPool.create}.
|
|
187
|
+
*
|
|
188
|
+
* @param device The host's device.
|
|
189
|
+
* @param buffer The pool buffer.
|
|
190
|
+
* @param owns True when the pool created `buffer` and frees it.
|
|
191
|
+
* @param capacity Grid table capacity in grids.
|
|
192
|
+
* @param limit Upper bound on the buffer size in bytes.
|
|
193
|
+
* @param label Debug label of the buffers.
|
|
194
|
+
* @param usage Extra `GPUBufferUsage` flags of the buffer.
|
|
195
|
+
*/
|
|
112
196
|
constructor(device, buffer, owns, capacity, limit, label, usage) {
|
|
113
197
|
this.device = device;
|
|
114
198
|
this.#buffer = buffer;
|
|
@@ -123,6 +207,9 @@ export class VDBGridPool {
|
|
|
123
207
|
* Creates a pool on `device`. Throws `VDB_UNSUPPORTED_DEVICE` (see
|
|
124
208
|
* {@link unsupportedReason}) or `VDB_BAD_OPTION`. The returned pool is
|
|
125
209
|
* bindable at once (an empty table).
|
|
210
|
+
*
|
|
211
|
+
* @param device The host's `GPUDevice`.
|
|
212
|
+
* @param options Initial size, table capacity, limits, label, usage and an optional host buffer.
|
|
126
213
|
*/
|
|
127
214
|
static async create(device, options = {}) {
|
|
128
215
|
const reason = unsupportedReason(device);
|
|
@@ -208,7 +295,7 @@ export class VDBGridPool {
|
|
|
208
295
|
get version() {
|
|
209
296
|
return this.#version;
|
|
210
297
|
}
|
|
211
|
-
/** +1 on every content change (add, replace, remove, setTransform, setMajorant). */
|
|
298
|
+
/** +1 on every content change (add, replace, remove, setTransform, setValueMax, setMajorant, buildMajorant). */
|
|
212
299
|
get revision() {
|
|
213
300
|
return this.#revision;
|
|
214
301
|
}
|
|
@@ -228,7 +315,8 @@ export class VDBGridPool {
|
|
|
228
315
|
get retiredBytes() {
|
|
229
316
|
let n = 0;
|
|
230
317
|
for (const r of this.#retired)
|
|
231
|
-
|
|
318
|
+
if (!r.params)
|
|
319
|
+
n += r.buffer.size;
|
|
232
320
|
for (const g of this.#growths)
|
|
233
321
|
n += g.from.size;
|
|
234
322
|
return n;
|
|
@@ -288,6 +376,9 @@ export class VDBGridPool {
|
|
|
288
376
|
* or `VDB_ALL_SCALAR_TYPES`), or regenerated and its pipeline rebuilt when
|
|
289
377
|
* a new type arrives. Call `vdbCheckModule(pool, options)` after `add` to
|
|
290
378
|
* catch a mismatch (`VDB_TYPE_NOT_COMPILED`).
|
|
379
|
+
*
|
|
380
|
+
* @param image A NanoVDB grid image (one grid) as 32-bit words.
|
|
381
|
+
* @param options Reserved capacity, transform, majorant, density bound and label.
|
|
291
382
|
*/
|
|
292
383
|
add(image, options = {}) {
|
|
293
384
|
this.#checkAlive();
|
|
@@ -296,7 +387,7 @@ export class VDBGridPool {
|
|
|
296
387
|
const transform = copyTransform(options.transform);
|
|
297
388
|
const affines = composeGridAffines(header, transform);
|
|
298
389
|
const valueMaxOverride = checkValueMax(options.valueMax);
|
|
299
|
-
const majorant = options.majorant ? validateMajorant(options.majorant) : null;
|
|
390
|
+
const majorant = options.majorant ? validateMajorant(options.majorant, header) : null;
|
|
300
391
|
let id = this.#grids.findIndex((g) => g === undefined);
|
|
301
392
|
if (id < 0)
|
|
302
393
|
id = this.#grids.length;
|
|
@@ -341,14 +432,19 @@ export class VDBGridPool {
|
|
|
341
432
|
* grid's reserved range (no `version` change: the sequence-player path), else
|
|
342
433
|
* moved. A brick majorant set on the grid is dropped (it described the old
|
|
343
434
|
* image); call `setMajorant` again. Transform, label and `valueMax` are kept.
|
|
435
|
+
*
|
|
436
|
+
* @param id The grid's pool id.
|
|
437
|
+
* @param image The new grid image, as for `add`.
|
|
344
438
|
*/
|
|
345
439
|
replace(id, image) {
|
|
346
440
|
this.#checkAlive();
|
|
347
441
|
const grid = this.#grid(id);
|
|
348
442
|
const header = readImageHeader(image);
|
|
443
|
+
// A GPU-built majorant follows the image (P1.15): lay it out for the new image before anything changes.
|
|
444
|
+
const rebuild = grid.majorant?.gpu ? gpuMajorant(grid.majorant.gpu.options, header) : null;
|
|
349
445
|
if (align32(header.byteLength) > grid.capacity) {
|
|
350
446
|
const capacity = align32(header.byteLength);
|
|
351
|
-
this.#checkCanFit(this.#grids.length, [capacity], "image"); // replace drops
|
|
447
|
+
this.#checkCanFit(this.#grids.length, rebuild ? [capacity, rebuild.bytes] : [capacity], "image"); // replace drops a CPU majorant
|
|
352
448
|
const next = { range: null, resident: false };
|
|
353
449
|
this.#replaceRange(grid.image.range, () => this.#place(next, capacity, "image"));
|
|
354
450
|
grid.image = next;
|
|
@@ -358,7 +454,10 @@ export class VDBGridPool {
|
|
|
358
454
|
grid.pendingImage = image;
|
|
359
455
|
grid.imageSerial++;
|
|
360
456
|
grid.affines = composeGridAffines(header, grid.transform);
|
|
361
|
-
|
|
457
|
+
if (rebuild)
|
|
458
|
+
this.#installMajorant(grid, rebuild);
|
|
459
|
+
else
|
|
460
|
+
this.#dropMajorant(grid);
|
|
362
461
|
this.#touch(id);
|
|
363
462
|
grid.imageRevision = this.#revision;
|
|
364
463
|
}
|
|
@@ -379,6 +478,9 @@ export class VDBGridPool {
|
|
|
379
478
|
* matrix (WebGPU / three convention), or `null` for the file's own map. The
|
|
380
479
|
* pool composes `worldToIndex = map⁻¹ ∘ objectToWorld⁻¹` and `indexToWorld`
|
|
381
480
|
* in f64 and rounds to f32. Only the record changes; the image is untouched.
|
|
481
|
+
*
|
|
482
|
+
* @param id The grid's pool id.
|
|
483
|
+
* @param objectToWorld A 4x4 column-major matrix, or `null` for the file's own map.
|
|
382
484
|
*/
|
|
383
485
|
setTransform(id, objectToWorld) {
|
|
384
486
|
this.#checkAlive();
|
|
@@ -391,6 +493,9 @@ export class VDBGridPool {
|
|
|
391
493
|
/**
|
|
392
494
|
* Stores brick-majorant bounds for grid `id` in the pool (record words
|
|
393
495
|
* 36–39, flag b2, brick log2 in b16–23), or clears them with `null`.
|
|
496
|
+
*
|
|
497
|
+
* @param id The grid's pool id.
|
|
498
|
+
* @param majorant The brick bounds, or `null` to clear them.
|
|
394
499
|
*/
|
|
395
500
|
setMajorant(id, majorant) {
|
|
396
501
|
this.#checkAlive();
|
|
@@ -400,19 +505,69 @@ export class VDBGridPool {
|
|
|
400
505
|
this.#touch(id);
|
|
401
506
|
return;
|
|
402
507
|
}
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
508
|
+
this.#installMajorant(grid, validateMajorant(majorant, grid.header));
|
|
509
|
+
this.#touch(id);
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Builds grid `id`'s brick majorant on the GPU (P1.15; K1-core §5.1) instead of taking CPU data: the next
|
|
513
|
+
* `update(encoder)` records a compute pass into `encoder`, after its writes, that fills the majorant range
|
|
514
|
+
* (header, upper bounds, optional lower bounds). The result equals `tools` `vdbBrickMajorant(image, options)`
|
|
515
|
+
* bit for bit (same options, same layout; Fp8 / FpN on a GPU that fuses the decode's multiply-add may differ by
|
|
516
|
+
* the reader's 1 ulp, as `vdbReadValue` itself does).
|
|
517
|
+
*
|
|
518
|
+
* The build follows the image: `replace` lays it out again and the next `update` rebuilds it (a sequence
|
|
519
|
+
* keeps GPU bricks without a CPU pass per frame). `setMajorant` replaces it with CPU data, `null` clears it.
|
|
520
|
+
* Record passes that read the majorant after that `update`.
|
|
521
|
+
*
|
|
522
|
+
* @param id The grid's pool id.
|
|
523
|
+
* @param options As `vdbBrickMajorant`'s: `brickLog2` (0..6 on the GPU), `minima`, `align`, `outside`, `resolution`.
|
|
524
|
+
* @throws VDBError `VDB_BAD_OPTION` for invalid options (as the CPU builder), `VDB_POOL_LIMIT` / `VDB_POOL_FULL` as `setMajorant`.
|
|
525
|
+
*/
|
|
526
|
+
buildMajorant(id, options = {}) {
|
|
527
|
+
this.#checkAlive();
|
|
528
|
+
const grid = this.#grid(id);
|
|
529
|
+
this.#installMajorant(grid, gpuMajorant(options, grid.header));
|
|
414
530
|
this.#touch(id);
|
|
415
531
|
}
|
|
532
|
+
/**
|
|
533
|
+
* Sets grid `id`'s global value bound (record word 35; EX1f-a), or with `null` returns to the default. Only
|
|
534
|
+
* the record changes: the next `update` writes 160 bytes, and `version` does not move. The bound is kept
|
|
535
|
+
* across `replace`, as `add`'s `valueMax` is, so set it again (or pass `null`) when the new image needs another.
|
|
536
|
+
*
|
|
537
|
+
* It is what `vdbMajorantGlobal(g)` returns and what the `'global'` majorant walk uses (a `'brick'` module
|
|
538
|
+
* walks a grid without brick bounds the same way), so every sample of the grid must be at or under it.
|
|
539
|
+
*
|
|
540
|
+
* The default, `max(root max, background)`, costs nothing and holds whenever the inactive values are the
|
|
541
|
+
* background, but it counts a root background that no voxel near the grid may hold: 3 against 1 on a fog
|
|
542
|
+
* volume converted from a level set, and with `outside: 'zero'` a background the field never takes outside
|
|
543
|
+
* the bbox. `vdbValueRange(image, { outside }).max` (`@pmndrs/vdb/tools`) is the exact bound over the box the
|
|
544
|
+
* walks cover; for a fog volume whose inactive voxels are 0, `Math.max(pool.info(id).rootMax, 0)` is the
|
|
545
|
+
* same number without the tree walk. An image without statistics has no default (+Infinity): give it a
|
|
546
|
+
* bound here (`vdbCheckModule` throws `VDB_NO_STATS` for a majorant module that would walk it).
|
|
547
|
+
*
|
|
548
|
+
* @param id The grid's pool id.
|
|
549
|
+
* @param valueMax The bound, or `null` for the default.
|
|
550
|
+
* @throws VDBError `VDB_BAD_OPTION` when `valueMax` is not a number, `VDB_UNKNOWN_GRID` for a dead id.
|
|
551
|
+
*/
|
|
552
|
+
setValueMax(id, valueMax) {
|
|
553
|
+
this.#checkAlive();
|
|
554
|
+
const grid = this.#grid(id);
|
|
555
|
+
grid.valueMaxOverride = valueMax === null ? undefined : checkValueMax(valueMax, "setValueMax: valueMax must be a number or null");
|
|
556
|
+
this.#touch(id);
|
|
557
|
+
}
|
|
558
|
+
/**
|
|
559
|
+
* The live grids whose global bound (`info(id).valueMax`) is not finite: images without statistics that the
|
|
560
|
+
* host gave no `valueMax`. A majorant walk that falls back on the global bound cannot use them;
|
|
561
|
+
* `vdbCheckModule(pool, options)` reads this list.
|
|
562
|
+
*/
|
|
563
|
+
get unboundedGrids() {
|
|
564
|
+
const out = [];
|
|
565
|
+
this.#grids.forEach((g, id) => {
|
|
566
|
+
if (g && !Number.isFinite(this.#valueMax(g)))
|
|
567
|
+
out.push({ id, hasStats: g.header.hasStats, hasBrickMajorant: g.majorant !== null });
|
|
568
|
+
});
|
|
569
|
+
return out;
|
|
570
|
+
}
|
|
416
571
|
/** Describes grid `id`. Throws `VDB_UNKNOWN_GRID` for a dead or out-of-range id. */
|
|
417
572
|
info(id) {
|
|
418
573
|
this.#checkAlive();
|
|
@@ -447,11 +602,15 @@ export class VDBGridPool {
|
|
|
447
602
|
hasBrickMajorant: m !== null,
|
|
448
603
|
majorantOffset: m?.range?.offset ?? null,
|
|
449
604
|
majorantDims: m ? [...m.dims] : null,
|
|
605
|
+
majorantOrigin: m ? [...m.origin] : null,
|
|
606
|
+
majorantMinima: m?.minima ?? false,
|
|
607
|
+
majorantBuilt: m?.gpu != null,
|
|
450
608
|
instanceTransform: g.transform !== null,
|
|
451
609
|
background: h.background,
|
|
452
610
|
valueMax: this.#valueMax(g),
|
|
453
611
|
rootMin: h.rootMin,
|
|
454
612
|
rootMax: h.rootMax,
|
|
613
|
+
rootAverage: h.rootAverage,
|
|
455
614
|
voxelSize: [...h.voxelSize],
|
|
456
615
|
indexBBox: { min: [...lo], max: [...h.indexBBoxMax] },
|
|
457
616
|
worldBBox: { min, max },
|
|
@@ -508,6 +667,7 @@ export class VDBGridPool {
|
|
|
508
667
|
}
|
|
509
668
|
}
|
|
510
669
|
this.#writePending();
|
|
670
|
+
this.#recordMajorantBuilds(encoder);
|
|
511
671
|
if (limitError)
|
|
512
672
|
throw limitError;
|
|
513
673
|
}
|
|
@@ -637,6 +797,19 @@ export class VDBGridPool {
|
|
|
637
797
|
}
|
|
638
798
|
state.range = null; // placed by the next update
|
|
639
799
|
}
|
|
800
|
+
/** Puts `next` on `grid`, in the current majorant's range when it fits. */
|
|
801
|
+
#installMajorant(grid, next) {
|
|
802
|
+
const current = grid.majorant;
|
|
803
|
+
if (current?.range && align32(next.bytes) <= current.range.size) {
|
|
804
|
+
next.range = current.range;
|
|
805
|
+
next.resident = next.gpu ? false : current.resident;
|
|
806
|
+
}
|
|
807
|
+
else {
|
|
808
|
+
this.#checkCanFit(this.#grids.length, [grid.capacity, next.bytes], "majorant");
|
|
809
|
+
this.#replaceRange(current?.range ?? null, () => this.#place(next, next.bytes, "majorant"));
|
|
810
|
+
}
|
|
811
|
+
grid.majorant = next;
|
|
812
|
+
}
|
|
640
813
|
#dropMajorant(grid) {
|
|
641
814
|
const m = grid.majorant;
|
|
642
815
|
if (m?.range)
|
|
@@ -812,6 +985,8 @@ export class VDBGridPool {
|
|
|
812
985
|
m.range = null;
|
|
813
986
|
m.resident = false;
|
|
814
987
|
m.pending ??= m.retained;
|
|
988
|
+
if (m.gpu)
|
|
989
|
+
m.gpu.stale = true; // built into the failed buffer (or never): build again
|
|
815
990
|
}
|
|
816
991
|
}
|
|
817
992
|
this.#releaseRetained();
|
|
@@ -925,6 +1100,62 @@ export class VDBGridPool {
|
|
|
925
1100
|
if (this.#headerDirty)
|
|
926
1101
|
this.#writeHeader();
|
|
927
1102
|
}
|
|
1103
|
+
/**
|
|
1104
|
+
* P1.15: records the staged GPU majorant builds into `encoder` (one compute pass), after this update's writes
|
|
1105
|
+
* (the queue runs `writeBuffer`s before the encoder's commands, so the kernel reads the new image and record).
|
|
1106
|
+
* A build needs its range placed and its image and record in the current buffer; else it waits for an update
|
|
1107
|
+
* that has them. Each build's 96-byte parameters live in their own uniform buffer, retired like an old pool buffer.
|
|
1108
|
+
*/
|
|
1109
|
+
#recordMajorantBuilds(encoder) {
|
|
1110
|
+
const builds = [];
|
|
1111
|
+
this.#grids.forEach((g, id) => {
|
|
1112
|
+
const m = g?.majorant;
|
|
1113
|
+
if (!g || !m?.gpu?.stale || !m.range || !g.image.range || !g.image.resident || id >= this.#capacity)
|
|
1114
|
+
return;
|
|
1115
|
+
builds.push({ id, g, m, gpu: m.gpu, range: m.range });
|
|
1116
|
+
});
|
|
1117
|
+
if (builds.length === 0)
|
|
1118
|
+
return;
|
|
1119
|
+
const device = this.device;
|
|
1120
|
+
const maxGroups = device.limits?.maxComputeWorkgroupsPerDimension ?? 65535;
|
|
1121
|
+
const pass = encoder.beginComputePass({ label: `${this.#label} buildMajorant` });
|
|
1122
|
+
for (const { id, g, m, gpu, range } of builds) {
|
|
1123
|
+
const h = g.header;
|
|
1124
|
+
const { params, groups } = packMajorantBuild({
|
|
1125
|
+
grid: id,
|
|
1126
|
+
rangeOffset: range.offset,
|
|
1127
|
+
brickLog2: m.brickLog2,
|
|
1128
|
+
origin: m.origin,
|
|
1129
|
+
dims: m.dims,
|
|
1130
|
+
bboxMin: h.indexBBoxMin,
|
|
1131
|
+
bboxMax: h.indexBBoxMax,
|
|
1132
|
+
resolution: gpu.resolution,
|
|
1133
|
+
zero: gpu.zero,
|
|
1134
|
+
pathtracer: gpu.pathtracer,
|
|
1135
|
+
minima: m.minima,
|
|
1136
|
+
}, maxGroups);
|
|
1137
|
+
const cached = majorantBuildPipeline(device, h.gridType);
|
|
1138
|
+
const uniform = device.createBuffer({
|
|
1139
|
+
label: `${this.#label} buildMajorant ${id}`,
|
|
1140
|
+
size: MAJORANT_BUILD_PARAMS_BYTES,
|
|
1141
|
+
usage: BUFFER_USAGE.UNIFORM | BUFFER_USAGE.COPY_DST,
|
|
1142
|
+
});
|
|
1143
|
+
write(device.queue, uniform, 0, new Uint32Array(params));
|
|
1144
|
+
this.#retired.push({ buffer: uniform, since: this.#updates, waiting: false, params: true });
|
|
1145
|
+
pass.setPipeline(cached.pipeline);
|
|
1146
|
+
pass.setBindGroup(0, device.createBindGroup({
|
|
1147
|
+
layout: cached.layout,
|
|
1148
|
+
entries: [
|
|
1149
|
+
{ binding: 0, resource: { buffer: this.#buffer } },
|
|
1150
|
+
{ binding: 1, resource: { buffer: uniform } },
|
|
1151
|
+
],
|
|
1152
|
+
}));
|
|
1153
|
+
pass.dispatchWorkgroups(groups[0], groups[1]);
|
|
1154
|
+
gpu.stale = false;
|
|
1155
|
+
m.resident = true;
|
|
1156
|
+
}
|
|
1157
|
+
pass.end();
|
|
1158
|
+
}
|
|
928
1159
|
/** The record for `g`, whose image is placed. A majorant is recorded only once it is placed. */
|
|
929
1160
|
#record(g) {
|
|
930
1161
|
const h = g.header;
|