@woosh/meep-engine 3.60.5 → 3.60.7
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 +19 -0
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/binary/BitSet.d.ts.map +1 -1
- package/src/core/binary/BitSet.js +2 -1
- package/src/{format/image/avif/av1/util → core/binary/operations}/ceil_log2.d.ts +2 -2
- package/src/core/binary/operations/ceil_log2.d.ts.map +1 -0
- package/src/{format/image/avif/av1/util → core/binary/operations}/ceil_log2.js +18 -18
- package/src/core/binary/zstd/ZstdReverseBitReader.d.ts.map +1 -1
- package/src/core/binary/zstd/ZstdReverseBitReader.js +225 -223
- package/src/core/binary/zstd/zstd_fse.d.ts.map +1 -1
- package/src/core/binary/zstd/zstd_fse.js +267 -265
- package/src/core/binary/zstd/zstd_huffman.d.ts.map +1 -1
- package/src/core/binary/zstd/zstd_huffman.js +246 -244
- package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
- package/src/core/bvh2/binary/2/BinaryUint32BVH.js +8 -2
- package/src/core/bvh2/bvh3/ebvh_optimize_treelet.d.ts.map +1 -1
- package/src/core/bvh2/bvh3/ebvh_optimize_treelet.js +8 -7
- package/src/core/collection/PairUint32Map.d.ts.map +1 -1
- package/src/core/collection/PairUint32Map.js +2 -2
- package/src/core/collection/Uint32Map.d.ts.map +1 -1
- package/src/core/collection/Uint32Map.js +2 -4
- package/src/core/collection/heap/FibonacciHeap.d.ts.map +1 -1
- package/src/core/collection/heap/FibonacciHeap.js +2 -1
- package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts.map +1 -1
- package/src/core/geom/2d/r-tree/StaticR2Tree.js +8 -2
- package/src/core/geom/3d/shape/util/mesh_compute_triangle_edge_flags.d.ts.map +1 -1
- package/src/core/geom/3d/shape/util/mesh_compute_triangle_edge_flags.js +2 -3
- package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
- package/src/engine/graphics/texture/atlas/TextureAtlas.js +13 -14
- package/src/engine/graphics/texture/atlas/sprite_atlas_border.d.ts.map +1 -1
- package/src/engine/graphics/texture/atlas/sprite_atlas_border.js +70 -69
- package/src/engine/graphics/texture/reflection/convolve_equirectangular_reflection.d.ts.map +1 -1
- package/src/engine/graphics/texture/reflection/convolve_equirectangular_reflection.js +2 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
- package/src/engine/graphics3/GPUParticleEmitterSystem.js +2 -1
- package/src/engine/graphics3/decal/GPUDecalRenderer.d.ts.map +1 -1
- package/src/engine/graphics3/decal/GPUDecalRenderer.js +2 -1
- package/src/engine/graphics3/decal/chunk_decal_record.d.ts +14 -0
- package/src/engine/graphics3/decal/chunk_decal_record.d.ts.map +1 -0
- package/src/engine/graphics3/decal/chunk_decal_record.js +44 -0
- package/src/engine/graphics3/decal/shader_cluster_assign_decals.d.ts.map +1 -1
- package/src/engine/graphics3/decal/shader_cluster_assign_decals.js +2 -15
- package/src/engine/graphics3/decal/shader_cull_decals_frustum.d.ts.map +1 -1
- package/src/engine/graphics3/decal/shader_cull_decals_frustum.js +3 -16
- package/src/engine/graphics3/decal/shader_decal_composite.d.ts.map +1 -1
- package/src/engine/graphics3/decal/shader_decal_composite.js +3 -23
- package/src/engine/graphics3/terrain/TERRAIN_MATERIAL_TEMPLATE.d.ts.map +1 -1
- package/src/engine/graphics3/terrain/TERRAIN_MATERIAL_TEMPLATE.js +2 -1
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/queries/shape_cast.js +2 -2
- package/src/format/image/avif/av1/decode/decode_palette.js +442 -442
- package/src/format/image/avif/av1/entropy/SymbolWriter.d.ts.map +1 -1
- package/src/format/image/avif/av1/entropy/SymbolWriter.js +2 -1
- package/src/generation/foliage/material/foliage_tile.d.ts.map +1 -1
- package/src/generation/foliage/material/foliage_tile.js +2 -1
- package/src/shade/device/mock/SoftwareGPUDevice.d.ts.map +1 -1
- package/src/shade/device/mock/SoftwareGPUDevice.js +6 -13
- package/src/shade/playground/caldera/main.js +3 -2
- package/src/shade/playground/probe_clipmap/README.md +2 -1
- package/src/shade/playground/probe_clipmap/index.html +7 -2
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +17 -7
- package/src/shade/playground/sh_exponential/sh_exp_playground_shaders.d.ts.map +1 -1
- package/src/shade/playground/sh_exponential/sh_exp_playground_shaders.js +7 -13
- package/src/shade/playground/vgeo_scene/main.js +2 -1
- package/src/shade/playground/vsm/VSMDebugOverlay.d.ts.map +1 -1
- package/src/shade/playground/vsm/VSMDebugOverlay.js +3 -1
- package/src/shade/renderer/Renderer.d.ts +11 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +43 -1
- package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
- package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
- package/src/shade/renderer/fluid/pressure/shader_fluid_mg_coarsest.d.ts.map +1 -1
- package/src/shade/renderer/fluid/pressure/shader_fluid_mg_coarsest.js +5 -4
- package/src/shade/renderer/fluid/pressure/shader_fluid_mg_residual_restrict.d.ts.map +1 -1
- package/src/shade/renderer/fluid/pressure/shader_fluid_mg_residual_restrict.js +168 -166
- package/src/shade/renderer/fluid/pressure/shader_fluid_mg_smooth.d.ts.map +1 -1
- package/src/shade/renderer/fluid/pressure/shader_fluid_mg_smooth.js +221 -219
- package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
- package/src/shade/renderer/fow/shader_fog_of_war.d.ts.map +1 -1
- package/src/shade/renderer/fow/shader_fog_of_war.js +8 -19
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +26 -43
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +115 -123
- package/src/shade/renderer/geometry/sdf/MeshSDFLayout.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/MeshSDFLayout.js +2 -1
- package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts +20 -2
- package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js +66 -2
- package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.d.ts +19 -0
- package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.js +25 -0
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +2 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.js +2 -1
- package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts +15 -0
- package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.js +38 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts +28 -59
- package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts.map +1 -1
- package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.js +84 -789
- package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_decode_from_storage.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_decode_from_storage.js +10 -31
- package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_encode_to_storage.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_encode_to_storage.js +9 -15
- package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.d.ts +2 -1
- package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.js +6 -5
- package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +15 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +168 -18
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +98 -57
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +168 -77
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +27 -12
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.js +12 -7
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +8 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts +2 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.js +2 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +5 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +5 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_movers_command.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_movers_command.js +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_scroll.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_scroll.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_store.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_store.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_take.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_take.js +3 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_cards.js +2 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +114 -41
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +424 -207
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +34 -25
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +41 -31
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.d.ts +7 -5
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.js +7 -5
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts +47 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.js +84 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +48 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +101 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +58 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +127 -30
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.d.ts +18 -7
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.js +39 -13
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.d.ts +29 -8
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.js +112 -56
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.d.ts +19 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.js +35 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +9 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts +3 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.js +5 -5
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts +8 -12
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js +23 -56
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts +0 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.js +11 -15
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.d.ts +26 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.js +173 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.d.ts +32 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.js +166 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +3 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +3 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.js +3 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +6 -12
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +15 -65
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.js +7 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts +4 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.js +24 -17
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.d.ts +7 -5
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.js +18 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts +2 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.js +9 -5
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts +3 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +9 -6
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.d.ts +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.js +16 -16
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.d.ts +36 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.js +233 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +7 -5
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +5 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +10 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.js +12 -6
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts +1 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.js +5 -6
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts +14 -18
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.js +25 -35
- package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.d.ts +13 -0
- package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.js +12 -0
- package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.d.ts +27 -2
- package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.js +62 -6
- package/src/shade/renderer/gpu_primitive/indirect/IndirectComputeCommandBuildPass.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/indirect/IndirectComputeCommandBuildPass.js +10 -19
- package/src/shade/renderer/gpu_primitive/indirect/chunk_folded_dispatch.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/indirect/chunk_folded_dispatch.js +6 -3
- package/src/shade/renderer/hiz/hzb_pick_alignment.d.ts.map +1 -1
- package/src/shade/renderer/hiz/hzb_pick_alignment.js +149 -148
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_environment_cells.d.ts.map +1 -1
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_environment_cells.js +4 -2
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_log_floor.d.ts.map +1 -1
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_log_floor.js +6 -5
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_project.d.ts.map +1 -1
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_project.js +3 -1
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_reference_reflectance.d.ts.map +1 -1
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_reference_reflectance.js +3 -1
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_solve.d.ts.map +1 -1
- package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_solve.js +3 -1
- package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts +0 -5
- package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts.map +1 -1
- package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.js +0 -7
- package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts +15 -2
- package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts.map +1 -1
- package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.js +51 -16
- package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.d.ts.map +1 -1
- package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.js +3 -2
- package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
- package/src/shade/renderer/material/GPUMaterialManager.d.ts +4 -1
- package/src/shade/renderer/material/GPUMaterialManager.d.ts.map +1 -1
- package/src/shade/renderer/material/GPUMaterialManager.js +5 -8
- package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.d.ts +17 -0
- package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.js +81 -0
- package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.js +5 -48
- package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.js +4 -44
- package/src/shade/renderer/postprocess/gtao/GTAO.d.ts +7 -3
- package/src/shade/renderer/postprocess/gtao/GTAO.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/gtao/GTAO.js +26 -13
- package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts +14 -0
- package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.js +196 -68
- package/src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.js +4 -1
- package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.js +42 -28
- package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js +430 -414
- package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.d.ts +16 -0
- package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.js +156 -0
- package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
- package/src/shade/renderer/postprocess/nss/chunk_nss_luma_derivative.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/nss/chunk_nss_luma_derivative.js +5 -7
- package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.d.ts +17 -0
- package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.js +56 -0
- package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.js +2 -22
- package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.js +2 -13
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +10 -13
- package/src/shade/renderer/rasterize/expand/bucket/RASTERIZATION_BUCKET_LIMIT.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/bucket/RASTERIZATION_BUCKET_LIMIT.js +39 -38
- package/src/shade/renderer/rasterize/expand/mesh/shader_prefix_sum_to_command.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/expand/mesh/shader_prefix_sum_to_command.js +7 -12
- package/src/shade/renderer/scene/GPUSceneContext.d.ts +2 -2
- package/src/shade/renderer/scene/GPUSceneContext.js +5 -5
- package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.d.ts +8 -6
- package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js +10 -7
- package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.d.ts +16 -0
- package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.js +35 -0
- package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.d.ts +5 -2
- package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.js +27 -18
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh2_color_get_irradiance_at.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh2_color_get_irradiance_at.js +5 -15
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh3_convolve_with_cosine_kernel.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh3_convolve_with_cosine_kernel.js +5 -19
- package/src/shade/renderer/shader/chunk/spherical_harmonics/dering/chunk_sh3_windowing.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/spherical_harmonics/dering/chunk_sh3_windowing.js +3 -22
- package/src/shade/renderer/shadow/map/ShadowmapDrawSelector.d.ts.map +1 -1
- package/src/shade/renderer/shadow/map/ShadowmapDrawSelector.js +2 -1
- package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_shadow_group_list.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_shadow_group_list.js +154 -152
- package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.js +2 -1
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts +3 -1
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.js +4 -3
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts +7 -1
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.js +54 -47
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.d.ts.map +1 -1
- package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.js +371 -370
- package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
- package/src/shade/renderer/water/GPUWaterRenderer.js +2 -1
- package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
- package/src/shade/renderer/water/surface/lod/shader_water_lod.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/lod/shader_water_lod.js +12 -14
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +2 -9
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
- package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +2 -1
- package/src/shade/renderer/wind/WIND_FIELD.d.ts +3 -1
- package/src/shade/renderer/wind/WIND_FIELD.d.ts.map +1 -1
- package/src/shade/renderer/wind/WIND_FIELD.js +4 -3
- package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts +8 -2
- package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/wind/WIND_FIELD_STRUCT.js +11 -4
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +2 -2
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +13 -4
- package/src/shade/util/texture_mip_extent.d.ts.map +1 -1
- package/src/shade/util/texture_mip_extent.js +88 -87
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +9 -7
- package/src/format/image/avif/av1/util/ceil_log2.d.ts.map +0 -1
- package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts +0 -47
- package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts.map +0 -1
- package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.js +0 -80
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts +0 -16
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts.map +0 -1
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.js +0 -67
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts +0 -17
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts.map +0 -1
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.js +0 -145
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts +0 -12
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts.map +0 -1
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.js +0 -105
- package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.d.ts +0 -1
- package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.js +0 -0
|
@@ -1,181 +1,46 @@
|
|
|
1
1
|
import { assert } from "../../../../../core/assert.js";
|
|
2
|
-
import { BufferDescriptor } from "../../../../descriptor/buffer/BufferDescriptor.js";
|
|
3
|
-
import { BufferResourceDescriptor } from "../../../../device/graph/BufferResourceDescriptor.js";
|
|
4
|
-
import { graph_read_buffer } from "../../../buffer/graph_read_buffer.js";
|
|
5
|
-
import { graph_build_indirect_dispatch_command } from "../../../gpu_primitive/indirect/IndirectComputeCommandBuildPass.js";
|
|
6
|
-
import {
|
|
7
|
-
graph_prefix_scan_csdldf,
|
|
8
|
-
prefix_scan_csdldf_output_descriptor
|
|
9
|
-
} from "../../../gpu_primitive/prefix_sum/v1/graph_prefix_scan_csdldf.js";
|
|
10
|
-
import { graph_create_buffer } from "../../../shader/graph/graph_create_buffer.js";
|
|
11
|
-
import { Attribute } from "../../Attribute.js";
|
|
12
|
-
import { Geometry } from "../../Geometry.js";
|
|
13
|
-
import { MeshoptClusterizer } from "../../meshlet/build/meshoptimizer/meshopt_clusterizer.js";
|
|
14
|
-
import { meshlet_geometry_build_from_geometry } from "../../meshlet_geometry_build_from_geometry.js";
|
|
15
|
-
import { MeshSDFState } from "../../sdf/MESH_SDF.js";
|
|
16
|
-
import { MeshSDFLayout } from "../../sdf/MeshSDFLayout.js";
|
|
17
|
-
import { StandardAttributes } from "../../StandardAttributes.js";
|
|
18
|
-
import { vgeo_feedback_slot_stats } from "../runtime/cut/vgeo_cut_feedback_layout.js";
|
|
19
|
-
import { graph_vgeo_cut_descent } from "../runtime/graph_vgeo_cut_descent.js";
|
|
20
|
-
import { VGEO_CUT_STAT } from "../runtime/layout/VGEO_CUT_STAT.js";
|
|
21
|
-
import { VGEO_CUT_STAT_COUNT } from "../runtime/layout/VGEO_CUT_STAT_COUNT.js";
|
|
22
|
-
import { VGEO_GEOMETRY_ROW_NONE } from "../runtime/layout/VGEO_GEOMETRY_ROW_NONE.js";
|
|
23
|
-
import { VGEO_INSTANCE_WORDS } from "../runtime/layout/VGEO_INSTANCE_WORDS.js";
|
|
24
|
-
import { VGeoViewCut } from "../runtime/VGeoViewCut.js";
|
|
25
|
-
import { shader_vgeo_sdf_collect, VGEO_SDF_COLLECT_WORKGROUP_SIZE } from "./shader_vgeo_sdf_collect.js";
|
|
26
|
-
import { shader_vgeo_sdf_decode } from "./shader_vgeo_sdf_decode.js";
|
|
27
|
-
import { shader_vgeo_sdf_traverse } from "./shader_vgeo_sdf_traverse.js";
|
|
28
|
-
import {
|
|
29
|
-
VGEO_SDF_CLUSTER_WORDS,
|
|
30
|
-
VGEO_SDF_COUNTER,
|
|
31
|
-
VGEO_SDF_COUNTER_WORDS,
|
|
32
|
-
VGEO_SDF_JOB_STRUCT,
|
|
33
|
-
vgeo_sdf_header_words
|
|
34
|
-
} from "./VGEO_SDF.js";
|
|
35
2
|
|
|
36
3
|
/**
|
|
37
|
-
* @typedef {import("../../../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph} FrameGraph
|
|
38
4
|
* @typedef {import("../../GPUGeometryManager.js").GPUGeometryManager} GPUGeometryManager
|
|
39
5
|
* @typedef {import("../../GPUGeometryMetadata.js").GPUGeometryMetadata} GPUGeometryMetadata
|
|
40
6
|
* @typedef {import("../../MeshletGeometry.js").MeshletGeometry} MeshletGeometry
|
|
41
|
-
* @typedef {import("../runtime/GPUVirtualGeometryRuntime.js").GPUVirtualGeometryRuntime} GPUVirtualGeometryRuntime
|
|
42
7
|
*/
|
|
43
8
|
|
|
44
|
-
/** The slot holds no geometry. */
|
|
45
|
-
const JOB_FREE = 0;
|
|
46
|
-
/** Cut each frame, its counters read back. */
|
|
47
|
-
const JOB_CUT = 1;
|
|
48
|
-
/** Its last cut read back stood nothing in: the next frame it is cut, its mesh is written out too. */
|
|
49
|
-
const JOB_READY = 2;
|
|
50
|
-
/** Written out in a frame whose readback has not landed. */
|
|
51
|
-
const JOB_DECODING = 3;
|
|
52
|
-
/** Its mesh is read back: its proxy is built on the host. */
|
|
53
|
-
const JOB_BUILD = 4;
|
|
54
|
-
/** Its proxy is baked by the mesh path. */
|
|
55
|
-
const JOB_BAKING = 5;
|
|
56
|
-
/** Its proxy's cache is resident: given to the geometry at the next update. */
|
|
57
|
-
const JOB_BAKED = 6;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Frames whose readback may be in flight before a frame's cut is skipped, as the bake's log: a mapping lands a frame or
|
|
61
|
-
* two after its copy, and past this the device is behind.
|
|
62
|
-
* @type {number}
|
|
63
|
-
*/
|
|
64
|
-
const MAX_FRAMES_IN_FLIGHT = 3;
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Geometries extracted at once: the jobs cut each frame until their cut stands nothing in. One whose proxy is built,
|
|
68
|
-
* baking or waiting to be given its cache keeps its slot until then.
|
|
69
|
-
* @type {number}
|
|
70
|
-
*/
|
|
71
|
-
const DEFAULT_JOB_CAPACITY = 32;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Entries the cluster list starts with: a cut of a typical geometry at half its cache's voxel is under 128 clusters
|
|
75
|
-
* (S8, step 0), for each of {@link DEFAULT_JOB_CAPACITY} jobs. It doubles past what a frame's cut took.
|
|
76
|
-
* @type {number}
|
|
77
|
-
*/
|
|
78
|
-
const INITIAL_CLUSTER_CAPACITY = DEFAULT_JOB_CAPACITY * 128;
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* One geometry being extracted.
|
|
82
|
-
*/
|
|
83
|
-
class VGeoSDFJob {
|
|
84
|
-
/**
|
|
85
|
-
* Bumped each time the slot takes a geometry: a readback of a frame cut for an earlier one is not this one's.
|
|
86
|
-
* @type {number}
|
|
87
|
-
*/
|
|
88
|
-
generation = 0;
|
|
89
|
-
|
|
90
|
-
phase = JOB_FREE;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* The geometry, whose cache is asked for.
|
|
94
|
-
* @type {GPUGeometryMetadata|null}
|
|
95
|
-
*/
|
|
96
|
-
record = null;
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* What puts its error against a τ of 1: one over half its cache's level-0 voxel, in its own units.
|
|
100
|
-
* @type {number}
|
|
101
|
-
*/
|
|
102
|
-
projection_k = 0;
|
|
103
|
-
|
|
104
|
-
/** What its last complete cut held. */
|
|
105
|
-
vertex_count = 0;
|
|
106
|
-
triangle_count = 0;
|
|
107
|
-
|
|
108
|
-
/** @type {Float32Array|null} */
|
|
109
|
-
positions = null;
|
|
110
|
-
|
|
111
|
-
/** @type {Uint32Array|null} */
|
|
112
|
-
indices = null;
|
|
113
|
-
|
|
114
|
-
/** @type {MeshletGeometry|null} */
|
|
115
|
-
proxy = null;
|
|
116
|
-
|
|
117
|
-
/** @type {GPUGeometryMetadata|null} */
|
|
118
|
-
proxy_record = null;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
9
|
/**
|
|
122
|
-
*
|
|
10
|
+
* A virtual geometry's stand-in, once applied.
|
|
123
11
|
*/
|
|
124
|
-
class
|
|
125
|
-
busy = false;
|
|
126
|
-
|
|
127
|
-
count = 0;
|
|
128
|
-
|
|
129
|
-
/** @type {VGeoSDFJob[]} */
|
|
130
|
-
jobs = [];
|
|
131
|
-
|
|
12
|
+
class VGeoProxyEntry {
|
|
132
13
|
/**
|
|
133
|
-
* @param {
|
|
14
|
+
* @param {GPUGeometryMetadata} record the virtual geometry's
|
|
15
|
+
* @param {MeshletGeometry} proxy
|
|
134
16
|
*/
|
|
135
|
-
constructor(
|
|
136
|
-
this.
|
|
137
|
-
this.
|
|
138
|
-
this.vertex_bases = new Uint32Array(capacity);
|
|
139
|
-
this.triangle_bases = new Uint32Array(capacity);
|
|
17
|
+
constructor(record, proxy) {
|
|
18
|
+
this.record = record;
|
|
19
|
+
this.proxy = proxy;
|
|
140
20
|
}
|
|
141
|
-
|
|
142
|
-
vertex_offset = 0;
|
|
143
|
-
index_offset = 0;
|
|
144
21
|
}
|
|
145
22
|
|
|
146
23
|
/**
|
|
147
|
-
* The geometry caches of virtual geometry (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §7.8,
|
|
148
|
-
* {@link
|
|
149
|
-
*
|
|
150
|
-
* the mesh path as any geometry is, and its resident cache adopted into the geometry. Its instances are then composed
|
|
151
|
-
* from it as a mesh's are.
|
|
24
|
+
* The geometry caches and cards of virtual geometry (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §7.8, §17).
|
|
25
|
+
* {@link GPUGeometrySDFManager} bakes a geometry's field from its tree and captures its cards through its meshlets, and
|
|
26
|
+
* a virtual geometry has neither.
|
|
152
27
|
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* its
|
|
28
|
+
* Each virtual geometry whose cache is asked for gets its proxy ({@link VirtualGeometry#get_proxy}): an ordinary
|
|
29
|
+
* geometry in the same local space, with its attributes. The proxy is added to the geometry manager and the virtual
|
|
30
|
+
* geometry aliased to it ({@link GPUGeometrySDFManager#alias}). From there the proxy is any geometry: the virtual
|
|
31
|
+
* geometry's holders hold its cache, baked from its tree, and the virtual geometry's card sets capture its layout,
|
|
32
|
+
* drawn through its meshlets with the virtual geometry's own materials.
|
|
157
33
|
*
|
|
158
|
-
* **The
|
|
159
|
-
*
|
|
160
|
-
* read back with that frame's counters. A frame that cut it otherwise (a page evicted since, the cut grown) is not
|
|
161
|
-
* taken, and the job is cut again.
|
|
34
|
+
* **The proxy's detail is its own**, not the cache's voxel's: a proxy coarser than the voxel bakes a coarser field and
|
|
35
|
+
* coarser cards than the asset would. A known discrepancy, kept: a hit on virtual geometry has a material at all.
|
|
162
36
|
*
|
|
163
|
-
*
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* A geometry no longer asked for when its turn comes is let go, and one whose holders ask again is extracted again.
|
|
169
|
-
* Settings that change the caches' voxel restart every job.
|
|
37
|
+
* A proxy is applied as it arrives, which is between frames: adding a geometry grows the geometry manager's buffers,
|
|
38
|
+
* which a frame's passes must not find replaced under them. A virtual geometry the geometry manager lets go takes its
|
|
39
|
+
* proxy with it; one let go before its proxy arrives has none applied. A proxy that cannot be had leaves its geometry
|
|
40
|
+
* waiting, black.
|
|
170
41
|
*/
|
|
171
42
|
export class VGeoSDFProxies {
|
|
172
43
|
|
|
173
|
-
/** @type {GPUDevice} */
|
|
174
|
-
#device;
|
|
175
|
-
|
|
176
|
-
/** @type {GPUVirtualGeometryRuntime} */
|
|
177
|
-
#runtime;
|
|
178
|
-
|
|
179
44
|
/** @type {GPUGeometryManager} */
|
|
180
45
|
#geometries;
|
|
181
46
|
|
|
@@ -183,700 +48,137 @@ export class VGeoSDFProxies {
|
|
|
183
48
|
#sdf;
|
|
184
49
|
|
|
185
50
|
/**
|
|
186
|
-
*
|
|
187
|
-
* @type {
|
|
51
|
+
* Virtual geometries whose proxy is asked for and has not arrived, by id.
|
|
52
|
+
* @type {Map<number, GPUGeometryMetadata>}
|
|
188
53
|
*/
|
|
189
|
-
#
|
|
190
|
-
|
|
191
|
-
/** @type {VGeoSDFJob[]} */
|
|
192
|
-
#jobs = [];
|
|
54
|
+
#asked = new Map();
|
|
193
55
|
|
|
194
56
|
/**
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
* @type {GPUGeometryMetadata[]}
|
|
57
|
+
* Proxies applied, by the virtual geometry's id.
|
|
58
|
+
* @type {Map<number, VGeoProxyEntry>}
|
|
198
59
|
*/
|
|
199
|
-
#
|
|
200
|
-
|
|
201
|
-
/** @type {VGeoSDFFrame[]} */
|
|
202
|
-
#frames = [];
|
|
203
|
-
|
|
204
|
-
#cluster_capacity = INITIAL_CLUSTER_CAPACITY;
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* The frame's jobs as the passes read them, `VGEO_SDF_JOB_STRUCT` each.
|
|
208
|
-
* @type {GPUBuffer}
|
|
209
|
-
*/
|
|
210
|
-
#jobs_buffer;
|
|
211
|
-
|
|
212
|
-
#jobs_scratch;
|
|
213
|
-
|
|
214
|
-
#settings = { job_count: 0, cluster_capacity: 0, vertex_offset: 0, index_offset: 0 };
|
|
215
|
-
|
|
216
|
-
#collect_data = { instances: -1, claim_widths: -1 };
|
|
217
|
-
#collect_bindings = {};
|
|
218
|
-
#decode_data = { command: -1, clusters: -1, counters: -1, payload: -1 };
|
|
219
|
-
#decode_bindings = {};
|
|
220
|
-
#header_data = { counters: -1, feedback: -1, payload: -1 };
|
|
221
|
-
|
|
222
|
-
/** Where the extraction's slot keeps its counters in the frame's feedback, for the frame being recorded. */
|
|
223
|
-
#stats_base = 0;
|
|
60
|
+
#applied = new Map();
|
|
224
61
|
|
|
225
|
-
#
|
|
226
|
-
#max_bricks;
|
|
227
|
-
|
|
228
|
-
#layout = new MeshSDFLayout();
|
|
229
|
-
|
|
230
|
-
#clusterizer_ready = false;
|
|
231
|
-
|
|
232
|
-
#extracted_count = 0;
|
|
233
|
-
#adopted_count = 0;
|
|
234
|
-
#triangles_extracted = 0;
|
|
62
|
+
#failed_count = 0;
|
|
235
63
|
|
|
236
64
|
#destroyed = false;
|
|
237
65
|
|
|
238
66
|
/**
|
|
239
67
|
* @param {Object} options
|
|
240
|
-
* @param {GPUDevice} options.device
|
|
241
|
-
* @param {GPUVirtualGeometryRuntime} options.runtime whose geometries' caches this makes
|
|
242
68
|
* @param {GPUGeometryManager} options.geometries the scene's, whose caches the virtual geometries' are
|
|
243
|
-
* @param {number} [options.job_capacity] geometries extracted at once
|
|
244
69
|
*/
|
|
245
|
-
constructor({
|
|
246
|
-
assert.defined(device, 'device');
|
|
247
|
-
assert.defined(runtime, 'runtime');
|
|
70
|
+
constructor({ geometries }) {
|
|
248
71
|
assert.defined(geometries, 'geometries');
|
|
249
|
-
assert.isPositiveInteger(job_capacity, 'job_capacity');
|
|
250
72
|
|
|
251
|
-
this.#device = device;
|
|
252
|
-
this.#runtime = runtime;
|
|
253
73
|
this.#geometries = geometries;
|
|
254
74
|
this.#sdf = geometries.sdf;
|
|
255
|
-
this.#cut = new VGeoViewCut({ device, label: 'vgeo sdf proxies' });
|
|
256
|
-
|
|
257
|
-
this.#voxel_size = this.#sdf.voxel_size;
|
|
258
|
-
this.#max_bricks = this.#sdf.max_bricks;
|
|
259
|
-
|
|
260
|
-
for (let i = 0; i < job_capacity; i++) {
|
|
261
|
-
this.#jobs.push(new VGeoSDFJob());
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
for (let i = 0; i < MAX_FRAMES_IN_FLIGHT; i++) {
|
|
265
|
-
this.#frames.push(new VGeoSDFFrame(job_capacity));
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
this.#jobs_buffer = device.createBuffer(BufferDescriptor.fromJSON({
|
|
269
|
-
label: 'VGeoSDFProxies/jobs',
|
|
270
|
-
size: job_capacity * VGEO_SDF_JOB_STRUCT.size,
|
|
271
|
-
usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST,
|
|
272
|
-
}));
|
|
273
|
-
|
|
274
|
-
this.#jobs_scratch = new DataView(new ArrayBuffer(job_capacity * VGEO_SDF_JOB_STRUCT.size));
|
|
275
|
-
|
|
276
|
-
const ready = MeshoptClusterizer.ready;
|
|
277
|
-
|
|
278
|
-
if (ready === undefined) {
|
|
279
|
-
this.#clusterizer_ready = true;
|
|
280
|
-
} else {
|
|
281
|
-
ready.then(() => {
|
|
282
|
-
this.#clusterizer_ready = true;
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
this.#sdf.onRequested.add(this.#requested_one, this);
|
|
287
|
-
this.#sdf.onBaked.add(this.#baked, this);
|
|
288
|
-
this.#sdf.add_source(this);
|
|
289
|
-
}
|
|
290
75
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
* @returns {VGeoViewCut}
|
|
294
|
-
*/
|
|
295
|
-
get cut() {
|
|
296
|
-
return this.#cut;
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
/**
|
|
300
|
-
* Geometries being extracted.
|
|
301
|
-
* @returns {number}
|
|
302
|
-
*/
|
|
303
|
-
get job_count() {
|
|
304
|
-
let count = 0;
|
|
305
|
-
|
|
306
|
-
for (const job of this.#jobs) {
|
|
307
|
-
if (job.phase !== JOB_FREE) {
|
|
308
|
-
count++;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
return count;
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Geometries asked for that wait for a job, those let go since included.
|
|
317
|
-
* @returns {number}
|
|
318
|
-
*/
|
|
319
|
-
get requested_count() {
|
|
320
|
-
return this.#requested.length;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Proxies built so far.
|
|
325
|
-
* @returns {number}
|
|
326
|
-
*/
|
|
327
|
-
get extracted_count() {
|
|
328
|
-
return this.#extracted_count;
|
|
76
|
+
this.#sdf.onRequested.add(this.#requested, this);
|
|
77
|
+
this.#sdf.onForgotten.add(this.#forgotten, this);
|
|
329
78
|
}
|
|
330
79
|
|
|
331
80
|
/**
|
|
332
|
-
*
|
|
81
|
+
* Virtual geometries whose proxy is asked for and has not arrived.
|
|
333
82
|
* @returns {number}
|
|
334
83
|
*/
|
|
335
|
-
get
|
|
336
|
-
return this.#
|
|
84
|
+
get pending_count() {
|
|
85
|
+
return this.#asked.size;
|
|
337
86
|
}
|
|
338
87
|
|
|
339
88
|
/**
|
|
340
|
-
*
|
|
89
|
+
* Virtual geometries standing in through their proxy.
|
|
341
90
|
* @returns {number}
|
|
342
91
|
*/
|
|
343
|
-
get
|
|
344
|
-
return this.#
|
|
92
|
+
get applied_count() {
|
|
93
|
+
return this.#applied.size;
|
|
345
94
|
}
|
|
346
95
|
|
|
347
96
|
/**
|
|
348
|
-
*
|
|
97
|
+
* Proxies that could not be had.
|
|
349
98
|
* @returns {number}
|
|
350
99
|
*/
|
|
351
|
-
get
|
|
352
|
-
return this.#
|
|
353
|
-
}
|
|
354
|
-
|
|
355
|
-
/**
|
|
356
|
-
* @param {GPUGeometryMetadata} record
|
|
357
|
-
*/
|
|
358
|
-
#requested_one(record) {
|
|
359
|
-
if (record.vg_row !== VGEO_GEOMETRY_ROW_NONE) {
|
|
360
|
-
this.#requested.push(record);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* @param {number} id
|
|
366
|
-
*/
|
|
367
|
-
#baked(id) {
|
|
368
|
-
for (const job of this.#jobs) {
|
|
369
|
-
if (job.phase === JOB_BAKING && job.proxy_record.index === id) {
|
|
370
|
-
job.phase = JOB_BAKED;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
100
|
+
get failed_count() {
|
|
101
|
+
return this.#failed_count;
|
|
373
102
|
}
|
|
374
103
|
|
|
375
104
|
/**
|
|
376
|
-
* The
|
|
377
|
-
* started, and the jobs' cut recorded into `graph` while the runtime's frame is open.
|
|
105
|
+
* The proxy a virtual geometry stands in through, once applied.
|
|
378
106
|
*
|
|
379
|
-
* @param {
|
|
380
|
-
|
|
381
|
-
graph_update(graph) {
|
|
382
|
-
assert.notOk(this.#destroyed, 'destroyed');
|
|
383
|
-
|
|
384
|
-
const sdf = this.#sdf;
|
|
385
|
-
|
|
386
|
-
if (sdf.voxel_size !== this.#voxel_size || sdf.max_bricks !== this.#max_bricks) {
|
|
387
|
-
// a cut for the old voxel bakes a proxy finer or coarser than the cache it is for
|
|
388
|
-
this.#restart();
|
|
389
|
-
|
|
390
|
-
this.#voxel_size = sdf.voxel_size;
|
|
391
|
-
this.#max_bricks = sdf.max_bricks;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
this.#adopt();
|
|
395
|
-
this.#build();
|
|
396
|
-
this.#start();
|
|
397
|
-
|
|
398
|
-
if (this.#runtime.frame_open) {
|
|
399
|
-
this.#record(graph);
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Give each geometry whose proxy is baked its cache, and remove the proxy.
|
|
107
|
+
* @param {GPUGeometryMetadata} record the virtual geometry's
|
|
108
|
+
* @returns {MeshletGeometry|undefined}
|
|
405
109
|
*/
|
|
406
|
-
|
|
407
|
-
const
|
|
408
|
-
|
|
409
|
-
for (const job of this.#jobs) {
|
|
410
|
-
if (job.phase !== JOB_BAKED) {
|
|
411
|
-
continue;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
if (sdf.adopt(job.record, job.proxy_record)) {
|
|
415
|
-
this.#adopted_count++;
|
|
416
|
-
} else if (sdf.is_requested(job.record)) {
|
|
417
|
-
// the proxy's cache is not the one it was baked to: a proxy equal to another's is that one's record
|
|
418
|
-
this.#requested.push(job.record);
|
|
419
|
-
}
|
|
110
|
+
proxy_of(record) {
|
|
111
|
+
const entry = this.#applied.get(record.index);
|
|
420
112
|
|
|
421
|
-
|
|
422
|
-
}
|
|
113
|
+
return entry !== undefined && entry.record === record ? entry.proxy : undefined;
|
|
423
114
|
}
|
|
424
115
|
|
|
425
116
|
/**
|
|
426
|
-
*
|
|
117
|
+
* @param {GPUGeometryMetadata} record
|
|
427
118
|
*/
|
|
428
|
-
#
|
|
429
|
-
|
|
430
|
-
return;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
const sdf = this.#sdf;
|
|
434
|
-
|
|
435
|
-
for (const job of this.#jobs) {
|
|
436
|
-
if (job.phase !== JOB_BUILD) {
|
|
437
|
-
continue;
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
if (!sdf.is_requested(job.record)) {
|
|
441
|
-
// let go since its cut was taken
|
|
442
|
-
this.#free(job);
|
|
443
|
-
continue;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
const mesh = new Geometry();
|
|
447
|
-
|
|
448
|
-
mesh.name = 'vgeo sdf proxy';
|
|
449
|
-
mesh.index = Attribute.from(job.indices, 1, StandardAttributes.Index);
|
|
450
|
-
mesh.addAttribute(Attribute.from(job.positions, 3, StandardAttributes.Position));
|
|
451
|
-
|
|
452
|
-
const proxy = meshlet_geometry_build_from_geometry(mesh);
|
|
453
|
-
|
|
454
|
-
this.#geometries.add(proxy);
|
|
455
|
-
|
|
456
|
-
job.proxy = proxy;
|
|
457
|
-
job.proxy_record = this.#geometries.get_metadata(proxy);
|
|
458
|
-
job.positions = null;
|
|
459
|
-
job.indices = null;
|
|
460
|
-
job.phase = JOB_BAKING;
|
|
461
|
-
|
|
462
|
-
this.#extracted_count++;
|
|
463
|
-
this.#triangles_extracted += job.triangle_count;
|
|
464
|
-
|
|
465
|
-
sdf.acquire(job.proxy_record, sdf.holds_two_sided(job.record));
|
|
466
|
-
|
|
467
|
-
if (sdf.state_of(job.proxy_record) === MeshSDFState.Resident) {
|
|
468
|
-
// a record a resident proxy of the same mesh already had
|
|
469
|
-
job.phase = JOB_BAKED;
|
|
470
|
-
}
|
|
119
|
+
#requested(record) {
|
|
120
|
+
const geometry = record.geometry;
|
|
471
121
|
|
|
122
|
+
if (geometry?.isVirtualGeometry !== true) {
|
|
472
123
|
return;
|
|
473
124
|
}
|
|
474
|
-
}
|
|
475
|
-
|
|
476
|
-
/**
|
|
477
|
-
* Give the free slots the geometries asked for, in the order asked.
|
|
478
|
-
*/
|
|
479
|
-
#start() {
|
|
480
|
-
const sdf = this.#sdf;
|
|
481
|
-
const requested = this.#requested;
|
|
482
|
-
const layout = this.#layout;
|
|
483
|
-
|
|
484
|
-
let taken = 0;
|
|
485
125
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
continue;
|
|
489
|
-
}
|
|
126
|
+
// asked again before it arrives, the proxy is the same promise's, and arrives twice: the second finds it applied
|
|
127
|
+
this.#asked.set(record.index, record);
|
|
490
128
|
|
|
491
|
-
|
|
492
|
-
|
|
129
|
+
geometry.get_proxy().then(
|
|
130
|
+
proxy => this.#arrived(record, proxy),
|
|
131
|
+
error => {
|
|
132
|
+
if (this.#asked.get(record.index) === record) {
|
|
133
|
+
this.#asked.delete(record.index);
|
|
134
|
+
this.#failed_count++;
|
|
493
135
|
|
|
494
|
-
|
|
495
|
-
continue;
|
|
136
|
+
console.warn('vgeo: no proxy, the geometry has no cache or cards', error);
|
|
496
137
|
}
|
|
497
|
-
|
|
498
|
-
layout.compute(record.geometry.bounding_box, sdf.voxel_size, sdf.max_bricks);
|
|
499
|
-
|
|
500
|
-
job.generation++;
|
|
501
|
-
job.record = record;
|
|
502
|
-
job.projection_k = 1 / (0.5 * layout.voxel);
|
|
503
|
-
job.phase = JOB_CUT;
|
|
504
|
-
|
|
505
|
-
break;
|
|
506
138
|
}
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
requested.copyWithin(0, taken);
|
|
510
|
-
requested.length -= taken;
|
|
139
|
+
);
|
|
511
140
|
}
|
|
512
141
|
|
|
513
142
|
/**
|
|
514
143
|
* @param {GPUGeometryMetadata} record
|
|
515
|
-
* @
|
|
516
|
-
*/
|
|
517
|
-
#extracting(record) {
|
|
518
|
-
for (const job of this.#jobs) {
|
|
519
|
-
if (job.phase !== JOB_FREE && job.record === record) {
|
|
520
|
-
return true;
|
|
521
|
-
}
|
|
522
|
-
}
|
|
523
|
-
|
|
524
|
-
return false;
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
/**
|
|
528
|
-
* Let every job go, and ask again for the geometries still asked for.
|
|
529
|
-
*/
|
|
530
|
-
#restart() {
|
|
531
|
-
for (const job of this.#jobs) {
|
|
532
|
-
if (job.phase === JOB_FREE) {
|
|
533
|
-
continue;
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
if (this.#sdf.is_requested(job.record)) {
|
|
537
|
-
this.#requested.push(job.record);
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
this.#free(job);
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
/**
|
|
545
|
-
* @param {VGeoSDFJob} job
|
|
546
|
-
*/
|
|
547
|
-
#free(job) {
|
|
548
|
-
if (job.proxy !== null) {
|
|
549
|
-
this.#geometries.remove(job.proxy);
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
job.phase = JOB_FREE;
|
|
553
|
-
job.record = null;
|
|
554
|
-
job.positions = null;
|
|
555
|
-
job.indices = null;
|
|
556
|
-
job.proxy = null;
|
|
557
|
-
job.proxy_record = null;
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
/**
|
|
561
|
-
* @returns {VGeoSDFFrame|null}
|
|
562
|
-
*/
|
|
563
|
-
#take_frame() {
|
|
564
|
-
for (const frame of this.#frames) {
|
|
565
|
-
if (!frame.busy) {
|
|
566
|
-
return frame;
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
|
|
570
|
-
return null;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* Record the cut of the jobs that cut, and the write-out of those whose last cut stood nothing in.
|
|
575
|
-
*
|
|
576
|
-
* @param {FrameGraph} graph
|
|
144
|
+
* @param {MeshletGeometry} proxy
|
|
577
145
|
*/
|
|
578
|
-
#record
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
if (frame === null) {
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
const runtime = this.#runtime;
|
|
586
|
-
const view = this.#jobs_scratch;
|
|
587
|
-
const stride = VGEO_SDF_JOB_STRUCT.size;
|
|
588
|
-
|
|
589
|
-
let count = 0;
|
|
590
|
-
let vertices = 0;
|
|
591
|
-
let triangles = 0;
|
|
592
|
-
|
|
593
|
-
for (const job of this.#jobs) {
|
|
594
|
-
if (job.phase !== JOB_CUT && job.phase !== JOB_READY) {
|
|
595
|
-
continue;
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
if (!this.#sdf.is_requested(job.record)) {
|
|
599
|
-
// let go since it was asked for: dropped, or forgotten
|
|
600
|
-
this.#free(job);
|
|
601
|
-
continue;
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
const decode = job.phase === JOB_READY;
|
|
605
|
-
const at = count * stride;
|
|
606
|
-
|
|
607
|
-
frame.jobs[count] = job;
|
|
608
|
-
frame.generations[count] = job.generation;
|
|
609
|
-
frame.decoding[count] = decode ? 1 : 0;
|
|
610
|
-
frame.vertex_bases[count] = vertices;
|
|
611
|
-
frame.triangle_bases[count] = triangles;
|
|
612
|
-
|
|
613
|
-
view.setUint32(at + VGEO_SDF_JOB_STRUCT.get("vg_row").offset, job.record.vg_row, true);
|
|
614
|
-
view.setFloat32(at + VGEO_SDF_JOB_STRUCT.get("projection_k").offset, job.projection_k, true);
|
|
615
|
-
view.setUint32(at + VGEO_SDF_JOB_STRUCT.get("decode").offset, decode ? 1 : 0, true);
|
|
616
|
-
view.setUint32(at + VGEO_SDF_JOB_STRUCT.get("vertex_base").offset, vertices, true);
|
|
617
|
-
view.setUint32(at + VGEO_SDF_JOB_STRUCT.get("triangle_base").offset, triangles, true);
|
|
618
|
-
view.setUint32(at + VGEO_SDF_JOB_STRUCT.get("vertex_count").offset, decode ? job.vertex_count : 0, true);
|
|
619
|
-
view.setUint32(at + VGEO_SDF_JOB_STRUCT.get("triangle_count").offset, decode ? job.triangle_count : 0, true);
|
|
620
|
-
|
|
621
|
-
if (decode) {
|
|
622
|
-
vertices += job.vertex_count;
|
|
623
|
-
triangles += job.triangle_count;
|
|
624
|
-
job.phase = JOB_DECODING;
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
count++;
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
if (count === 0) {
|
|
146
|
+
#arrived(record, proxy) {
|
|
147
|
+
if (this.#asked.get(record.index) !== record) {
|
|
148
|
+
// let go since it was asked for, or applied already
|
|
631
149
|
return;
|
|
632
150
|
}
|
|
633
151
|
|
|
634
|
-
|
|
635
|
-
frame.count = count;
|
|
636
|
-
|
|
637
|
-
const header_words = vgeo_sdf_header_words(count);
|
|
638
|
-
|
|
639
|
-
frame.vertex_offset = header_words;
|
|
640
|
-
frame.index_offset = header_words + 3 * vertices;
|
|
641
|
-
|
|
642
|
-
const payload_bytes = 4 * (frame.index_offset + 3 * triangles);
|
|
643
|
-
|
|
644
|
-
this.#device.queue.writeBuffer(this.#jobs_buffer, 0, view.buffer, 0, count * stride);
|
|
645
|
-
|
|
646
|
-
const settings = this.#settings;
|
|
647
|
-
|
|
648
|
-
settings.job_count = count;
|
|
649
|
-
settings.cluster_capacity = this.#cluster_capacity;
|
|
650
|
-
settings.vertex_offset = frame.vertex_offset;
|
|
651
|
-
settings.index_offset = frame.index_offset;
|
|
652
|
-
|
|
653
|
-
// this frame's slot for the cut, and its params: a τ of 1, since its records carry the error's own scale
|
|
654
|
-
const slot = runtime.slot_of(this.#cut);
|
|
655
|
-
|
|
656
|
-
this.#cut.write_params({ runtime, slot, tau: 1 });
|
|
657
|
-
this.#stats_base = vgeo_feedback_slot_stats(slot);
|
|
658
|
-
|
|
659
|
-
// ----- the records: a job's geometry whole, then their claim widths scanned -----
|
|
660
|
-
|
|
661
|
-
const collect_data = this.#collect_data;
|
|
662
|
-
const collect = graph.add("VGeo SDF Collect", collect_data, this.#execute_collect);
|
|
152
|
+
this.#asked.delete(record.index);
|
|
663
153
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
));
|
|
667
|
-
collect_data.claim_widths = collect.create("vgeo sdf claim widths", BufferResourceDescriptor.from(
|
|
668
|
-
16 + count * 4, GPUBufferUsage.STORAGE, 0, 16
|
|
669
|
-
));
|
|
154
|
+
this.#geometries.add(proxy);
|
|
155
|
+
this.#applied.set(record.index, new VGeoProxyEntry(record, proxy));
|
|
670
156
|
|
|
671
|
-
|
|
672
|
-
graph,
|
|
673
|
-
input: collect_data.claim_widths,
|
|
674
|
-
output: graph_create_buffer(graph, "vgeo sdf claim offsets", prefix_scan_csdldf_output_descriptor(count)),
|
|
675
|
-
element_max_count: count,
|
|
676
|
-
});
|
|
677
|
-
|
|
678
|
-
// ----- the cut: the camera cut's own descent, its clusters onto the list -----
|
|
679
|
-
|
|
680
|
-
const counters = graph_create_buffer(graph, "vgeo sdf counters", BufferResourceDescriptor.empty(
|
|
681
|
-
count * VGEO_SDF_COUNTER_WORDS * 4, GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC
|
|
682
|
-
));
|
|
683
|
-
const clusters = graph_create_buffer(graph, "vgeo sdf clusters", BufferResourceDescriptor.from(
|
|
684
|
-
16 + this.#cluster_capacity * VGEO_SDF_CLUSTER_WORDS * 4, GPUBufferUsage.STORAGE, 0, 16
|
|
685
|
-
));
|
|
686
|
-
|
|
687
|
-
const descent = graph_vgeo_cut_descent({
|
|
688
|
-
graph,
|
|
689
|
-
runtime,
|
|
690
|
-
cut: this.#cut,
|
|
691
|
-
instances: collect_data.instances,
|
|
692
|
-
prefix_sums,
|
|
693
|
-
feedback: runtime.feedback_in(graph),
|
|
694
|
-
traverse: shader_vgeo_sdf_traverse,
|
|
695
|
-
bindings: { settings },
|
|
696
|
-
outputs: { vgeo_sdf_counters: counters, vgeo_sdf_clusters: clusters },
|
|
697
|
-
});
|
|
698
|
-
|
|
699
|
-
runtime.publish_feedback(graph, descent.feedback);
|
|
700
|
-
|
|
701
|
-
// ----- the write-out: a workgroup a listed cluster, every job's sizes and the ready jobs' meshes -----
|
|
702
|
-
|
|
703
|
-
const command = graph_build_indirect_dispatch_command(graph, descent.outputs.vgeo_sdf_clusters, 1, true);
|
|
704
|
-
|
|
705
|
-
const decode_data = this.#decode_data;
|
|
706
|
-
const decode = graph.add("VGeo SDF Decode", decode_data, this.#execute_decode);
|
|
707
|
-
|
|
708
|
-
decode_data.command = decode.read(command);
|
|
709
|
-
decode_data.clusters = decode.read(descent.outputs.vgeo_sdf_clusters);
|
|
710
|
-
decode_data.counters = decode.write(descent.outputs.vgeo_sdf_counters);
|
|
711
|
-
decode_data.payload = decode.create("vgeo sdf payload", BufferResourceDescriptor.from(
|
|
712
|
-
payload_bytes, GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST
|
|
713
|
-
));
|
|
714
|
-
|
|
715
|
-
// ----- the header: the jobs' counters and the cut's own, ahead of the meshes, then read back -----
|
|
716
|
-
|
|
717
|
-
const header_data = this.#header_data;
|
|
718
|
-
const header = graph.add("VGeo SDF Header", header_data, this.#execute_header);
|
|
719
|
-
|
|
720
|
-
header_data.counters = header.read(decode_data.counters);
|
|
721
|
-
header_data.feedback = header.read(descent.feedback);
|
|
722
|
-
header_data.payload = header.write(decode_data.payload);
|
|
723
|
-
|
|
724
|
-
graph_read_buffer({ graph, buffer: header_data.payload, offset: 0, size: payload_bytes })
|
|
725
|
-
.then(reference => {
|
|
726
|
-
try {
|
|
727
|
-
if (!this.#destroyed) {
|
|
728
|
-
this.#apply(new Uint32Array(reference.getValue()), frame);
|
|
729
|
-
}
|
|
730
|
-
} finally {
|
|
731
|
-
reference.release();
|
|
732
|
-
}
|
|
733
|
-
})
|
|
734
|
-
.catch(error => {
|
|
735
|
-
if (!this.#destroyed) {
|
|
736
|
-
console.warn('VGeoSDFProxies: readback failed', error);
|
|
737
|
-
this.#lose(frame);
|
|
738
|
-
}
|
|
739
|
-
})
|
|
740
|
-
.finally(() => {
|
|
741
|
-
frame.busy = false;
|
|
742
|
-
});
|
|
157
|
+
this.#sdf.alias(record, this.#geometries.get_metadata(proxy));
|
|
743
158
|
}
|
|
744
159
|
|
|
745
|
-
#execute_collect = (data, resources, execution) => {
|
|
746
|
-
const b = this.#collect_bindings;
|
|
747
|
-
|
|
748
|
-
b.settings = this.#settings;
|
|
749
|
-
b.vgeo_sdf_jobs = this.#jobs_buffer;
|
|
750
|
-
b.vg_geometries = this.#runtime.pool.buffer_geometries;
|
|
751
|
-
b.instances = resources.get(data.instances);
|
|
752
|
-
b.claim_widths = resources.get(data.claim_widths);
|
|
753
|
-
|
|
754
|
-
shader_vgeo_sdf_collect.dispatch({
|
|
755
|
-
encoder: execution.encoder,
|
|
756
|
-
group_count_x: Math.ceil(this.#settings.job_count / VGEO_SDF_COLLECT_WORKGROUP_SIZE),
|
|
757
|
-
bindings: b,
|
|
758
|
-
});
|
|
759
|
-
};
|
|
760
|
-
|
|
761
|
-
#execute_decode = (data, resources, execution) => {
|
|
762
|
-
const meshlets = this.#geometries.meshlets;
|
|
763
|
-
const b = this.#decode_bindings;
|
|
764
|
-
|
|
765
|
-
b.settings = this.#settings;
|
|
766
|
-
b.vgeo_sdf_jobs = this.#jobs_buffer;
|
|
767
|
-
b.vgeo_sdf_counters = resources.get(data.counters);
|
|
768
|
-
b.vgeo_sdf_clusters = resources.get(data.clusters);
|
|
769
|
-
b.meshlet_metadata = meshlets.buffer_metadata;
|
|
770
|
-
b.meshlet_data = meshlets.buffer_data;
|
|
771
|
-
b.vgeo_sdf_payload = resources.get(data.payload);
|
|
772
|
-
|
|
773
|
-
shader_vgeo_sdf_decode.dispatchIndirect({
|
|
774
|
-
encoder: execution.encoder,
|
|
775
|
-
command: resources.get(data.command),
|
|
776
|
-
command_offset: 0,
|
|
777
|
-
bindings: b,
|
|
778
|
-
});
|
|
779
|
-
};
|
|
780
|
-
|
|
781
|
-
#execute_header = (data, resources, execution) => {
|
|
782
|
-
const encoder = execution.encoder;
|
|
783
|
-
const payload = resources.get(data.payload);
|
|
784
|
-
const counter_bytes = 4 * this.#settings.job_count * VGEO_SDF_COUNTER_WORDS;
|
|
785
|
-
|
|
786
|
-
encoder.copyBufferToBuffer(resources.get(data.counters), 0, payload, 0, counter_bytes);
|
|
787
|
-
encoder.copyBufferToBuffer(resources.get(data.feedback), 4 * this.#stats_base, payload, counter_bytes, 4 * VGEO_CUT_STAT_COUNT);
|
|
788
|
-
};
|
|
789
|
-
|
|
790
160
|
/**
|
|
791
|
-
*
|
|
792
|
-
*
|
|
793
|
-
* @param {Uint32Array} words
|
|
794
|
-
* @param {VGeoSDFFrame} frame
|
|
161
|
+
* @param {GPUGeometryMetadata} record
|
|
795
162
|
*/
|
|
796
|
-
#
|
|
797
|
-
const
|
|
798
|
-
|
|
799
|
-
// a subtree the cut left undescended is missing from every job's list, and no counter of a job says which
|
|
800
|
-
const holes = words[stats + VGEO_CUT_STAT.QUEUE_DROPPED] > 0
|
|
801
|
-
|| words[stats + VGEO_CUT_STAT.QUEUE_REMAINING] > 0
|
|
802
|
-
|| words[stats + VGEO_CUT_STAT.INSTANCES_DROPPED] > 0;
|
|
803
|
-
|
|
804
|
-
let taken = 0;
|
|
805
|
-
let dropped = false;
|
|
806
|
-
|
|
807
|
-
for (let i = 0; i < frame.count; i++) {
|
|
808
|
-
const job = frame.jobs[i];
|
|
809
|
-
const c = i * VGEO_SDF_COUNTER_WORDS;
|
|
810
|
-
|
|
811
|
-
taken += words[c + VGEO_SDF_COUNTER.TAKEN];
|
|
812
|
-
dropped ||= words[c + VGEO_SDF_COUNTER.DROPPED] > 0;
|
|
813
|
-
|
|
814
|
-
if (job.generation !== frame.generations[i]) {
|
|
815
|
-
// the slot holds another geometry now
|
|
816
|
-
continue;
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
const complete = !holes
|
|
820
|
-
&& words[c + VGEO_SDF_COUNTER.TAKEN] > 0
|
|
821
|
-
&& words[c + VGEO_SDF_COUNTER.STAND_INS] === 0
|
|
822
|
-
&& words[c + VGEO_SDF_COUNTER.DROPPED] === 0;
|
|
823
|
-
|
|
824
|
-
if (frame.decoding[i] === 0) {
|
|
825
|
-
if (job.phase === JOB_CUT && complete) {
|
|
826
|
-
job.vertex_count = words[c + VGEO_SDF_COUNTER.VERTICES];
|
|
827
|
-
job.triangle_count = words[c + VGEO_SDF_COUNTER.TRIANGLES];
|
|
828
|
-
job.phase = JOB_READY;
|
|
829
|
-
}
|
|
830
|
-
|
|
831
|
-
continue;
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
if (job.phase !== JOB_DECODING) {
|
|
835
|
-
continue;
|
|
836
|
-
}
|
|
163
|
+
#forgotten(record) {
|
|
164
|
+
const id = record.index;
|
|
837
165
|
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
&& words[c + VGEO_SDF_COUNTER.TRIANGLES] === job.triangle_count
|
|
841
|
-
&& words[c + VGEO_SDF_COUNTER.VERTICES_WRITTEN] === job.vertex_count
|
|
842
|
-
&& words[c + VGEO_SDF_COUNTER.TRIANGLES_WRITTEN] === job.triangle_count;
|
|
843
|
-
|
|
844
|
-
if (!whole) {
|
|
845
|
-
// cut otherwise than the cut its room was made for
|
|
846
|
-
job.phase = JOB_CUT;
|
|
847
|
-
continue;
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
const first_vertex = frame.vertex_offset + 3 * frame.vertex_bases[i];
|
|
851
|
-
const first_index = frame.index_offset + 3 * frame.triangle_bases[i];
|
|
852
|
-
|
|
853
|
-
job.positions = new Float32Array(words.buffer, words.byteOffset + 4 * first_vertex, 3 * job.vertex_count).slice();
|
|
854
|
-
job.indices = words.slice(first_index, first_index + 3 * job.triangle_count);
|
|
855
|
-
job.phase = JOB_BUILD;
|
|
166
|
+
if (this.#asked.get(id) === record) {
|
|
167
|
+
this.#asked.delete(id);
|
|
856
168
|
}
|
|
857
169
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
170
|
+
const entry = this.#applied.get(id);
|
|
171
|
+
|
|
172
|
+
if (entry !== undefined && entry.record === record) {
|
|
173
|
+
this.#applied.delete(id);
|
|
174
|
+
this.#geometries.remove(entry.proxy);
|
|
862
175
|
}
|
|
863
176
|
}
|
|
864
177
|
|
|
865
178
|
/**
|
|
866
|
-
*
|
|
867
|
-
*
|
|
868
|
-
* @param {VGeoSDFFrame} frame
|
|
179
|
+
* Hear no more of the caches. The proxies applied stay with the geometry manager, as stand-ins their geometries
|
|
180
|
+
* are aliased to: removing one under its alias would leave its geometry's holders holding a geometry let go.
|
|
869
181
|
*/
|
|
870
|
-
#lose(frame) {
|
|
871
|
-
for (let i = 0; i < frame.count; i++) {
|
|
872
|
-
const job = frame.jobs[i];
|
|
873
|
-
|
|
874
|
-
if (frame.decoding[i] === 1 && job.generation === frame.generations[i] && job.phase === JOB_DECODING) {
|
|
875
|
-
job.phase = JOB_CUT;
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
}
|
|
879
|
-
|
|
880
182
|
destroy() {
|
|
881
183
|
if (this.#destroyed) {
|
|
882
184
|
return;
|
|
@@ -886,17 +188,10 @@ export class VGeoSDFProxies {
|
|
|
886
188
|
|
|
887
189
|
const sdf = this.#sdf;
|
|
888
190
|
|
|
889
|
-
sdf.
|
|
890
|
-
sdf.
|
|
891
|
-
sdf.onBaked.remove(this.#baked, this);
|
|
892
|
-
|
|
893
|
-
for (const job of this.#jobs) {
|
|
894
|
-
this.#free(job);
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
this.#requested.length = 0;
|
|
191
|
+
sdf.onRequested.remove(this.#requested, this);
|
|
192
|
+
sdf.onForgotten.remove(this.#forgotten, this);
|
|
898
193
|
|
|
899
|
-
this.#
|
|
900
|
-
this.#
|
|
194
|
+
this.#applied.clear();
|
|
195
|
+
this.#asked.clear();
|
|
901
196
|
}
|
|
902
197
|
}
|