@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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AI,CAAC,IAAI,CAAC,8BAA8B;YACzH,qGAAqG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;YAC1H,yGAAyG,CAC5G,CAAC;IACJ,CAAC;AACH,CAAC;AAED,uHAAuH;AACvH,MAAM,UAAU,qBAAqB,CAAC,OAAyB;IAC7D,MAAM,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AACrD,CAAC","sourcesContent":["/**\n * WGSL module generator (docs/dev/design/K1-core.md §3, task K1.4a).\n *\n * Roots for the profile and options (the vendored names the API layer uses)\n * -> closure over the declaration table extracted from the unmodified vendored\n * `pnanovdb.wgsl` -> generation transforms -> `pnanovdb_`→`vdb_` rename ->\n * append the API layer -> prepend one SPDX line.\n *\n * Generation transforms (each one is a row in vendor/VENDOR.md, \"Generation\n * transforms\"; none edits the vendored file):\n * 1. `pnanovdb_buf_read_uint32` reads through `vdb_load`, the module's single\n * buffer access site (§2).\n * 2. The 27-row `pnanovdb_grid_type_constants` array becomes\n * `fn vdb_gtc(grid_type)` returning only the compiled types' rows; its\n * `[grid_type]` call sites become `vdb_gtc(grid_type)`.\n * 3. `pnanovdb_read_float_typed` keeps only the compiled types' branches, so\n * the other decoders drop out of the closure.\n * 4. Declarations unreachable from the profile's roots are not emitted (the\n * `pnanovdb_sample_trilinear_{float,fp8,fpn}` wrappers among them).\n * 5. Every `pnanovdb_` / `PNANOVDB_` becomes `vdb_` / `VDB_`.\n * 6. Comments are dropped (done at extraction).\n * 7. `pnanovdb_leaf_get_stat_float` keeps only the compiled types' branch\n * (the Fp leaf-stats decode, K1.4b), so a Float-only module has no\n * uint16 decoder.\n *\n * Output is deterministic: the same options give the same bytes, and `types`\n * is a set (order and duplicates do not matter).\n */\n\nimport { VDBError } from \"../errors.js\";\nimport { VDB_GPU_LAYOUT_VERSION, vdbPoolLayoutWgsl } from \"../pool/layout.js\";\nimport { VDB_GRID_TYPE_IDS, VDB_GRID_TYPE_NAMES, type VDBGridTypeName, type VDBSlot } from \"../types.js\";\nimport { apiWgsl, type ApiOptions } from \"./api.js\";\nimport { WGSL_KEYWORDS, WGSL_RESERVED_WORDS } from \"./reserved.js\";\nimport { PNANOVDB_CHUNKS, type PnanovdbChunk } from \"./pnanovdb.chunks.generated.js\";\nimport type { VDBModuleHelper, VDBModuleOptions, VDBModulePoolLike, VDBModuleProfile, VDBModuleTypeCheck } from \"./types.js\";\n\n/** First line of every generated module (§3.3). */\nexport const VDB_MODULE_BANNER =\n \"// SPDX-License-Identifier: Apache-2.0 AND MIT. Derived from PNanoVDB.h (OpenVDB) via emcfarlane/webgpu-nanovdb; see NOTICE.\";\n\n/** Name of the storage binding `slot` mode declares. */\nexport const VDB_POOL_BINDING_NAME = \"vdbPool\";\n\n/** Profiles in inclusion order; only the first `IMPLEMENTED_PROFILES` generate (`majorant` is deferred, D22). */\nconst PROFILES: readonly VDBModuleProfile[] = [\"read\", \"sample\", \"march\", \"majorant\"];\nconst IMPLEMENTED_PROFILES = 3;\n\n/** `GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE` (0x2 | 0x4); the global does not exist in Node. */\nconst SHADER_STAGE_FRAGMENT_COMPUTE = 0x2 | 0x4;\n\n/** Opt-in helpers in canonical order, with the lowest profile rank each needs. */\nconst HELPERS: Readonly<Record<VDBModuleHelper, { readonly rank: number }>> = {\n cellBoundTrilinear: { rank: 2 },\n hddaCellEnd: { rank: 2 },\n levelSet: { rank: 2 },\n nodeAverage: { rank: 2 },\n rayClipSupport: { rank: 1 },\n fastTrilinear: { rank: 1 },\n};\nconst HELPER_NAMES = Object.keys(HELPERS) as VDBModuleHelper[];\n\nconst IDENTIFIER = /[A-Za-z_][A-Za-z0-9_]*/g;\nconst BUFFER_EXPRESSION = /^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*$/;\n\ntype Binding = { readonly kind: \"slot\"; readonly slot: VDBSlot } | { readonly kind: \"buffer\"; readonly expression: string };\n\ninterface NormalizedOptions extends ApiOptions {\n readonly profile: VDBModuleProfile;\n readonly profileRank: number;\n readonly binding: Binding;\n}\n\nfunction bad(message: string): VDBError {\n return new VDBError(\"VDB_BAD_OPTION\", message);\n}\n\nfunction checkSlot(slot: unknown, where: string): VDBSlot {\n const s = slot as Partial<VDBSlot> | null | undefined;\n if (\n s === null ||\n typeof s !== \"object\" ||\n !Number.isInteger(s.group) ||\n !Number.isInteger(s.firstBinding) ||\n (s.group as number) < 0 ||\n (s.firstBinding as number) < 0\n ) {\n throw bad(`${where}: slot must be { group, firstBinding } with non-negative integers, got ${JSON.stringify(slot)}.`);\n }\n return { group: s.group as number, firstBinding: s.firstBinding as number };\n}\n\n/** The old bvh-style positional slot (`{ group, firstBinding }` at the top level of the module options) would be silently misread. */\nfunction rejectPositionalSlot(where: string, options: object): void {\n if (\"group\" in options || \"firstBinding\" in options) {\n throw bad(`${where}: got 'group' or 'firstBinding' at the top level. Pass { slot: { group, firstBinding } }.`);\n }\n}\n\nfunction normalizeHelpers(helpers: unknown, profile: VDBModuleProfile, profileRank: number, where: string): VDBModuleHelper[] {\n if (helpers === undefined) return [];\n if (helpers === null || typeof helpers === \"string\" || typeof (helpers as Iterable<unknown>)[Symbol.iterator] !== \"function\") {\n throw bad(`${where}: helpers must be an array or set of helper names (${HELPER_NAMES.join(\", \")}), got ${JSON.stringify(helpers)}.`);\n }\n const seen = new Set<string>();\n for (const h of helpers as Iterable<unknown>) {\n if (typeof h !== \"string\" || !(HELPER_NAMES as readonly string[]).includes(h)) {\n throw bad(`${where}: unknown helper ${JSON.stringify(h)}; use ${HELPER_NAMES.join(\", \")}.`);\n }\n const need = HELPERS[h as VDBModuleHelper].rank;\n if (profileRank < need) {\n throw bad(`${where}: helper '${h}' needs profile '${PROFILES[need]}' or above, got '${profile}'.`);\n }\n seen.add(h);\n }\n return HELPER_NAMES.filter((h) => seen.has(h));\n}\n\nfunction normalizeTypes(types: unknown, where: string): VDBGridTypeName[] {\n if (types === undefined || types === null || typeof types === \"string\" || typeof (types as Iterable<unknown>)[Symbol.iterator] !== \"function\") {\n throw bad(`${where}: types must be an array or set of grid type names (${VDB_GRID_TYPE_NAMES.join(\", \")}), e.g. [...pool.types].`);\n }\n const seen = new Set<string>();\n for (const t of types as Iterable<unknown>) {\n if (typeof t !== \"string\" || !(VDB_GRID_TYPE_NAMES as readonly string[]).includes(t)) {\n throw bad(`${where}: unknown grid type ${JSON.stringify(t)}; use ${VDB_GRID_TYPE_NAMES.join(\", \")}.`);\n }\n seen.add(t);\n }\n if (seen.size === 0) {\n throw bad(`${where}: types is empty. Compile at least one grid type, e.g. ['float'], or pass [...pool.types] after adding a grid.`);\n }\n return VDB_GRID_TYPE_NAMES.filter((t) => seen.has(t));\n}\n\nfunction normalize(options: VDBModuleOptions, where: string): NormalizedOptions {\n if (options === null || typeof options !== \"object\") {\n throw bad(`${where}: expected an options object { slot | buffer, types, profile }.`);\n }\n rejectPositionalSlot(where, options);\n\n const hasSlot = (options as { slot?: unknown }).slot !== undefined;\n const hasBuffer = (options as { buffer?: unknown }).buffer !== undefined;\n if (hasSlot === hasBuffer) {\n throw bad(`${where}: pass exactly one of slot: { group, firstBinding } (declares the binding) or buffer: '<wgsl expression>' (reads a host-declared array<u32>).`);\n }\n let binding: Binding;\n if (hasSlot) {\n binding = { kind: \"slot\", slot: checkSlot(options.slot, where) };\n } else {\n const expression: unknown = options.buffer;\n if (typeof expression !== \"string\" || !BUFFER_EXPRESSION.test(expression)) {\n throw bad(`${where}: buffer must be a WGSL identifier or member chain such as 'vdbPool.value', got ${JSON.stringify(expression)}.`);\n }\n for (const part of expression.split(\".\")) {\n if (part.startsWith(\"__\")) {\n throw bad(`${where}: buffer ${JSON.stringify(expression)} uses '${part}'; WGSL identifiers must not start with '__'. Rename the host binding.`);\n }\n if (part === \"_\" || WGSL_RESERVED_WORDS.has(part) || WGSL_KEYWORDS.has(part)) {\n throw bad(`${where}: buffer ${JSON.stringify(expression)} uses '${part}', which WGSL reserves. Rename the host binding (e.g. 'vdbPool.value').`);\n }\n }\n binding = { kind: \"buffer\", expression };\n }\n\n const profileRank = PROFILES.indexOf(options.profile);\n if (profileRank < 0) {\n throw bad(`${where}: profile must be one of ${PROFILES.map((p) => `'${p}'`).join(\", \")}, got ${JSON.stringify(options.profile)}.`);\n }\n if (profileRank >= IMPLEMENTED_PROFILES) {\n throw bad(`${where}: profile '${options.profile}' is deferred past 0.1 (D22). Use 'read', 'sample' or 'march'.`);\n }\n\n const sampler = options.sampler ?? \"trilinear\";\n if (sampler !== \"trilinear\" && sampler !== \"nearest\") {\n throw bad(`${where}: sampler must be 'trilinear' or 'nearest', got ${JSON.stringify(sampler)}.`);\n }\n const outside = options.outside ?? \"background\";\n if (outside !== \"background\" && outside !== \"zero\") {\n throw bad(`${where}: outside must be 'background' or 'zero', got ${JSON.stringify(outside)}.`);\n }\n const isActive = options.isActive ?? true;\n if (typeof isActive !== \"boolean\") {\n throw bad(`${where}: isActive must be a boolean, got ${JSON.stringify(isActive)}.`);\n }\n\n // Sample-only options do not change a `read` module; normalize them away so\n // equal modules share one cache key.\n const sampleOnly = profileRank >= 1;\n return {\n profile: options.profile,\n profileRank,\n binding,\n types: normalizeTypes(options.types, where),\n isActive,\n sampler: sampleOnly ? sampler : \"trilinear\",\n outside: sampleOnly ? outside : \"background\",\n helpers: checkHelperSampler(normalizeHelpers(options.helpers, options.profile, profileRank, where), sampleOnly ? sampler : \"trilinear\", where),\n };\n}\n\n/** `fastTrilinear` shares one leaf between the 8 trilinear taps; `nearest` has one tap. */\nfunction checkHelperSampler(helpers: VDBModuleHelper[], sampler: \"trilinear\" | \"nearest\", where: string): VDBModuleHelper[] {\n if (sampler === \"nearest\" && helpers.includes(\"fastTrilinear\")) {\n throw bad(`${where}: helper 'fastTrilinear' needs sampler 'trilinear' (nearest reads one voxel; call vdbSample).`);\n }\n return helpers;\n}\n\n// ---------------------------------------------------------------------------\n// Declaration table and transforms\n\nconst CHUNKS = new Map<string, PnanovdbChunk>(PNANOVDB_CHUNKS.map((c) => [c.name, c]));\nconst ORDER = new Map<string, number>(PNANOVDB_CHUNKS.map((c, i) => [c.name, i]));\n\nfunction chunk(name: string): PnanovdbChunk {\n const c = CHUNKS.get(name);\n if (!c) throw new Error(`@pmndrs/vdb: vendored declaration ${name} is missing; re-run scripts/extract-wgsl-chunks.mjs`);\n return c;\n}\n\nconst TYPE_TABLE = \"pnanovdb_grid_type_constants\";\nconst TYPE_TABLE_FN = \"pnanovdb_gtc\";\nconst TYPE_TABLE_CALL_SITE = /\\bpnanovdb_grid_type_constants\\[([^\\]]+)\\]/g;\n/** Names the transforms introduce, resolved to the declaration they replace. */\nconst ALIASES = new Map<string, string>([[TYPE_TABLE_FN, TYPE_TABLE]]);\n\nconst GRID_TYPE_CONSTANT_PRE: Readonly<Record<VDBGridTypeName, string>> = {\n float: \"PNANOVDB_GRID_TYPE_FLOAT\",\n fp4: \"PNANOVDB_GRID_TYPE_FP4\",\n fp8: \"PNANOVDB_GRID_TYPE_FP8\",\n fp16: \"PNANOVDB_GRID_TYPE_FP16\",\n fpn: \"PNANOVDB_GRID_TYPE_FPN\",\n};\n\n/** Field names of the vendored `pnanovdb_grid_type_constants_t`, in order. */\nconst TYPE_TABLE_FIELDS: readonly string[] = [...chunk(\"pnanovdb_grid_type_constants_t\").text.matchAll(/^\\s+(\\w+)\\s*:/gm)].map((m) => m[1] as string);\n\n/** The 27 rows of the vendored type table, as argument lists. */\nconst TYPE_TABLE_ROWS: readonly (readonly string[])[] = (() => {\n const rows = [...chunk(TYPE_TABLE).text.matchAll(/pnanovdb_grid_type_constants_t\\(([^)]*)\\)/g)].map((m) =>\n (m[1] as string).split(\",\").map((v) => v.trim()),\n );\n if (rows.length !== 27 || rows.some((r) => r.length !== TYPE_TABLE_FIELDS.length)) {\n throw new Error(`@pmndrs/vdb: unexpected vendored grid type table shape; re-check generate.ts against vendor/pnanovdb.wgsl`);\n }\n return rows;\n})();\n\n/**\n * Generation context: the options, plus the type-table fields the emitted\n * code reads (`null` = all, used for the first closure pass).\n */\ninterface Context {\n readonly o: NormalizedOptions;\n readonly fields: ReadonlySet<string> | null;\n}\n\n/** Transform 1: the single buffer access. */\nfunction bufReadOverride(): string {\n return `fn pnanovdb_buf_read_uint32(buf: pnanovdb_buf_t, byte_offset: u32) -> u32 {\n return vdb_load((buf.byte_offset >> 2u) + (byte_offset >> 2u));\n}`;\n}\n\n/**\n * Transform 2: the type table cut to the compiled types. Fields no emitted code\n * reads are written as 0u, and types whose remaining rows are equal share one\n * branch (Fp4/Fp8/Fp16/FpN differ only in the unread `leaf_size`). One distinct\n * row: a constant, no branch.\n */\nfunction typeTableOverride({ o, fields }: Context): string {\n const groups: { row: string; types: VDBGridTypeName[] }[] = [];\n for (const t of o.types) {\n const values = TYPE_TABLE_ROWS[VDB_GRID_TYPE_IDS[t]] as readonly string[];\n const row = `pnanovdb_grid_type_constants_t(${values\n .map((v, i) => (fields === null || fields.has(TYPE_TABLE_FIELDS[i] as string) ? v : \"0u\"))\n .join(\", \")})`;\n const group = groups.find((g) => g.row === row);\n if (group) group.types.push(t);\n else groups.push({ row, types: [t] });\n }\n const lines = [`fn ${TYPE_TABLE_FN}(grid_type: u32) -> pnanovdb_grid_type_constants_t {`];\n groups.forEach((g, i) => {\n if (i === groups.length - 1) {\n lines.push(` return ${g.row};`);\n } else {\n lines.push(` if ${g.types.map((t) => `grid_type == ${GRID_TYPE_CONSTANT_PRE[t]}`).join(\" || \")} {`);\n lines.push(` return ${g.row};`);\n lines.push(` }`);\n }\n });\n lines.push(\"}\");\n return lines.join(\"\\n\");\n}\n\n/** Transform 3: typed decode limited to the compiled types. */\nfunction readFloatTypedOverride({ o }: Context): string {\n const text = chunk(\"pnanovdb_read_float_typed\").text;\n const signature = text.slice(0, text.indexOf(\"{\") + 1);\n const fpTypes = o.types.filter((t) => t !== \"float\");\n const decode = (t: VDBGridTypeName) => `pnanovdb_root_${t}_read_float(buf, address, ijk, level)`;\n const lines = [signature];\n // Without Float, the last Fp type is the fallthrough: `ok` already rejects\n // every other type before a read reaches here.\n const branches = o.types.includes(\"float\") ? fpTypes : fpTypes.slice(0, -1);\n for (const t of branches) {\n lines.push(` if grid_type == ${GRID_TYPE_CONSTANT_PRE[t]} {`);\n lines.push(` return ${decode(t)};`);\n lines.push(` }`);\n }\n lines.push(o.types.includes(\"float\") ? \" return pnanovdb_read_float(buf, address);\" : ` return ${decode(fpTypes[fpTypes.length - 1] as VDBGridTypeName)};`);\n lines.push(\"}\");\n return lines.join(\"\\n\");\n}\n\n/**\n * Transform 7: the leaf-stat dispatch limited to the compiled types. No Fp type\n * compiled: a plain f32 read (the code decoder drops out). Only Fp types: the\n * decode, unconditionally. Both: one branch over the compiled Fp types.\n */\nfunction leafStatOverride({ o }: Context): string {\n const text = chunk(\"pnanovdb_leaf_get_stat_float\").text;\n const signature = text.slice(0, text.indexOf(\"{\") + 1);\n const fpTypes = o.types.filter((t) => t !== \"float\");\n const decode = \"return pnanovdb_leaf_fp_get_stat_float(grid_type, buf, node, address, with_minimum);\";\n const plain = \"return pnanovdb_read_float(buf, address);\";\n const lines = [signature];\n if (fpTypes.length === 0) {\n lines.push(` ${plain}`);\n } else if (!o.types.includes(\"float\")) {\n lines.push(` ${decode}`);\n } else {\n lines.push(` if ${fpTypes.map((t) => `grid_type == ${GRID_TYPE_CONSTANT_PRE[t]}`).join(\" || \")} {`);\n lines.push(` ${decode}`);\n lines.push(\" }\");\n lines.push(` ${plain}`);\n }\n lines.push(\"}\");\n return lines.join(\"\\n\");\n}\n\nconst OVERRIDES = new Map<string, (ctx: Context) => string>([\n [\"pnanovdb_buf_read_uint32\", bufReadOverride],\n [TYPE_TABLE, typeTableOverride],\n [\"pnanovdb_read_float_typed\", readFloatTypedOverride],\n [\"pnanovdb_leaf_get_stat_float\", leafStatOverride],\n]);\n\nfunction effectiveText(c: PnanovdbChunk, ctx: Context): string {\n const override = OVERRIDES.get(c.name);\n if (override) return override(ctx);\n return c.text.replace(TYPE_TABLE_CALL_SITE, `${TYPE_TABLE_FN}($1)`);\n}\n\nfunction referencedChunks(text: string, self?: string): string[] {\n const out = new Set<string>();\n for (const m of text.matchAll(IDENTIFIER)) {\n const name = ALIASES.get(m[0]) ?? m[0];\n if (name !== self && CHUNKS.has(name)) out.add(name);\n }\n return [...out];\n}\n\n/** Map a final (`vdb_` / `VDB_`) name back to its vendored declaration, if it is one. */\nfunction vendoredName(finalName: string): string | undefined {\n let name: string | undefined;\n if (finalName.startsWith(\"vdb_\")) name = `pnanovdb_${finalName.slice(4)}`;\n else if (finalName.startsWith(\"VDB_\")) name = `PNANOVDB_${finalName.slice(4)}`;\n if (name === undefined) return undefined;\n name = ALIASES.get(name) ?? name;\n return CHUNKS.has(name) ? name : undefined;\n}\n\nfunction rename(text: string): string {\n return text.replace(/\\bpnanovdb_/g, \"vdb_\").replace(/\\bPNANOVDB_/g, \"VDB_\");\n}\n\n/** Vendored declarations a module needs, in file order. */\nfunction closurePass(api: string, ctx: Context): string[] {\n const roots = new Set<string>();\n for (const m of api.matchAll(IDENTIFIER)) {\n const name = vendoredName(m[0]);\n if (name) roots.add(name);\n }\n const included = new Set<string>();\n const stack = [...roots];\n while (stack.length > 0) {\n const name = stack.pop() as string;\n if (included.has(name)) continue;\n included.add(name);\n const c = chunk(name);\n for (const d of referencedChunks(effectiveText(c, ctx), name)) if (!included.has(d)) stack.push(d);\n }\n return [...included].sort((a, b) => (ORDER.get(a) as number) - (ORDER.get(b) as number));\n}\n\n/**\n * Vendored declarations a module needs, in file order, and the context to\n * emit them with. Two passes: the first (whole type-table rows) finds which\n * type-table fields the closure reads; the second emits only those, which can\n * only shrink the closure.\n */\nfunction closure(api: string, o: NormalizedOptions): { names: string[]; ctx: Context } {\n const first = closurePass(api, { o, fields: null });\n const fields = new Set<string>();\n for (const name of first) {\n if (name === TYPE_TABLE || name === \"pnanovdb_grid_type_constants_t\") continue;\n for (const m of chunk(name).text.matchAll(/\\.([A-Za-z_]\\w*)/g)) {\n if (TYPE_TABLE_FIELDS.includes(m[1] as string)) fields.add(m[1] as string);\n }\n }\n const ctx: Context = { o, fields };\n return { names: closurePass(api, ctx), ctx };\n}\n\nconst cache = new Map<string, string>();\n\nfunction build(o: NormalizedOptions): string {\n const api = apiWgsl(o.profileRank, o);\n const access = o.binding.kind === \"slot\" ? VDB_POOL_BINDING_NAME : o.binding.expression;\n const load = `fn vdb_load(vdb_i: u32) -> u32 {\n return ${access}[vdb_i];\n}`;\n const { names, ctx } = closure(api, o);\n const vendored = names.map((name) => rename(effectiveText(chunk(name), ctx))).join(\"\\n\");\n const body = [vendored, load, api].join(\"\\n\");\n // Layout constants come from core/pool/layout.ts (one source of truth); keep\n // only the `const` lines the body references.\n const constants = vdbPoolLayoutWgsl()\n .split(\"\\n\")\n .filter((line) => {\n const name = /^const\\s+(\\w+)/.exec(line)?.[1];\n return name !== undefined && new RegExp(`\\\\b${name}\\\\b`).test(body);\n });\n const head = [VDB_MODULE_BANNER];\n if (o.binding.kind === \"slot\") {\n head.push(`@group(${o.binding.slot.group}) @binding(${o.binding.slot.firstBinding}) var<storage, read> ${VDB_POOL_BINDING_NAME}: array<u32>;`);\n }\n return [...head, ...constants, body].join(\"\\n\") + \"\\n\";\n}\n\n/**\n * Generate a WGSL module for the pool (docs/dev/design/K1-core.md §3.1).\n * Deterministic: the same options give the same string.\n *\n * `types` must cover every grid type the host may add to the pool, not just\n * the ones present now: a grid of a type the module wasn't generated for reads\n * as 0. Either generate for every type up front (`VDB_ALL_SCALAR_TYPES`, or\n * the host's known set) or regenerate the module and rebuild the pipeline when\n * `vdbCheckModule(pool, options)` throws `VDB_TYPE_NOT_COMPILED` after an `add`.\n *\n * @throws VDBError `VDB_BAD_OPTION` for invalid options.\n */\nexport function vdbModuleWgsl(options: VDBModuleOptions): string {\n const o = normalize(options, \"vdbModuleWgsl\");\n const key = JSON.stringify(o);\n let code = cache.get(key);\n if (code === undefined) {\n code = build(o);\n cache.set(key, code);\n }\n return code;\n}\n\n/**\n * The bind group layout entries a `slot` module declares: one read-only\n * storage buffer at `slot.firstBinding` (layout 1).\n *\n * Takes the same `VDBSlot` as `vdbModuleWgsl({ slot })` and\n * `pool.bindGroupEntry(slot)`, either bare or as `{ slot, visibility }`.\n * `visibility` defaults to `GPUShaderStage.COMPUTE | GPUShaderStage.FRAGMENT`\n * (read-only storage is legal in both stages), so render and compute hosts\n * both work without it; pass it to narrow the layout.\n *\n * @throws VDBError `VDB_BAD_OPTION` for a malformed slot.\n */\nexport function vdbModuleEntries(\n slotOrOptions: VDBSlot | { readonly slot: VDBSlot; readonly visibility?: GPUShaderStageFlags | undefined },\n): GPUBindGroupLayoutEntry[] {\n const where = \"vdbModuleEntries\";\n if (slotOrOptions === null || typeof slotOrOptions !== \"object\") throw bad(`${where}: expected a slot { group, firstBinding } or { slot, visibility? }.`);\n let slot: VDBSlot;\n let visibility: GPUShaderStageFlags = SHADER_STAGE_FRAGMENT_COMPUTE;\n if (\"slot\" in slotOrOptions) {\n rejectPositionalSlot(where, slotOrOptions);\n slot = checkSlot(slotOrOptions.slot, where);\n const v = slotOrOptions.visibility;\n if (v !== undefined) {\n if (!Number.isInteger(v) || v <= 0) throw bad(`${where}: visibility must be GPUShaderStage flags (a positive integer), got ${JSON.stringify(v)}.`);\n visibility = v;\n }\n } else {\n if (\"visibility\" in slotOrOptions) throw bad(`${where}: pass visibility as { slot: { group, firstBinding }, visibility }.`);\n slot = checkSlot(slotOrOptions, where);\n }\n return [{ binding: slot.firstBinding, visibility, buffer: { type: \"read-only-storage\" } }];\n}\n\n/**\n * Check that a module generated with `options` can read every grid in `pool`.\n *\n * `options` is either the full `vdbModuleWgsl` options (validated as such) or\n * just `{ types, layoutVersion? }` for a type/layout-only check, e.g. from an\n * engine adapter that builds its module elsewhere. `layoutVersion` is the\n * layout the module targets (default: this generator's,\n * `VDB_GPU_LAYOUT_VERSION`).\n *\n * After every `pool.add`: a module must be generated for every type the host\n * may add, or regenerated and its pipeline rebuilt.\n *\n * @throws VDBError `VDB_LAYOUT_MISMATCH` if the pool's layout is not the one\n * the module targets; `VDB_TYPE_NOT_COMPILED` if the pool holds a grid\n * type the module would not decode; `VDB_BAD_OPTION` for invalid options.\n */\nexport function vdbCheckModule(pool: VDBModulePoolLike, options: VDBModuleOptions | VDBModuleTypeCheck): void {\n const where = \"vdbCheckModule\";\n let o: { readonly types: readonly VDBGridTypeName[] };\n let target = VDB_GPU_LAYOUT_VERSION;\n if (options !== null && typeof options === \"object\" && !(\"slot\" in options) && !(\"buffer\" in options) && !(\"profile\" in options)) {\n // Type/layout-only form.\n o = { types: normalizeTypes(options.types, where) };\n const v = (options as VDBModuleTypeCheck).layoutVersion;\n if (v !== undefined) {\n if (!Number.isInteger(v) || v < 0) throw bad(`${where}: layoutVersion must be a non-negative integer, got ${JSON.stringify(v)}.`);\n target = v;\n }\n } else {\n o = normalize(options as VDBModuleOptions, where);\n }\n if (pool.layoutVersion !== target) {\n throw new VDBError(\n \"VDB_LAYOUT_MISMATCH\",\n `the pool uses layout ${pool.layoutVersion} but the module targets layout ${target}. Use one @pmndrs/vdb version for both.`,\n );\n }\n const missing = [...new Set(pool.types)].filter((t) => !o.types.includes(t));\n if (missing.length > 0) {\n throw new VDBError(\n \"VDB_TYPE_NOT_COMPILED\",\n `the pool holds ${missing.join(\", \")} grids but the module compiles only ${o.types.join(\", \")}; those grids would read 0. ` +\n `A module must be generated for every type the host may add: regenerate it with types that include ${missing.join(\", \")} ` +\n `(e.g. [...pool.types], or VDB_ALL_SCALAR_TYPES to never rebuild) and rebuild the pipeline that uses it.`,\n );\n }\n}\n\n/** @internal Vendored declarations (vendored names) a module with these options includes, in file order. For tests. */\nexport function vdbModuleDeclarations(options: VDBModuleOptions): string[] {\n const o = normalize(options, \"vdbModuleDeclarations\");\n return closure(apiWgsl(o.profileRank, o), o).names;\n}\n"]}
|
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,CAAC,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;QACvI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC7C,MAAM,IAAI,QAAQ,CAChB,cAAc,EACd,QAAQ,GAAG,wFAAwF,IAAI,kBAAkB;gBACvH,2HAA2H;gBAC3H,6CAA6C;gBAC7C,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,gEAAgE,CAAC,CAAC,CAAC,GAAG,CAAC,CAC9F,CAAC;QACJ,CAAC;IACH,CAAC;AACH,CAAC;AAED,uHAAuH;AACvH,MAAM,UAAU,qBAAqB,CAAC,OAAyB;IAC7D,MAAM,CAAC,GAAG,SAAS,CAAC,OAAO,EAAE,uBAAuB,CAAC,CAAC;IACtD,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,uBAAuB,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC/D,CAAC","sourcesContent":["/**\n * WGSL module generator (docs/dev/design/K1-core.md §3, task K1.4a).\n *\n * Roots for the profile and options (the vendored names the API layer uses)\n * -> closure over the declaration table extracted from the unmodified vendored\n * `pnanovdb.wgsl` -> generation transforms -> `pnanovdb_`→`vdb_` rename ->\n * append the API layer -> prepend one SPDX line.\n *\n * Generation transforms (each one is a row in vendor/VENDOR.md, \"Generation\n * transforms\"; none edits the vendored file):\n * 1. `pnanovdb_buf_read_uint32` reads through `vdb_load`, the module's single\n * buffer access site (§2).\n * 2. The 27-row `pnanovdb_grid_type_constants` array becomes\n * `fn vdb_gtc(grid_type)` returning only the compiled types' rows; its\n * `[grid_type]` call sites become `vdb_gtc(grid_type)`.\n * 3. `pnanovdb_read_float_typed` keeps only the compiled types' branches, so\n * the other decoders drop out of the closure.\n * 4. Declarations unreachable from the profile's roots are not emitted (the\n * `pnanovdb_sample_trilinear_{float,fp8,fpn}` wrappers among them).\n * 5. Every `pnanovdb_` / `PNANOVDB_` becomes `vdb_` / `VDB_`.\n * 6. Comments are dropped (done at extraction).\n * 7. `pnanovdb_leaf_get_stat_float` keeps only the compiled types' branch\n * (the Fp leaf-stats decode, K1.4b), so a Float-only module has no\n * uint16 decoder.\n * 8. Half min/max stats (K7.H): without `half`, calls to\n * `pnanovdb_read_minmax_float` / `pnanovdb_leaf_get_minmax_float` are\n * rewritten to the plain readers they wrap (so modules without `half` are\n * byte-identical to those generated before Half existed); with `half`,\n * the two keep only the compiled types' branch.\n *\n * Output is deterministic: the same options give the same bytes, and `types`\n * is a set (order and duplicates do not matter).\n */\n\nimport { VDBError } from \"../errors.js\";\nimport { VDB_GPU_LAYOUT_VERSION, vdbPoolLayoutWgsl } from \"../pool/layout.js\";\nimport { VDB_GRID_TYPE_IDS, VDB_GRID_TYPE_NAMES, type VDBGridTypeName, type VDBSlot } from \"../types.js\";\nimport { apiPublicFunctions, apiWgsl, hasMarch, pruneApiWgsl, type ApiOptions } from \"./api.js\";\nimport type { VDBMajorantMode } from \"./majorant.js\";\nimport { WGSL_KEYWORDS, WGSL_RESERVED_WORDS } from \"./reserved.js\";\nimport { PNANOVDB_CHUNKS, type PnanovdbChunk } from \"./pnanovdb.chunks.generated.js\";\nimport type { VDBModuleHelper, VDBModuleOptions, VDBModulePoolLike, VDBModuleProfile, VDBModuleTypeCheck } from \"./types.js\";\n\n/** First line of every generated module (§3.3). */\nexport const VDB_MODULE_BANNER =\n \"// SPDX-License-Identifier: Apache-2.0 AND MIT. Derived from PNanoVDB.h (OpenVDB) via emcfarlane/webgpu-nanovdb; see NOTICE.\";\n\n/** Name of the storage binding `slot` mode declares. */\nexport const VDB_POOL_BINDING_NAME = \"vdbPool\";\n\n/** Profiles in inclusion order (`majorant`, P1.3, takes the march layer only with `majorant: 'nodeMax'`). */\nconst PROFILES: readonly VDBModuleProfile[] = [\"read\", \"sample\", \"march\", \"majorant\"];\nconst MAJORANT_MODES: readonly VDBMajorantMode[] = [\"brick\", \"global\", \"nodeMax\"];\n\n/** `GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE` (0x2 | 0x4); the global does not exist in Node. */\nconst SHADER_STAGE_FRAGMENT_COMPUTE = 0x2 | 0x4;\n\n/** Opt-in helpers in canonical order, with the lowest profile rank each needs. */\nconst HELPERS: Readonly<Record<VDBModuleHelper, { readonly rank: number }>> = {\n cellBoundTrilinear: { rank: 2 },\n hddaCellEnd: { rank: 2 },\n levelSet: { rank: 2 },\n nodeAverage: { rank: 2 },\n rayClipSupport: { rank: 1 },\n fastTrilinear: { rank: 1 },\n // EX1f-b, the majorant profile's helpers (appended: the canonical order of the older ones is unchanged).\n majorantWorld: { rank: 3 },\n majorantGlobal: { rank: 3 },\n deltaTrack: { rank: 3 },\n ratioTrack: { rank: 3 },\n // P1.16, the lean reader's unchecked init (appended).\n accessorUnchecked: { rank: 0 },\n};\n/** Helpers that never touch the vendored accessor (the lean reader takes them). */\nconst LEAN_HELPERS: readonly VDBModuleHelper[] = [\"rayClipSupport\", \"majorantWorld\", \"majorantGlobal\", \"deltaTrack\", \"ratioTrack\", \"accessorUnchecked\"];\nconst LEAN_CACHES = [\"leaf\", \"lower\", \"lowerLeaf\"] as const;\nconst TRACK_HELPERS: readonly VDBModuleHelper[] = [\"deltaTrack\", \"ratioTrack\"];\nconst WGSL_IDENTIFIER = /^[A-Za-z_][A-Za-z0-9_]*$/;\nconst HELPER_NAMES = Object.keys(HELPERS) as VDBModuleHelper[];\n\nconst IDENTIFIER = /[A-Za-z_][A-Za-z0-9_]*/g;\nconst BUFFER_EXPRESSION = /^[A-Za-z_][A-Za-z0-9_]*(\\.[A-Za-z_][A-Za-z0-9_]*)*$/;\n\ntype Binding = { readonly kind: \"slot\"; readonly slot: VDBSlot } | { readonly kind: \"buffer\"; readonly expression: string };\n\ninterface NormalizedOptions extends ApiOptions {\n readonly profile: VDBModuleProfile;\n readonly profileRank: number;\n readonly binding: Binding;\n /** P1.16: the public functions to keep (sorted), or null for all. */\n readonly keep: readonly string[] | null;\n}\n\nfunction bad(message: string): VDBError {\n return new VDBError(\"VDB_BAD_OPTION\", message);\n}\n\nfunction checkSlot(slot: unknown, where: string): VDBSlot {\n const s = slot as Partial<VDBSlot> | null | undefined;\n if (\n s === null ||\n typeof s !== \"object\" ||\n !Number.isInteger(s.group) ||\n !Number.isInteger(s.firstBinding) ||\n (s.group as number) < 0 ||\n (s.firstBinding as number) < 0\n ) {\n throw bad(`${where}: slot must be { group, firstBinding } with non-negative integers, got ${JSON.stringify(slot)}.`);\n }\n return { group: s.group as number, firstBinding: s.firstBinding as number };\n}\n\n/** The old bvh-style positional slot (`{ group, firstBinding }` at the top level of the module options) would be silently misread. */\nfunction rejectPositionalSlot(where: string, options: object): void {\n if (\"group\" in options || \"firstBinding\" in options) {\n throw bad(`${where}: got 'group' or 'firstBinding' at the top level. Pass { slot: { group, firstBinding } }.`);\n }\n}\n\nfunction normalizeHelpers(\n helpers: unknown,\n profile: VDBModuleProfile,\n profileRank: number,\n majorant: VDBMajorantMode,\n reader: \"vendored\" | \"lean\",\n cache: \"leaf\" | \"lower\" | \"lowerLeaf\",\n where: string,\n): VDBModuleHelper[] {\n if (helpers === undefined) return [];\n if (helpers === null || typeof helpers === \"string\" || typeof (helpers as Iterable<unknown>)[Symbol.iterator] !== \"function\") {\n throw bad(`${where}: helpers must be an array or set of helper names (${HELPER_NAMES.join(\", \")}), got ${JSON.stringify(helpers)}.`);\n }\n const seen = new Set<string>();\n for (const h of helpers as Iterable<unknown>) {\n if (typeof h !== \"string\" || !(HELPER_NAMES as readonly string[]).includes(h)) {\n throw bad(`${where}: unknown helper ${JSON.stringify(h)}; use ${HELPER_NAMES.join(\", \")}.`);\n }\n const need = HELPERS[h as VDBModuleHelper].rank;\n if (profileRank < need || (need === 2 && !hasMarch(profileRank, { majorant }))) {\n const also = profileRank === 3 ? \" (profile 'majorant' has the march layer only with majorant: 'nodeMax')\" : \"\";\n throw bad(`${where}: helper '${h}' needs profile '${PROFILES[need]}' or above, got '${profile}'${also}.`);\n }\n if (reader === \"lean\" && h === \"fastTrilinear\") {\n // P1.16: with a lower-node cache the lean vdbSample is the fast sampler; vdbSampleFast is its other name.\n if (cache === \"leaf\") {\n throw bad(`${where}: helper 'fastTrilinear' with reader 'lean' needs cache: 'lower' or 'lowerLeaf' (the lean vdbSample then reads every tap as one lower-node lookup).`);\n }\n } else if (reader === \"lean\" && !LEAN_HELPERS.includes(h as VDBModuleHelper)) {\n throw bad(`${where}: helper '${h}' reads the vendored accessor; reader 'lean' takes only ${LEAN_HELPERS.map((n) => `'${n}'`).join(\", \")} (and 'fastTrilinear' with cache 'lower' / 'lowerLeaf').`);\n }\n if (reader !== \"lean\" && h === \"accessorUnchecked\") {\n throw bad(`${where}: helper 'accessorUnchecked' needs reader: 'lean'.`);\n }\n if (h === \"majorantGlobal\" && majorant === \"nodeMax\") {\n throw bad(`${where}: helper 'majorantGlobal' needs majorant 'brick' or 'global' (the 'nodeMax' iterator has no one-segment mode).`);\n }\n seen.add(h);\n }\n return HELPER_NAMES.filter((h) => seen.has(h));\n}\n\nfunction normalizeTypes(types: unknown, where: string): VDBGridTypeName[] {\n if (types === undefined || types === null || typeof types === \"string\" || typeof (types as Iterable<unknown>)[Symbol.iterator] !== \"function\") {\n throw bad(`${where}: types must be an array or set of grid type names (${VDB_GRID_TYPE_NAMES.join(\", \")}), e.g. [...pool.types].`);\n }\n const seen = new Set<string>();\n for (const t of types as Iterable<unknown>) {\n if (typeof t !== \"string\" || !(VDB_GRID_TYPE_NAMES as readonly string[]).includes(t)) {\n throw bad(`${where}: unknown grid type ${JSON.stringify(t)}; use ${VDB_GRID_TYPE_NAMES.join(\", \")}.`);\n }\n seen.add(t);\n }\n if (seen.size === 0) {\n throw bad(`${where}: types is empty. Compile at least one grid type, e.g. ['float'], or pass [...pool.types] after adding a grid.`);\n }\n return VDB_GRID_TYPE_NAMES.filter((t) => seen.has(t));\n}\n\nfunction normalize(options: VDBModuleOptions, where: string): NormalizedOptions {\n if (options === null || typeof options !== \"object\") {\n throw bad(`${where}: expected an options object { slot | buffer, types, profile }.`);\n }\n rejectPositionalSlot(where, options);\n\n const hasSlot = (options as { slot?: unknown }).slot !== undefined;\n const hasBuffer = (options as { buffer?: unknown }).buffer !== undefined;\n if (hasSlot === hasBuffer) {\n throw bad(`${where}: pass exactly one of slot: { group, firstBinding } (declares the binding) or buffer: '<wgsl expression>' (reads a host-declared array<u32>).`);\n }\n let binding: Binding;\n if (hasSlot) {\n binding = { kind: \"slot\", slot: checkSlot(options.slot, where) };\n } else {\n const expression: unknown = options.buffer;\n if (typeof expression !== \"string\" || !BUFFER_EXPRESSION.test(expression)) {\n throw bad(`${where}: buffer must be a WGSL identifier or member chain such as 'vdbPool.value', got ${JSON.stringify(expression)}.`);\n }\n for (const part of expression.split(\".\")) {\n if (part.startsWith(\"__\")) {\n throw bad(`${where}: buffer ${JSON.stringify(expression)} uses '${part}'; WGSL identifiers must not start with '__'. Rename the host binding.`);\n }\n if (part === \"_\" || WGSL_RESERVED_WORDS.has(part) || WGSL_KEYWORDS.has(part)) {\n throw bad(`${where}: buffer ${JSON.stringify(expression)} uses '${part}', which WGSL reserves. Rename the host binding (e.g. 'vdbPool.value').`);\n }\n }\n binding = { kind: \"buffer\", expression };\n }\n\n const profileRank = PROFILES.indexOf(options.profile);\n if (profileRank < 0) {\n throw bad(`${where}: profile must be one of ${PROFILES.map((p) => `'${p}'`).join(\", \")}, got ${JSON.stringify(options.profile)}.`);\n }\n const isMajorant = profileRank === 3;\n if (options.majorant !== undefined && !isMajorant) {\n throw bad(`${where}: majorant applies to profile 'majorant' only, got profile '${options.profile}'.`);\n }\n if (options.minima !== undefined && !isMajorant) {\n throw bad(`${where}: minima applies to profile 'majorant' only, got profile '${options.profile}'.`);\n }\n const majorant = options.majorant ?? \"brick\";\n if (!MAJORANT_MODES.includes(majorant)) {\n throw bad(`${where}: majorant must be ${MAJORANT_MODES.map((m) => `'${m}'`).join(\", \")}, got ${JSON.stringify(majorant)}.`);\n }\n const minima = options.minima ?? false;\n if (typeof minima !== \"boolean\") throw bad(`${where}: minima must be a boolean, got ${JSON.stringify(minima)}.`);\n const reader = options.reader ?? \"vendored\";\n if (reader !== \"vendored\" && reader !== \"lean\") {\n throw bad(`${where}: reader must be 'vendored' or 'lean', got ${JSON.stringify(reader)}.`);\n }\n if (reader === \"lean\" && hasMarch(profileRank, { majorant })) {\n throw bad(\n `${where}: reader 'lean' has no march layer (HDDA, node stats); use the vendored reader for profile 'march' or majorant 'nodeMax'.`,\n );\n }\n\n // P1.16: the lean accessor's cache.\n const cache: unknown = options.cache ?? \"leaf\";\n if (!(LEAN_CACHES as readonly unknown[]).includes(cache)) {\n throw bad(`${where}: cache must be ${LEAN_CACHES.map((c) => `'${c}'`).join(\", \")}, got ${JSON.stringify(cache)}.`);\n }\n if (options.cache !== undefined && reader !== \"lean\") {\n throw bad(`${where}: cache applies to reader 'lean' only (the vendored accessor has its own leaf / lower / upper cache).`);\n }\n\n // EX1f-b: the trackers call the host's random function by name.\n const helperNames = normalizeHelpers(options.helpers, options.profile, profileRank, majorant, reader, cache as (typeof LEAN_CACHES)[number], where);\n const tracking = helperNames.some((h) => TRACK_HELPERS.includes(h));\n const random: unknown = options.random;\n if (random !== undefined) {\n if (!tracking) throw bad(`${where}: random applies to the helpers 'deltaTrack' and 'ratioTrack' only.`);\n if (typeof random !== \"string\" || !WGSL_IDENTIFIER.test(random)) {\n throw bad(`${where}: random must be the name of a WGSL function \\`fn name() -> f32\\` (an identifier), got ${JSON.stringify(random)}.`);\n }\n if (random.startsWith(\"__\") || random === \"_\" || WGSL_RESERVED_WORDS.has(random) || WGSL_KEYWORDS.has(random)) {\n throw bad(`${where}: random '${random}' is not a name WGSL allows for a function. Rename the host's function.`);\n }\n if (/^vdb/i.test(random)) throw bad(`${where}: random '${random}' starts with 'vdb', the module's own prefix. Rename the host's function.`);\n } else if (tracking) {\n throw bad(\n `${where}: helpers 'deltaTrack' / 'ratioTrack' need random: '<name>', a function \\`fn <name>() -> f32\\` in your shader that returns uniform numbers in [0, 1).`,\n );\n }\n\n const sampler = options.sampler ?? \"trilinear\";\n if (sampler !== \"trilinear\" && sampler !== \"nearest\") {\n throw bad(`${where}: sampler must be 'trilinear' or 'nearest', got ${JSON.stringify(sampler)}.`);\n }\n const outside = options.outside ?? \"background\";\n if (outside !== \"background\" && outside !== \"zero\") {\n throw bad(`${where}: outside must be 'background' or 'zero', got ${JSON.stringify(outside)}.`);\n }\n const isActive = options.isActive ?? true;\n if (typeof isActive !== \"boolean\") {\n throw bad(`${where}: isActive must be a boolean, got ${JSON.stringify(isActive)}.`);\n }\n\n // Sample-only options do not change a `read` module; normalize them away so\n // equal modules share one cache key.\n const sampleOnly = profileRank >= 1;\n return {\n profile: options.profile,\n profileRank,\n binding,\n types: normalizeTypes(options.types, where),\n isActive,\n sampler: sampleOnly ? sampler : \"trilinear\",\n outside: sampleOnly ? outside : \"background\",\n helpers: checkHelperSampler(helperNames, sampleOnly ? sampler : \"trilinear\", where),\n reader,\n majorant,\n minima,\n random: (random as string | undefined) ?? null,\n cache: cache as (typeof LEAN_CACHES)[number],\n keep: normalizeKeep(options.keep, where),\n };\n}\n\n/** P1.16 `keep`: a set of function names (checked against the module's functions at build), sorted. */\nfunction normalizeKeep(keep: unknown, where: string): string[] | null {\n if (keep === undefined) return null;\n if (keep === null || typeof keep === \"string\" || typeof (keep as Iterable<unknown>)[Symbol.iterator] !== \"function\") {\n throw bad(`${where}: keep must be an array or set of the module's function names, e.g. ['vdbAccessorInit', 'vdbSample'].`);\n }\n const seen = new Set<string>();\n for (const k of keep as Iterable<unknown>) {\n if (typeof k !== \"string\" || !WGSL_IDENTIFIER.test(k)) throw bad(`${where}: keep entries are function names, got ${JSON.stringify(k)}.`);\n seen.add(k);\n }\n if (seen.size === 0) throw bad(`${where}: keep is empty; list the functions the kernel calls, or leave it out.`);\n return [...seen].sort();\n}\n\n/** The API text of the options: every layer and helper, cut to `keep` when given. */\nfunction apiText(o: NormalizedOptions, where: string): string {\n const api = apiWgsl(o.profileRank, o);\n if (o.keep === null) return api;\n const names = apiPublicFunctions(api);\n const unknown = o.keep.filter((k) => !names.includes(k));\n if (unknown.length > 0) {\n throw bad(`${where}: keep names ${unknown.map((k) => `'${k}'`).join(\", \")}, which this module does not have. Its functions: ${names.join(\", \")}.`);\n }\n return pruneApiWgsl(api, o.keep);\n}\n\n/** `fastTrilinear` shares one leaf between the 8 trilinear taps; `nearest` has one tap. */\nfunction checkHelperSampler(helpers: VDBModuleHelper[], sampler: \"trilinear\" | \"nearest\", where: string): VDBModuleHelper[] {\n if (sampler === \"nearest\" && helpers.includes(\"fastTrilinear\")) {\n throw bad(`${where}: helper 'fastTrilinear' needs sampler 'trilinear' (nearest reads one voxel; call vdbSample).`);\n }\n return helpers;\n}\n\n// ---------------------------------------------------------------------------\n// Declaration table and transforms\n\nconst CHUNKS = new Map<string, PnanovdbChunk>(PNANOVDB_CHUNKS.map((c) => [c.name, c]));\nconst ORDER = new Map<string, number>(PNANOVDB_CHUNKS.map((c, i) => [c.name, i]));\n\nfunction chunk(name: string): PnanovdbChunk {\n const c = CHUNKS.get(name);\n if (!c) throw new Error(`@pmndrs/vdb: vendored declaration ${name} is missing; re-run scripts/extract-wgsl-chunks.mjs`);\n return c;\n}\n\nconst TYPE_TABLE = \"pnanovdb_grid_type_constants\";\nconst TYPE_TABLE_FN = \"pnanovdb_gtc\";\nconst TYPE_TABLE_CALL_SITE = /\\bpnanovdb_grid_type_constants\\[([^\\]]+)\\]/g;\n/** Names the transforms introduce, resolved to the declaration they replace. */\nconst ALIASES = new Map<string, string>([[TYPE_TABLE_FN, TYPE_TABLE]]);\n\nconst GRID_TYPE_CONSTANT_PRE: Readonly<Record<VDBGridTypeName, string>> = {\n float: \"PNANOVDB_GRID_TYPE_FLOAT\",\n fp4: \"PNANOVDB_GRID_TYPE_FP4\",\n fp8: \"PNANOVDB_GRID_TYPE_FP8\",\n fp16: \"PNANOVDB_GRID_TYPE_FP16\",\n fpn: \"PNANOVDB_GRID_TYPE_FPN\",\n half: \"PNANOVDB_GRID_TYPE_HALF\",\n};\n\n/** Types whose leaf values are Fp codes (decoded by `pnanovdb_root_<t>_read_float`). */\nconst FP_TYPES: ReadonlySet<VDBGridTypeName> = new Set([\"fp4\", \"fp8\", \"fp16\", \"fpn\"]);\n\n/** Field names of the vendored `pnanovdb_grid_type_constants_t`, in order. */\nconst TYPE_TABLE_FIELDS: readonly string[] = [...chunk(\"pnanovdb_grid_type_constants_t\").text.matchAll(/^\\s+(\\w+)\\s*:/gm)].map((m) => m[1] as string);\n\n/** The 27 rows of the vendored type table, as argument lists. */\nconst TYPE_TABLE_ROWS: readonly (readonly string[])[] = (() => {\n const rows = [...chunk(TYPE_TABLE).text.matchAll(/pnanovdb_grid_type_constants_t\\(([^)]*)\\)/g)].map((m) =>\n (m[1] as string).split(\",\").map((v) => v.trim()),\n );\n if (rows.length !== 27 || rows.some((r) => r.length !== TYPE_TABLE_FIELDS.length)) {\n throw new Error(`@pmndrs/vdb: unexpected vendored grid type table shape; re-check generate.ts against vendor/pnanovdb.wgsl`);\n }\n return rows;\n})();\n\n/**\n * Generation context: the options, plus the type-table fields the emitted\n * code reads (`null` = all, used for the first closure pass).\n */\ninterface Context {\n readonly o: NormalizedOptions;\n readonly fields: ReadonlySet<string> | null;\n}\n\n/** Transform 1: the single buffer access. */\nfunction bufReadOverride(): string {\n return `fn pnanovdb_buf_read_uint32(buf: pnanovdb_buf_t, byte_offset: u32) -> u32 {\n return vdb_load((buf.byte_offset >> 2u) + (byte_offset >> 2u));\n}`;\n}\n\n/**\n * Transform 2: the type table cut to the compiled types. Fields no emitted code\n * reads are written as 0u, and types whose remaining rows are equal share one\n * branch (Fp4/Fp8/Fp16/FpN differ only in the unread `leaf_size`). One distinct\n * row: a constant, no branch.\n */\nfunction typeTableOverride({ o, fields }: Context): string {\n const groups: { row: string; types: VDBGridTypeName[] }[] = [];\n for (const t of o.types) {\n const values = TYPE_TABLE_ROWS[VDB_GRID_TYPE_IDS[t]] as readonly string[];\n const row = `pnanovdb_grid_type_constants_t(${values\n .map((v, i) => (fields === null || fields.has(TYPE_TABLE_FIELDS[i] as string) ? v : \"0u\"))\n .join(\", \")})`;\n const group = groups.find((g) => g.row === row);\n if (group) group.types.push(t);\n else groups.push({ row, types: [t] });\n }\n const lines = [`fn ${TYPE_TABLE_FN}(grid_type: u32) -> pnanovdb_grid_type_constants_t {`];\n groups.forEach((g, i) => {\n if (i === groups.length - 1) {\n lines.push(` return ${g.row};`);\n } else {\n lines.push(` if ${g.types.map((t) => `grid_type == ${GRID_TYPE_CONSTANT_PRE[t]}`).join(\" || \")} {`);\n lines.push(` return ${g.row};`);\n lines.push(` }`);\n }\n });\n lines.push(\"}\");\n return lines.join(\"\\n\");\n}\n\n/** Transform 3: typed decode limited to the compiled types. */\nfunction readFloatTypedOverride({ o }: Context): string {\n const text = chunk(\"pnanovdb_read_float_typed\").text;\n const signature = text.slice(0, text.indexOf(\"{\") + 1);\n const special = o.types.filter((t) => t !== \"float\");\n const decode = (t: VDBGridTypeName) =>\n t === \"half\" ? \"pnanovdb_read_half(buf, address)\" : `pnanovdb_root_${t}_read_float(buf, address, ijk, level)`;\n const lines = [signature];\n // Without Float, the last other type is the fallthrough: `ok` already rejects\n // every type not compiled before a read reaches here.\n const branches = o.types.includes(\"float\") ? special : special.slice(0, -1);\n for (const t of branches) {\n lines.push(` if grid_type == ${GRID_TYPE_CONSTANT_PRE[t]} {`);\n lines.push(` return ${decode(t)};`);\n lines.push(` }`);\n }\n lines.push(o.types.includes(\"float\") ? \" return pnanovdb_read_float(buf, address);\" : ` return ${decode(special[special.length - 1] as VDBGridTypeName)};`);\n lines.push(\"}\");\n return lines.join(\"\\n\");\n}\n\n/**\n * Transform 7: the leaf-stat dispatch limited to the compiled types. No Fp type\n * compiled: a plain f32 read (the code decoder drops out). Only Fp types: the\n * decode, unconditionally. Both: one branch over the compiled Fp types. (Half\n * leaf ave/stddev are f32, so Half counts as a plain type here; its min/max go\n * through transform 8.)\n */\nfunction leafStatOverride({ o }: Context): string {\n const text = chunk(\"pnanovdb_leaf_get_stat_float\").text;\n const signature = text.slice(0, text.indexOf(\"{\") + 1);\n const fpTypes = o.types.filter((t) => FP_TYPES.has(t));\n const plainTypes = o.types.filter((t) => !FP_TYPES.has(t));\n const decode = \"return pnanovdb_leaf_fp_get_stat_float(grid_type, buf, node, address, with_minimum);\";\n const plain = \"return pnanovdb_read_float(buf, address);\";\n const lines = [signature];\n if (fpTypes.length === 0) {\n lines.push(` ${plain}`);\n } else if (plainTypes.length === 0) {\n lines.push(` ${decode}`);\n } else {\n lines.push(` if ${fpTypes.map((t) => `grid_type == ${GRID_TYPE_CONSTANT_PRE[t]}`).join(\" || \")} {`);\n lines.push(` ${decode}`);\n lines.push(\" }\");\n lines.push(` ${plain}`);\n }\n lines.push(\"}\");\n return lines.join(\"\\n\");\n}\n\n/** Transform 8 (with `half`): a Half-aware min/max reader keeping only the compiled types' branch. */\nfunction minmaxOverride(name: string, other: string): (ctx: Context) => string {\n return ({ o }) => {\n const text = chunk(name).text;\n const signature = text.slice(0, text.indexOf(\"{\") + 1);\n const half = \"return pnanovdb_read_half(buf, address);\";\n const lines = [signature];\n if (o.types.length === 1) {\n lines.push(` ${half}`);\n } else {\n lines.push(` if grid_type == ${GRID_TYPE_CONSTANT_PRE.half} {`);\n lines.push(` ${half}`);\n lines.push(\" }\");\n lines.push(` ${other}`);\n }\n lines.push(\"}\");\n return lines.join(\"\\n\");\n };\n}\n\n/** Transform 8 (without `half`): call sites of the Half-aware min/max readers, back to the readers they wrap. */\nconst MINMAX_CALL_SITE = /\\bpnanovdb_read_minmax_float\\(grid_type, buf, /g;\nconst LEAF_MINMAX_CALL_SITE = /\\bpnanovdb_leaf_get_minmax_float\\(grid_type, buf, node, (pnanovdb_leaf_get_m(?:in|ax)_address\\(grid_type, buf, node\\))\\)/g;\n\nconst OVERRIDES = new Map<string, (ctx: Context) => string>([\n [\"pnanovdb_buf_read_uint32\", bufReadOverride],\n [TYPE_TABLE, typeTableOverride],\n [\"pnanovdb_read_float_typed\", readFloatTypedOverride],\n [\"pnanovdb_leaf_get_stat_float\", leafStatOverride],\n [\"pnanovdb_read_minmax_float\", minmaxOverride(\"pnanovdb_read_minmax_float\", \"return pnanovdb_read_float(buf, address);\")],\n [\n \"pnanovdb_leaf_get_minmax_float\",\n minmaxOverride(\"pnanovdb_leaf_get_minmax_float\", \"return pnanovdb_leaf_get_stat_float(grid_type, buf, node, address, true);\"),\n ],\n]);\n\nfunction effectiveText(c: PnanovdbChunk, ctx: Context): string {\n const override = OVERRIDES.get(c.name);\n if (override) return override(ctx);\n let text = c.text.replace(TYPE_TABLE_CALL_SITE, `${TYPE_TABLE_FN}($1)`);\n if (!ctx.o.types.includes(\"half\")) {\n text = text\n .replace(MINMAX_CALL_SITE, \"pnanovdb_read_float(buf, \")\n .replace(LEAF_MINMAX_CALL_SITE, \"pnanovdb_leaf_get_stat_float(grid_type, buf, node, $1, true)\");\n }\n return text;\n}\n\nfunction referencedChunks(text: string, self?: string): string[] {\n const out = new Set<string>();\n for (const m of text.matchAll(IDENTIFIER)) {\n const name = ALIASES.get(m[0]) ?? m[0];\n if (name !== self && CHUNKS.has(name)) out.add(name);\n }\n return [...out];\n}\n\n/** Map a final (`vdb_` / `VDB_`) name back to its vendored declaration, if it is one. */\nfunction vendoredName(finalName: string): string | undefined {\n let name: string | undefined;\n if (finalName.startsWith(\"vdb_\")) name = `pnanovdb_${finalName.slice(4)}`;\n else if (finalName.startsWith(\"VDB_\")) name = `PNANOVDB_${finalName.slice(4)}`;\n if (name === undefined) return undefined;\n name = ALIASES.get(name) ?? name;\n return CHUNKS.has(name) ? name : undefined;\n}\n\nfunction rename(text: string): string {\n return text.replace(/\\bpnanovdb_/g, \"vdb_\").replace(/\\bPNANOVDB_/g, \"VDB_\");\n}\n\n/** Vendored declarations a module needs, in file order. */\nfunction closurePass(api: string, ctx: Context): string[] {\n const roots = new Set<string>();\n for (const m of api.matchAll(IDENTIFIER)) {\n const name = vendoredName(m[0]);\n if (name) roots.add(name);\n }\n const included = new Set<string>();\n const stack = [...roots];\n while (stack.length > 0) {\n const name = stack.pop() as string;\n if (included.has(name)) continue;\n included.add(name);\n const c = chunk(name);\n for (const d of referencedChunks(effectiveText(c, ctx), name)) if (!included.has(d)) stack.push(d);\n }\n return [...included].sort((a, b) => (ORDER.get(a) as number) - (ORDER.get(b) as number));\n}\n\n/**\n * Vendored declarations a module needs, in file order, and the context to\n * emit them with. Two passes: the first (whole type-table rows) finds which\n * type-table fields the closure reads; the second emits only those, which can\n * only shrink the closure.\n */\nfunction closure(api: string, o: NormalizedOptions): { names: string[]; ctx: Context } {\n const first = closurePass(api, { o, fields: null });\n const fields = new Set<string>();\n for (const name of first) {\n if (name === TYPE_TABLE || name === \"pnanovdb_grid_type_constants_t\") continue;\n for (const m of chunk(name).text.matchAll(/\\.([A-Za-z_]\\w*)/g)) {\n if (TYPE_TABLE_FIELDS.includes(m[1] as string)) fields.add(m[1] as string);\n }\n }\n const ctx: Context = { o, fields };\n return { names: closurePass(api, ctx), ctx };\n}\n\nconst cache = new Map<string, string>();\n\nfunction build(o: NormalizedOptions): string {\n const api = apiText(o, \"vdbModuleWgsl\");\n const access = o.binding.kind === \"slot\" ? VDB_POOL_BINDING_NAME : o.binding.expression;\n const load = `fn vdb_load(vdb_i: u32) -> u32 {\n return ${access}[vdb_i];\n}`;\n const { names, ctx } = closure(api, o);\n const vendored = names.map((name) => rename(effectiveText(chunk(name), ctx))).join(\"\\n\");\n const body = [vendored, load, api].join(\"\\n\");\n // Layout constants come from core/pool/layout.ts (one source of truth); keep\n // only the `const` lines the body references.\n const constants = vdbPoolLayoutWgsl()\n .split(\"\\n\")\n .filter((line) => {\n const name = /^const\\s+(\\w+)/.exec(line)?.[1];\n return name !== undefined && new RegExp(`\\\\b${name}\\\\b`).test(body);\n });\n const head = [VDB_MODULE_BANNER];\n if (o.binding.kind === \"slot\") {\n head.push(`@group(${o.binding.slot.group}) @binding(${o.binding.slot.firstBinding}) var<storage, read> ${VDB_POOL_BINDING_NAME}: array<u32>;`);\n }\n return [...head, ...constants, body].join(\"\\n\") + \"\\n\";\n}\n\n/**\n * Generate a WGSL module for the pool (docs/dev/design/K1-core.md §3.1).\n * Deterministic: the same options give the same string.\n *\n * `types` must cover every grid type the host may add to the pool, not just\n * the ones present now: a grid of a type the module wasn't generated for reads\n * as 0. Either generate for every type up front (`VDB_ALL_SCALAR_TYPES`, or\n * the host's known set) or regenerate the module and rebuild the pipeline when\n * `vdbCheckModule(pool, options)` throws `VDB_TYPE_NOT_COMPILED` after an `add`.\n *\n * @throws VDBError `VDB_BAD_OPTION` for invalid options.\n */\nexport function vdbModuleWgsl(options: VDBModuleOptions): string {\n const o = normalize(options, \"vdbModuleWgsl\");\n const key = JSON.stringify(o);\n let code = cache.get(key);\n if (code === undefined) {\n code = build(o);\n cache.set(key, code);\n }\n return code;\n}\n\n/**\n * The bind group layout entries a `slot` module declares: one read-only\n * storage buffer at `slot.firstBinding` (layout 1).\n *\n * Takes the same `VDBSlot` as `vdbModuleWgsl({ slot })` and\n * `pool.bindGroupEntry(slot)`, either bare or as `{ slot, visibility }`.\n * `visibility` defaults to `GPUShaderStage.COMPUTE | GPUShaderStage.FRAGMENT`\n * (read-only storage is legal in both stages), so render and compute hosts\n * both work without it; pass it to narrow the layout.\n *\n * @throws VDBError `VDB_BAD_OPTION` for a malformed slot.\n */\nexport function vdbModuleEntries(\n slotOrOptions: VDBSlot | { readonly slot: VDBSlot; readonly visibility?: GPUShaderStageFlags | undefined },\n): GPUBindGroupLayoutEntry[] {\n const where = \"vdbModuleEntries\";\n if (slotOrOptions === null || typeof slotOrOptions !== \"object\") throw bad(`${where}: expected a slot { group, firstBinding } or { slot, visibility? }.`);\n let slot: VDBSlot;\n let visibility: GPUShaderStageFlags = SHADER_STAGE_FRAGMENT_COMPUTE;\n if (\"slot\" in slotOrOptions) {\n rejectPositionalSlot(where, slotOrOptions);\n slot = checkSlot(slotOrOptions.slot, where);\n const v = slotOrOptions.visibility;\n if (v !== undefined) {\n if (!Number.isInteger(v) || v <= 0) throw bad(`${where}: visibility must be GPUShaderStage flags (a positive integer), got ${JSON.stringify(v)}.`);\n visibility = v;\n }\n } else {\n if (\"visibility\" in slotOrOptions) throw bad(`${where}: pass visibility as { slot: { group, firstBinding }, visibility }.`);\n slot = checkSlot(slotOrOptions, where);\n }\n return [{ binding: slot.firstBinding, visibility, buffer: { type: \"read-only-storage\" } }];\n}\n\n/**\n * Check that a module generated with `options` can read every grid in `pool`.\n *\n * `options` is either the full `vdbModuleWgsl` options (validated as such) or\n * just `{ types, layoutVersion? }` for a type/layout-only check, e.g. from an\n * engine adapter that builds its module elsewhere. `layoutVersion` is the\n * layout the module targets (default: this generator's,\n * `VDB_GPU_LAYOUT_VERSION`).\n *\n * After every `pool.add`: a module must be generated for every type the host\n * may add, or regenerated and its pipeline rebuilt.\n *\n * @param pool The pool whose grids the module must read.\n * @param options The module's options, or just `{ types, layoutVersion? }`.\n *\n * @throws VDBError `VDB_LAYOUT_MISMATCH` if the pool's layout is not the one\n * the module targets; `VDB_TYPE_NOT_COMPILED` if the pool holds a grid\n * type the module would not decode; `VDB_BAD_OPTION` for invalid options.\n */\nexport function vdbCheckModule(pool: VDBModulePoolLike, options: VDBModuleOptions | VDBModuleTypeCheck): void {\n const where = \"vdbCheckModule\";\n let o: { readonly types: readonly VDBGridTypeName[] };\n let walk: VDBMajorantMode | null = null;\n let target = VDB_GPU_LAYOUT_VERSION;\n if (options !== null && typeof options === \"object\" && !(\"slot\" in options) && !(\"buffer\" in options) && !(\"profile\" in options)) {\n // Type/layout-only form.\n o = { types: normalizeTypes(options.types, where) };\n const v = (options as VDBModuleTypeCheck).layoutVersion;\n if (v !== undefined) {\n if (!Number.isInteger(v) || v < 0) throw bad(`${where}: layoutVersion must be a non-negative integer, got ${JSON.stringify(v)}.`);\n target = v;\n }\n } else {\n const n = normalize(options as VDBModuleOptions, where);\n o = n;\n if (n.profileRank === 3) walk = n.majorant;\n }\n if (pool.layoutVersion !== target) {\n throw new VDBError(\n \"VDB_LAYOUT_MISMATCH\",\n `the pool uses layout ${pool.layoutVersion} but the module targets layout ${target}. Use one @pmndrs/vdb version for both.`,\n );\n }\n const missing = [...new Set(pool.types)].filter((t) => !o.types.includes(t));\n if (missing.length > 0) {\n throw new VDBError(\n \"VDB_TYPE_NOT_COMPILED\",\n `the pool holds ${missing.join(\", \")} grids but the module compiles only ${o.types.join(\", \")}; those grids would read 0. ` +\n `A module must be generated for every type the host may add: regenerate it with types that include ${missing.join(\", \")} ` +\n `(e.g. [...pool.types], or VDB_ALL_SCALAR_TYPES to never rebuild) and rebuild the pipeline that uses it.`,\n );\n }\n // EX1f-a: a walk on the global bound needs a finite one (WGSL may assume no infinities). 'global' always walks\n // on it, 'brick' for a grid without brick bounds, 'nodeMax' for a grid without statistics.\n if (walk !== null && pool.unboundedGrids !== undefined) {\n const mode = walk;\n const open = [...pool.unboundedGrids].filter((g) => (mode === \"global\" ? true : mode === \"brick\" ? !g.hasBrickMajorant : !g.hasStats));\n if (open.length > 0) {\n const ids = open.map((g) => g.id).join(\", \");\n throw new VDBError(\n \"VDB_NO_STATS\",\n `grid ${ids} has no min/max statistics and no valueMax, so its global bound is infinite and the '${mode}' majorant walk ` +\n `would step with it. Give it a bound: pool.setValueMax(id, vdbValueRange(image, { outside }).max) with vdbValueRange from ` +\n `@pmndrs/vdb/tools (or valueMax in pool.add)` +\n (mode === \"brick\" ? `, or brick bounds (pool.buildMajorant(id) / pool.setMajorant).` : `.`),\n );\n }\n }\n}\n\n/** @internal Vendored declarations (vendored names) a module with these options includes, in file order. For tests. */\nexport function vdbModuleDeclarations(options: VDBModuleOptions): string[] {\n const o = normalize(options, \"vdbModuleDeclarations\");\n return closure(apiText(o, \"vdbModuleDeclarations\"), o).names;\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ApiOptions } from "./api.js";
|
|
2
|
+
/** NanoVDB byte offsets the lean reader bakes in (ABI 32; equal for Float, Half and every Fp type above the leaf). */
|
|
3
|
+
export declare const LEAN_OFFSETS: {
|
|
4
|
+
/** `GridData` size, where the tree starts. */
|
|
5
|
+
readonly gridSize: 672;
|
|
6
|
+
/** Tree: byte offset of the root, relative to the tree (low word of the i64). */
|
|
7
|
+
readonly treeRootOffset: 24;
|
|
8
|
+
readonly rootTableSize: 24;
|
|
9
|
+
readonly rootBackground: 28;
|
|
10
|
+
/** First root tile, relative to the root (`root_size`). */
|
|
11
|
+
readonly rootTiles: 64;
|
|
12
|
+
readonly rootTileSize: 32;
|
|
13
|
+
readonly rootTileChild: 8;
|
|
14
|
+
readonly rootTileState: 16;
|
|
15
|
+
readonly rootTileValue: 20;
|
|
16
|
+
readonly upperValueMask: 32;
|
|
17
|
+
readonly upperChildMask: 4128;
|
|
18
|
+
readonly upperTable: 8256;
|
|
19
|
+
readonly lowerValueMask: 32;
|
|
20
|
+
readonly lowerChildMask: 544;
|
|
21
|
+
readonly lowerTable: 1088;
|
|
22
|
+
/** Child/value table entry size (`table_stride`). */
|
|
23
|
+
readonly tableStride: 8;
|
|
24
|
+
readonly leafFlags: 12;
|
|
25
|
+
readonly leafValueMask: 16;
|
|
26
|
+
readonly leafMinimum: 80;
|
|
27
|
+
readonly leafQuantum: 84;
|
|
28
|
+
readonly leafTable: 96;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The lean reader's opt-in helpers (P1.16), emitted after the layers.
|
|
32
|
+
*
|
|
33
|
+
* `vdbAccessorInitUnchecked(g)`: `vdbAccessorInit` without `vdb_live` and `vdb_type_ok`, with the bbox read straight
|
|
34
|
+
* from the record. The host guarantees a live grid of a compiled type; a single-type module does not read the type.
|
|
35
|
+
*
|
|
36
|
+
* `vdbSampleFast` (`'fastTrilinear'`, cache `'lower'` / `'lowerLeaf'` only): `vdbSample` under the vendored
|
|
37
|
+
* helper's name. With those caches every tap is already one lower-node child lookup.
|
|
38
|
+
*/
|
|
39
|
+
export declare function leanHelperFunctions(o: ApiOptions, bbox: boolean): string[];
|
|
40
|
+
/**
|
|
41
|
+
* The lean accessor parts of the read layer: the struct, `vdbAccessorInit`, the descent, the leaf and
|
|
42
|
+
* tile decoders, `vdbReadValue` and (with `isActive`) `vdbIsActive`. `common` are the record functions
|
|
43
|
+
* every reader shares (`vdb_rec`, `vdbGridCount`, `vdb_live`, ...).
|
|
44
|
+
*/
|
|
45
|
+
export declare function leanReadLayer(o: ApiOptions, bbox: boolean, common: readonly string[]): string;
|
|
46
|
+
/**
|
|
47
|
+
* The lean `vdbSample`: taps through `vdbReadValue` (so through the one-leaf cache), the zero-mode lerp
|
|
48
|
+
* order of the vendored API layer; with `outside: 'zero'` a tap outside `[lo, hi]` reads 0.
|
|
49
|
+
*/
|
|
50
|
+
export declare function leanSampleFunctions(o: ApiOptions, bbox: boolean): string[];
|
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
/** NanoVDB byte offsets the lean reader bakes in (ABI 32; equal for Float, Half and every Fp type above the leaf). */
|
|
2
|
+
export const LEAN_OFFSETS = {
|
|
3
|
+
/** `GridData` size, where the tree starts. */
|
|
4
|
+
gridSize: 672,
|
|
5
|
+
/** Tree: byte offset of the root, relative to the tree (low word of the i64). */
|
|
6
|
+
treeRootOffset: 24,
|
|
7
|
+
rootTableSize: 24,
|
|
8
|
+
rootBackground: 28,
|
|
9
|
+
/** First root tile, relative to the root (`root_size`). */
|
|
10
|
+
rootTiles: 64,
|
|
11
|
+
rootTileSize: 32,
|
|
12
|
+
rootTileChild: 8,
|
|
13
|
+
rootTileState: 16,
|
|
14
|
+
rootTileValue: 20,
|
|
15
|
+
upperValueMask: 32,
|
|
16
|
+
upperChildMask: 4128,
|
|
17
|
+
upperTable: 8256,
|
|
18
|
+
lowerValueMask: 32,
|
|
19
|
+
lowerChildMask: 544,
|
|
20
|
+
lowerTable: 1088,
|
|
21
|
+
/** Child/value table entry size (`table_stride`). */
|
|
22
|
+
tableStride: 8,
|
|
23
|
+
leafFlags: 12,
|
|
24
|
+
leafValueMask: 16,
|
|
25
|
+
leafMinimum: 80,
|
|
26
|
+
leafQuantum: 84,
|
|
27
|
+
leafTable: 96,
|
|
28
|
+
};
|
|
29
|
+
const L = LEAN_OFFSETS;
|
|
30
|
+
/** Grid type constant names after the rename (the vendored `PNANOVDB_GRID_TYPE_*` consts). */
|
|
31
|
+
const TYPE_CONST = {
|
|
32
|
+
float: "VDB_GRID_TYPE_FLOAT",
|
|
33
|
+
fp4: "VDB_GRID_TYPE_FP4",
|
|
34
|
+
fp8: "VDB_GRID_TYPE_FP8",
|
|
35
|
+
fp16: "VDB_GRID_TYPE_FP16",
|
|
36
|
+
fpn: "VDB_GRID_TYPE_FPN",
|
|
37
|
+
half: "VDB_GRID_TYPE_HALF",
|
|
38
|
+
};
|
|
39
|
+
/** log2 of the code width of a fixed-width Fp type. */
|
|
40
|
+
const FP_LOG_BITS = { fp4: "2u", fp8: "3u", fp16: "4u" };
|
|
41
|
+
/** The leaf decode of one type, as statements ending in a `return` (inputs `b`, `l`, `n`). */
|
|
42
|
+
function leafDecode(t) {
|
|
43
|
+
if (t === "float")
|
|
44
|
+
return `return bitcast<f32>(vdb_ln_w(b, l + ${L.leafTable}u + 4u * n));`;
|
|
45
|
+
if (t === "half")
|
|
46
|
+
return `return unpack2x16float(vdb_ln_w(b, l + ${L.leafTable}u + 2u * n) >> ((n & 1u) << 4u)).x;`;
|
|
47
|
+
const lb = FP_LOG_BITS[t] ?? `(vdb_ln_w(b, l + ${L.leafFlags}u) >> 29u)`;
|
|
48
|
+
return `let lb = ${lb};
|
|
49
|
+
let pw = 5u - lb;
|
|
50
|
+
let c = (vdb_ln_w(b, l + ${L.leafTable}u + ((n >> pw) << 2u)) >> ((n & ((1u << pw) - 1u)) << lb)) & ((1u << (1u << lb)) - 1u);
|
|
51
|
+
return f32(c) * bitcast<f32>(vdb_ln_w(b, l + ${L.leafQuantum}u)) + bitcast<f32>(vdb_ln_w(b, l + ${L.leafMinimum}u));`;
|
|
52
|
+
}
|
|
53
|
+
/** Statements dispatching on `t` over the compiled types; the last type is the fallthrough (`ok` rejected the rest). */
|
|
54
|
+
function dispatch(types, body, groupKey) {
|
|
55
|
+
const groups = [];
|
|
56
|
+
for (const t of types) {
|
|
57
|
+
const k = groupKey(t);
|
|
58
|
+
const g = groups.find((x) => x.key === k);
|
|
59
|
+
if (g)
|
|
60
|
+
g.types.push(t);
|
|
61
|
+
else
|
|
62
|
+
groups.push({ key: k, types: [t] });
|
|
63
|
+
}
|
|
64
|
+
const lines = [];
|
|
65
|
+
groups.forEach((g, i) => {
|
|
66
|
+
const text = body(g.types[0]);
|
|
67
|
+
if (i === groups.length - 1) {
|
|
68
|
+
lines.push(` ${text}`);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
lines.push(` if ${g.types.map((x) => `t == ${TYPE_CONST[x]}`).join(" || ")} {`);
|
|
72
|
+
lines.push(` ${text.replace(/\n {4}/g, "\n ")}`);
|
|
73
|
+
lines.push(" }");
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return lines.join("\n");
|
|
77
|
+
}
|
|
78
|
+
/** The root-to-lower part of the descent, shared by every cache mode's text. */
|
|
79
|
+
const ROOT_KEY = ` let u = bitcast<vec3u>(ijk);
|
|
80
|
+
let kl = (u.z >> 12u) | ((u.y >> 12u) << 21u);
|
|
81
|
+
let kh = (u.y >> 23u) | ((u.x >> 12u) << 10u);
|
|
82
|
+
let n = vdb_ln_w(b, r + ${L.rootTableSize}u);
|
|
83
|
+
for (var i = 0u; i < n; i++) {
|
|
84
|
+
let t = r + ${L.rootTiles}u + i * ${L.rootTileSize}u;
|
|
85
|
+
if vdb_ln_w(b, t) == kl && vdb_ln_w(b, t + 4u) == kh {
|
|
86
|
+
let c = vdb_ln_w(b, t + ${L.rootTileChild}u);
|
|
87
|
+
if c == 0u && vdb_ln_w(b, t + ${L.rootTileChild + 4}u) == 0u {
|
|
88
|
+
return vec4u(t + ${L.rootTileValue}u, 3u, t + ${L.rootTileState}u, 0u);
|
|
89
|
+
}
|
|
90
|
+
let p = r + c;
|
|
91
|
+
let un = (((u.x & 4095u) >> 7u) << 10u) | (((u.y & 4095u) >> 7u) << 5u) | ((u.z & 4095u) >> 7u);
|
|
92
|
+
let e = p + ${L.upperTable}u + ${L.tableStride}u * un;
|
|
93
|
+
if vdb_ln_bit(b, p + ${L.upperChildMask}u, un) == 0u {
|
|
94
|
+
return vec4u(e, 2u, p + ${L.upperValueMask}u, un);
|
|
95
|
+
}`;
|
|
96
|
+
const LOWER_DOWN = (q, pad) => `${pad}let ln = (((u.x & 127u) >> 3u) << 8u) | (((u.y & 127u) >> 3u) << 4u) | ((u.z & 127u) >> 3u);
|
|
97
|
+
${pad}let f = ${q} + ${L.lowerTable}u + ${L.tableStride}u * ln;
|
|
98
|
+
${pad}if vdb_ln_bit(b, ${q} + ${L.lowerChildMask}u, ln) == 0u {
|
|
99
|
+
${pad} return vec4u(f, 1u, ${q} + ${L.lowerValueMask}u, ln);
|
|
100
|
+
${pad}}
|
|
101
|
+
${pad}let l = ${q} + vdb_ln_w(b, f);
|
|
102
|
+
${pad}return vec4u(l, 0u, l + ${L.leafValueMask}u, ((u.x & 7u) << 6u) | ((u.y & 7u) << 3u) | (u.z & 7u));`;
|
|
103
|
+
const ROOT_END = ` }
|
|
104
|
+
}
|
|
105
|
+
return vec4u(r + ${L.rootBackground}u, 4u, 0u, 0u);
|
|
106
|
+
}`;
|
|
107
|
+
/**
|
|
108
|
+
* The descent. Every function returns (address, level, mask word address, bit) with level 0 leaf / 1 lower tile /
|
|
109
|
+
* 2 upper tile / 3 root tile / 4 background.
|
|
110
|
+
* - `cache: 'leaf'`: `vdb_ln_find`, root to leaf in one function (the P1.5 text, byte for byte).
|
|
111
|
+
* - `'lower'` / `'lowerLeaf'` (P1.16): `vdb_ln_lower`, root to the lower node (level 1 here means "the lower node
|
|
112
|
+
* at this address"), and `vdb_ln_down`, the lower node's child lookup; `vdb_ln_find` (for `vdbIsActive`) chains them.
|
|
113
|
+
*/
|
|
114
|
+
function findFunctions(o) {
|
|
115
|
+
if (o.cache === "leaf") {
|
|
116
|
+
return [
|
|
117
|
+
`fn vdb_ln_find(b: u32, r: u32, ijk: vec3i) -> vec4u {
|
|
118
|
+
${ROOT_KEY}
|
|
119
|
+
let q = p + vdb_ln_w(b, e);
|
|
120
|
+
${LOWER_DOWN("q", " ")}
|
|
121
|
+
${ROOT_END}`,
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
const out = [
|
|
125
|
+
`fn vdb_ln_lower(b: u32, r: u32, ijk: vec3i) -> vec4u {
|
|
126
|
+
${ROOT_KEY}
|
|
127
|
+
return vec4u(p + vdb_ln_w(b, e), 1u, 0u, 0u);
|
|
128
|
+
${ROOT_END}`,
|
|
129
|
+
`fn vdb_ln_down(b: u32, q: u32, ijk: vec3i) -> vec4u {
|
|
130
|
+
let u = bitcast<vec3u>(ijk);
|
|
131
|
+
${LOWER_DOWN("q", " ")}
|
|
132
|
+
}`,
|
|
133
|
+
];
|
|
134
|
+
if (o.isActive) {
|
|
135
|
+
out.push(`fn vdb_ln_find(b: u32, r: u32, ijk: vec3i) -> vec4u {
|
|
136
|
+
let f = vdb_ln_lower(b, r, ijk);
|
|
137
|
+
if f.y != 1u {
|
|
138
|
+
return f;
|
|
139
|
+
}
|
|
140
|
+
return vdb_ln_down(b, f.x, ijk);
|
|
141
|
+
}`);
|
|
142
|
+
}
|
|
143
|
+
return out;
|
|
144
|
+
}
|
|
145
|
+
/** `vdbReadValue` per cache mode: the same value, a different number of pool words (docs: "Reads per lookup"). */
|
|
146
|
+
function readValueFunction(o) {
|
|
147
|
+
if (o.cache === "leaf") {
|
|
148
|
+
return `fn vdbReadValue(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {
|
|
149
|
+
if !(*acc).ok {
|
|
150
|
+
return 0.0;
|
|
151
|
+
}
|
|
152
|
+
let n = bitcast<u32>(((ijk.x & 7) << 6u) | ((ijk.y & 7) << 3u) | (ijk.z & 7));
|
|
153
|
+
if (*acc).la == 0u || any((ijk & vec3i(-8)) != (*acc).lk) {
|
|
154
|
+
let f = vdb_ln_find((*acc).b, (*acc).r, ijk);
|
|
155
|
+
if f.y != 0u {
|
|
156
|
+
return vdb_ln_tile((*acc).gridType, (*acc).b, f.x);
|
|
157
|
+
}
|
|
158
|
+
(*acc).la = f.x;
|
|
159
|
+
(*acc).lk = ijk & vec3i(-8);
|
|
160
|
+
}
|
|
161
|
+
return vdb_ln_leaf((*acc).gridType, (*acc).b, (*acc).la, n);
|
|
162
|
+
}`;
|
|
163
|
+
}
|
|
164
|
+
// The lower node of ijk: the cached one, else a walk from the root (a tile or the background returns its value).
|
|
165
|
+
const lower = (key, addr, pad) => `${pad}if (*acc).${addr} == 0u || any((ijk & vec3i(-128)) != (*acc).${key}) {
|
|
166
|
+
${pad} let f = vdb_ln_lower((*acc).b, (*acc).r, ijk);
|
|
167
|
+
${pad} if f.y != 1u {
|
|
168
|
+
${pad} return vdb_ln_tile((*acc).gridType, (*acc).b, f.x);
|
|
169
|
+
${pad} }
|
|
170
|
+
${pad} (*acc).${addr} = f.x;
|
|
171
|
+
${pad} (*acc).${key} = ijk & vec3i(-128);
|
|
172
|
+
${pad}}
|
|
173
|
+
${pad}let d = vdb_ln_down((*acc).b, (*acc).${addr}, ijk);
|
|
174
|
+
${pad}if d.y != 0u {
|
|
175
|
+
${pad} return vdb_ln_tile((*acc).gridType, (*acc).b, d.x);
|
|
176
|
+
${pad}}`;
|
|
177
|
+
if (o.cache === "lower") {
|
|
178
|
+
return `fn vdbReadValue(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {
|
|
179
|
+
if !(*acc).ok {
|
|
180
|
+
return 0.0;
|
|
181
|
+
}
|
|
182
|
+
${lower("lk", "la", " ")}
|
|
183
|
+
return vdb_ln_leaf((*acc).gridType, (*acc).b, d.x, d.w);
|
|
184
|
+
}`;
|
|
185
|
+
}
|
|
186
|
+
return `fn vdbReadValue(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {
|
|
187
|
+
if !(*acc).ok {
|
|
188
|
+
return 0.0;
|
|
189
|
+
}
|
|
190
|
+
let n = bitcast<u32>(((ijk.x & 7) << 6u) | ((ijk.y & 7) << 3u) | (ijk.z & 7));
|
|
191
|
+
if (*acc).la == 0u || any((ijk & vec3i(-8)) != (*acc).lk) {
|
|
192
|
+
${lower("qk", "qa", " ")}
|
|
193
|
+
(*acc).la = d.x;
|
|
194
|
+
(*acc).lk = ijk & vec3i(-8);
|
|
195
|
+
}
|
|
196
|
+
return vdb_ln_leaf((*acc).gridType, (*acc).b, (*acc).la, n);
|
|
197
|
+
}`;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* The lean reader's opt-in helpers (P1.16), emitted after the layers.
|
|
201
|
+
*
|
|
202
|
+
* `vdbAccessorInitUnchecked(g)`: `vdbAccessorInit` without `vdb_live` and `vdb_type_ok`, with the bbox read straight
|
|
203
|
+
* from the record. The host guarantees a live grid of a compiled type; a single-type module does not read the type.
|
|
204
|
+
*
|
|
205
|
+
* `vdbSampleFast` (`'fastTrilinear'`, cache `'lower'` / `'lowerLeaf'` only): `vdbSample` under the vendored
|
|
206
|
+
* helper's name. With those caches every tap is already one lower-node child lookup.
|
|
207
|
+
*/
|
|
208
|
+
export function leanHelperFunctions(o, bbox) {
|
|
209
|
+
const out = [];
|
|
210
|
+
if (o.helpers.includes("fastTrilinear")) {
|
|
211
|
+
out.push(`fn vdbSampleFast(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {
|
|
212
|
+
return vdbSample(acc, xyz);
|
|
213
|
+
}`);
|
|
214
|
+
}
|
|
215
|
+
if (o.helpers.includes("accessorUnchecked")) {
|
|
216
|
+
const rec3 = (w) => `bitcast<vec3i>(vec3u(vdb_rec(g, ${w}), vdb_rec(g, ${w} + 1u), vdb_rec(g, ${w} + 2u)))`;
|
|
217
|
+
const type = o.types.length === 1 ? TYPE_CONST[o.types[0]] : "vdb_rec(g, VDB_REC_GRID_TYPE)";
|
|
218
|
+
out.push(`fn vdbAccessorInitUnchecked(g: u32) -> VdbAccessor {
|
|
219
|
+
var a: VdbAccessor;
|
|
220
|
+
a.gridType = ${type};
|
|
221
|
+
a.ok = true;
|
|
222
|
+
a.b = vdb_rec(g, VDB_REC_IMAGE_OFFSET) >> 2u;
|
|
223
|
+
a.r = ${L.gridSize}u + vdb_ln_w(a.b, ${L.gridSize + L.treeRootOffset}u);${bbox ? `\n a.lo = ${rec3("VDB_REC_INDEX_BBOX_MIN")};\n a.hi = ${rec3("VDB_REC_INDEX_BBOX_MAX")};` : ""}
|
|
224
|
+
return a;
|
|
225
|
+
}`);
|
|
226
|
+
}
|
|
227
|
+
return out;
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* The lean accessor parts of the read layer: the struct, `vdbAccessorInit`, the descent, the leaf and
|
|
231
|
+
* tile decoders, `vdbReadValue` and (with `isActive`) `vdbIsActive`. `common` are the record functions
|
|
232
|
+
* every reader shares (`vdb_rec`, `vdbGridCount`, `vdb_live`, ...).
|
|
233
|
+
*/
|
|
234
|
+
export function leanReadLayer(o, bbox, common) {
|
|
235
|
+
const extra = bbox ? "\n lo: vec3i,\n hi: vec3i," : "";
|
|
236
|
+
const extraInit = bbox ? "\n a.lo = vdbIndexMin(g);\n a.hi = vdbIndexMax(g);" : "";
|
|
237
|
+
const half = o.types.includes("half");
|
|
238
|
+
// A tile or background slot: f32, or binary16 at a 2-byte-aligned address for Half.
|
|
239
|
+
const slot = (t) => t === "half" ? "return unpack2x16float(vdb_ln_w(b, a) >> ((a & 2u) << 3u)).x;" : "return bitcast<f32>(vdb_ln_w(b, a));";
|
|
240
|
+
const both = o.cache === "lowerLeaf";
|
|
241
|
+
const parts = [
|
|
242
|
+
`struct VdbAccessor {
|
|
243
|
+
b: u32,
|
|
244
|
+
r: u32,
|
|
245
|
+
gridType: u32,
|
|
246
|
+
ok: bool,
|
|
247
|
+
lk: vec3i,
|
|
248
|
+
la: u32,${both ? "\n qk: vec3i,\n qa: u32," : ""}${extra}
|
|
249
|
+
}`,
|
|
250
|
+
...common,
|
|
251
|
+
`fn vdb_ln_w(b: u32, a: u32) -> u32 {
|
|
252
|
+
return vdb_load(b + (a >> 2u));
|
|
253
|
+
}`,
|
|
254
|
+
`fn vdb_ln_bit(b: u32, m: u32, n: u32) -> u32 {
|
|
255
|
+
return (vdb_ln_w(b, m + 4u * (n >> 5u)) >> (n & 31u)) & 1u;
|
|
256
|
+
}`,
|
|
257
|
+
`fn vdbAccessorInit(g: u32) -> VdbAccessor {
|
|
258
|
+
var a: VdbAccessor;
|
|
259
|
+
a.gridType = vdbGridType(g);
|
|
260
|
+
a.ok = vdb_type_ok(a.gridType);
|
|
261
|
+
if a.ok {
|
|
262
|
+
a.b = vdb_rec(g, VDB_REC_IMAGE_OFFSET) >> 2u;
|
|
263
|
+
a.r = ${L.gridSize}u + vdb_ln_w(a.b, ${L.gridSize + L.treeRootOffset}u);${extraInit}
|
|
264
|
+
}
|
|
265
|
+
return a;
|
|
266
|
+
}`,
|
|
267
|
+
...findFunctions(o),
|
|
268
|
+
`fn vdb_ln_leaf(t: u32, b: u32, l: u32, n: u32) -> f32 {
|
|
269
|
+
${dispatch(o.types, leafDecode, (t) => (FP_LOG_BITS[t] !== undefined || t === "fpn" ? `fp:${t}` : t))}
|
|
270
|
+
}`,
|
|
271
|
+
`fn vdb_ln_tile(t: u32, b: u32, a: u32) -> f32 {
|
|
272
|
+
${half ? dispatch(o.types, slot, (t) => (t === "half" ? "half" : "f32")) : ` ${slot("float")}`}
|
|
273
|
+
}`,
|
|
274
|
+
readValueFunction(o),
|
|
275
|
+
];
|
|
276
|
+
if (o.isActive) {
|
|
277
|
+
parts.push(`fn vdbIsActive(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> bool {
|
|
278
|
+
if !(*acc).ok {
|
|
279
|
+
return false;
|
|
280
|
+
}
|
|
281
|
+
let f = vdb_ln_find((*acc).b, (*acc).r, ijk);
|
|
282
|
+
return f.y < 4u && vdb_ln_bit((*acc).b, f.z, f.w) != 0u;
|
|
283
|
+
}`);
|
|
284
|
+
}
|
|
285
|
+
return parts.join("\n");
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* The lean `vdbSample`: taps through `vdbReadValue` (so through the one-leaf cache), the zero-mode lerp
|
|
289
|
+
* order of the vendored API layer; with `outside: 'zero'` a tap outside `[lo, hi]` reads 0.
|
|
290
|
+
*/
|
|
291
|
+
export function leanSampleFunctions(o, bbox) {
|
|
292
|
+
const guard = bbox ? "!(*acc).ok || any(b < (*acc).lo - vec3i(1)) || any(b > (*acc).hi)" : "!(*acc).ok";
|
|
293
|
+
if (o.sampler === "nearest") {
|
|
294
|
+
return [
|
|
295
|
+
`fn vdbSample(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {
|
|
296
|
+
let ijk = vec3i(floor(xyz + vec3f(0.5)));
|
|
297
|
+
if !(*acc).ok${bbox ? " || any(ijk < (*acc).lo) || any(ijk > (*acc).hi)" : ""} {
|
|
298
|
+
return 0.0;
|
|
299
|
+
}
|
|
300
|
+
return vdbReadValue(acc, ijk);
|
|
301
|
+
}`,
|
|
302
|
+
];
|
|
303
|
+
}
|
|
304
|
+
return [
|
|
305
|
+
`fn vdb_ln_tap(acc: ptr<function, VdbAccessor>, ijk: vec3i) -> f32 {${bbox
|
|
306
|
+
? `
|
|
307
|
+
if any(ijk < (*acc).lo) || any(ijk > (*acc).hi) {
|
|
308
|
+
return 0.0;
|
|
309
|
+
}`
|
|
310
|
+
: ""}
|
|
311
|
+
return vdbReadValue(acc, ijk);
|
|
312
|
+
}`,
|
|
313
|
+
`fn vdbSample(acc: ptr<function, VdbAccessor>, xyz: vec3f) -> f32 {
|
|
314
|
+
let b = vec3i(floor(xyz));
|
|
315
|
+
if ${guard} {
|
|
316
|
+
return 0.0;
|
|
317
|
+
}
|
|
318
|
+
let u = xyz - vec3f(b);
|
|
319
|
+
let x00 = mix(vdb_ln_tap(acc, b), vdb_ln_tap(acc, b + vec3i(1, 0, 0)), u.x);
|
|
320
|
+
let x10 = mix(vdb_ln_tap(acc, b + vec3i(0, 1, 0)), vdb_ln_tap(acc, b + vec3i(1, 1, 0)), u.x);
|
|
321
|
+
let x01 = mix(vdb_ln_tap(acc, b + vec3i(0, 0, 1)), vdb_ln_tap(acc, b + vec3i(1, 0, 1)), u.x);
|
|
322
|
+
let x11 = mix(vdb_ln_tap(acc, b + vec3i(0, 1, 1)), vdb_ln_tap(acc, b + vec3i(1, 1, 1)), u.x);
|
|
323
|
+
return mix(mix(x00, x10, u.y), mix(x01, x11, u.y), u.z);
|
|
324
|
+
}`,
|
|
325
|
+
];
|
|
326
|
+
}
|
|
327
|
+
//# sourceMappingURL=lean.js.map
|