@pmndrs/vdb 0.0.0-stage → 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 +727 -0
- package/LICENSE +21 -0
- package/README.md +496 -2
- package/THIRD_PARTY_NOTICES.md +315 -0
- package/dist/core/compute/atlas.d.ts +102 -0
- package/dist/core/compute/atlas.js +103 -0
- package/dist/core/compute/atlas.js.map +1 -0
- package/dist/core/compute/index.d.ts +13 -0
- package/dist/core/compute/index.js +9 -0
- package/dist/core/compute/index.js.map +1 -0
- 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 +120 -0
- package/dist/core/compute/pyramid.js +468 -0
- package/dist/core/compute/pyramid.js.map +1 -0
- package/dist/core/compute/shared.d.ts +116 -0
- package/dist/core/compute/shared.js +211 -0
- package/dist/core/compute/shared.js.map +1 -0
- package/dist/core/compute/stats.d.ts +78 -0
- package/dist/core/compute/stats.js +193 -0
- package/dist/core/compute/stats.js.map +1 -0
- package/dist/core/compute/value-transform.d.ts +30 -0
- package/dist/core/compute/value-transform.js +64 -0
- package/dist/core/compute/value-transform.js.map +1 -0
- package/dist/core/errors.d.ts +21 -0
- package/dist/core/errors.js +17 -0
- package/dist/core/errors.js.map +1 -0
- 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 +52 -0
- package/dist/core/index.js +46 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/internal.d.ts +31 -0
- package/dist/core/internal.js +32 -0
- package/dist/core/internal.js.map +1 -0
- package/dist/core/pool/affine.d.ts +34 -0
- package/dist/core/pool/affine.js +100 -0
- package/dist/core/pool/affine.js.map +1 -0
- package/dist/core/pool/allocator.d.ts +32 -0
- package/dist/core/pool/allocator.js +81 -0
- package/dist/core/pool/allocator.js.map +1 -0
- package/dist/core/pool/image-header.d.ts +93 -0
- package/dist/core/pool/image-header.js +194 -0
- package/dist/core/pool/image-header.js.map +1 -0
- package/dist/core/pool/layout.d.ts +198 -0
- package/dist/core/pool/layout.js +316 -0
- package/dist/core/pool/layout.js.map +1 -0
- package/dist/core/pool/limits.d.ts +41 -0
- package/dist/core/pool/limits.js +80 -0
- package/dist/core/pool/limits.js.map +1 -0
- package/dist/core/pool/pool.d.ts +384 -0
- package/dist/core/pool/pool.js +1184 -0
- package/dist/core/pool/pool.js.map +1 -0
- 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/core/sequence.d.ts +347 -0
- package/dist/core/sequence.js +548 -0
- 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 +50 -0
- package/dist/core/source/dense.js +384 -0
- package/dist/core/source/dense.js.map +1 -0
- 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 +120 -0
- package/dist/core/source/types.js +9 -0
- package/dist/core/source/types.js.map +1 -0
- 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 +37 -0
- package/dist/core/types.js +32 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/wgsl/api.d.ts +65 -0
- package/dist/core/wgsl/api.js +546 -0
- package/dist/core/wgsl/api.js.map +1 -0
- package/dist/core/wgsl/generate.d.ts +90 -0
- package/dist/core/wgsl/generate.js +678 -0
- package/dist/core/wgsl/generate.js.map +1 -0
- 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 +58 -0
- package/dist/core/wgsl/level-set.js +200 -0
- package/dist/core/wgsl/level-set.js.map +1 -0
- 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 +14 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.js +333 -0
- package/dist/core/wgsl/pnanovdb.chunks.generated.js.map +1 -0
- package/dist/core/wgsl/reserved.d.ts +9 -0
- package/dist/core/wgsl/reserved.js +26 -0
- package/dist/core/wgsl/reserved.js.map +1 -0
- package/dist/core/wgsl/types.d.ts +198 -0
- package/dist/core/wgsl/types.js +2 -0
- package/dist/core/wgsl/types.js.map +1 -0
- package/dist/three/coarse-first.d.ts +207 -0
- package/dist/three/coarse-first.js +205 -0
- package/dist/three/coarse-first.js.map +1 -0
- package/dist/three/compute.d.ts +73 -0
- package/dist/three/compute.js +66 -0
- package/dist/three/compute.js.map +1 -0
- package/dist/three/device.d.ts +66 -0
- package/dist/three/device.js +62 -0
- package/dist/three/device.js.map +1 -0
- 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 +117 -0
- package/dist/three/frame/emission-light.js +276 -0
- package/dist/three/frame/emission-light.js.map +1 -0
- package/dist/three/frame/index.d.ts +19 -0
- package/dist/three/frame/index.js +15 -0
- package/dist/three/frame/index.js.map +1 -0
- package/dist/three/frame/medium.d.ts +33 -0
- package/dist/three/frame/medium.js +29 -0
- package/dist/three/frame/medium.js.map +1 -0
- package/dist/three/frame/renderer.d.ts +97 -0
- package/dist/three/frame/renderer.js +480 -0
- package/dist/three/frame/renderer.js.map +1 -0
- package/dist/three/frame/spectrum.d.ts +4 -0
- package/dist/three/frame/spectrum.js +15 -0
- package/dist/three/frame/spectrum.js.map +1 -0
- package/dist/three/frame/three-internals.d.ts +60 -0
- package/dist/three/frame/three-internals.js +152 -0
- package/dist/three/frame/three-internals.js.map +1 -0
- package/dist/three/frame/volume-shadows.d.ts +139 -0
- package/dist/three/frame/volume-shadows.js +403 -0
- package/dist/three/frame/volume-shadows.js.map +1 -0
- package/dist/three/frame/volume.d.ts +230 -0
- package/dist/three/frame/volume.js +268 -0
- package/dist/three/frame/volume.js.map +1 -0
- package/dist/three/grid-node.d.ts +229 -0
- package/dist/three/grid-node.js +545 -0
- package/dist/three/grid-node.js.map +1 -0
- package/dist/three/index.d.ts +52 -0
- package/dist/three/index.js +58 -0
- package/dist/three/index.js.map +1 -0
- package/dist/three/internal.d.ts +20 -0
- package/dist/three/internal.js +18 -0
- package/dist/three/internal.js.map +1 -0
- package/dist/three/level-set-material.d.ts +185 -0
- package/dist/three/level-set-material.js +241 -0
- package/dist/three/level-set-material.js.map +1 -0
- 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 +324 -0
- package/dist/three/material.js +502 -0
- package/dist/three/material.js.map +1 -0
- package/dist/three/points.d.ts +140 -0
- package/dist/three/points.js +261 -0
- package/dist/three/points.js.map +1 -0
- package/dist/three/sparse-source.d.ts +165 -0
- package/dist/three/sparse-source.js +405 -0
- package/dist/three/sparse-source.js.map +1 -0
- package/dist/three/volume-source.d.ts +22 -0
- package/dist/three/volume-source.js +110 -0
- package/dist/three/volume-source.js.map +1 -0
- 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 +116 -0
- package/dist/tools/cpu/compute.js +239 -0
- package/dist/tools/cpu/compute.js.map +1 -0
- 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 +111 -0
- package/dist/tools/cpu/level-set.js +313 -0
- package/dist/tools/cpu/level-set.js.map +1 -0
- 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 +297 -0
- package/dist/tools/cpu/march.js +726 -0
- package/dist/tools/cpu/march.js.map +1 -0
- 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/probe-coords.d.ts +70 -0
- package/dist/tools/cpu/probe-coords.js +116 -0
- package/dist/tools/cpu/probe-coords.js.map +1 -0
- package/dist/tools/cpu/read-value.d.ts +44 -0
- package/dist/tools/cpu/read-value.js +351 -0
- package/dist/tools/cpu/read-value.js.map +1 -0
- package/dist/tools/cpu/sample-trilinear.d.ts +43 -0
- package/dist/tools/cpu/sample-trilinear.js +168 -0
- package/dist/tools/cpu/sample-trilinear.js.map +1 -0
- package/dist/tools/cpu/stride-tables.d.ts +56 -0
- package/dist/tools/cpu/stride-tables.generated.d.ts +1059 -0
- package/dist/tools/cpu/stride-tables.generated.js +1267 -0
- package/dist/tools/cpu/stride-tables.generated.js.map +1 -0
- package/dist/tools/cpu/stride-tables.js +78 -0
- package/dist/tools/cpu/stride-tables.js.map +1 -0
- 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 +66 -0
- package/dist/tools/errors.js +67 -0
- package/dist/tools/errors.js.map +1 -0
- 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 +57 -0
- package/dist/tools/frame/blackbody.js +151 -0
- package/dist/tools/frame/blackbody.js.map +1 -0
- 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 +137 -0
- package/dist/tools/frame/emission.js +290 -0
- package/dist/tools/frame/emission.js.map +1 -0
- 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 +106 -0
- package/dist/tools/frame/environment.js +272 -0
- package/dist/tools/frame/environment.js.map +1 -0
- 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 +392 -0
- package/dist/tools/frame/grid.js +802 -0
- package/dist/tools/frame/grid.js.map +1 -0
- package/dist/tools/frame/index.d.ts +150 -0
- package/dist/tools/frame/index.js +389 -0
- package/dist/tools/frame/index.js.map +1 -0
- package/dist/tools/frame/medium.d.ts +77 -0
- package/dist/tools/frame/medium.js +101 -0
- package/dist/tools/frame/medium.js.map +1 -0
- package/dist/tools/frame/mie-table.d.ts +6 -0
- package/dist/tools/frame/mie-table.js +16 -0
- package/dist/tools/frame/mie-table.js.map +1 -0
- package/dist/tools/frame/mie.d.ts +63 -0
- package/dist/tools/frame/mie.js +194 -0
- package/dist/tools/frame/mie.js.map +1 -0
- 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 +10 -0
- package/dist/tools/frame/neural-weights.js +244 -0
- package/dist/tools/frame/neural-weights.js.map +1 -0
- package/dist/tools/frame/neural.d.ts +80 -0
- package/dist/tools/frame/neural.js +150 -0
- package/dist/tools/frame/neural.js.map +1 -0
- 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 +55 -0
- package/dist/tools/frame/pyramid-layout.js +100 -0
- package/dist/tools/frame/pyramid-layout.js.map +1 -0
- package/dist/tools/frame/shadows.d.ts +190 -0
- package/dist/tools/frame/shadows.js +468 -0
- package/dist/tools/frame/shadows.js.map +1 -0
- package/dist/tools/frame/sparse.d.ts +147 -0
- package/dist/tools/frame/sparse.js +432 -0
- package/dist/tools/frame/sparse.js.map +1 -0
- 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 +222 -0
- package/dist/tools/frame/spectral.js +572 -0
- package/dist/tools/frame/spectral.js.map +1 -0
- 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 +157 -0
- package/dist/tools/index.js +132 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/internal.d.ts +87 -0
- package/dist/tools/internal.js +85 -0
- package/dist/tools/internal.js.map +1 -0
- package/dist/tools/nanovdb/build-from-vdb.d.ts +59 -0
- package/dist/tools/nanovdb/build-from-vdb.js +100 -0
- package/dist/tools/nanovdb/build-from-vdb.js.map +1 -0
- package/dist/tools/nanovdb/bytes.d.ts +233 -0
- package/dist/tools/nanovdb/bytes.js +388 -0
- package/dist/tools/nanovdb/bytes.js.map +1 -0
- package/dist/tools/nanovdb/coarse-first.d.ts +78 -0
- package/dist/tools/nanovdb/coarse-first.js +92 -0
- package/dist/tools/nanovdb/coarse-first.js.map +1 -0
- 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 +34 -0
- package/dist/tools/nanovdb/index.js +25 -0
- package/dist/tools/nanovdb/index.js.map +1 -0
- package/dist/tools/nanovdb/inspect.d.ts +33 -0
- package/dist/tools/nanovdb/inspect.js +70 -0
- package/dist/tools/nanovdb/inspect.js.map +1 -0
- package/dist/tools/nanovdb/leaf-codec.d.ts +119 -0
- package/dist/tools/nanovdb/leaf-codec.js +356 -0
- package/dist/tools/nanovdb/leaf-codec.js.map +1 -0
- package/dist/tools/nanovdb/quantize.d.ts +72 -0
- package/dist/tools/nanovdb/quantize.js +329 -0
- package/dist/tools/nanovdb/quantize.js.map +1 -0
- package/dist/tools/nanovdb/resample.d.ts +177 -0
- package/dist/tools/nanovdb/resample.js +692 -0
- package/dist/tools/nanovdb/resample.js.map +1 -0
- package/dist/tools/nanovdb/serialize.d.ts +176 -0
- package/dist/tools/nanovdb/serialize.js +439 -0
- package/dist/tools/nanovdb/serialize.js.map +1 -0
- package/dist/tools/nanovdb/stats.d.ts +87 -0
- package/dist/tools/nanovdb/stats.js +225 -0
- package/dist/tools/nanovdb/stats.js.map +1 -0
- package/dist/tools/nanovdb/transform.d.ts +30 -0
- package/dist/tools/nanovdb/transform.js +94 -0
- package/dist/tools/nanovdb/transform.js.map +1 -0
- package/dist/tools/nanovdb/tree.d.ts +186 -0
- package/dist/tools/nanovdb/tree.js +530 -0
- package/dist/tools/nanovdb/tree.js.map +1 -0
- package/dist/tools/nanovdb/write-nvdb.d.ts +74 -0
- package/dist/tools/nanovdb/write-nvdb.js +290 -0
- package/dist/tools/nanovdb/write-nvdb.js.map +1 -0
- package/dist/tools/nvdb-file.d.ts +265 -0
- package/dist/tools/nvdb-file.js +763 -0
- package/dist/tools/nvdb-file.js.map +1 -0
- package/dist/tools/nvdb-stream.d.ts +154 -0
- package/dist/tools/nvdb-stream.js +409 -0
- package/dist/tools/nvdb-stream.js.map +1 -0
- 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/bit-utils.d.ts +20 -0
- package/dist/tools/vdb/bit-utils.js +42 -0
- package/dist/tools/vdb/bit-utils.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 +86 -0
- package/dist/tools/vdb/blosc.js +287 -0
- package/dist/tools/vdb/blosc.js.map +1 -0
- 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 +50 -0
- package/dist/tools/vdb/byte-reader.js +161 -0
- package/dist/tools/vdb/byte-reader.js.map +1 -0
- package/dist/tools/vdb/compression.d.ts +81 -0
- package/dist/tools/vdb/compression.js +260 -0
- package/dist/tools/vdb/compression.js.map +1 -0
- package/dist/tools/vdb/errors.d.ts +10 -0
- package/dist/tools/vdb/errors.js +11 -0
- package/dist/tools/vdb/errors.js.map +1 -0
- package/dist/tools/vdb/grid.d.ts +37 -0
- package/dist/tools/vdb/grid.js +153 -0
- package/dist/tools/vdb/grid.js.map +1 -0
- package/dist/tools/vdb/half-float.d.ts +9 -0
- package/dist/tools/vdb/half-float.js +24 -0
- package/dist/tools/vdb/half-float.js.map +1 -0
- package/dist/tools/vdb/index.d.ts +4 -0
- package/dist/tools/vdb/index.js +3 -0
- package/dist/tools/vdb/index.js.map +1 -0
- package/dist/tools/vdb/inflate.d.ts +24 -0
- package/dist/tools/vdb/inflate.js +334 -0
- package/dist/tools/vdb/inflate.js.map +1 -0
- 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.d.ts +17 -0
- package/dist/tools/vdb/metadata.js +72 -0
- package/dist/tools/vdb/metadata.js.map +1 -0
- package/dist/tools/vdb/parse.d.ts +47 -0
- package/dist/tools/vdb/parse.js +241 -0
- package/dist/tools/vdb/parse.js.map +1 -0
- package/dist/tools/vdb/point-render-data.d.ts +79 -0
- package/dist/tools/vdb/point-render-data.js +137 -0
- package/dist/tools/vdb/point-render-data.js.map +1 -0
- package/dist/tools/vdb/points.d.ts +186 -0
- package/dist/tools/vdb/points.js +835 -0
- package/dist/tools/vdb/points.js.map +1 -0
- package/dist/tools/vdb/transform.d.ts +23 -0
- package/dist/tools/vdb/transform.js +54 -0
- package/dist/tools/vdb/transform.js.map +1 -0
- package/dist/tools/vdb/tree.d.ts +111 -0
- package/dist/tools/vdb/tree.js +228 -0
- package/dist/tools/vdb/tree.js.map +1 -0
- package/dist/tools/vdb/types.d.ts +195 -0
- package/dist/tools/vdb/types.js +3 -0
- package/dist/tools/vdb/types.js.map +1 -0
- package/dist/tools/wvdb/bake.d.ts +145 -0
- package/dist/tools/wvdb/bake.js +361 -0
- package/dist/tools/wvdb/bake.js.map +1 -0
- package/dist/tools/wvdb/dense.d.ts +191 -0
- package/dist/tools/wvdb/dense.js +368 -0
- package/dist/tools/wvdb/dense.js.map +1 -0
- package/dist/tools/wvdb/format.d.ts +220 -0
- package/dist/tools/wvdb/format.js +306 -0
- package/dist/tools/wvdb/format.js.map +1 -0
- package/dist/tools/wvdb/index.d.ts +14 -0
- package/dist/tools/wvdb/index.js +15 -0
- package/dist/tools/wvdb/index.js.map +1 -0
- package/dist/tools/wvdb/level-set.d.ts +56 -0
- package/dist/tools/wvdb/level-set.js +153 -0
- package/dist/tools/wvdb/level-set.js.map +1 -0
- package/dist/tools/wvdb/nanovdb.d.ts +59 -0
- package/dist/tools/wvdb/nanovdb.js +64 -0
- package/dist/tools/wvdb/nanovdb.js.map +1 -0
- 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 +336 -0
- package/dist/tools/wvdb/read.js +766 -0
- package/dist/tools/wvdb/read.js.map +1 -0
- package/dist/tools/wvdb/sha256.d.ts +7 -0
- package/dist/tools/wvdb/sha256.js +76 -0
- package/dist/tools/wvdb/sha256.js.map +1 -0
- package/dist/tools/wvdb/write.d.ts +149 -0
- package/dist/tools/wvdb/write.js +403 -0
- package/dist/tools/wvdb/write.js.map +1 -0
- package/package.json +83 -4
- package/vendor/LICENSE +201 -0
- package/vendor/NOTICE +19 -0
- package/vendor/VENDOR.md +100 -0
- package/vendor/pnanovdb.wgsl +1577 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dense-fill.js","sourceRoot":"","sources":["../../../src/core/source/dense-fill.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,qHAAqH;AACrH,oHAAoH;AACpH,4GAA4G;AAC5G,+GAA+G;AAC/G,mHAAmH;AACnH,wCAAwC;AAEx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GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC;YACxC,OAAO,CAAC,mBAAmB,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,YAAY,EAAE,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;QAC5I,CAAC;QACD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,gFAAgF;IAChF,OAAO;QACL,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9D,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACnC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,GAAG,CAAC;IACb,CAAC;CACF","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/wvdb/wvdbKernel.js upsample L122–188 (a multi-page LOD shows the previous LOD upsampled in the\n// bricks not decoded yet), src/three-openvdb/frame/webgpu/frameMipmaps.js downsample L20–62 and packAtlas L65–88.\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: WGSL compute instead of his worker / CPU loops; integer weights (8 fractional bits) so the CPU twin\n// (`tools/wvdb/partial.ts` wvdbUpsampleTexels, `wvdbMipAtlas`) agrees byte for byte; only pending bricks upsample.\n// Divergences: DIVERGES.md (K4.22 row).\n\n/**\n * K4.22: the dense source's GPU fill of a partially streamed `.wvdb` LOD (`WvdbDenseTexture.fill`). One storage\n * buffer holds, at byte offsets: the pending-brick bits, the coarser LOD's texels, the partial LOD's texels (both\n * tight, as the host has them), then the texture's rows and the mip atlas's rows padded to 256 bytes (copy layout).\n * One compute pass:\n *\n * 1. `vdbDenseFillCs`, one thread per texel: a pending brick's texel is the coarse texels' trilinear upsample\n * (his `axis`: centres aligned, edges clamped; weights in 1/256, the sum rounded half up once), any other texel\n * is the host's; written into the cleared row region with `atomicOr` per byte.\n * 2. `vdbDenseMipCs`, one dispatch per mip level, one thread per texel: his box downsample (`(sum of 8 + 4) >> 3`,\n * edge taps clamped) of the level below, into the atlas at his x offset (`atlasWidth − atlasWidth / 2^(l−1)`).\n * With `mips: 'coarse'` (the default fill) level 1 of a pending brick is the coarser LOD's texel instead: the LOD\n * the bake box-filtered from this one, so a far view of a pending brick reads it, not a blur of its upsample.\n *\n * Then `copyBufferToTexture` into the source's texture and atlas. The work is submitted at once (the source's\n * `replace` acts on the queue, as `writeTexture` does), so a later `replace` lands after it. r8unorm is not a\n * storage-texture format in core WebGPU, hence the buffer and the copies (Traps: the f16 multi-scale chain does\n * the same). A texture whose buffer would pass `maxStorageBufferBindingSize` or `maxBufferSize` is filled on the\n * CPU by the twin instead (`vdbDenseFillFits`).\n */\n\nimport { VDBError } from \"../errors.js\";\nimport { USAGE, WORKGROUP_AXIS } from \"../compute/shared.js\";\nimport type { WvdbDenseTexture } from \"../../tools/wvdb/dense.js\";\nimport { wvdbFillCoarseMips } from \"../../tools/wvdb/partial.js\";\n\nconst W = WORKGROUP_AXIS;\nconst STAGE_COMPUTE = 0x4;\n/** Uniform slot stride (minUniformBufferOffsetAlignment's default). */\nconst SLOT = 256;\nconst PARAMS_BYTES = 96;\nconst BRICK = 8;\n\nconst FILL_WGSL = /* wgsl */ `\nstruct VdbDenseFillParams {\n dims: vec3u,\n texelBytes: u32,\n srcDims: vec3u,\n pendingWord: u32,\n bricks: vec3u,\n coarseByte: u32,\n fineByte: u32,\n dstByte: u32,\n dstRow: u32,\n dstRows: u32,\n dstX: u32,\n srcByte: u32,\n srcRow: u32,\n srcRows: u32,\n srcX: u32,\n coarseMip: u32,\n pad1: u32,\n pad2: u32,\n};\n@group(0) @binding(0) var<uniform> vdbFillP: VdbDenseFillParams;\n@group(0) @binding(1) var<storage, read_write> vdbFillBuf: array<atomic<u32>>;\n\n// Byte b of the buffer, and an OR of v into byte b (the row regions are cleared before the pass).\nfn vdbFillLoad(b: u32) -> u32 {\n return (atomicLoad(&vdbFillBuf[b >> 2u]) >> ((b & 3u) * 8u)) & 0xffu;\n}\nfn vdbFillStore(b: u32, v: u32) {\n atomicOr(&vdbFillBuf[b >> 2u], (v & 0xffu) << ((b & 3u) * 8u));\n}\n\n// His upsample axis in integers: target texel i of size reads clamp((i + 1/2) src / size - 1/2, 0, src - 1);\n// returns (lower tap, upper tap, upper weight in 1/256, the exact fraction rounded half up).\nfn vdbFillAxis(i: u32, size: u32, src: u32) -> vec3u {\n let den = 2u * size;\n let num = min(u32(max(i32((2u * i + 1u) * src) - i32(size), 0)), (src - 1u) * den);\n let lo = num / den;\n let r = num - lo * den;\n return vec3u(lo, min(lo + 1u, src - 1u), (r * 256u + size) / den);\n}\n\nfn vdbFillTap(i: u32, c: u32) -> u32 {\n return vdbFillLoad(vdbFillP.coarseByte + i * vdbFillP.texelBytes + c);\n}\n\n@compute @workgroup_size(${W}, ${W}, ${W})\nfn vdbDenseFillCs(@builtin(global_invocation_id) id: vec3u) {\n let p = vdbFillP;\n if any(id >= p.dims) {\n return;\n }\n let brick = (id.x >> 3u) + p.bricks.x * ((id.y >> 3u) + p.bricks.y * (id.z >> 3u));\n let pending = (atomicLoad(&vdbFillBuf[p.pendingWord + (brick >> 5u)]) >> (brick & 31u)) & 1u;\n let dst = p.dstByte + (id.z * p.dstRows + id.y) * p.dstRow + (p.dstX + id.x) * p.texelBytes;\n if pending == 0u {\n let src = p.fineByte + ((id.z * p.dims.y + id.y) * p.dims.x + id.x) * p.texelBytes;\n for (var c = 0u; c < p.texelBytes; c++) {\n vdbFillStore(dst + c, vdbFillLoad(src + c));\n }\n return;\n }\n let ax = vdbFillAxis(id.x, p.dims.x, p.srcDims.x);\n let ay = vdbFillAxis(id.y, p.dims.y, p.srcDims.y);\n let az = vdbFillAxis(id.z, p.dims.z, p.srcDims.z);\n let r00 = (ay.x + az.x * p.srcDims.y) * p.srcDims.x;\n let r10 = (ay.y + az.x * p.srcDims.y) * p.srcDims.x;\n let r01 = (ay.x + az.y * p.srcDims.y) * p.srcDims.x;\n let r11 = (ay.y + az.y * p.srcDims.y) * p.srcDims.x;\n for (var c = 0u; c < p.texelBytes; c++) {\n let c00 = vdbFillTap(ax.x + r00, c) * (256u - ax.z) + vdbFillTap(ax.y + r00, c) * ax.z;\n let c10 = vdbFillTap(ax.x + r10, c) * (256u - ax.z) + vdbFillTap(ax.y + r10, c) * ax.z;\n let c01 = vdbFillTap(ax.x + r01, c) * (256u - ax.z) + vdbFillTap(ax.y + r01, c) * ax.z;\n let c11 = vdbFillTap(ax.x + r11, c) * (256u - ax.z) + vdbFillTap(ax.y + r11, c) * ax.z;\n let c0 = c00 * (256u - ay.z) + c10 * ay.z;\n let c1 = c01 * (256u - ay.z) + c11 * ay.z;\n vdbFillStore(dst + c, (c0 * (256u - az.z) + c1 * az.z + 0x800000u) >> 24u);\n }\n}\n\nfn vdbMipTap(x: u32, y: u32, z: u32, c: u32) -> u32 {\n let p = vdbFillP;\n return vdbFillLoad(p.srcByte + (z * p.srcRows + y) * p.srcRow + (p.srcX + x) * p.texelBytes + c);\n}\n\n@compute @workgroup_size(${W}, ${W}, ${W})\nfn vdbDenseMipCs(@builtin(global_invocation_id) id: vec3u) {\n let p = vdbFillP;\n if any(id >= p.dims) {\n return;\n }\n let s = p.srcDims - vec3u(1u);\n let x0 = min(id.x * 2u, s.x);\n let x1 = min(id.x * 2u + 1u, s.x);\n let y0 = min(id.y * 2u, s.y);\n let y1 = min(id.y * 2u + 1u, s.y);\n let z0 = min(id.z * 2u, s.z);\n let z1 = min(id.z * 2u + 1u, s.z);\n let dst = p.dstByte + (id.z * p.dstRows + id.y) * p.dstRow + (p.dstX + id.x) * p.texelBytes;\n if p.coarseMip != 0u {\n // Level 1 of a pending brick: the coarser LOD's texel (its size is level 1's). Children 2x, 2x + 1 share a brick.\n let brick = ((id.x * 2u) >> 3u) + p.bricks.x * (((id.y * 2u) >> 3u) + p.bricks.y * ((id.z * 2u) >> 3u));\n if ((atomicLoad(&vdbFillBuf[p.pendingWord + (brick >> 5u)]) >> (brick & 31u)) & 1u) != 0u {\n let src = p.coarseByte + ((id.z * p.dims.y + id.y) * p.dims.x + id.x) * p.texelBytes;\n for (var c = 0u; c < p.texelBytes; c++) {\n vdbFillStore(dst + c, vdbFillLoad(src + c));\n }\n return;\n }\n }\n for (var c = 0u; c < p.texelBytes; c++) {\n let sum = vdbMipTap(x0, y0, z0, c) + vdbMipTap(x1, y0, z0, c) + vdbMipTap(x0, y1, z0, c) + vdbMipTap(x1, y1, z0, c)\n + vdbMipTap(x0, y0, z1, c) + vdbMipTap(x1, y0, z1, c) + vdbMipTap(x0, y1, z1, c) + vdbMipTap(x1, y1, z1, c);\n vdbFillStore(dst + c, (sum + 4u) >> 3u);\n }\n}\n`;\n\n/** The WGSL of the fill and mip kernels (exported for probes and tests). */\nexport function vdbDenseFillWgsl(): string {\n return FILL_WGSL;\n}\n\nconst align = (n: number, a: number) => Math.ceil(n / a) * a;\nconst levelSize = (size: number, level: number) => Math.max(1, Math.ceil(size / 2 ** level));\n\n/** One dispatch: its parameters (u32 words of `VdbDenseFillParams`) and size. */\ninterface Dispatch {\n entry: \"fill\" | \"mip\";\n dims: [number, number, number];\n params: Uint32Array;\n}\n\n/** Where everything sits in the fill buffer of one texture (bytes), and the dispatches. */\nexport interface VDBDenseFillLayout {\n readonly key: string;\n readonly texelBytes: number;\n readonly dims: readonly [number, number, number];\n readonly srcDims: readonly [number, number, number];\n readonly pendingByte: number;\n readonly pendingWords: number;\n readonly coarseByte: number;\n readonly fineByte: number;\n readonly mapByte: number;\n readonly mapRow: number;\n /** The atlas rows (null without a mip atlas). */\n readonly atlas: { readonly byte: number; readonly row: number; readonly dimensions: readonly [number, number, number]; readonly levels: number } | null;\n /** Level 1 of the pending bricks from the coarse texels (`fill.mips` 'coarse' and a halving size). */\n readonly coarseMips: boolean;\n /** Buffer bytes. */\n readonly size: number;\n}\n\n/** The fill buffer layout of `tex` (which must carry a `fill`). */\nexport function vdbDenseFillLayout(tex: WvdbDenseTexture): VDBDenseFillLayout {\n const fill = tex.fill;\n if (!fill) throw new VDBError(\"VDB_BAD_OPTION\", \"vdbDenseFillLayout: the texture has no fill.\");\n const tb = tex.texelBytes;\n const dims = [...tex.dimensions] as [number, number, number];\n const srcDims = [...fill.from.dimensions] as [number, number, number];\n const bricks = dims.map((d) => Math.ceil(d / BRICK));\n const pendingWords = Math.ceil((bricks[0]! * bricks[1]! * bricks[2]!) / 32);\n const coarseByte = align(pendingWords * 4, 16);\n const fineByte = coarseByte + align(srcDims[0] * srcDims[1] * srcDims[2] * tb, 16);\n const mapByte = align(fineByte + dims[0] * dims[1] * dims[2] * tb, 256);\n const mapRow = align(dims[0] * tb, 256);\n let end = mapByte + mapRow * dims[1] * dims[2];\n let atlas: VDBDenseFillLayout[\"atlas\"] = null;\n if (tex.mip) {\n const a = tex.mip.dimensions;\n atlas = { byte: align(end, 256), row: align(a[0] * tb, 256), dimensions: [a[0], a[1], a[2]], levels: tex.mip.levels };\n end = atlas.byte + atlas.row * a[1] * a[2];\n }\n const coarseMips = !!atlas && wvdbFillCoarseMips(tex);\n return {\n key: `${dims.join(\"x\")}|${srcDims.join(\"x\")}|${tb}|${atlas ? `${atlas.dimensions.join(\"x\")}:${atlas.levels}` : \"-\"}|${coarseMips ? \"coarse\" : \"box\"}`,\n texelBytes: tb,\n dims,\n srcDims,\n pendingByte: 0,\n pendingWords,\n coarseByte,\n fineByte,\n mapByte,\n mapRow,\n atlas,\n coarseMips,\n size: align(end, 4),\n };\n}\n\n/** The dispatches of a layout: the fill, then one per mip level (level 1 reads the texture rows, then the atlas). */\nfunction dispatchesOf(l: VDBDenseFillLayout): Dispatch[] {\n const [w, h, d] = l.dims;\n const bricks = l.dims.map((v) => Math.ceil(v / BRICK));\n const params = (o: Partial<Record<string, number | readonly number[]>>): Uint32Array => {\n const u = new Uint32Array(PARAMS_BYTES / 4);\n const vec = (at: number, v: readonly number[]) => u.set(v, at);\n vec(0, (o.dims as readonly number[]) ?? [0, 0, 0]);\n u[3] = l.texelBytes;\n vec(4, (o.srcDims as readonly number[]) ?? [0, 0, 0]);\n u[7] = l.pendingByte / 4;\n vec(8, bricks);\n u[11] = l.coarseByte;\n u[12] = l.fineByte;\n u[13] = o.dstByte as number;\n u[14] = o.dstRow as number;\n u[15] = o.dstRows as number;\n u[16] = (o.dstX as number) ?? 0;\n u[17] = (o.srcByte as number) ?? 0;\n u[18] = (o.srcRow as number) ?? 0;\n u[19] = (o.srcRows as number) ?? 0;\n u[20] = (o.srcX as number) ?? 0;\n u[21] = (o.coarseMip as number) ?? 0;\n return u;\n };\n const out: Dispatch[] = [{ entry: \"fill\", dims: [w, h, d], params: params({ dims: l.dims, srcDims: l.srcDims, dstByte: l.mapByte, dstRow: l.mapRow, dstRows: h, dstX: 0 }) }];\n const a = l.atlas;\n if (a) {\n const aw = a.dimensions[0];\n const xOf = (level: number) => aw - aw / 2 ** (level - 1);\n for (let level = 1; level <= a.levels; level++) {\n const dims = [levelSize(w, level), levelSize(h, level), levelSize(d, level)] as [number, number, number];\n const src = level === 1 ? { srcByte: l.mapByte, srcRow: l.mapRow, srcRows: h, srcX: 0 } : { srcByte: a.byte, srcRow: a.row, srcRows: a.dimensions[1], srcX: xOf(level - 1) };\n const srcDims = [levelSize(w, level - 1), levelSize(h, level - 1), levelSize(d, level - 1)];\n const coarseMip = level === 1 && l.coarseMips ? 1 : 0;\n out.push({ entry: \"mip\", dims, params: params({ dims, srcDims, dstByte: a.byte, dstRow: a.row, dstRows: a.dimensions[1], dstX: xOf(level), coarseMip, ...src }) });\n }\n }\n return out;\n}\n\n/** True when `layout`'s buffer fits the device's storage binding and buffer limits (else fill on the CPU). */\nexport function vdbDenseFillFits(device: GPUDevice, layout: VDBDenseFillLayout): boolean {\n const limits = (device as { limits?: Partial<GPUSupportedLimits> }).limits ?? {};\n const binding = limits.maxStorageBufferBindingSize ?? 128 * 1024 * 1024;\n const buffer = limits.maxBufferSize ?? 256 * 1024 * 1024;\n return layout.size <= binding && layout.size <= buffer;\n}\n\ninterface Pipelines {\n fill: GPUComputePipeline;\n mip: GPUComputePipeline;\n group0: GPUBindGroupLayout;\n error: Promise<GPUError | null>;\n}\n\nconst pipelines = new WeakMap<GPUDevice, Pipelines>();\n\nfunction fillPipelines(device: GPUDevice): Pipelines {\n const cached = pipelines.get(device);\n if (cached) return cached;\n device.pushErrorScope(\"validation\");\n const group0 = device.createBindGroupLayout({\n label: \"vdb dense fill group 0\",\n entries: [\n { binding: 0, visibility: STAGE_COMPUTE, buffer: { type: \"uniform\", hasDynamicOffset: true, minBindingSize: PARAMS_BYTES } },\n { binding: 1, visibility: STAGE_COMPUTE, buffer: { type: \"storage\" } },\n ],\n });\n const module = device.createShaderModule({ label: \"vdb dense fill\", code: FILL_WGSL });\n const layout = device.createPipelineLayout({ label: \"vdb dense fill\", bindGroupLayouts: [group0] });\n const make = (entryPoint: string) => device.createComputePipeline({ label: `vdb dense fill ${entryPoint}`, layout, compute: { module, entryPoint } });\n const error = device.popErrorScope().then((e) => {\n if (e) console.error(`@pmndrs/vdb vdbDenseSource: the fill kernels are invalid: ${e.message}`);\n return e;\n });\n const p: Pipelines = { fill: make(\"vdbDenseFillCs\"), mip: make(\"vdbDenseMipCs\"), group0, error };\n pipelines.set(device, p);\n return p;\n}\n\n/** Writes `data` at `offset` (bytes) with `writeBuffer`'s 4-byte size rule: the tail goes through a padded word. */\nfunction writeBytes(device: GPUDevice, buffer: GPUBuffer, offset: number, data: Uint8Array<ArrayBuffer>): void {\n const body = data.byteLength & ~3;\n if (body > 0) device.queue.writeBuffer(buffer, offset, data, 0, body);\n if (body < data.byteLength) {\n const tail = new Uint8Array(4);\n tail.set(data.subarray(body));\n device.queue.writeBuffer(buffer, offset + body, tail);\n }\n}\n\n/**\n * The GPU fill of one dense channel's textures (see the file comment). Keeps its buffer while the layout stays\n * (the pages of one LOD), and the coarse texels it last wrote (pages share one coarse array).\n */\nexport class VDBDenseFiller {\n readonly #device: GPUDevice;\n readonly #label: string;\n #layout: VDBDenseFillLayout | null = null;\n #buffer: GPUBuffer | null = null;\n #params: GPUBuffer | null = null;\n #group: GPUBindGroup | null = null;\n #dispatches: Dispatch[] = [];\n #coarse: Uint8Array | null = null;\n /** Fills run (for tests and probes). */\n runs = 0;\n\n constructor(device: GPUDevice, label: string) {\n this.#device = device;\n this.#label = label;\n }\n\n /** Pipeline validation of the kernels (null = valid). */\n get error(): Promise<GPUError | null> {\n return fillPipelines(this.#device).error;\n }\n\n /** Bytes of this filler's buffers. */\n get gpuBytes(): number {\n return (this.#buffer?.size ?? 0) + (this.#params?.size ?? 0);\n }\n\n /**\n * Fills `map` (and `mip`, the atlas texture, when `tex` has one) with `tex` and its pending bricks upsampled, and\n * submits the work. `tex.fill` must be set; `map`/`mip` must have `tex`'s sizes and `COPY_DST`.\n * @returns the buffers it replaced (the caller retires them).\n */\n fill(map: GPUTexture, mip: GPUTexture | null, tex: WvdbDenseTexture): GPUBuffer[] {\n const fill = tex.fill!;\n const device = this.#device;\n const layout = vdbDenseFillLayout(tex);\n const retired: GPUBuffer[] = [];\n if (!this.#layout || this.#layout.key !== layout.key) {\n if (this.#buffer) retired.push(this.#buffer, this.#params!);\n this.#layout = layout;\n this.#dispatches = dispatchesOf(layout);\n this.#buffer = device.createBuffer({ label: `${this.#label} fill`, size: layout.size, usage: USAGE.STORAGE | USAGE.COPY_DST | USAGE.COPY_SRC });\n this.#params = device.createBuffer({ label: `${this.#label} fill params`, size: this.#dispatches.length * SLOT, usage: USAGE.UNIFORM | USAGE.COPY_DST });\n const bytes = new Uint8Array(this.#dispatches.length * SLOT);\n this.#dispatches.forEach((d, i) => bytes.set(new Uint8Array(d.params.buffer), i * SLOT));\n device.queue.writeBuffer(this.#params, 0, bytes);\n const p = fillPipelines(device);\n this.#group = device.createBindGroup({\n label: `${this.#label} fill group`,\n layout: p.group0,\n entries: [\n { binding: 0, resource: { buffer: this.#params, size: PARAMS_BYTES } },\n { binding: 1, resource: { buffer: this.#buffer } },\n ],\n });\n this.#coarse = null;\n }\n const buffer = this.#buffer!;\n const l = this.#layout;\n device.queue.writeBuffer(buffer, l.pendingByte, new Uint32Array(fill.pending.subarray(0, l.pendingWords)));\n if (this.#coarse !== fill.from.data) {\n writeBytes(device, buffer, l.coarseByte, fill.from.data);\n this.#coarse = fill.from.data;\n }\n writeBytes(device, buffer, l.fineByte, tex.data);\n const p = fillPipelines(device);\n const encoder = device.createCommandEncoder({ label: `${this.#label} fill` });\n encoder.clearBuffer(buffer, l.mapByte, l.size - l.mapByte);\n const pass = encoder.beginComputePass({ label: `${this.#label} fill` });\n this.#dispatches.forEach((d, i) => {\n pass.setPipeline(d.entry === \"fill\" ? p.fill : p.mip);\n pass.setBindGroup(0, this.#group!, [i * SLOT]);\n pass.dispatchWorkgroups(Math.ceil(d.dims[0] / W), Math.ceil(d.dims[1] / W), Math.ceil(d.dims[2] / W));\n });\n pass.end();\n const [w, h, d] = l.dims;\n encoder.copyBufferToTexture({ buffer, offset: l.mapByte, bytesPerRow: l.mapRow, rowsPerImage: h }, { texture: map }, [w, h, d]);\n if (l.atlas && mip) {\n const [aw, ah, ad] = l.atlas.dimensions;\n encoder.copyBufferToTexture({ buffer, offset: l.atlas.byte, bytesPerRow: l.atlas.row, rowsPerImage: ah }, { texture: mip }, [aw, ah, ad]);\n }\n device.queue.submit([encoder.finish()]);\n this.runs++;\n return retired;\n }\n\n /** The buffers this filler holds (the caller retires them), and forget them. */\n release(): GPUBuffer[] {\n const out = this.#buffer ? [this.#buffer, this.#params!] : [];\n this.#buffer = this.#params = null;\n this.#group = null;\n this.#layout = null;\n this.#coarse = null;\n return out;\n }\n}\n"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { WvdbDenseVolume } from "../../tools/wvdb/dense.js";
|
|
2
|
+
import type { VDBVolumeSlot, VDBVolumeSource } from "./types.js";
|
|
3
|
+
type ChannelName = "density" | "mask" | "albedo" | "emission";
|
|
4
|
+
/** Options of {@link vdbDenseSource}. */
|
|
5
|
+
export interface VDBDenseSourceOptions {
|
|
6
|
+
/** Label prefix of the GPU objects. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/**
|
|
9
|
+
* K4.22: where a partial LOD's pending bricks (`WvdbDenseTexture.fill`) are filled: `'gpu'` (default, a compute
|
|
10
|
+
* kernel) or `'cpu'` (`wvdbDenseResolve`, then an upload). Both give the same bytes; a texture whose fill buffer
|
|
11
|
+
* would pass the device's storage binding or buffer size limit is filled on the CPU anyway.
|
|
12
|
+
*/
|
|
13
|
+
fill?: "gpu" | "cpu";
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* @internal The textures a dense source holds now, per channel (`map`, and `mip` the atlas): for probes that read
|
|
17
|
+
* them back (they have `COPY_SRC`). Null for an object that is not a dense source.
|
|
18
|
+
*/
|
|
19
|
+
export declare function vdbDenseSourceTextures(source: object): Partial<Record<ChannelName, {
|
|
20
|
+
map: GPUTexture;
|
|
21
|
+
mip: GPUTexture | null;
|
|
22
|
+
}>> | null;
|
|
23
|
+
/** A dense source with `replace` (LOD swap). */
|
|
24
|
+
export type VDBDenseSource = VDBVolumeSource & VDBVolumeSlot & {
|
|
25
|
+
readonly kind: "dense";
|
|
26
|
+
readonly volume: WvdbDenseVolume;
|
|
27
|
+
/**
|
|
28
|
+
* Swap in another LOD or frame. K4.22: a partial LOD (`wvdbDensePartialVolume`) is filled before the upload
|
|
29
|
+
* (its pending bricks upsampled from the coarser LOD, on the GPU by default; see {@link VDBDenseSourceOptions}).
|
|
30
|
+
*/
|
|
31
|
+
replace(volume: WvdbDenseVolume): void;
|
|
32
|
+
/** K4.22: how many channel fills ran on the GPU and on the CPU (partial LODs). */
|
|
33
|
+
readonly fills: {
|
|
34
|
+
readonly gpu: number;
|
|
35
|
+
readonly cpu: number;
|
|
36
|
+
};
|
|
37
|
+
/** K4.22: bumps on every `replace` (the content changed; `version` only when the textures are new). */
|
|
38
|
+
readonly revision: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Upload a dense `.wvdb` volume (`wvdbDenseVolume` from `@pmndrs/vdb/tools`) on
|
|
42
|
+
* the host's device. The source owns its textures and sampler; `dispose()` frees
|
|
43
|
+
* the textures (samplers have no destroy).
|
|
44
|
+
*
|
|
45
|
+
* @param device The host's `GPUDevice`; the source creates its textures on it.
|
|
46
|
+
* @param volume The decoded `.wvdb` level (`wvdbDenseVolume`).
|
|
47
|
+
* @param o Options ({@link VDBDenseSourceOptions}).
|
|
48
|
+
*/
|
|
49
|
+
export declare function vdbDenseSource(device: GPUDevice, volume: WvdbDenseVolume, o?: VDBDenseSourceOptions): VDBDenseSource;
|
|
50
|
+
export {};
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):
|
|
2
|
+
// src/three-openvdb/frame/webgpu/frameShaderChunks.js L834–1028 (createVolumeNodes: sampleMipAtlas,
|
|
3
|
+
// sampleMipmapped, sample3D, sampleOptional), src/three-openvdb/frame/core/FrameVolume.js L14–22 and
|
|
4
|
+
// src/three-openvdb/frame/webgpu/FrameRenderer.js L483–487 (texture setup: linear filter, clamp to edge,
|
|
5
|
+
// no GPU mipmaps), src/three-openvdb/frame/webgpu/frameMipmaps.js L183–189 (mip atlas texture).
|
|
6
|
+
// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).
|
|
7
|
+
// Changes: TSL → WGSL, raw WebGPU upload; mip level count from textureDimensions instead of a uniform.
|
|
8
|
+
// Divergences: DIVERGES.md V23–V25.
|
|
9
|
+
/**
|
|
10
|
+
* `vdbDenseSource(device, volume)`: the dense `.wvdb` volume source on raw
|
|
11
|
+
* WebGPU (K3.0, R1 §4.2). It uploads the bytes `wvdbDenseVolume` (tools) built,
|
|
12
|
+
* as his renderer does: one 3D texture per channel (`r8unorm` density, mask and
|
|
13
|
+
* emission; `rgba8unorm` albedo) plus a CPU box mip atlas per channel, sampled
|
|
14
|
+
* with hardware trilinear (linear min/mag, clamp to edge, no GPU mipmaps).
|
|
15
|
+
*
|
|
16
|
+
* D10 says kernels need no textures; that holds for the sparse source. A
|
|
17
|
+
* kernel compiled against a dense source binds textures, by the host's choice.
|
|
18
|
+
*
|
|
19
|
+
* K4.22: a volume from `wvdbDensePartialVolume` (a `.wvdb` LOD still streaming) carries a `fill` on its
|
|
20
|
+
* textures: the bricks stored but not decoded yet, and the coarser LOD to upsample there. The source fills them
|
|
21
|
+
* on the GPU (`dense-fill.ts`: one compute pass, its own submit) and builds the mip atlas from the result; the
|
|
22
|
+
* CPU twin (`wvdbDenseResolve`) gives the same bytes and is the fallback (`fill: 'cpu'`, or a texture too large
|
|
23
|
+
* for one storage binding).
|
|
24
|
+
*/
|
|
25
|
+
import { VDBError } from "../errors.js";
|
|
26
|
+
import { VDBRetireQueue } from "../frame/resources.js";
|
|
27
|
+
import { wvdbDenseResolveTexture } from "../../tools/wvdb/partial.js";
|
|
28
|
+
import { VDBDenseFiller, vdbDenseFillFits, vdbDenseFillLayout } from "./dense-fill.js";
|
|
29
|
+
/** `GPUTextureUsage.TEXTURE_BINDING | COPY_DST | COPY_SRC` (0x04 | 0x02 | 0x01); the globals do not exist in Node. */
|
|
30
|
+
const TEXTURE_USAGE = 0x04 | 0x02 | 0x01;
|
|
31
|
+
/** `GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE`. */
|
|
32
|
+
const STAGE_FRAGMENT_COMPUTE = 0x2 | 0x4;
|
|
33
|
+
const CHANNELS = ["density", "mask", "albedo", "emission"];
|
|
34
|
+
const CAP = { density: "Density", mask: "Mask", albedo: "Albedo", emission: "Emission" };
|
|
35
|
+
/** K4.22 probes: each source's live textures (core internal, `vdbDenseSourceTextures`). */
|
|
36
|
+
const liveTextures = new WeakMap();
|
|
37
|
+
/**
|
|
38
|
+
* @internal The textures a dense source holds now, per channel (`map`, and `mip` the atlas): for probes that read
|
|
39
|
+
* them back (they have `COPY_SRC`). Null for an object that is not a dense source.
|
|
40
|
+
*/
|
|
41
|
+
export function vdbDenseSourceTextures(source) {
|
|
42
|
+
return liveTextures.get(source)?.() ?? null;
|
|
43
|
+
}
|
|
44
|
+
const bad = (message) => new VDBError("VDB_BAD_OPTION", message);
|
|
45
|
+
function create(device, dims, format, label) {
|
|
46
|
+
const [w, h, d] = dims;
|
|
47
|
+
return device.createTexture({ label, size: [w, h, d], dimension: "3d", format, usage: TEXTURE_USAGE });
|
|
48
|
+
}
|
|
49
|
+
function write(device, texture, data, dims, texelBytes, label) {
|
|
50
|
+
const [w, h, d] = dims;
|
|
51
|
+
if (data.byteLength !== w * h * d * texelBytes) {
|
|
52
|
+
throw bad(`vdbDenseSource: ${label} has ${data.byteLength} bytes, expected ${w}x${h}x${d}x${texelBytes}`);
|
|
53
|
+
}
|
|
54
|
+
// writeTexture has no 256-byte row alignment rule (only buffer copies do); FrameVolume uses unpackAlignment 1.
|
|
55
|
+
device.queue.writeTexture({ texture }, data, { bytesPerRow: w * texelBytes, rowsPerImage: h }, [w, h, d]);
|
|
56
|
+
}
|
|
57
|
+
function createChannel(device, tex, label) {
|
|
58
|
+
const map = create(device, tex.dimensions, tex.format, `${label}`);
|
|
59
|
+
const mip = tex.mip ? create(device, tex.mip.dimensions, tex.format, `${label} mip atlas`) : null;
|
|
60
|
+
return { map, mip };
|
|
61
|
+
}
|
|
62
|
+
function present(volume) {
|
|
63
|
+
return { density: volume.density, mask: volume.mask, albedo: volume.albedo, emission: volume.emission };
|
|
64
|
+
}
|
|
65
|
+
function checkSlot(slot, where) {
|
|
66
|
+
if (!slot || !Number.isInteger(slot.group) || slot.group < 0 || !Number.isInteger(slot.firstBinding) || slot.firstBinding < 0) {
|
|
67
|
+
throw bad(`${where}: slot must be { group, firstBinding } with non-negative integers, got ${JSON.stringify(slot)}.`);
|
|
68
|
+
}
|
|
69
|
+
return slot;
|
|
70
|
+
}
|
|
71
|
+
/** WGSL for one channel's sample function (his sampleMipmapped / sampleMipAtlas, L838–877). */
|
|
72
|
+
function channelWgsl(name, hasMip) {
|
|
73
|
+
const C = CAP[name];
|
|
74
|
+
const map = `vdbSrc${C}Map`;
|
|
75
|
+
if (!hasMip) {
|
|
76
|
+
return `fn vdbSrcSample${C}(uvw: vec3f, lod: f32) -> vec4f {\n return textureSampleLevel(${map}, vdbSrcSampler, uvw, 0.0);\n}\n`;
|
|
77
|
+
}
|
|
78
|
+
const mip = `vdbSrc${C}Mip`;
|
|
79
|
+
return `fn vdbSrcMipAtlas${C}(level: f32, uvw: vec3f) -> vec4f {
|
|
80
|
+
let texels = vec3f(textureDimensions(${map}));
|
|
81
|
+
let atlas = vec3f(textureDimensions(${mip}));
|
|
82
|
+
let size = max(vec3f(1.0), ceil(texels / exp2(level)));
|
|
83
|
+
let offset = atlas.x - atlas.x / exp2(level - 1.0);
|
|
84
|
+
let texel = clamp(uvw * size, vec3f(0.5), size - 0.5);
|
|
85
|
+
return textureSampleLevel(${mip}, vdbSrcSampler, vec3f(texel.x + offset, texel.y, texel.z) / atlas, 0.0);
|
|
86
|
+
}
|
|
87
|
+
fn vdbSrcSample${C}(uvw: vec3f, lod: f32) -> vec4f {
|
|
88
|
+
let level = min(lod, vdbSrcLevelCount(textureDimensions(${map})));
|
|
89
|
+
if (level <= 0.0) {
|
|
90
|
+
return textureSampleLevel(${map}, vdbSrcSampler, uvw, 0.0);
|
|
91
|
+
}
|
|
92
|
+
let level0 = floor(level);
|
|
93
|
+
var low: vec4f;
|
|
94
|
+
if (level0 < 0.5) {
|
|
95
|
+
low = textureSampleLevel(${map}, vdbSrcSampler, uvw, 0.0);
|
|
96
|
+
} else {
|
|
97
|
+
low = vdbSrcMipAtlas${C}(level0, uvw);
|
|
98
|
+
}
|
|
99
|
+
let high = vdbSrcMipAtlas${C}(min(level0 + 1.0, vdbSrcLevelCount(textureDimensions(${map}))), uvw);
|
|
100
|
+
return mix(low, high, level - level0);
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
class DenseSource {
|
|
105
|
+
kind = "dense";
|
|
106
|
+
/** A dense source is its own volume slot (K6 design §2.1): `source` is itself, `v` = 0. */
|
|
107
|
+
get source() {
|
|
108
|
+
return this;
|
|
109
|
+
}
|
|
110
|
+
v = 0;
|
|
111
|
+
texels;
|
|
112
|
+
lodLevels;
|
|
113
|
+
channels;
|
|
114
|
+
stats;
|
|
115
|
+
/** Local unit box → uvw: translate by 0.5 (column-major). */
|
|
116
|
+
boxToSource = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0.5, 0.5, 0.5, 1]);
|
|
117
|
+
version = 0;
|
|
118
|
+
/** K4.22: every `replace` (same size included) bumps it: the content changed (`VDBVolumeSourceInfo.revision`). */
|
|
119
|
+
revision = 0;
|
|
120
|
+
#device;
|
|
121
|
+
#label;
|
|
122
|
+
#volume;
|
|
123
|
+
#textures = {};
|
|
124
|
+
#sampler;
|
|
125
|
+
#disposed = false;
|
|
126
|
+
#retire = new VDBRetireQueue();
|
|
127
|
+
#fillMode;
|
|
128
|
+
/** K4.22: one GPU filler per channel while that channel's LOD streams in. */
|
|
129
|
+
#fillers = new Map();
|
|
130
|
+
/** K4.22: channel fills done on the GPU and on the CPU (for tests and probes). */
|
|
131
|
+
fills = { gpu: 0, cpu: 0 };
|
|
132
|
+
constructor(device, volume, o) {
|
|
133
|
+
this.#device = device;
|
|
134
|
+
this.#label = o.label ?? "vdb dense source";
|
|
135
|
+
if (o.fill !== undefined && o.fill !== "gpu" && o.fill !== "cpu")
|
|
136
|
+
throw bad(`vdbDenseSource: fill must be 'gpu' or 'cpu', got ${JSON.stringify(o.fill)}.`);
|
|
137
|
+
this.#fillMode = o.fill ?? "gpu";
|
|
138
|
+
liveTextures.set(this, () => ({ ...this.#textures }));
|
|
139
|
+
this.#volume = volume;
|
|
140
|
+
this.channels = { mask: !!volume.mask, albedo: !!volume.albedo, emission: !!volume.emission };
|
|
141
|
+
// FrameRenderer.js L483–487 + Data3DTexture defaults: linear, clamp to edge, no mipmaps.
|
|
142
|
+
this.#sampler = device.createSampler({
|
|
143
|
+
label: `${this.#label} sampler`,
|
|
144
|
+
magFilter: "linear",
|
|
145
|
+
minFilter: "linear",
|
|
146
|
+
mipmapFilter: "nearest",
|
|
147
|
+
addressModeU: "clamp-to-edge",
|
|
148
|
+
addressModeV: "clamp-to-edge",
|
|
149
|
+
addressModeW: "clamp-to-edge",
|
|
150
|
+
});
|
|
151
|
+
this.texels = [...volume.dimensions];
|
|
152
|
+
this.lodLevels = volume.density.mip?.levels ?? 0;
|
|
153
|
+
this.stats = { meanNonZero: volume.meanDensity, max: volume.maxDensity, activeVoxels: volume.activeTexels };
|
|
154
|
+
this.#upload(volume);
|
|
155
|
+
}
|
|
156
|
+
#upload(volume) {
|
|
157
|
+
const textures = present(volume);
|
|
158
|
+
for (const name of CHANNELS) {
|
|
159
|
+
const tex = textures[name];
|
|
160
|
+
if (!tex)
|
|
161
|
+
continue;
|
|
162
|
+
const up = createChannel(this.#device, tex, `${this.#label} ${name}`);
|
|
163
|
+
this.#textures[name] = up;
|
|
164
|
+
this.#write(name, tex, up);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/** Writes a channel's texels and atlas; K4.22: a texture with pending bricks is filled first (GPU or CPU). */
|
|
168
|
+
#write(name, tex, up) {
|
|
169
|
+
const label = `${this.#label} ${name}`;
|
|
170
|
+
let t = tex;
|
|
171
|
+
if (tex.fill && tex.fill.count > 0) {
|
|
172
|
+
if (this.#fillMode === "gpu" && vdbDenseFillFits(this.#device, vdbDenseFillLayout(tex))) {
|
|
173
|
+
let filler = this.#fillers.get(name);
|
|
174
|
+
if (!filler)
|
|
175
|
+
this.#fillers.set(name, (filler = new VDBDenseFiller(this.#device, label)));
|
|
176
|
+
for (const b of filler.fill(up.map, up.mip, tex))
|
|
177
|
+
this.#retire.retireAfterTask(b);
|
|
178
|
+
this.fills.gpu++;
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
t = wvdbDenseResolveTexture(tex);
|
|
182
|
+
this.fills.cpu++;
|
|
183
|
+
}
|
|
184
|
+
write(this.#device, up.map, t.data, t.dimensions, t.texelBytes, label);
|
|
185
|
+
if (t.mip && up.mip)
|
|
186
|
+
write(this.#device, up.mip, t.mip.data, t.mip.dimensions, t.texelBytes, `${label} mip atlas`);
|
|
187
|
+
}
|
|
188
|
+
/** Retires the GPU fillers of channels that have no pending bricks in `volume` (their LOD is complete). */
|
|
189
|
+
#releaseFillers(volume) {
|
|
190
|
+
const textures = present(volume);
|
|
191
|
+
for (const [name, filler] of this.#fillers) {
|
|
192
|
+
const tex = textures[name];
|
|
193
|
+
if (tex?.fill && tex.fill.count > 0)
|
|
194
|
+
continue;
|
|
195
|
+
for (const b of filler.release())
|
|
196
|
+
this.#retire.retireAfterTask(b);
|
|
197
|
+
this.#fillers.delete(name);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* K6.10a: a replaced texture may be named by passes the host recorded but has not submitted yet (a `replace` between
|
|
202
|
+
* the frame's `update(encoder)` and `queue.submit`), so it is destroyed in a later task (the retire queue's rule).
|
|
203
|
+
* `dispose()` destroys at once.
|
|
204
|
+
*/
|
|
205
|
+
#retireTextures() {
|
|
206
|
+
for (const t of Object.values(this.#textures)) {
|
|
207
|
+
this.#retire.retireAfterTask(t.map);
|
|
208
|
+
this.#retire.retireAfterTask(t.mip);
|
|
209
|
+
}
|
|
210
|
+
this.#textures = {};
|
|
211
|
+
}
|
|
212
|
+
#check() {
|
|
213
|
+
if (this.#disposed)
|
|
214
|
+
throw new VDBError("VDB_DISPOSED", "vdbDenseSource: the source was disposed; create a new one.");
|
|
215
|
+
}
|
|
216
|
+
/** The textures as uploaded (for tests and adapters). */
|
|
217
|
+
get volume() {
|
|
218
|
+
return this.#volume;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Swap in another LOD (or frame) of the same grids. The channel set and mip
|
|
222
|
+
* presence must match; a size change makes new textures and bumps `version`
|
|
223
|
+
* (rebuild bind groups; the WGSL does not change). The replaced textures are
|
|
224
|
+
* destroyed in a later task (K6.10a): passes recorded with them before the
|
|
225
|
+
* call stay valid when the host submits in the same task.
|
|
226
|
+
*/
|
|
227
|
+
replace(volume) {
|
|
228
|
+
this.#check();
|
|
229
|
+
const now = present(this.#volume);
|
|
230
|
+
const next = present(volume);
|
|
231
|
+
for (const name of CHANNELS) {
|
|
232
|
+
if (!!now[name] !== !!next[name] || !!now[name]?.mip !== !!next[name]?.mip) {
|
|
233
|
+
throw bad(`vdbDenseSource.replace: the ${name} channel or its mip atlas appears or disappears; create a new source (the WGSL differs).`);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
const sameSize = (a, b) => !a || !b || (a.dimensions.every((v, i) => v === b.dimensions[i]) && (!a.mip || a.mip.dimensions.every((v, i) => v === b.mip.dimensions[i])));
|
|
237
|
+
this.#releaseFillers(volume);
|
|
238
|
+
if (CHANNELS.every((n) => sameSize(now[n], next[n]))) {
|
|
239
|
+
for (const name of CHANNELS) {
|
|
240
|
+
const tex = next[name];
|
|
241
|
+
const up = this.#textures[name];
|
|
242
|
+
if (!tex || !up)
|
|
243
|
+
continue;
|
|
244
|
+
this.#write(name, tex, up);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
else {
|
|
248
|
+
this.#retireTextures();
|
|
249
|
+
this.#upload(volume);
|
|
250
|
+
this.version++;
|
|
251
|
+
}
|
|
252
|
+
this.#volume = volume;
|
|
253
|
+
this.revision++;
|
|
254
|
+
this.texels = [...volume.dimensions];
|
|
255
|
+
this.lodLevels = volume.density.mip?.levels ?? 0;
|
|
256
|
+
this.stats = { meanNonZero: volume.meanDensity, max: volume.maxDensity, activeVoxels: volume.activeTexels };
|
|
257
|
+
}
|
|
258
|
+
/** Bindings in order: sampler, then per present channel its texture and its mip atlas. */
|
|
259
|
+
#bindings(slot) {
|
|
260
|
+
let b = slot.firstBinding;
|
|
261
|
+
const out = [
|
|
262
|
+
{ name: "vdbSrcSampler", binding: b++, kind: "sampler" },
|
|
263
|
+
];
|
|
264
|
+
for (const name of CHANNELS) {
|
|
265
|
+
const t = this.#textures[name];
|
|
266
|
+
if (!t)
|
|
267
|
+
continue;
|
|
268
|
+
out.push({ name: `vdbSrc${CAP[name]}Map`, binding: b++, kind: "texture", texture: t.map });
|
|
269
|
+
if (t.mip)
|
|
270
|
+
out.push({ name: `vdbSrc${CAP[name]}Mip`, binding: b++, kind: "texture", texture: t.mip });
|
|
271
|
+
}
|
|
272
|
+
return out;
|
|
273
|
+
}
|
|
274
|
+
wgsl(o) {
|
|
275
|
+
this.#check();
|
|
276
|
+
const slot = checkSlot(o.slot, "vdbDenseSource.wgsl");
|
|
277
|
+
if (o.profile !== "sample" && o.profile !== "march")
|
|
278
|
+
throw bad(`vdbDenseSource.wgsl: profile must be 'sample' or 'march', got ${JSON.stringify(o.profile)}.`);
|
|
279
|
+
const on = (name) => this.channels[name] && o.channels?.[name] !== false;
|
|
280
|
+
const lines = [`// vdbDenseSource: dense .wvdb volume source (K3.0). ${this.#label}`];
|
|
281
|
+
for (const b of this.#bindings(slot)) {
|
|
282
|
+
lines.push(`@group(${slot.group}) @binding(${b.binding}) var ${b.name}: ${b.kind === "sampler" ? "sampler" : "texture_3d<f32>"};`);
|
|
283
|
+
}
|
|
284
|
+
lines.push(`
|
|
285
|
+
// frameMipmaps.js getMipLevelCount: ceil(log2(max side)), exactly, in integers.
|
|
286
|
+
fn vdbSrcLevelCount(dims: vec3u) -> f32 {
|
|
287
|
+
let m = max(max(dims.x, dims.y), max(dims.z, 1u));
|
|
288
|
+
if (m <= 1u) {
|
|
289
|
+
return 0.0;
|
|
290
|
+
}
|
|
291
|
+
return f32(32u - countLeadingZeros(m - 1u));
|
|
292
|
+
}
|
|
293
|
+
`);
|
|
294
|
+
const sampled = ["density", ...["mask", "albedo", "emission"].filter(on)];
|
|
295
|
+
for (const name of sampled)
|
|
296
|
+
lines.push(channelWgsl(name, !!this.#textures[name]?.mip));
|
|
297
|
+
lines.push(`fn vdbSrcDensity(v: u32, uvw: vec3f, lod: f32) -> f32 {
|
|
298
|
+
return vdbSrcSampleDensity(uvw, lod).r;
|
|
299
|
+
}
|
|
300
|
+
fn vdbSrcMask(v: u32, uvw: vec3f, lod: f32) -> f32 {
|
|
301
|
+
return ${on("mask") ? "vdbSrcSampleMask(uvw, lod).r" : "1.0"};
|
|
302
|
+
}
|
|
303
|
+
fn vdbSrcAlbedo(v: u32, uvw: vec3f, lod: f32) -> vec3f {
|
|
304
|
+
return ${on("albedo") ? "vdbSrcSampleAlbedo(uvw, lod).rgb" : "vec3f(1.0)"};
|
|
305
|
+
}
|
|
306
|
+
fn vdbSrcEmission(v: u32, uvw: vec3f, lod: f32) -> f32 {
|
|
307
|
+
return ${on("emission") ? "vdbSrcSampleEmission(uvw, lod).r" : "0.0"};
|
|
308
|
+
}
|
|
309
|
+
fn vdbSrcTexels(v: u32) -> vec3f {
|
|
310
|
+
return vec3f(textureDimensions(vdbSrcDensityMap));
|
|
311
|
+
}
|
|
312
|
+
fn vdbSrcLodLevels(v: u32) -> f32 {
|
|
313
|
+
return ${this.#textures.density?.mip ? "vdbSrcLevelCount(textureDimensions(vdbSrcDensityMap))" : "0.0"};
|
|
314
|
+
}
|
|
315
|
+
`);
|
|
316
|
+
if (o.stochastic) {
|
|
317
|
+
// Issue #2: hardware trilinear is already one fetch; the stochastic form is the deterministic one.
|
|
318
|
+
lines.push(`fn vdbSrcDensityStochastic(v: u32, uvw: vec3f, lod: f32, xi: vec3f) -> f32 {
|
|
319
|
+
return vdbSrcDensity(v, uvw, lod);
|
|
320
|
+
}`);
|
|
321
|
+
}
|
|
322
|
+
if (o.profile === "march") {
|
|
323
|
+
// Dense: no empty-space structure; the march steps everywhere (R1 §4.2). K4.22a: vdbSrcMaxIn is the r8unorm bound
|
|
324
|
+
// (every texel and every filtered sample is <= 1), not stats.max: baked into the WGSL, a max that moved with each
|
|
325
|
+
// partial LOD page rebuilt every frame kernel (demo 16: 7 builds at LOD 1's first page). stats.max stays on the CPU.
|
|
326
|
+
lines.push(`fn vdbSrcSkipEmpty(v: u32, o: vec3f, d: vec3f, t0: f32, t1: f32) -> f32 {
|
|
327
|
+
return t0;
|
|
328
|
+
}
|
|
329
|
+
fn vdbSrcSkipSpan(v: u32, o: vec3f, d: vec3f, t0: f32, t1: f32, lod: f32, cutoff: f32) -> vec2f {
|
|
330
|
+
return vec2f(t0, 1e30);
|
|
331
|
+
}
|
|
332
|
+
fn vdbSrcMaxIn(v: u32, uvwMin: vec3f, uvwMax: vec3f) -> f32 {
|
|
333
|
+
return 1.0;
|
|
334
|
+
}
|
|
335
|
+
`);
|
|
336
|
+
}
|
|
337
|
+
return lines.join("\n");
|
|
338
|
+
}
|
|
339
|
+
layoutEntries(slot, visibility = STAGE_FRAGMENT_COMPUTE) {
|
|
340
|
+
this.#check();
|
|
341
|
+
checkSlot(slot, "vdbDenseSource.layoutEntries");
|
|
342
|
+
return this.#bindings(slot).map((b) => b.kind === "sampler"
|
|
343
|
+
? { binding: b.binding, visibility, sampler: { type: "filtering" } }
|
|
344
|
+
: { binding: b.binding, visibility, texture: { sampleType: "float", viewDimension: "3d" } });
|
|
345
|
+
}
|
|
346
|
+
bindEntries(slot) {
|
|
347
|
+
this.#check();
|
|
348
|
+
checkSlot(slot, "vdbDenseSource.bindEntries");
|
|
349
|
+
return this.#bindings(slot).map((b) => ({
|
|
350
|
+
binding: b.binding,
|
|
351
|
+
resource: b.kind === "sampler" ? this.#sampler : b.texture.createView({ dimension: "3d" }),
|
|
352
|
+
}));
|
|
353
|
+
}
|
|
354
|
+
dispose() {
|
|
355
|
+
if (this.#disposed)
|
|
356
|
+
return;
|
|
357
|
+
for (const filler of this.#fillers.values())
|
|
358
|
+
for (const b of filler.release())
|
|
359
|
+
this.#retire.retireAfterTask(b);
|
|
360
|
+
this.#fillers.clear();
|
|
361
|
+
this.#retireTextures();
|
|
362
|
+
this.#retire.drain();
|
|
363
|
+
this.#disposed = true;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Upload a dense `.wvdb` volume (`wvdbDenseVolume` from `@pmndrs/vdb/tools`) on
|
|
368
|
+
* the host's device. The source owns its textures and sampler; `dispose()` frees
|
|
369
|
+
* the textures (samplers have no destroy).
|
|
370
|
+
*
|
|
371
|
+
* @param device The host's `GPUDevice`; the source creates its textures on it.
|
|
372
|
+
* @param volume The decoded `.wvdb` level (`wvdbDenseVolume`).
|
|
373
|
+
* @param o Options ({@link VDBDenseSourceOptions}).
|
|
374
|
+
*/
|
|
375
|
+
export function vdbDenseSource(device, volume, o = {}) {
|
|
376
|
+
if (!device || typeof device.createTexture !== "function") {
|
|
377
|
+
throw new VDBError("VDB_UNSUPPORTED_DEVICE", "vdbDenseSource: pass the host's GPUDevice.");
|
|
378
|
+
}
|
|
379
|
+
if (!volume || volume.kind !== "dense" || !volume.density) {
|
|
380
|
+
throw bad("vdbDenseSource: pass a dense volume from wvdbDenseVolume() (@pmndrs/vdb/tools).");
|
|
381
|
+
}
|
|
382
|
+
return new DenseSource(device, volume, o);
|
|
383
|
+
}
|
|
384
|
+
//# sourceMappingURL=dense.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dense.js","sourceRoot":"","sources":["../../../src/core/source/dense.ts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AC,CAAC,CAAC,OAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;SAC5F,CAAC,CAAC,CAAC;IACN,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,SAAS;YAAE,OAAO;QAC3B,KAAK,MAAM,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;YAAE,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,EAAE;gBAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;QAC/G,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACxB,CAAC;CACF;AAiBD;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAAC,MAAiB,EAAE,MAAuB,EAAE,IAA2B,EAAE;IACtG,IAAI,CAAC,MAAM,IAAI,OAAQ,MAAsC,CAAC,aAAa,KAAK,UAAU,EAAE,CAAC;QAC3F,MAAM,IAAI,QAAQ,CAAC,wBAAwB,EAAE,4CAA4C,CAAC,CAAC;IAC7F,CAAC;IACD,IAAI,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAC1D,MAAM,GAAG,CAAC,iFAAiF,CAAC,CAAC;IAC/F,CAAC;IACD,OAAO,IAAI,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["// Portions derived from mjurczyk/openvdb (MIT), commit 75e7345 (v0.26.0):\n// src/three-openvdb/frame/webgpu/frameShaderChunks.js L834–1028 (createVolumeNodes: sampleMipAtlas,\n// sampleMipmapped, sample3D, sampleOptional), src/three-openvdb/frame/core/FrameVolume.js L14–22 and\n// src/three-openvdb/frame/webgpu/FrameRenderer.js L483–487 (texture setup: linear filter, clamp to edge,\n// no GPU mipmaps), src/three-openvdb/frame/webgpu/frameMipmaps.js L183–189 (mip atlas texture).\n// Copyright (c) mjurczyk/openvdb contributors. Licensed under the MIT License (see THIRD_PARTY_NOTICES.md).\n// Changes: TSL → WGSL, raw WebGPU upload; mip level count from textureDimensions instead of a uniform.\n// Divergences: DIVERGES.md V23–V25.\n\n/**\n * `vdbDenseSource(device, volume)`: the dense `.wvdb` volume source on raw\n * WebGPU (K3.0, R1 §4.2). It uploads the bytes `wvdbDenseVolume` (tools) built,\n * as his renderer does: one 3D texture per channel (`r8unorm` density, mask and\n * emission; `rgba8unorm` albedo) plus a CPU box mip atlas per channel, sampled\n * with hardware trilinear (linear min/mag, clamp to edge, no GPU mipmaps).\n *\n * D10 says kernels need no textures; that holds for the sparse source. A\n * kernel compiled against a dense source binds textures, by the host's choice.\n *\n * K4.22: a volume from `wvdbDensePartialVolume` (a `.wvdb` LOD still streaming) carries a `fill` on its\n * textures: the bricks stored but not decoded yet, and the coarser LOD to upsample there. The source fills them\n * on the GPU (`dense-fill.ts`: one compute pass, its own submit) and builds the mip atlas from the result; the\n * CPU twin (`wvdbDenseResolve`) gives the same bytes and is the fallback (`fill: 'cpu'`, or a texture too large\n * for one storage binding).\n */\n\nimport { VDBError } from \"../errors.js\";\nimport { VDBRetireQueue } from \"../frame/resources.js\";\nimport type { VDBSlot } from \"../types.js\";\nimport type { WvdbDenseTexture, WvdbDenseVolume } from \"../../tools/wvdb/dense.js\";\nimport { wvdbDenseResolveTexture } from \"../../tools/wvdb/partial.js\";\nimport { VDBDenseFiller, vdbDenseFillFits, vdbDenseFillLayout } from \"./dense-fill.js\";\nimport type { VDBVolumeChannels, VDBVolumeSlot, VDBVolumeSource, VDBVolumeSourceWgslInternalOptions, VDBVolumeSourceWgslOptions } from \"./types.js\";\n\n/** `GPUTextureUsage.TEXTURE_BINDING | COPY_DST | COPY_SRC` (0x04 | 0x02 | 0x01); the globals do not exist in Node. */\nconst TEXTURE_USAGE = 0x04 | 0x02 | 0x01;\n/** `GPUShaderStage.FRAGMENT | GPUShaderStage.COMPUTE`. */\nconst STAGE_FRAGMENT_COMPUTE = 0x2 | 0x4;\n\ntype ChannelName = \"density\" | \"mask\" | \"albedo\" | \"emission\";\nconst CHANNELS: readonly ChannelName[] = [\"density\", \"mask\", \"albedo\", \"emission\"];\nconst CAP: Record<ChannelName, string> = { density: \"Density\", mask: \"Mask\", albedo: \"Albedo\", emission: \"Emission\" };\n\n/** Options of {@link vdbDenseSource}. */\nexport interface VDBDenseSourceOptions {\n /** Label prefix of the GPU objects. */\n label?: string;\n /**\n * K4.22: where a partial LOD's pending bricks (`WvdbDenseTexture.fill`) are filled: `'gpu'` (default, a compute\n * kernel) or `'cpu'` (`wvdbDenseResolve`, then an upload). Both give the same bytes; a texture whose fill buffer\n * would pass the device's storage binding or buffer size limit is filled on the CPU anyway.\n */\n fill?: \"gpu\" | \"cpu\";\n}\n\ninterface Uploaded {\n map: GPUTexture;\n mip: GPUTexture | null;\n}\n\n/** K4.22 probes: each source's live textures (core internal, `vdbDenseSourceTextures`). */\nconst liveTextures = new WeakMap<object, () => Partial<Record<ChannelName, Uploaded>>>();\n\n/**\n * @internal The textures a dense source holds now, per channel (`map`, and `mip` the atlas): for probes that read\n * them back (they have `COPY_SRC`). Null for an object that is not a dense source.\n */\nexport function vdbDenseSourceTextures(source: object): Partial<Record<ChannelName, { map: GPUTexture; mip: GPUTexture | null }>> | null {\n return liveTextures.get(source)?.() ?? null;\n}\n\nconst bad = (message: string) => new VDBError(\"VDB_BAD_OPTION\", message);\n\nfunction create(device: GPUDevice, dims: readonly number[], format: GPUTextureFormat, label: string): GPUTexture {\n const [w, h, d] = dims as [number, number, number];\n return device.createTexture({ label, size: [w, h, d], dimension: \"3d\", format, usage: TEXTURE_USAGE });\n}\n\nfunction write(device: GPUDevice, texture: GPUTexture, data: Uint8Array<ArrayBuffer>, dims: readonly number[], texelBytes: number, label: string): void {\n const [w, h, d] = dims as [number, number, number];\n if (data.byteLength !== w * h * d * texelBytes) {\n throw bad(`vdbDenseSource: ${label} has ${data.byteLength} bytes, expected ${w}x${h}x${d}x${texelBytes}`);\n }\n // writeTexture has no 256-byte row alignment rule (only buffer copies do); FrameVolume uses unpackAlignment 1.\n device.queue.writeTexture({ texture }, data, { bytesPerRow: w * texelBytes, rowsPerImage: h }, [w, h, d]);\n}\n\nfunction createChannel(device: GPUDevice, tex: WvdbDenseTexture, label: string): Uploaded {\n const map = create(device, tex.dimensions, tex.format, `${label}`);\n const mip = tex.mip ? create(device, tex.mip.dimensions, tex.format, `${label} mip atlas`) : null;\n return { map, mip };\n}\n\nfunction present(volume: WvdbDenseVolume): Record<ChannelName, WvdbDenseTexture | null> {\n return { density: volume.density, mask: volume.mask, albedo: volume.albedo, emission: volume.emission };\n}\n\nfunction checkSlot(slot: VDBSlot, where: string): VDBSlot {\n if (!slot || !Number.isInteger(slot.group) || slot.group < 0 || !Number.isInteger(slot.firstBinding) || slot.firstBinding < 0) {\n throw bad(`${where}: slot must be { group, firstBinding } with non-negative integers, got ${JSON.stringify(slot)}.`);\n }\n return slot;\n}\n\n/** WGSL for one channel's sample function (his sampleMipmapped / sampleMipAtlas, L838–877). */\nfunction channelWgsl(name: ChannelName, hasMip: boolean): string {\n const C = CAP[name];\n const map = `vdbSrc${C}Map`;\n if (!hasMip) {\n return `fn vdbSrcSample${C}(uvw: vec3f, lod: f32) -> vec4f {\\n return textureSampleLevel(${map}, vdbSrcSampler, uvw, 0.0);\\n}\\n`;\n }\n const mip = `vdbSrc${C}Mip`;\n return `fn vdbSrcMipAtlas${C}(level: f32, uvw: vec3f) -> vec4f {\n let texels = vec3f(textureDimensions(${map}));\n let atlas = vec3f(textureDimensions(${mip}));\n let size = max(vec3f(1.0), ceil(texels / exp2(level)));\n let offset = atlas.x - atlas.x / exp2(level - 1.0);\n let texel = clamp(uvw * size, vec3f(0.5), size - 0.5);\n return textureSampleLevel(${mip}, vdbSrcSampler, vec3f(texel.x + offset, texel.y, texel.z) / atlas, 0.0);\n}\nfn vdbSrcSample${C}(uvw: vec3f, lod: f32) -> vec4f {\n let level = min(lod, vdbSrcLevelCount(textureDimensions(${map})));\n if (level <= 0.0) {\n return textureSampleLevel(${map}, vdbSrcSampler, uvw, 0.0);\n }\n let level0 = floor(level);\n var low: vec4f;\n if (level0 < 0.5) {\n low = textureSampleLevel(${map}, vdbSrcSampler, uvw, 0.0);\n } else {\n low = vdbSrcMipAtlas${C}(level0, uvw);\n }\n let high = vdbSrcMipAtlas${C}(min(level0 + 1.0, vdbSrcLevelCount(textureDimensions(${map}))), uvw);\n return mix(low, high, level - level0);\n}\n`;\n}\n\nclass DenseSource implements VDBVolumeSource, VDBVolumeSlot {\n readonly kind = \"dense\" as const;\n /** A dense source is its own volume slot (K6 design §2.1): `source` is itself, `v` = 0. */\n get source(): VDBVolumeSource {\n return this;\n }\n readonly v = 0;\n texels: [number, number, number];\n lodLevels: number;\n readonly channels: VDBVolumeChannels;\n stats: { meanNonZero: number; max: number; activeVoxels: number };\n /** Local unit box → uvw: translate by 0.5 (column-major). */\n readonly boxToSource = new Float32Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0.5, 0.5, 0.5, 1]);\n version = 0;\n /** K4.22: every `replace` (same size included) bumps it: the content changed (`VDBVolumeSourceInfo.revision`). */\n revision = 0;\n readonly #device: GPUDevice;\n readonly #label: string;\n #volume: WvdbDenseVolume;\n #textures: Partial<Record<ChannelName, Uploaded>> = {};\n #sampler: GPUSampler;\n #disposed = false;\n readonly #retire = new VDBRetireQueue();\n readonly #fillMode: \"gpu\" | \"cpu\";\n /** K4.22: one GPU filler per channel while that channel's LOD streams in. */\n readonly #fillers = new Map<ChannelName, VDBDenseFiller>();\n /** K4.22: channel fills done on the GPU and on the CPU (for tests and probes). */\n readonly fills = { gpu: 0, cpu: 0 };\n\n constructor(device: GPUDevice, volume: WvdbDenseVolume, o: VDBDenseSourceOptions) {\n this.#device = device;\n this.#label = o.label ?? \"vdb dense source\";\n if (o.fill !== undefined && o.fill !== \"gpu\" && o.fill !== \"cpu\") throw bad(`vdbDenseSource: fill must be 'gpu' or 'cpu', got ${JSON.stringify(o.fill)}.`);\n this.#fillMode = o.fill ?? \"gpu\";\n liveTextures.set(this, () => ({ ...this.#textures }));\n this.#volume = volume;\n this.channels = { mask: !!volume.mask, albedo: !!volume.albedo, emission: !!volume.emission };\n // FrameRenderer.js L483–487 + Data3DTexture defaults: linear, clamp to edge, no mipmaps.\n this.#sampler = device.createSampler({\n label: `${this.#label} sampler`,\n magFilter: \"linear\",\n minFilter: \"linear\",\n mipmapFilter: \"nearest\",\n addressModeU: \"clamp-to-edge\",\n addressModeV: \"clamp-to-edge\",\n addressModeW: \"clamp-to-edge\",\n });\n this.texels = [...volume.dimensions] as [number, number, number];\n this.lodLevels = volume.density.mip?.levels ?? 0;\n this.stats = { meanNonZero: volume.meanDensity, max: volume.maxDensity, activeVoxels: volume.activeTexels };\n this.#upload(volume);\n }\n\n #upload(volume: WvdbDenseVolume): void {\n const textures = present(volume);\n for (const name of CHANNELS) {\n const tex = textures[name];\n if (!tex) continue;\n const up = createChannel(this.#device, tex, `${this.#label} ${name}`);\n this.#textures[name] = up;\n this.#write(name, tex, up);\n }\n }\n\n /** Writes a channel's texels and atlas; K4.22: a texture with pending bricks is filled first (GPU or CPU). */\n #write(name: ChannelName, tex: WvdbDenseTexture, up: Uploaded): void {\n const label = `${this.#label} ${name}`;\n let t = tex;\n if (tex.fill && tex.fill.count > 0) {\n if (this.#fillMode === \"gpu\" && vdbDenseFillFits(this.#device, vdbDenseFillLayout(tex))) {\n let filler = this.#fillers.get(name);\n if (!filler) this.#fillers.set(name, (filler = new VDBDenseFiller(this.#device, label)));\n for (const b of filler.fill(up.map, up.mip, tex)) this.#retire.retireAfterTask(b);\n this.fills.gpu++;\n return;\n }\n t = wvdbDenseResolveTexture(tex);\n this.fills.cpu++;\n }\n write(this.#device, up.map, t.data, t.dimensions, t.texelBytes, label);\n if (t.mip && up.mip) write(this.#device, up.mip, t.mip.data, t.mip.dimensions, t.texelBytes, `${label} mip atlas`);\n }\n\n /** Retires the GPU fillers of channels that have no pending bricks in `volume` (their LOD is complete). */\n #releaseFillers(volume: WvdbDenseVolume): void {\n const textures = present(volume);\n for (const [name, filler] of this.#fillers) {\n const tex = textures[name];\n if (tex?.fill && tex.fill.count > 0) continue;\n for (const b of filler.release()) this.#retire.retireAfterTask(b);\n this.#fillers.delete(name);\n }\n }\n\n /**\n * K6.10a: a replaced texture may be named by passes the host recorded but has not submitted yet (a `replace` between\n * the frame's `update(encoder)` and `queue.submit`), so it is destroyed in a later task (the retire queue's rule).\n * `dispose()` destroys at once.\n */\n #retireTextures(): void {\n for (const t of Object.values(this.#textures)) {\n this.#retire.retireAfterTask(t.map);\n this.#retire.retireAfterTask(t.mip);\n }\n this.#textures = {};\n }\n\n #check(): void {\n if (this.#disposed) throw new VDBError(\"VDB_DISPOSED\", \"vdbDenseSource: the source was disposed; create a new one.\");\n }\n\n /** The textures as uploaded (for tests and adapters). */\n get volume(): WvdbDenseVolume {\n return this.#volume;\n }\n\n /**\n * Swap in another LOD (or frame) of the same grids. The channel set and mip\n * presence must match; a size change makes new textures and bumps `version`\n * (rebuild bind groups; the WGSL does not change). The replaced textures are\n * destroyed in a later task (K6.10a): passes recorded with them before the\n * call stay valid when the host submits in the same task.\n */\n replace(volume: WvdbDenseVolume): void {\n this.#check();\n const now = present(this.#volume);\n const next = present(volume);\n for (const name of CHANNELS) {\n if (!!now[name] !== !!next[name] || !!now[name]?.mip !== !!next[name]?.mip) {\n throw bad(`vdbDenseSource.replace: the ${name} channel or its mip atlas appears or disappears; create a new source (the WGSL differs).`);\n }\n }\n const sameSize = (a: WvdbDenseTexture | null, b: WvdbDenseTexture | null) =>\n !a || !b || (a.dimensions.every((v, i) => v === b.dimensions[i]) && (!a.mip || a.mip.dimensions.every((v, i) => v === b.mip!.dimensions[i])));\n this.#releaseFillers(volume);\n if (CHANNELS.every((n) => sameSize(now[n], next[n]))) {\n for (const name of CHANNELS) {\n const tex = next[name];\n const up = this.#textures[name];\n if (!tex || !up) continue;\n this.#write(name, tex, up);\n }\n } else {\n this.#retireTextures();\n this.#upload(volume);\n this.version++;\n }\n this.#volume = volume;\n this.revision++;\n this.texels = [...volume.dimensions] as [number, number, number];\n this.lodLevels = volume.density.mip?.levels ?? 0;\n this.stats = { meanNonZero: volume.meanDensity, max: volume.maxDensity, activeVoxels: volume.activeTexels };\n }\n\n /** Bindings in order: sampler, then per present channel its texture and its mip atlas. */\n #bindings(slot: VDBSlot): { name: string; binding: number; kind: \"sampler\" | \"texture\"; texture?: GPUTexture }[] {\n let b = slot.firstBinding;\n const out: { name: string; binding: number; kind: \"sampler\" | \"texture\"; texture?: GPUTexture }[] = [\n { name: \"vdbSrcSampler\", binding: b++, kind: \"sampler\" },\n ];\n for (const name of CHANNELS) {\n const t = this.#textures[name];\n if (!t) continue;\n out.push({ name: `vdbSrc${CAP[name]}Map`, binding: b++, kind: \"texture\", texture: t.map });\n if (t.mip) out.push({ name: `vdbSrc${CAP[name]}Mip`, binding: b++, kind: \"texture\", texture: t.mip });\n }\n return out;\n }\n\n wgsl(o: VDBVolumeSourceWgslOptions): string {\n this.#check();\n const slot = checkSlot(o.slot, \"vdbDenseSource.wgsl\");\n if (o.profile !== \"sample\" && o.profile !== \"march\") throw bad(`vdbDenseSource.wgsl: profile must be 'sample' or 'march', got ${JSON.stringify(o.profile)}.`);\n const on = (name: Exclude<ChannelName, \"density\">) => this.channels[name] && o.channels?.[name] !== false;\n const lines: string[] = [`// vdbDenseSource: dense .wvdb volume source (K3.0). ${this.#label}`];\n for (const b of this.#bindings(slot)) {\n lines.push(`@group(${slot.group}) @binding(${b.binding}) var ${b.name}: ${b.kind === \"sampler\" ? \"sampler\" : \"texture_3d<f32>\"};`);\n }\n lines.push(`\n// frameMipmaps.js getMipLevelCount: ceil(log2(max side)), exactly, in integers.\nfn vdbSrcLevelCount(dims: vec3u) -> f32 {\n let m = max(max(dims.x, dims.y), max(dims.z, 1u));\n if (m <= 1u) {\n return 0.0;\n }\n return f32(32u - countLeadingZeros(m - 1u));\n}\n`);\n const sampled: ChannelName[] = [\"density\", ...([\"mask\", \"albedo\", \"emission\"] as const).filter(on)];\n for (const name of sampled) lines.push(channelWgsl(name, !!this.#textures[name]?.mip));\n lines.push(`fn vdbSrcDensity(v: u32, uvw: vec3f, lod: f32) -> f32 {\n return vdbSrcSampleDensity(uvw, lod).r;\n}\nfn vdbSrcMask(v: u32, uvw: vec3f, lod: f32) -> f32 {\n return ${on(\"mask\") ? \"vdbSrcSampleMask(uvw, lod).r\" : \"1.0\"};\n}\nfn vdbSrcAlbedo(v: u32, uvw: vec3f, lod: f32) -> vec3f {\n return ${on(\"albedo\") ? \"vdbSrcSampleAlbedo(uvw, lod).rgb\" : \"vec3f(1.0)\"};\n}\nfn vdbSrcEmission(v: u32, uvw: vec3f, lod: f32) -> f32 {\n return ${on(\"emission\") ? \"vdbSrcSampleEmission(uvw, lod).r\" : \"0.0\"};\n}\nfn vdbSrcTexels(v: u32) -> vec3f {\n return vec3f(textureDimensions(vdbSrcDensityMap));\n}\nfn vdbSrcLodLevels(v: u32) -> f32 {\n return ${this.#textures.density?.mip ? \"vdbSrcLevelCount(textureDimensions(vdbSrcDensityMap))\" : \"0.0\"};\n}\n`);\n if ((o as VDBVolumeSourceWgslInternalOptions).stochastic) {\n // Issue #2: hardware trilinear is already one fetch; the stochastic form is the deterministic one.\n lines.push(`fn vdbSrcDensityStochastic(v: u32, uvw: vec3f, lod: f32, xi: vec3f) -> f32 {\n return vdbSrcDensity(v, uvw, lod);\n}`);\n }\n if (o.profile === \"march\") {\n // Dense: no empty-space structure; the march steps everywhere (R1 §4.2). K4.22a: vdbSrcMaxIn is the r8unorm bound\n // (every texel and every filtered sample is <= 1), not stats.max: baked into the WGSL, a max that moved with each\n // partial LOD page rebuilt every frame kernel (demo 16: 7 builds at LOD 1's first page). stats.max stays on the CPU.\n lines.push(`fn vdbSrcSkipEmpty(v: u32, o: vec3f, d: vec3f, t0: f32, t1: f32) -> f32 {\n return t0;\n}\nfn vdbSrcSkipSpan(v: u32, o: vec3f, d: vec3f, t0: f32, t1: f32, lod: f32, cutoff: f32) -> vec2f {\n return vec2f(t0, 1e30);\n}\nfn vdbSrcMaxIn(v: u32, uvwMin: vec3f, uvwMax: vec3f) -> f32 {\n return 1.0;\n}\n`);\n }\n return lines.join(\"\\n\");\n }\n\n layoutEntries(slot: VDBSlot, visibility: GPUShaderStageFlags = STAGE_FRAGMENT_COMPUTE): GPUBindGroupLayoutEntry[] {\n this.#check();\n checkSlot(slot, \"vdbDenseSource.layoutEntries\");\n return this.#bindings(slot).map((b) =>\n b.kind === \"sampler\"\n ? { binding: b.binding, visibility, sampler: { type: \"filtering\" } }\n : { binding: b.binding, visibility, texture: { sampleType: \"float\", viewDimension: \"3d\" } },\n );\n }\n\n bindEntries(slot: VDBSlot): GPUBindGroupEntry[] {\n this.#check();\n checkSlot(slot, \"vdbDenseSource.bindEntries\");\n return this.#bindings(slot).map((b) => ({\n binding: b.binding,\n resource: b.kind === \"sampler\" ? this.#sampler : b.texture!.createView({ dimension: \"3d\" }),\n }));\n }\n\n dispose(): void {\n if (this.#disposed) return;\n for (const filler of this.#fillers.values()) for (const b of filler.release()) this.#retire.retireAfterTask(b);\n this.#fillers.clear();\n this.#retireTextures();\n this.#retire.drain();\n this.#disposed = true;\n }\n}\n\n/** A dense source with `replace` (LOD swap). */\nexport type VDBDenseSource = VDBVolumeSource & VDBVolumeSlot & {\n readonly kind: \"dense\";\n readonly volume: WvdbDenseVolume;\n /**\n * Swap in another LOD or frame. K4.22: a partial LOD (`wvdbDensePartialVolume`) is filled before the upload\n * (its pending bricks upsampled from the coarser LOD, on the GPU by default; see {@link VDBDenseSourceOptions}).\n */\n replace(volume: WvdbDenseVolume): void;\n /** K4.22: how many channel fills ran on the GPU and on the CPU (partial LODs). */\n readonly fills: { readonly gpu: number; readonly cpu: number };\n /** K4.22: bumps on every `replace` (the content changed; `version` only when the textures are new). */\n readonly revision: number;\n};\n\n/**\n * Upload a dense `.wvdb` volume (`wvdbDenseVolume` from `@pmndrs/vdb/tools`) on\n * the host's device. The source owns its textures and sampler; `dispose()` frees\n * the textures (samplers have no destroy).\n *\n * @param device The host's `GPUDevice`; the source creates its textures on it.\n * @param volume The decoded `.wvdb` level (`wvdbDenseVolume`).\n * @param o Options ({@link VDBDenseSourceOptions}).\n */\nexport function vdbDenseSource(device: GPUDevice, volume: WvdbDenseVolume, o: VDBDenseSourceOptions = {}): VDBDenseSource {\n if (!device || typeof (device as { createTexture?: unknown }).createTexture !== \"function\") {\n throw new VDBError(\"VDB_UNSUPPORTED_DEVICE\", \"vdbDenseSource: pass the host's GPUDevice.\");\n }\n if (!volume || volume.kind !== \"dense\" || !volume.density) {\n throw bad(\"vdbDenseSource: pass a dense volume from wvdbDenseVolume() (@pmndrs/vdb/tools).\");\n }\n return new DenseSource(device, volume, o);\n}\n"]}
|