@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
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* K6.R: the reference renderer on the host's device (design K6-core-renderer.md §7.4). A brute-force volumetric path
|
|
3
|
+
* tracer over one volume source (dense textures or the sparse pool: the group-2 `vdbSrc*` contract), accumulated
|
|
4
|
+
* progressively in rgba32float textures with per-pixel variance. Engine-free, internal only (no public export). The
|
|
5
|
+
* CPU twin is `tools/reference/trace.ts` (same stream, same draw order).
|
|
6
|
+
*
|
|
7
|
+
* const ref = await vdbCreateReferenceRenderer(device, { source, width, height });
|
|
8
|
+
* ref.setScene(scene, settings); // resets the accumulation
|
|
9
|
+
* const enc = device.createCommandEncoder();
|
|
10
|
+
* pool?.update(enc); source.update?.(enc); // host order (Traps): the pool, the source, then the kernel
|
|
11
|
+
* ref.render(enc, 4); // 4 batches of settings.spp samples per pixel
|
|
12
|
+
* device.queue.submit([enc.finish()]);
|
|
13
|
+
* const accum = await ref.readback(); // sums of batch means → vdbReferenceStatistics (tools)
|
|
14
|
+
*
|
|
15
|
+
* One `render()` per submitted encoder (its batch records are written with `queue.writeBuffer`). The renderer frees
|
|
16
|
+
* only what it made (textures, buffers); the source is the host's.
|
|
17
|
+
*/
|
|
18
|
+
import { VDBError } from "../errors.js";
|
|
19
|
+
import { VDBRetireQueue } from "../frame/resources.js";
|
|
20
|
+
import { VDB_REFERENCE_MAX_HEMISPHERES, VDB_REFERENCE_MAX_LIGHTS, VDB_REFERENCE_MAX_STEPS, VDB_REFERENCE_MAX_VOLUMES, VDB_REFERENCE_RATIO_RR, vdbRefInvert4, vdbReferenceEnvironmentSampler, vdbReferenceSettings, } from "../../tools/reference/index.js";
|
|
21
|
+
import { VDB_REF_BATCH_STRIDE, VDB_REF_FLAG_BOX_FILTER, VDB_REF_FLAG_ENV_MIS, VDB_REF_FLAG_EQUIRECT, VDB_REF_FLAG_ORTHOGRAPHIC, VDB_REF_FLAG_SH, VDB_REF_HEMI_BYTES, VDB_REF_LIGHT_BYTES, VDB_REF_UNIFORM_OFFSETS as OFF, VDB_REF_VOLUME_BYTES, vdbReferenceKernelWgsl, } from "./wgsl.js";
|
|
22
|
+
/** `GPUShaderStage.COMPUTE`, `GPUBufferUsage` and `GPUTextureUsage` bits (the globals do not exist in Node). */
|
|
23
|
+
const STAGE_COMPUTE = 0x4;
|
|
24
|
+
const BUFFER_UNIFORM = 0x40;
|
|
25
|
+
const BUFFER_COPY_DST = 0x8;
|
|
26
|
+
const BUFFER_MAP_READ = 0x1;
|
|
27
|
+
const TEX_COPY_SRC = 0x1;
|
|
28
|
+
const TEX_COPY_DST = 0x2;
|
|
29
|
+
const TEX_BINDING = 0x4;
|
|
30
|
+
const TEX_STORAGE = 0x8;
|
|
31
|
+
const MAP_READ = 0x1;
|
|
32
|
+
/** The source slot of the kernel (the K6 group-2 contract). */
|
|
33
|
+
export const VDB_REFERENCE_SOURCE_SLOT = Object.freeze({ group: 2, firstBinding: 0 });
|
|
34
|
+
/** Most batches one `render()` records. */
|
|
35
|
+
export const VDB_REFERENCE_MAX_BATCHES_PER_RENDER = 64;
|
|
36
|
+
/** The table texture and majorant atlas of a scene (one row / one z range per distinct table or grid). */
|
|
37
|
+
export function vdbReferenceTableLayout(scene) {
|
|
38
|
+
const phaseRows = new Map();
|
|
39
|
+
const colorRows = new Map();
|
|
40
|
+
const gridOffsets = new Map();
|
|
41
|
+
let rows = 0;
|
|
42
|
+
let width = 2;
|
|
43
|
+
let gw = 1;
|
|
44
|
+
let gh = 1;
|
|
45
|
+
let depth = 0;
|
|
46
|
+
for (const v of scene.volumes) {
|
|
47
|
+
const t = v.phase?.table;
|
|
48
|
+
if (t && !phaseRows.has(t)) {
|
|
49
|
+
phaseRows.set(t, rows++);
|
|
50
|
+
width = Math.max(width, t.size);
|
|
51
|
+
}
|
|
52
|
+
const c = v.emission?.colorTable;
|
|
53
|
+
if (c && !colorRows.has(c)) {
|
|
54
|
+
colorRows.set(c, rows++);
|
|
55
|
+
width = Math.max(width, c.size);
|
|
56
|
+
}
|
|
57
|
+
const g = v.majorantGrid;
|
|
58
|
+
if (g && !gridOffsets.has(g)) {
|
|
59
|
+
if (g.values.length !== g.dims[0] * g.dims[1] * g.dims[2])
|
|
60
|
+
throw new VDBError("VDB_BAD_OPTION", `reference renderer: a majorant grid of ${g.dims.join("x")} has ${g.values.length} values`);
|
|
61
|
+
gridOffsets.set(g, depth);
|
|
62
|
+
depth += g.dims[2];
|
|
63
|
+
gw = Math.max(gw, g.dims[0]);
|
|
64
|
+
gh = Math.max(gh, g.dims[1]);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
const height = Math.max(rows, 1);
|
|
68
|
+
const tables = new Float32Array(width * height * 4);
|
|
69
|
+
for (const [t, row] of phaseRows) {
|
|
70
|
+
for (let i = 0; i < t.size; i++)
|
|
71
|
+
tables.set([t.values[i * 3], t.values[i * 3 + 1], t.values[i * 3 + 2], t.cdf[i]], (row * width + i) * 4);
|
|
72
|
+
}
|
|
73
|
+
for (const [t, row] of colorRows) {
|
|
74
|
+
for (let i = 0; i < t.size; i++)
|
|
75
|
+
tables.set([t.values[i * 3], t.values[i * 3 + 1], t.values[i * 3 + 2], 0], (row * width + i) * 4);
|
|
76
|
+
}
|
|
77
|
+
const d = Math.max(depth, 1);
|
|
78
|
+
const majorants = new Float32Array(gw * gh * d);
|
|
79
|
+
for (const [g, z0] of gridOffsets) {
|
|
80
|
+
const [nx, ny, nz] = g.dims;
|
|
81
|
+
for (let z = 0; z < nz; z++)
|
|
82
|
+
for (let y = 0; y < ny; y++)
|
|
83
|
+
majorants.set(g.values.subarray((z * ny + y) * nx, (z * ny + y + 1) * nx), ((z0 + z) * gh + y) * gw);
|
|
84
|
+
}
|
|
85
|
+
return { phaseRows, colorRows, gridOffsets, tables: { width, height, data: tables }, majorants: { width: gw, height: gh, depth: d, data: majorants } };
|
|
86
|
+
}
|
|
87
|
+
/** K6.R2: whether the kernel samples the scene's equirect map (MIS): the setting, a map, and light in it. */
|
|
88
|
+
export function vdbReferenceEnvironmentMis(scene, settings) {
|
|
89
|
+
const eq = scene.environment?.equirect;
|
|
90
|
+
return !!eq && settings.environmentSampling === "mis" && vdbReferenceEnvironmentSampler(eq).total > 0;
|
|
91
|
+
}
|
|
92
|
+
/** Pack `VdbRefUniforms` (layout in `wgsl.ts`). Exported for tests. */
|
|
93
|
+
export function vdbReferencePackUniforms(scene, settingsIn, layout = vdbReferenceTableLayout(scene)) {
|
|
94
|
+
const s = vdbReferenceSettings(settingsIn);
|
|
95
|
+
const buf = new ArrayBuffer(OFF.size_);
|
|
96
|
+
const f = new Float32Array(buf);
|
|
97
|
+
const u = new Uint32Array(buf);
|
|
98
|
+
const F = (byte, values) => f.set(Array.from(values), byte / 4);
|
|
99
|
+
const U = (byte, value) => (u[byte / 4] = value >>> 0);
|
|
100
|
+
const volumes = scene.volumes;
|
|
101
|
+
const lights = scene.lights ?? [];
|
|
102
|
+
const env = scene.environment ?? {};
|
|
103
|
+
const hemis = env.hemispheres ?? [];
|
|
104
|
+
if (volumes.length > VDB_REFERENCE_MAX_VOLUMES)
|
|
105
|
+
throw new VDBError("VDB_BAD_OPTION", `reference renderer: at most ${VDB_REFERENCE_MAX_VOLUMES} volumes, got ${volumes.length}`);
|
|
106
|
+
if (lights.length > VDB_REFERENCE_MAX_LIGHTS)
|
|
107
|
+
throw new VDBError("VDB_BAD_OPTION", `reference renderer: at most ${VDB_REFERENCE_MAX_LIGHTS} lights, got ${lights.length}`);
|
|
108
|
+
if (hemis.length > VDB_REFERENCE_MAX_HEMISPHERES)
|
|
109
|
+
throw new VDBError("VDB_BAD_OPTION", `reference renderer: at most ${VDB_REFERENCE_MAX_HEMISPHERES} hemispheres, got ${hemis.length}`);
|
|
110
|
+
F(OFF.cameraToWorld, scene.camera.cameraToWorld);
|
|
111
|
+
F(OFF.projectionInverse, scene.camera.projectionInverse);
|
|
112
|
+
U(OFF.size, s.width);
|
|
113
|
+
U(OFF.size + 4, s.height);
|
|
114
|
+
U(OFF.seed, s.seed);
|
|
115
|
+
U(OFF.spp, s.spp);
|
|
116
|
+
U(OFF.maxBounces, s.maxBounces);
|
|
117
|
+
U(OFF.rrStart, s.rrStart);
|
|
118
|
+
U(OFF.volumeCount, volumes.length);
|
|
119
|
+
U(OFF.lightCount, lights.length);
|
|
120
|
+
U(OFF.hemiCount, hemis.length);
|
|
121
|
+
const eq = env.equirect;
|
|
122
|
+
const sh = env.sh;
|
|
123
|
+
if (sh && sh.length !== 27)
|
|
124
|
+
throw new VDBError("VDB_BAD_OPTION", `reference renderer: the environment's sh needs 27 numbers, got ${sh.length}`);
|
|
125
|
+
const mis = vdbReferenceEnvironmentMis(scene, s);
|
|
126
|
+
U(OFF.flags, (s.pixelFilter === "box" ? VDB_REF_FLAG_BOX_FILTER : 0) | (scene.camera.orthographic ? VDB_REF_FLAG_ORTHOGRAPHIC : 0) | (eq ? VDB_REF_FLAG_EQUIRECT : 0) | (sh ? VDB_REF_FLAG_SH : 0) | (mis ? VDB_REF_FLAG_ENV_MIS : 0));
|
|
127
|
+
if (sh)
|
|
128
|
+
for (let i = 0; i < 9; i++)
|
|
129
|
+
F(OFF.sh + i * 16, [sh[i * 3], sh[i * 3 + 1], sh[i * 3 + 2], 0]);
|
|
130
|
+
U(OFF.envSize, eq?.width ?? 1);
|
|
131
|
+
U(OFF.envSize + 4, eq?.height ?? 1);
|
|
132
|
+
F(OFF.uniformEnv, [...(env.uniform ?? [0, 0, 0]), eq?.intensity ?? 1]);
|
|
133
|
+
const r = eq?.rotation ?? [1, 0, 0, 0, 1, 0, 0, 0, 1];
|
|
134
|
+
for (let row = 0; row < 3; row++)
|
|
135
|
+
F(OFF.envRotation + row * 16, [r[row * 3], r[row * 3 + 1], r[row * 3 + 2], 0]);
|
|
136
|
+
hemis.forEach((h, i) => {
|
|
137
|
+
const o = OFF.hemis + i * VDB_REF_HEMI_BYTES;
|
|
138
|
+
const l = Math.hypot(...h.up);
|
|
139
|
+
F(o, [...h.sky, 0]);
|
|
140
|
+
F(o + 16, [...h.ground, 0]);
|
|
141
|
+
F(o + 32, [h.up[0] / l, h.up[1] / l, h.up[2] / l, 0]);
|
|
142
|
+
});
|
|
143
|
+
volumes.forEach((v, i) => {
|
|
144
|
+
const o = OFF.volumes + i * VDB_REF_VOLUME_BYTES;
|
|
145
|
+
const e = v.emission ?? {};
|
|
146
|
+
const c = e.color ?? [1, 1, 1];
|
|
147
|
+
const k = e.intensity ?? 1;
|
|
148
|
+
const range = e.temperatureRange ?? [0, 6500];
|
|
149
|
+
F(o, vdbRefInvert4(v.localToWorld));
|
|
150
|
+
F(o + 64, [v.sigma, v.sigma * (v.majorant ?? 1), v.cutoff ?? 0, v.shape === "sphere" ? 1 : 0]);
|
|
151
|
+
F(o + 80, [...(v.albedo ?? [1, 1, 1]), v.emits ? 1 : 0]);
|
|
152
|
+
F(o + 96, [v.phase?.g ?? 0, v.phase?.backG ?? 0, v.phase?.backWeight ?? 0, 0]);
|
|
153
|
+
F(o + 112, [c[0] * k, c[1] * k, c[2] * k, 0]);
|
|
154
|
+
const ct = e.colorTable;
|
|
155
|
+
F(o + 128, [range[0], range[1], ct ? Math.log(ct.minTemperature) : 0, ct ? Math.log(ct.maxTemperature) : 0]);
|
|
156
|
+
const g = v.majorantGrid;
|
|
157
|
+
U(o + 144, v.v ?? 0);
|
|
158
|
+
if (g) {
|
|
159
|
+
U(o + 148, g.dims[0]);
|
|
160
|
+
U(o + 152, g.dims[1]);
|
|
161
|
+
U(o + 156, g.dims[2]);
|
|
162
|
+
U(o + 160, layout.gridOffsets.get(g));
|
|
163
|
+
}
|
|
164
|
+
const pt = v.phase?.table;
|
|
165
|
+
if (pt) {
|
|
166
|
+
U(o + 176, layout.phaseRows.get(pt) + 1);
|
|
167
|
+
U(o + 180, pt.size);
|
|
168
|
+
}
|
|
169
|
+
if (ct) {
|
|
170
|
+
U(o + 184, layout.colorRows.get(ct) + 1);
|
|
171
|
+
U(o + 188, ct.size);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
lights.forEach((l, i) => {
|
|
175
|
+
const o = OFF.lights + i * VDB_REF_LIGHT_BYTES;
|
|
176
|
+
const norm = (d) => {
|
|
177
|
+
const n = Math.hypot(d[0], d[1], d[2]);
|
|
178
|
+
return [d[0] / n, d[1] / n, d[2] / n];
|
|
179
|
+
};
|
|
180
|
+
if (l.kind === "directional") {
|
|
181
|
+
F(o, [0, 0, 0, 0]);
|
|
182
|
+
F(o + 16, [...norm(l.direction), 0]);
|
|
183
|
+
F(o + 32, [...l.irradiance, 0]);
|
|
184
|
+
F(o + 48, [0, 0, 0, 0]);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
// falloff: mode 0 none, 1 inverse square, 2 three's getDistanceAttenuation (cutoff, decay)
|
|
188
|
+
const falloff = l.falloff ? [2, l.falloff.cutoff ?? 0, l.falloff.decay, 0] : [l.inverseSquare ? 1 : 0, 0, 0, 0];
|
|
189
|
+
if (l.kind === "point") {
|
|
190
|
+
F(o, [...l.position, 1]);
|
|
191
|
+
F(o + 16, [0, 0, 0, 0]);
|
|
192
|
+
F(o + 32, [...l.intensity, 0]);
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
F(o, [...l.position, 2]);
|
|
196
|
+
F(o + 16, [...norm(l.direction), l.cosOuter]);
|
|
197
|
+
F(o + 32, [...l.intensity, l.cosInner]);
|
|
198
|
+
}
|
|
199
|
+
F(o + 48, falloff);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
return buf;
|
|
203
|
+
}
|
|
204
|
+
/** The composed WGSL of a reference kernel over `source` (module + source + kernel). */
|
|
205
|
+
export function vdbReferenceWgsl(source, o = {}) {
|
|
206
|
+
const stochastic = (o.densityFilter ?? "trilinear") === "stochastic";
|
|
207
|
+
const slot = VDB_REFERENCE_SOURCE_SLOT;
|
|
208
|
+
const module = typeof source.moduleWgsl === "function" ? source.moduleWgsl(slot) : "";
|
|
209
|
+
const kernel = vdbReferenceKernelWgsl({
|
|
210
|
+
maxVolumes: VDB_REFERENCE_MAX_VOLUMES,
|
|
211
|
+
maxLights: VDB_REFERENCE_MAX_LIGHTS,
|
|
212
|
+
maxHemispheres: VDB_REFERENCE_MAX_HEMISPHERES,
|
|
213
|
+
maxSteps: VDB_REFERENCE_MAX_STEPS,
|
|
214
|
+
ratioRr: VDB_REFERENCE_RATIO_RR,
|
|
215
|
+
stochastic,
|
|
216
|
+
});
|
|
217
|
+
const sourceOptions = { slot, profile: "sample", ...(stochastic ? { stochastic } : {}) };
|
|
218
|
+
return `${module}\n${source.wgsl(sourceOptions)}\n${kernel}`;
|
|
219
|
+
}
|
|
220
|
+
class ReferenceRenderer {
|
|
221
|
+
device;
|
|
222
|
+
width;
|
|
223
|
+
height;
|
|
224
|
+
wgsl;
|
|
225
|
+
batches = 0;
|
|
226
|
+
#source;
|
|
227
|
+
#label;
|
|
228
|
+
#pipeline;
|
|
229
|
+
#layouts;
|
|
230
|
+
#uniforms;
|
|
231
|
+
#batch;
|
|
232
|
+
#accum;
|
|
233
|
+
#env;
|
|
234
|
+
#tables;
|
|
235
|
+
#majorants;
|
|
236
|
+
/** K6.R2: the equirect map's sampling table (r32float). */
|
|
237
|
+
#envCdf;
|
|
238
|
+
#group0;
|
|
239
|
+
#group1 = [];
|
|
240
|
+
#group2 = null;
|
|
241
|
+
#sourceVersion = -1;
|
|
242
|
+
#front = 0;
|
|
243
|
+
#settings = null;
|
|
244
|
+
#disposed = false;
|
|
245
|
+
// K6.10b: textures setScene replaced; destroyed in a later task (a render recorded before setScene, in the host's
|
|
246
|
+
// encoder, may still name them until the host submits)
|
|
247
|
+
#retire = new VDBRetireQueue();
|
|
248
|
+
constructor(device, o, wgsl, pipeline, layouts) {
|
|
249
|
+
this.device = device;
|
|
250
|
+
this.width = o.width;
|
|
251
|
+
this.height = o.height;
|
|
252
|
+
this.wgsl = wgsl;
|
|
253
|
+
this.#source = o.source;
|
|
254
|
+
this.#label = o.label ?? "vdb reference";
|
|
255
|
+
this.#pipeline = pipeline;
|
|
256
|
+
this.#layouts = layouts;
|
|
257
|
+
this.#uniforms = device.createBuffer({ label: `${this.#label} uniforms`, size: OFF.size_, usage: BUFFER_UNIFORM | BUFFER_COPY_DST });
|
|
258
|
+
this.#batch = device.createBuffer({ label: `${this.#label} batches`, size: VDB_REF_BATCH_STRIDE * VDB_REFERENCE_MAX_BATCHES_PER_RENDER, usage: BUFFER_UNIFORM | BUFFER_COPY_DST });
|
|
259
|
+
// Two (sum, sum of squares) pairs, ping-ponged: 0,1 = pair A; 2,3 = pair B.
|
|
260
|
+
this.#accum = [0, 1, 2, 3].map((i) => device.createTexture({ label: `${this.#label} accum ${i}`, size: [o.width, o.height], format: "rgba32float", usage: TEX_BINDING | TEX_STORAGE | TEX_COPY_SRC }));
|
|
261
|
+
this.#env = this.#makeEnv(1, 1, new Float32Array(4));
|
|
262
|
+
this.#tables = this.#makeEnv(2, 1, new Float32Array(8));
|
|
263
|
+
this.#majorants = this.#makeMajorants(1, 1, 1, new Float32Array(1));
|
|
264
|
+
this.#envCdf = this.#makeR32(2, 6, new Float32Array(12));
|
|
265
|
+
this.#group0 = device.createBindGroup({
|
|
266
|
+
label: `${this.#label} group 0`,
|
|
267
|
+
layout: layouts[0],
|
|
268
|
+
entries: [
|
|
269
|
+
{ binding: 0, resource: { buffer: this.#uniforms } },
|
|
270
|
+
{ binding: 1, resource: { buffer: this.#batch, size: 16 } },
|
|
271
|
+
],
|
|
272
|
+
});
|
|
273
|
+
this.#buildGroup1();
|
|
274
|
+
}
|
|
275
|
+
#makeEnv(w, h, data) {
|
|
276
|
+
const t = this.device.createTexture({ label: `${this.#label} environment`, size: [w, h], format: "rgba32float", usage: TEX_BINDING | TEX_COPY_DST });
|
|
277
|
+
this.device.queue.writeTexture({ texture: t }, data, { bytesPerRow: w * 16, rowsPerImage: h }, [w, h]);
|
|
278
|
+
return t;
|
|
279
|
+
}
|
|
280
|
+
#makeR32(w, h, data) {
|
|
281
|
+
const t = this.device.createTexture({ label: `${this.#label} environment sampling`, size: [w, h], format: "r32float", usage: TEX_BINDING | TEX_COPY_DST });
|
|
282
|
+
this.device.queue.writeTexture({ texture: t }, data, { bytesPerRow: w * 4, rowsPerImage: h }, [w, h]);
|
|
283
|
+
return t;
|
|
284
|
+
}
|
|
285
|
+
#makeMajorants(w, h, d, data) {
|
|
286
|
+
const t = this.device.createTexture({ label: `${this.#label} majorants`, size: [w, h, d], dimension: "3d", format: "r32float", usage: TEX_BINDING | TEX_COPY_DST });
|
|
287
|
+
this.device.queue.writeTexture({ texture: t }, data, { bytesPerRow: w * 4, rowsPerImage: h }, [w, h, d]);
|
|
288
|
+
return t;
|
|
289
|
+
}
|
|
290
|
+
#buildGroup1() {
|
|
291
|
+
const view = (t) => t.createView();
|
|
292
|
+
const a = this.#accum;
|
|
293
|
+
// Group 1 reading pair p and writing the other one.
|
|
294
|
+
this.#group1 = [0, 1].map((p) => this.device.createBindGroup({
|
|
295
|
+
label: `${this.#label} group 1 (${p ? "B→A" : "A→B"})`,
|
|
296
|
+
layout: this.#layouts[1],
|
|
297
|
+
entries: [
|
|
298
|
+
{ binding: 0, resource: view(a[2 * p]) },
|
|
299
|
+
{ binding: 1, resource: view(a[2 * p + 1]) },
|
|
300
|
+
{ binding: 2, resource: view(a[2 * (1 - p)]) },
|
|
301
|
+
{ binding: 3, resource: view(a[2 * (1 - p) + 1]) },
|
|
302
|
+
{ binding: 4, resource: view(this.#env) },
|
|
303
|
+
{ binding: 5, resource: view(this.#tables) },
|
|
304
|
+
{ binding: 6, resource: view(this.#majorants) },
|
|
305
|
+
{ binding: 7, resource: view(this.#envCdf) },
|
|
306
|
+
],
|
|
307
|
+
}));
|
|
308
|
+
}
|
|
309
|
+
#check() {
|
|
310
|
+
if (this.#disposed)
|
|
311
|
+
throw new VDBError("VDB_DISPOSED", "reference renderer: disposed");
|
|
312
|
+
}
|
|
313
|
+
setScene(scene, settings) {
|
|
314
|
+
this.#check();
|
|
315
|
+
const full = { ...settings, width: this.width, height: this.height };
|
|
316
|
+
this.#settings = vdbReferenceSettings(full);
|
|
317
|
+
const layout = vdbReferenceTableLayout(scene);
|
|
318
|
+
this.device.queue.writeBuffer(this.#uniforms, 0, vdbReferencePackUniforms(scene, full, layout));
|
|
319
|
+
const eq = scene.environment?.equirect;
|
|
320
|
+
if (eq) {
|
|
321
|
+
if (eq.data.length !== eq.width * eq.height * 4)
|
|
322
|
+
throw new VDBError("VDB_BAD_OPTION", `reference renderer: the equirect map has ${eq.data.length} floats, expected ${eq.width}x${eq.height}x4`);
|
|
323
|
+
this.#retire.retireAfterTask(this.#env);
|
|
324
|
+
this.#env = this.#makeEnv(eq.width, eq.height, eq.data);
|
|
325
|
+
if (vdbReferenceEnvironmentMis(scene, this.#settings)) {
|
|
326
|
+
const smp = vdbReferenceEnvironmentSampler(eq);
|
|
327
|
+
const max2d = this.device.limits.maxTextureDimension2D;
|
|
328
|
+
if (smp.tableWidth > max2d || smp.tableHeight > max2d)
|
|
329
|
+
throw new VDBError("VDB_BAD_OPTION", `reference renderer: the environment sampling table ${smp.tableWidth}x${smp.tableHeight} exceeds maxTextureDimension2D ${max2d} (use environmentSampling 'phase' or a smaller map)`);
|
|
330
|
+
this.#retire.retireAfterTask(this.#envCdf);
|
|
331
|
+
this.#envCdf = this.#makeR32(smp.tableWidth, smp.tableHeight, smp.data);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
const max3d = this.device.limits.maxTextureDimension3D;
|
|
335
|
+
const m = layout.majorants;
|
|
336
|
+
if (m.width > max3d || m.height > max3d || m.depth > max3d)
|
|
337
|
+
throw new VDBError("VDB_BAD_OPTION", `reference renderer: the majorant atlas ${m.width}x${m.height}x${m.depth} exceeds maxTextureDimension3D ${max3d} (use larger cells)`);
|
|
338
|
+
this.#retire.retireAfterTask(this.#tables);
|
|
339
|
+
this.#tables = this.#makeEnv(layout.tables.width, layout.tables.height, layout.tables.data);
|
|
340
|
+
this.#retire.retireAfterTask(this.#majorants);
|
|
341
|
+
this.#majorants = this.#makeMajorants(m.width, m.height, m.depth, m.data);
|
|
342
|
+
this.#buildGroup1();
|
|
343
|
+
this.reset();
|
|
344
|
+
}
|
|
345
|
+
reset() {
|
|
346
|
+
this.batches = 0;
|
|
347
|
+
this.#front = 0;
|
|
348
|
+
}
|
|
349
|
+
render(encoder, batches = 1) {
|
|
350
|
+
this.#check();
|
|
351
|
+
if (!this.#settings)
|
|
352
|
+
throw new VDBError("VDB_BAD_OPTION", "reference renderer: call setScene() before render()");
|
|
353
|
+
if (!Number.isInteger(batches) || batches < 1 || batches > VDB_REFERENCE_MAX_BATCHES_PER_RENDER) {
|
|
354
|
+
throw new VDBError("VDB_BAD_OPTION", `reference renderer: batches must be an integer in [1, ${VDB_REFERENCE_MAX_BATCHES_PER_RENDER}], got ${batches}`);
|
|
355
|
+
}
|
|
356
|
+
if (!this.#group2 || this.#source.version !== this.#sourceVersion) {
|
|
357
|
+
this.#group2 = this.device.createBindGroup({ label: `${this.#label} group 2 (source)`, layout: this.#layouts[2], entries: this.#source.bindEntries(VDB_REFERENCE_SOURCE_SLOT) });
|
|
358
|
+
this.#sourceVersion = this.#source.version;
|
|
359
|
+
}
|
|
360
|
+
const records = new Uint32Array((VDB_REF_BATCH_STRIDE / 4) * batches);
|
|
361
|
+
for (let b = 0; b < batches; b++) {
|
|
362
|
+
records[(b * VDB_REF_BATCH_STRIDE) / 4] = this.batches + b;
|
|
363
|
+
records[(b * VDB_REF_BATCH_STRIDE) / 4 + 1] = this.batches + b > 0 ? 1 : 0;
|
|
364
|
+
}
|
|
365
|
+
this.device.queue.writeBuffer(this.#batch, 0, records);
|
|
366
|
+
const pass = encoder.beginComputePass({ label: `${this.#label} trace` });
|
|
367
|
+
pass.setPipeline(this.#pipeline);
|
|
368
|
+
pass.setBindGroup(2, this.#group2);
|
|
369
|
+
for (let b = 0; b < batches; b++) {
|
|
370
|
+
pass.setBindGroup(0, this.#group0, [b * VDB_REF_BATCH_STRIDE]);
|
|
371
|
+
pass.setBindGroup(1, this.#group1[this.#front]);
|
|
372
|
+
pass.dispatchWorkgroups(Math.ceil(this.width / 8), Math.ceil(this.height / 8));
|
|
373
|
+
this.#front = 1 - this.#front;
|
|
374
|
+
}
|
|
375
|
+
pass.end();
|
|
376
|
+
this.batches += batches;
|
|
377
|
+
}
|
|
378
|
+
async readback() {
|
|
379
|
+
this.#check();
|
|
380
|
+
const rowBytes = Math.ceil((this.width * 16) / 256) * 256;
|
|
381
|
+
const size = rowBytes * this.height;
|
|
382
|
+
const staging = [0, 1].map((i) => this.device.createBuffer({ label: `${this.#label} readback ${i}`, size, usage: BUFFER_MAP_READ | BUFFER_COPY_DST }));
|
|
383
|
+
const encoder = this.device.createCommandEncoder({ label: `${this.#label} readback` });
|
|
384
|
+
for (let i = 0; i < 2; i++) {
|
|
385
|
+
encoder.copyTextureToBuffer({ texture: this.#accum[2 * this.#front + i] }, { buffer: staging[i], bytesPerRow: rowBytes, rowsPerImage: this.height }, [this.width, this.height]);
|
|
386
|
+
}
|
|
387
|
+
this.device.queue.submit([encoder.finish()]);
|
|
388
|
+
const out = await Promise.all(staging.map(async (b) => {
|
|
389
|
+
await b.mapAsync(MAP_READ);
|
|
390
|
+
const raw = new Float32Array(b.getMappedRange().slice(0));
|
|
391
|
+
b.destroy();
|
|
392
|
+
const packed = new Float32Array(this.width * this.height * 4);
|
|
393
|
+
for (let y = 0; y < this.height; y++)
|
|
394
|
+
packed.set(raw.subarray((y * rowBytes) / 4, (y * rowBytes) / 4 + this.width * 4), y * this.width * 4);
|
|
395
|
+
return packed;
|
|
396
|
+
}));
|
|
397
|
+
return { width: this.width, height: this.height, batches: this.batches, sum: out[0], sumSq: out[1] };
|
|
398
|
+
}
|
|
399
|
+
dispose() {
|
|
400
|
+
if (this.#disposed)
|
|
401
|
+
return;
|
|
402
|
+
this.#disposed = true;
|
|
403
|
+
for (const t of this.#accum)
|
|
404
|
+
t.destroy();
|
|
405
|
+
this.#env.destroy();
|
|
406
|
+
this.#tables.destroy();
|
|
407
|
+
this.#majorants.destroy();
|
|
408
|
+
this.#envCdf.destroy();
|
|
409
|
+
this.#uniforms.destroy();
|
|
410
|
+
this.#batch.destroy();
|
|
411
|
+
this.#retire.drain();
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Create the reference renderer on the host's device: compiles the kernel for `options.source` (under a validation
|
|
416
|
+
* error scope; WGSL errors throw `VDBError('VDB_BAD_OPTION')` with the compiler messages).
|
|
417
|
+
*/
|
|
418
|
+
export async function vdbCreateReferenceRenderer(device, o) {
|
|
419
|
+
if (!device || typeof device.createComputePipelineAsync !== "function") {
|
|
420
|
+
throw new VDBError("VDB_UNSUPPORTED_DEVICE", "vdbCreateReferenceRenderer: pass the host's GPUDevice.");
|
|
421
|
+
}
|
|
422
|
+
if (!(o.width >= 1 && o.height >= 1 && Number.isInteger(o.width) && Number.isInteger(o.height))) {
|
|
423
|
+
throw new VDBError("VDB_BAD_OPTION", `vdbCreateReferenceRenderer: width and height must be positive integers, got ${o.width}x${o.height}`);
|
|
424
|
+
}
|
|
425
|
+
const densityFilter = o.densityFilter ?? "trilinear";
|
|
426
|
+
if (densityFilter !== "trilinear" && densityFilter !== "stochastic") {
|
|
427
|
+
throw new VDBError("VDB_BAD_OPTION", `vdbCreateReferenceRenderer: densityFilter must be 'trilinear' or 'stochastic', got ${JSON.stringify(densityFilter)}`);
|
|
428
|
+
}
|
|
429
|
+
let wgsl = vdbReferenceWgsl(o.source, { densityFilter });
|
|
430
|
+
if (o.wgslPatch)
|
|
431
|
+
wgsl = o.wgslPatch(wgsl);
|
|
432
|
+
const label = o.label ?? "vdb reference";
|
|
433
|
+
device.pushErrorScope("validation");
|
|
434
|
+
const layouts = [
|
|
435
|
+
device.createBindGroupLayout({
|
|
436
|
+
label: `${label} layout 0`,
|
|
437
|
+
entries: [
|
|
438
|
+
{ binding: 0, visibility: STAGE_COMPUTE, buffer: { type: "uniform", minBindingSize: OFF.size_ } },
|
|
439
|
+
{ binding: 1, visibility: STAGE_COMPUTE, buffer: { type: "uniform", hasDynamicOffset: true, minBindingSize: 16 } },
|
|
440
|
+
],
|
|
441
|
+
}),
|
|
442
|
+
device.createBindGroupLayout({
|
|
443
|
+
label: `${label} layout 1`,
|
|
444
|
+
entries: [
|
|
445
|
+
{ binding: 0, visibility: STAGE_COMPUTE, texture: { sampleType: "unfilterable-float", viewDimension: "2d" } },
|
|
446
|
+
{ binding: 1, visibility: STAGE_COMPUTE, texture: { sampleType: "unfilterable-float", viewDimension: "2d" } },
|
|
447
|
+
{ binding: 2, visibility: STAGE_COMPUTE, storageTexture: { access: "write-only", format: "rgba32float", viewDimension: "2d" } },
|
|
448
|
+
{ binding: 3, visibility: STAGE_COMPUTE, storageTexture: { access: "write-only", format: "rgba32float", viewDimension: "2d" } },
|
|
449
|
+
{ binding: 4, visibility: STAGE_COMPUTE, texture: { sampleType: "unfilterable-float", viewDimension: "2d" } },
|
|
450
|
+
{ binding: 5, visibility: STAGE_COMPUTE, texture: { sampleType: "unfilterable-float", viewDimension: "2d" } },
|
|
451
|
+
{ binding: 6, visibility: STAGE_COMPUTE, texture: { sampleType: "unfilterable-float", viewDimension: "3d" } },
|
|
452
|
+
{ binding: 7, visibility: STAGE_COMPUTE, texture: { sampleType: "unfilterable-float", viewDimension: "2d" } },
|
|
453
|
+
],
|
|
454
|
+
}),
|
|
455
|
+
device.createBindGroupLayout({ label: `${label} layout 2 (source)`, entries: o.source.layoutEntries(VDB_REFERENCE_SOURCE_SLOT, STAGE_COMPUTE) }),
|
|
456
|
+
];
|
|
457
|
+
const module = device.createShaderModule({ label: `${label} kernel`, code: wgsl });
|
|
458
|
+
const info = await module.getCompilationInfo();
|
|
459
|
+
const errors = info.messages.filter((m) => m.type === "error");
|
|
460
|
+
if (errors.length) {
|
|
461
|
+
await device.popErrorScope();
|
|
462
|
+
throw new VDBError("VDB_BAD_OPTION", `reference renderer WGSL: ${errors.map((e) => `${e.lineNum}:${e.linePos} ${e.message}`).join("\n")}`);
|
|
463
|
+
}
|
|
464
|
+
const pipeline = await device.createComputePipelineAsync({
|
|
465
|
+
label: `${label} pipeline`,
|
|
466
|
+
layout: device.createPipelineLayout({ label: `${label} pipeline layout`, bindGroupLayouts: layouts }),
|
|
467
|
+
compute: { module, entryPoint: "vdbRefTraceCs" },
|
|
468
|
+
});
|
|
469
|
+
const err = await device.popErrorScope();
|
|
470
|
+
if (err)
|
|
471
|
+
throw new VDBError("VDB_BAD_OPTION", `reference renderer pipeline: ${err.message}`);
|
|
472
|
+
return new ReferenceRenderer(device, o, wgsl, pipeline, layouts);
|
|
473
|
+
}
|
|
474
|
+
//# sourceMappingURL=renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/core/reference/renderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EACtB,aAAa,EACb,8BAA8B,EAC9B,oBAAoB,GAOrB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,IAAI,GAAG,EAC9B,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,WAAW,CAAC;AAEnB,gHAAgH;AAChH,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,cAAc,GAAG,IAAI,CAAC;AAC5B,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,YAAY,GAAG,GAAG,CAAC;AACzB,MAAM,WA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AAM,CAAC,aAAa,EAAE,CAAC;IACzC,IAAI,GAAG;QAAE,MAAM,IAAI,QAAQ,CAAC,gBAAgB,EAAE,gCAAgC,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAC7F,OAAO,IAAI,iBAAiB,CAAC,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;AACnE,CAAC","sourcesContent":["/**\n * K6.R: the reference renderer on the host's device (design K6-core-renderer.md §7.4). A brute-force volumetric path\n * tracer over one volume source (dense textures or the sparse pool: the group-2 `vdbSrc*` contract), accumulated\n * progressively in rgba32float textures with per-pixel variance. Engine-free, internal only (no public export). The\n * CPU twin is `tools/reference/trace.ts` (same stream, same draw order).\n *\n * const ref = await vdbCreateReferenceRenderer(device, { source, width, height });\n * ref.setScene(scene, settings); // resets the accumulation\n * const enc = device.createCommandEncoder();\n * pool?.update(enc); source.update?.(enc); // host order (Traps): the pool, the source, then the kernel\n * ref.render(enc, 4); // 4 batches of settings.spp samples per pixel\n * device.queue.submit([enc.finish()]);\n * const accum = await ref.readback(); // sums of batch means → vdbReferenceStatistics (tools)\n *\n * One `render()` per submitted encoder (its batch records are written with `queue.writeBuffer`). The renderer frees\n * only what it made (textures, buffers); the source is the host's.\n */\n\nimport { VDBError } from \"../errors.js\";\nimport { VDBRetireQueue } from \"../frame/resources.js\";\nimport type { VDBSlot } from \"../types.js\";\nimport type { VDBVolumeSource, VDBVolumeSourceWgslInternalOptions } from \"../source/types.js\";\nimport {\n VDB_REFERENCE_MAX_HEMISPHERES,\n VDB_REFERENCE_MAX_LIGHTS,\n VDB_REFERENCE_MAX_STEPS,\n VDB_REFERENCE_MAX_VOLUMES,\n VDB_REFERENCE_RATIO_RR,\n vdbRefInvert4,\n vdbReferenceEnvironmentSampler,\n vdbReferenceSettings,\n type VDBReferenceAccum,\n type VDBReferenceColorTable,\n type VDBReferenceMajorantGrid,\n type VDBReferencePhaseTable,\n type VDBReferenceScene,\n type VDBReferenceSettings,\n} from \"../../tools/reference/index.js\";\nimport {\n VDB_REF_BATCH_STRIDE,\n VDB_REF_FLAG_BOX_FILTER,\n VDB_REF_FLAG_ENV_MIS,\n VDB_REF_FLAG_EQUIRECT,\n VDB_REF_FLAG_ORTHOGRAPHIC,\n VDB_REF_FLAG_SH,\n VDB_REF_HEMI_BYTES,\n VDB_REF_LIGHT_BYTES,\n VDB_REF_UNIFORM_OFFSETS as OFF,\n VDB_REF_VOLUME_BYTES,\n vdbReferenceKernelWgsl,\n} from \"./wgsl.js\";\n\n/** `GPUShaderStage.COMPUTE`, `GPUBufferUsage` and `GPUTextureUsage` bits (the globals do not exist in Node). */\nconst STAGE_COMPUTE = 0x4;\nconst BUFFER_UNIFORM = 0x40;\nconst BUFFER_COPY_DST = 0x8;\nconst BUFFER_MAP_READ = 0x1;\nconst TEX_COPY_SRC = 0x1;\nconst TEX_COPY_DST = 0x2;\nconst TEX_BINDING = 0x4;\nconst TEX_STORAGE = 0x8;\nconst MAP_READ = 0x1;\n\n/** The source slot of the kernel (the K6 group-2 contract). */\nexport const VDB_REFERENCE_SOURCE_SLOT: VDBSlot = Object.freeze({ group: 2, firstBinding: 0 });\n/** Most batches one `render()` records. */\nexport const VDB_REFERENCE_MAX_BATCHES_PER_RENDER = 64;\n\n/** A source the kernel can read: the group-2 contract, plus the sparse source's module and update. */\nexport type VDBReferenceSource = VDBVolumeSource & {\n moduleWgsl?(slot: VDBSlot): string;\n};\n\n/** Options of {@link vdbCreateReferenceRenderer}. */\nexport interface VDBReferenceRendererOptions {\n /** The source every volume of the scene reads (its slots: `VDBReferenceVolume.v`). One source per kernel (D10). */\n source: VDBReferenceSource;\n width: number;\n height: number;\n label?: string;\n /** Tests: patch the WGSL before it compiles (the fail-before mutations, `VDB_REFERENCE_MUTATIONS`). */\n wgslPatch?: (wgsl: string) => string;\n /**\n * Issue #2: how sigma reads the density. 'trilinear' (default): `vdbSrcDensity` (eight taps on a sparse source).\n * 'stochastic': ONE voxel picked with probability equal to its trilinear weight (`vdbSrcDensityStochastic`, three\n * more draws per sigma lookup in the shared stream; the CPU twin's `densityFilter`). Unbiased for a cutoff of 0:\n * delta and ratio tracking are linear in sigma and the cell majorants bound the 2x2x2 support. Compiled in, so a\n * setting of the kernel, not of the scene.\n */\n densityFilter?: VDBReferenceDensityFilter;\n}\n\n/** Issue #2: the reference kernel's density reconstruction (see {@link VDBReferenceRendererOptions.densityFilter}). */\nexport type VDBReferenceDensityFilter = \"trilinear\" | \"stochastic\";\n\n/** The reference renderer (internal). */\nexport interface VDBReferenceRenderer {\n readonly device: GPUDevice;\n readonly width: number;\n readonly height: number;\n /** The composed WGSL (module + source + kernel). */\n readonly wgsl: string;\n /** Batches accumulated since the last {@link setScene} / {@link reset}. */\n readonly batches: number;\n /**\n * Set the scene and settings (packs the uniforms, uploads an equirect map) and reset the accumulation. The textures it\n * replaces are destroyed in a later task (K6.10b): submit the encoder of an earlier `render()` in the task that recorded it.\n */\n setScene(scene: VDBReferenceScene, settings: Omit<VDBReferenceSettings, \"width\" | \"height\">): void;\n /** Drop the accumulation (the next batch starts from 0; batch indices restart, so the samples repeat). */\n reset(): void;\n /** Record `batches` dispatches (each `settings.spp` samples per pixel). One `render()` per submitted encoder. */\n render(encoder: GPUCommandEncoder, batches?: number): void;\n /** Read the accumulation back (after the encoder was submitted): sums of batch means and of their squares. */\n readback(): Promise<VDBReferenceAccum>;\n dispose(): void;\n}\n\n/**\n * K6.R1: where the scene's tables and majorant grids live in the kernel's table texture (rows) and majorant atlas\n * (z offsets), and their texel data. Tables and grids are shared by identity (instanced volumes upload once).\n */\nexport interface VDBReferenceTableLayout {\n phaseRows: Map<VDBReferencePhaseTable, number>;\n colorRows: Map<VDBReferenceColorTable, number>;\n gridOffsets: Map<VDBReferenceMajorantGrid, number>;\n tables: { width: number; height: number; data: Float32Array };\n majorants: { width: number; height: number; depth: number; data: Float32Array };\n}\n\n/** The table texture and majorant atlas of a scene (one row / one z range per distinct table or grid). */\nexport function vdbReferenceTableLayout(scene: VDBReferenceScene): VDBReferenceTableLayout {\n const phaseRows = new Map<VDBReferencePhaseTable, number>();\n const colorRows = new Map<VDBReferenceColorTable, number>();\n const gridOffsets = new Map<VDBReferenceMajorantGrid, number>();\n let rows = 0;\n let width = 2;\n let gw = 1;\n let gh = 1;\n let depth = 0;\n for (const v of scene.volumes) {\n const t = v.phase?.table;\n if (t && !phaseRows.has(t)) {\n phaseRows.set(t, rows++);\n width = Math.max(width, t.size);\n }\n const c = v.emission?.colorTable;\n if (c && !colorRows.has(c)) {\n colorRows.set(c, rows++);\n width = Math.max(width, c.size);\n }\n const g = v.majorantGrid;\n if (g && !gridOffsets.has(g)) {\n if (g.values.length !== g.dims[0] * g.dims[1] * g.dims[2]) throw new VDBError(\"VDB_BAD_OPTION\", `reference renderer: a majorant grid of ${g.dims.join(\"x\")} has ${g.values.length} values`);\n gridOffsets.set(g, depth);\n depth += g.dims[2];\n gw = Math.max(gw, g.dims[0]);\n gh = Math.max(gh, g.dims[1]);\n }\n }\n const height = Math.max(rows, 1);\n const tables = new Float32Array(width * height * 4);\n for (const [t, row] of phaseRows) {\n for (let i = 0; i < t.size; i++) tables.set([t.values[i * 3]!, t.values[i * 3 + 1]!, t.values[i * 3 + 2]!, t.cdf[i]!], (row * width + i) * 4);\n }\n for (const [t, row] of colorRows) {\n for (let i = 0; i < t.size; i++) tables.set([t.values[i * 3]!, t.values[i * 3 + 1]!, t.values[i * 3 + 2]!, 0], (row * width + i) * 4);\n }\n const d = Math.max(depth, 1);\n const majorants = new Float32Array(gw * gh * d);\n for (const [g, z0] of gridOffsets) {\n const [nx, ny, nz] = g.dims;\n for (let z = 0; z < nz; z++) for (let y = 0; y < ny; y++) majorants.set(g.values.subarray((z * ny + y) * nx, (z * ny + y + 1) * nx), ((z0 + z) * gh + y) * gw);\n }\n return { phaseRows, colorRows, gridOffsets, tables: { width, height, data: tables }, majorants: { width: gw, height: gh, depth: d, data: majorants } };\n}\n\n/** K6.R2: whether the kernel samples the scene's equirect map (MIS): the setting, a map, and light in it. */\nexport function vdbReferenceEnvironmentMis(scene: VDBReferenceScene, settings: Pick<Required<VDBReferenceSettings>, \"environmentSampling\">): boolean {\n const eq = scene.environment?.equirect;\n return !!eq && settings.environmentSampling === \"mis\" && vdbReferenceEnvironmentSampler(eq).total > 0;\n}\n\n/** Pack `VdbRefUniforms` (layout in `wgsl.ts`). Exported for tests. */\nexport function vdbReferencePackUniforms(scene: VDBReferenceScene, settingsIn: VDBReferenceSettings, layout: VDBReferenceTableLayout = vdbReferenceTableLayout(scene)): ArrayBuffer {\n const s = vdbReferenceSettings(settingsIn);\n const buf = new ArrayBuffer(OFF.size_);\n const f = new Float32Array(buf);\n const u = new Uint32Array(buf);\n const F = (byte: number, values: ArrayLike<number>) => f.set(Array.from(values as ArrayLike<number>), byte / 4);\n const U = (byte: number, value: number) => (u[byte / 4] = value >>> 0);\n const volumes = scene.volumes;\n const lights = scene.lights ?? [];\n const env = scene.environment ?? {};\n const hemis = env.hemispheres ?? [];\n if (volumes.length > VDB_REFERENCE_MAX_VOLUMES) throw new VDBError(\"VDB_BAD_OPTION\", `reference renderer: at most ${VDB_REFERENCE_MAX_VOLUMES} volumes, got ${volumes.length}`);\n if (lights.length > VDB_REFERENCE_MAX_LIGHTS) throw new VDBError(\"VDB_BAD_OPTION\", `reference renderer: at most ${VDB_REFERENCE_MAX_LIGHTS} lights, got ${lights.length}`);\n if (hemis.length > VDB_REFERENCE_MAX_HEMISPHERES) throw new VDBError(\"VDB_BAD_OPTION\", `reference renderer: at most ${VDB_REFERENCE_MAX_HEMISPHERES} hemispheres, got ${hemis.length}`);\n F(OFF.cameraToWorld, scene.camera.cameraToWorld);\n F(OFF.projectionInverse, scene.camera.projectionInverse);\n U(OFF.size, s.width);\n U(OFF.size + 4, s.height);\n U(OFF.seed, s.seed);\n U(OFF.spp, s.spp);\n U(OFF.maxBounces, s.maxBounces);\n U(OFF.rrStart, s.rrStart);\n U(OFF.volumeCount, volumes.length);\n U(OFF.lightCount, lights.length);\n U(OFF.hemiCount, hemis.length);\n const eq = env.equirect;\n const sh = env.sh;\n if (sh && sh.length !== 27) throw new VDBError(\"VDB_BAD_OPTION\", `reference renderer: the environment's sh needs 27 numbers, got ${sh.length}`);\n const mis = vdbReferenceEnvironmentMis(scene, s);\n U(OFF.flags, (s.pixelFilter === \"box\" ? VDB_REF_FLAG_BOX_FILTER : 0) | (scene.camera.orthographic ? VDB_REF_FLAG_ORTHOGRAPHIC : 0) | (eq ? VDB_REF_FLAG_EQUIRECT : 0) | (sh ? VDB_REF_FLAG_SH : 0) | (mis ? VDB_REF_FLAG_ENV_MIS : 0));\n if (sh) for (let i = 0; i < 9; i++) F(OFF.sh + i * 16, [sh[i * 3]!, sh[i * 3 + 1]!, sh[i * 3 + 2]!, 0]);\n U(OFF.envSize, eq?.width ?? 1);\n U(OFF.envSize + 4, eq?.height ?? 1);\n F(OFF.uniformEnv, [...(env.uniform ?? [0, 0, 0]), eq?.intensity ?? 1]);\n const r = eq?.rotation ?? [1, 0, 0, 0, 1, 0, 0, 0, 1];\n for (let row = 0; row < 3; row++) F(OFF.envRotation + row * 16, [r[row * 3]!, r[row * 3 + 1]!, r[row * 3 + 2]!, 0]);\n hemis.forEach((h, i) => {\n const o = OFF.hemis + i * VDB_REF_HEMI_BYTES;\n const l = Math.hypot(...h.up);\n F(o, [...h.sky, 0]);\n F(o + 16, [...h.ground, 0]);\n F(o + 32, [h.up[0] / l, h.up[1] / l, h.up[2] / l, 0]);\n });\n volumes.forEach((v, i) => {\n const o = OFF.volumes + i * VDB_REF_VOLUME_BYTES;\n const e = v.emission ?? {};\n const c = e.color ?? [1, 1, 1];\n const k = e.intensity ?? 1;\n const range = e.temperatureRange ?? [0, 6500];\n F(o, vdbRefInvert4(v.localToWorld));\n F(o + 64, [v.sigma, v.sigma * (v.majorant ?? 1), v.cutoff ?? 0, v.shape === \"sphere\" ? 1 : 0]);\n F(o + 80, [...(v.albedo ?? [1, 1, 1]), v.emits ? 1 : 0]);\n F(o + 96, [v.phase?.g ?? 0, v.phase?.backG ?? 0, v.phase?.backWeight ?? 0, 0]);\n F(o + 112, [c[0] * k, c[1] * k, c[2] * k, 0]);\n const ct = e.colorTable;\n F(o + 128, [range[0], range[1], ct ? Math.log(ct.minTemperature) : 0, ct ? Math.log(ct.maxTemperature) : 0]);\n const g = v.majorantGrid;\n U(o + 144, v.v ?? 0);\n if (g) {\n U(o + 148, g.dims[0]);\n U(o + 152, g.dims[1]);\n U(o + 156, g.dims[2]);\n U(o + 160, layout.gridOffsets.get(g)!);\n }\n const pt = v.phase?.table;\n if (pt) {\n U(o + 176, layout.phaseRows.get(pt)! + 1);\n U(o + 180, pt.size);\n }\n if (ct) {\n U(o + 184, layout.colorRows.get(ct)! + 1);\n U(o + 188, ct.size);\n }\n });\n lights.forEach((l, i) => {\n const o = OFF.lights + i * VDB_REF_LIGHT_BYTES;\n const norm = (d: readonly number[]) => {\n const n = Math.hypot(d[0]!, d[1]!, d[2]!);\n return [d[0]! / n, d[1]! / n, d[2]! / n];\n };\n if (l.kind === \"directional\") {\n F(o, [0, 0, 0, 0]);\n F(o + 16, [...norm(l.direction), 0]);\n F(o + 32, [...l.irradiance, 0]);\n F(o + 48, [0, 0, 0, 0]);\n } else {\n // falloff: mode 0 none, 1 inverse square, 2 three's getDistanceAttenuation (cutoff, decay)\n const falloff = l.falloff ? [2, l.falloff.cutoff ?? 0, l.falloff.decay, 0] : [l.inverseSquare ? 1 : 0, 0, 0, 0];\n if (l.kind === \"point\") {\n F(o, [...l.position, 1]);\n F(o + 16, [0, 0, 0, 0]);\n F(o + 32, [...l.intensity, 0]);\n } else {\n F(o, [...l.position, 2]);\n F(o + 16, [...norm(l.direction), l.cosOuter]);\n F(o + 32, [...l.intensity, l.cosInner]);\n }\n F(o + 48, falloff);\n }\n });\n return buf;\n}\n\n/** The composed WGSL of a reference kernel over `source` (module + source + kernel). */\nexport function vdbReferenceWgsl(source: VDBReferenceSource, o: { densityFilter?: VDBReferenceDensityFilter } = {}): string {\n const stochastic = (o.densityFilter ?? \"trilinear\") === \"stochastic\";\n const slot = VDB_REFERENCE_SOURCE_SLOT;\n const module = typeof source.moduleWgsl === \"function\" ? source.moduleWgsl(slot) : \"\";\n const kernel = vdbReferenceKernelWgsl({\n maxVolumes: VDB_REFERENCE_MAX_VOLUMES,\n maxLights: VDB_REFERENCE_MAX_LIGHTS,\n maxHemispheres: VDB_REFERENCE_MAX_HEMISPHERES,\n maxSteps: VDB_REFERENCE_MAX_STEPS,\n ratioRr: VDB_REFERENCE_RATIO_RR,\n stochastic,\n });\n const sourceOptions: VDBVolumeSourceWgslInternalOptions = { slot, profile: \"sample\", ...(stochastic ? { stochastic } : {}) };\n return `${module}\\n${source.wgsl(sourceOptions)}\\n${kernel}`;\n}\n\nclass ReferenceRenderer implements VDBReferenceRenderer {\n readonly device: GPUDevice;\n readonly width: number;\n readonly height: number;\n readonly wgsl: string;\n batches = 0;\n readonly #source: VDBReferenceSource;\n readonly #label: string;\n readonly #pipeline: GPUComputePipeline;\n readonly #layouts: GPUBindGroupLayout[];\n readonly #uniforms: GPUBuffer;\n readonly #batch: GPUBuffer;\n readonly #accum: GPUTexture[];\n #env: GPUTexture;\n #tables: GPUTexture;\n #majorants: GPUTexture;\n /** K6.R2: the equirect map's sampling table (r32float). */\n #envCdf: GPUTexture;\n #group0: GPUBindGroup;\n #group1: GPUBindGroup[] = [];\n #group2: GPUBindGroup | null = null;\n #sourceVersion = -1;\n #front = 0;\n #settings: Required<VDBReferenceSettings> | null = null;\n #disposed = false;\n // K6.10b: textures setScene replaced; destroyed in a later task (a render recorded before setScene, in the host's\n // encoder, may still name them until the host submits)\n readonly #retire = new VDBRetireQueue();\n\n constructor(device: GPUDevice, o: VDBReferenceRendererOptions, wgsl: string, pipeline: GPUComputePipeline, layouts: GPUBindGroupLayout[]) {\n this.device = device;\n this.width = o.width;\n this.height = o.height;\n this.wgsl = wgsl;\n this.#source = o.source;\n this.#label = o.label ?? \"vdb reference\";\n this.#pipeline = pipeline;\n this.#layouts = layouts;\n this.#uniforms = device.createBuffer({ label: `${this.#label} uniforms`, size: OFF.size_, usage: BUFFER_UNIFORM | BUFFER_COPY_DST });\n this.#batch = device.createBuffer({ label: `${this.#label} batches`, size: VDB_REF_BATCH_STRIDE * VDB_REFERENCE_MAX_BATCHES_PER_RENDER, usage: BUFFER_UNIFORM | BUFFER_COPY_DST });\n // Two (sum, sum of squares) pairs, ping-ponged: 0,1 = pair A; 2,3 = pair B.\n this.#accum = [0, 1, 2, 3].map((i) =>\n device.createTexture({ label: `${this.#label} accum ${i}`, size: [o.width, o.height], format: \"rgba32float\", usage: TEX_BINDING | TEX_STORAGE | TEX_COPY_SRC }),\n );\n this.#env = this.#makeEnv(1, 1, new Float32Array(4));\n this.#tables = this.#makeEnv(2, 1, new Float32Array(8));\n this.#majorants = this.#makeMajorants(1, 1, 1, new Float32Array(1));\n this.#envCdf = this.#makeR32(2, 6, new Float32Array(12));\n this.#group0 = device.createBindGroup({\n label: `${this.#label} group 0`,\n layout: layouts[0]!,\n entries: [\n { binding: 0, resource: { buffer: this.#uniforms } },\n { binding: 1, resource: { buffer: this.#batch, size: 16 } },\n ],\n });\n this.#buildGroup1();\n }\n\n #makeEnv(w: number, h: number, data: Float32Array): GPUTexture {\n const t = this.device.createTexture({ label: `${this.#label} environment`, size: [w, h], format: \"rgba32float\", usage: TEX_BINDING | TEX_COPY_DST });\n this.device.queue.writeTexture({ texture: t }, data as Float32Array<ArrayBuffer>, { bytesPerRow: w * 16, rowsPerImage: h }, [w, h]);\n return t;\n }\n\n #makeR32(w: number, h: number, data: Float32Array): GPUTexture {\n const t = this.device.createTexture({ label: `${this.#label} environment sampling`, size: [w, h], format: \"r32float\", usage: TEX_BINDING | TEX_COPY_DST });\n this.device.queue.writeTexture({ texture: t }, data as Float32Array<ArrayBuffer>, { bytesPerRow: w * 4, rowsPerImage: h }, [w, h]);\n return t;\n }\n\n #makeMajorants(w: number, h: number, d: number, data: Float32Array): GPUTexture {\n const t = this.device.createTexture({ label: `${this.#label} majorants`, size: [w, h, d], dimension: \"3d\", format: \"r32float\", usage: TEX_BINDING | TEX_COPY_DST });\n this.device.queue.writeTexture({ texture: t }, data as Float32Array<ArrayBuffer>, { bytesPerRow: w * 4, rowsPerImage: h }, [w, h, d]);\n return t;\n }\n\n #buildGroup1(): void {\n const view = (t: GPUTexture) => t.createView();\n const a = this.#accum;\n // Group 1 reading pair p and writing the other one.\n this.#group1 = [0, 1].map((p) =>\n this.device.createBindGroup({\n label: `${this.#label} group 1 (${p ? \"B→A\" : \"A→B\"})`,\n layout: this.#layouts[1]!,\n entries: [\n { binding: 0, resource: view(a[2 * p]!) },\n { binding: 1, resource: view(a[2 * p + 1]!) },\n { binding: 2, resource: view(a[2 * (1 - p)]!) },\n { binding: 3, resource: view(a[2 * (1 - p) + 1]!) },\n { binding: 4, resource: view(this.#env) },\n { binding: 5, resource: view(this.#tables) },\n { binding: 6, resource: view(this.#majorants) },\n { binding: 7, resource: view(this.#envCdf) },\n ],\n }),\n );\n }\n\n #check(): void {\n if (this.#disposed) throw new VDBError(\"VDB_DISPOSED\", \"reference renderer: disposed\");\n }\n\n setScene(scene: VDBReferenceScene, settings: Omit<VDBReferenceSettings, \"width\" | \"height\">): void {\n this.#check();\n const full = { ...settings, width: this.width, height: this.height };\n this.#settings = vdbReferenceSettings(full);\n const layout = vdbReferenceTableLayout(scene);\n this.device.queue.writeBuffer(this.#uniforms, 0, vdbReferencePackUniforms(scene, full, layout));\n const eq = scene.environment?.equirect;\n if (eq) {\n if (eq.data.length !== eq.width * eq.height * 4) throw new VDBError(\"VDB_BAD_OPTION\", `reference renderer: the equirect map has ${eq.data.length} floats, expected ${eq.width}x${eq.height}x4`);\n this.#retire.retireAfterTask(this.#env);\n this.#env = this.#makeEnv(eq.width, eq.height, eq.data);\n if (vdbReferenceEnvironmentMis(scene, this.#settings)) {\n const smp = vdbReferenceEnvironmentSampler(eq);\n const max2d = this.device.limits.maxTextureDimension2D;\n if (smp.tableWidth > max2d || smp.tableHeight > max2d) throw new VDBError(\"VDB_BAD_OPTION\", `reference renderer: the environment sampling table ${smp.tableWidth}x${smp.tableHeight} exceeds maxTextureDimension2D ${max2d} (use environmentSampling 'phase' or a smaller map)`);\n this.#retire.retireAfterTask(this.#envCdf);\n this.#envCdf = this.#makeR32(smp.tableWidth, smp.tableHeight, smp.data);\n }\n }\n const max3d = this.device.limits.maxTextureDimension3D;\n const m = layout.majorants;\n if (m.width > max3d || m.height > max3d || m.depth > max3d) throw new VDBError(\"VDB_BAD_OPTION\", `reference renderer: the majorant atlas ${m.width}x${m.height}x${m.depth} exceeds maxTextureDimension3D ${max3d} (use larger cells)`);\n this.#retire.retireAfterTask(this.#tables);\n this.#tables = this.#makeEnv(layout.tables.width, layout.tables.height, layout.tables.data);\n this.#retire.retireAfterTask(this.#majorants);\n this.#majorants = this.#makeMajorants(m.width, m.height, m.depth, m.data);\n this.#buildGroup1();\n this.reset();\n }\n\n reset(): void {\n this.batches = 0;\n this.#front = 0;\n }\n\n render(encoder: GPUCommandEncoder, batches = 1): void {\n this.#check();\n if (!this.#settings) throw new VDBError(\"VDB_BAD_OPTION\", \"reference renderer: call setScene() before render()\");\n if (!Number.isInteger(batches) || batches < 1 || batches > VDB_REFERENCE_MAX_BATCHES_PER_RENDER) {\n throw new VDBError(\"VDB_BAD_OPTION\", `reference renderer: batches must be an integer in [1, ${VDB_REFERENCE_MAX_BATCHES_PER_RENDER}], got ${batches}`);\n }\n if (!this.#group2 || this.#source.version !== this.#sourceVersion) {\n this.#group2 = this.device.createBindGroup({ label: `${this.#label} group 2 (source)`, layout: this.#layouts[2]!, entries: this.#source.bindEntries(VDB_REFERENCE_SOURCE_SLOT) });\n this.#sourceVersion = this.#source.version;\n }\n const records = new Uint32Array((VDB_REF_BATCH_STRIDE / 4) * batches);\n for (let b = 0; b < batches; b++) {\n records[(b * VDB_REF_BATCH_STRIDE) / 4] = this.batches + b;\n records[(b * VDB_REF_BATCH_STRIDE) / 4 + 1] = this.batches + b > 0 ? 1 : 0;\n }\n this.device.queue.writeBuffer(this.#batch, 0, records);\n const pass = encoder.beginComputePass({ label: `${this.#label} trace` });\n pass.setPipeline(this.#pipeline);\n pass.setBindGroup(2, this.#group2);\n for (let b = 0; b < batches; b++) {\n pass.setBindGroup(0, this.#group0, [b * VDB_REF_BATCH_STRIDE]);\n pass.setBindGroup(1, this.#group1[this.#front]!);\n pass.dispatchWorkgroups(Math.ceil(this.width / 8), Math.ceil(this.height / 8));\n this.#front = 1 - this.#front;\n }\n pass.end();\n this.batches += batches;\n }\n\n async readback(): Promise<VDBReferenceAccum> {\n this.#check();\n const rowBytes = Math.ceil((this.width * 16) / 256) * 256;\n const size = rowBytes * this.height;\n const staging = [0, 1].map((i) => this.device.createBuffer({ label: `${this.#label} readback ${i}`, size, usage: BUFFER_MAP_READ | BUFFER_COPY_DST }));\n const encoder = this.device.createCommandEncoder({ label: `${this.#label} readback` });\n for (let i = 0; i < 2; i++) {\n encoder.copyTextureToBuffer({ texture: this.#accum[2 * this.#front + i]! }, { buffer: staging[i]!, bytesPerRow: rowBytes, rowsPerImage: this.height }, [this.width, this.height]);\n }\n this.device.queue.submit([encoder.finish()]);\n const out = await Promise.all(\n staging.map(async (b) => {\n await b.mapAsync(MAP_READ);\n const raw = new Float32Array(b.getMappedRange().slice(0));\n b.destroy();\n const packed = new Float32Array(this.width * this.height * 4);\n for (let y = 0; y < this.height; y++) packed.set(raw.subarray((y * rowBytes) / 4, (y * rowBytes) / 4 + this.width * 4), y * this.width * 4);\n return packed;\n }),\n );\n return { width: this.width, height: this.height, batches: this.batches, sum: out[0]!, sumSq: out[1]! };\n }\n\n dispose(): void {\n if (this.#disposed) return;\n this.#disposed = true;\n for (const t of this.#accum) t.destroy();\n this.#env.destroy();\n this.#tables.destroy();\n this.#majorants.destroy();\n this.#envCdf.destroy();\n this.#uniforms.destroy();\n this.#batch.destroy();\n this.#retire.drain();\n }\n}\n\n/**\n * Create the reference renderer on the host's device: compiles the kernel for `options.source` (under a validation\n * error scope; WGSL errors throw `VDBError('VDB_BAD_OPTION')` with the compiler messages).\n */\nexport async function vdbCreateReferenceRenderer(device: GPUDevice, o: VDBReferenceRendererOptions): Promise<VDBReferenceRenderer> {\n if (!device || typeof (device as { createComputePipelineAsync?: unknown }).createComputePipelineAsync !== \"function\") {\n throw new VDBError(\"VDB_UNSUPPORTED_DEVICE\", \"vdbCreateReferenceRenderer: pass the host's GPUDevice.\");\n }\n if (!(o.width >= 1 && o.height >= 1 && Number.isInteger(o.width) && Number.isInteger(o.height))) {\n throw new VDBError(\"VDB_BAD_OPTION\", `vdbCreateReferenceRenderer: width and height must be positive integers, got ${o.width}x${o.height}`);\n }\n const densityFilter = o.densityFilter ?? \"trilinear\";\n if (densityFilter !== \"trilinear\" && densityFilter !== \"stochastic\") {\n throw new VDBError(\"VDB_BAD_OPTION\", `vdbCreateReferenceRenderer: densityFilter must be 'trilinear' or 'stochastic', got ${JSON.stringify(densityFilter)}`);\n }\n let wgsl = vdbReferenceWgsl(o.source, { densityFilter });\n if (o.wgslPatch) wgsl = o.wgslPatch(wgsl);\n const label = o.label ?? \"vdb reference\";\n device.pushErrorScope(\"validation\");\n const layouts = [\n device.createBindGroupLayout({\n label: `${label} layout 0`,\n entries: [\n { binding: 0, visibility: STAGE_COMPUTE, buffer: { type: \"uniform\", minBindingSize: OFF.size_ } },\n { binding: 1, visibility: STAGE_COMPUTE, buffer: { type: \"uniform\", hasDynamicOffset: true, minBindingSize: 16 } },\n ],\n }),\n device.createBindGroupLayout({\n label: `${label} layout 1`,\n entries: [\n { binding: 0, visibility: STAGE_COMPUTE, texture: { sampleType: \"unfilterable-float\", viewDimension: \"2d\" } },\n { binding: 1, visibility: STAGE_COMPUTE, texture: { sampleType: \"unfilterable-float\", viewDimension: \"2d\" } },\n { binding: 2, visibility: STAGE_COMPUTE, storageTexture: { access: \"write-only\", format: \"rgba32float\", viewDimension: \"2d\" } },\n { binding: 3, visibility: STAGE_COMPUTE, storageTexture: { access: \"write-only\", format: \"rgba32float\", viewDimension: \"2d\" } },\n { binding: 4, visibility: STAGE_COMPUTE, texture: { sampleType: \"unfilterable-float\", viewDimension: \"2d\" } },\n { binding: 5, visibility: STAGE_COMPUTE, texture: { sampleType: \"unfilterable-float\", viewDimension: \"2d\" } },\n { binding: 6, visibility: STAGE_COMPUTE, texture: { sampleType: \"unfilterable-float\", viewDimension: \"3d\" } },\n { binding: 7, visibility: STAGE_COMPUTE, texture: { sampleType: \"unfilterable-float\", viewDimension: \"2d\" } },\n ],\n }),\n device.createBindGroupLayout({ label: `${label} layout 2 (source)`, entries: o.source.layoutEntries(VDB_REFERENCE_SOURCE_SLOT, STAGE_COMPUTE) }),\n ];\n const module = device.createShaderModule({ label: `${label} kernel`, code: wgsl });\n const info = await module.getCompilationInfo();\n const errors = info.messages.filter((m) => m.type === \"error\");\n if (errors.length) {\n await device.popErrorScope();\n throw new VDBError(\"VDB_BAD_OPTION\", `reference renderer WGSL: ${errors.map((e) => `${e.lineNum}:${e.linePos} ${e.message}`).join(\"\\n\")}`);\n }\n const pipeline = await device.createComputePipelineAsync({\n label: `${label} pipeline`,\n layout: device.createPipelineLayout({ label: `${label} pipeline layout`, bindGroupLayouts: layouts }),\n compute: { module, entryPoint: \"vdbRefTraceCs\" },\n });\n const err = await device.popErrorScope();\n if (err) throw new VDBError(\"VDB_BAD_OPTION\", `reference renderer pipeline: ${err.message}`);\n return new ReferenceRenderer(device, o, wgsl, pipeline, layouts);\n}\n"]}
|