@woosh/meep-engine 3.64.1 → 3.67.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 +85 -0
- package/build/bundle-worker-image-decoder.js +1 -1
- package/build/bundle-worker-terrain.js +1 -1
- package/package.json +1 -1
- package/src/core/binary/BinaryBuffer.d.ts +5 -0
- package/src/core/binary/BinaryBuffer.d.ts.map +1 -1
- package/src/core/binary/BinaryBuffer.js +39 -5
- package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts +65 -6
- package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_boundary_loop.js +451 -101
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts +4 -2
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_close_boundary_holes.js +4 -2
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts +8 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_fill_small_holes.js +45 -10
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.d.ts.map +1 -1
- package/src/core/geom/3d/topology/struct/binary/query/bt_mesh_face_find_path_polyanya.js +237 -119
- package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts +143 -0
- package/src/engine/graphics/ecs/grass/GrassSpecies.d.ts.map +1 -0
- package/src/engine/graphics/ecs/grass/GrassSpecies.js +189 -0
- package/src/engine/graphics/ecs/grass/GrassSurface.d.ts +25 -0
- package/src/engine/graphics/ecs/grass/GrassSurface.d.ts.map +1 -0
- package/src/engine/graphics/ecs/grass/GrassSurface.js +32 -0
- package/src/engine/graphics/ecs/grass/GroundCover.d.ts +68 -0
- package/src/engine/graphics/ecs/grass/GroundCover.d.ts.map +1 -0
- package/src/engine/graphics/ecs/grass/GroundCover.js +85 -0
- package/src/engine/graphics3/GrassSurfaceSystem.d.ts +153 -0
- package/src/engine/graphics3/GrassSurfaceSystem.d.ts.map +1 -0
- package/src/engine/graphics3/GrassSurfaceSystem.js +1076 -0
- package/src/engine/graphics3/GroundCoverSystem.d.ts +33 -0
- package/src/engine/graphics3/GroundCoverSystem.d.ts.map +1 -0
- package/src/engine/graphics3/GroundCoverSystem.js +58 -0
- package/src/engine/network/NetworkSession.d.ts.map +1 -1
- package/src/engine/network/NetworkSession.js +372 -110
- package/src/engine/network/orchestrator/NetworkPeer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/NetworkPeer.js +6 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeClient.js +9 -2
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.d.ts.map +1 -1
- package/src/engine/network/orchestrator/ServerAuthoritativeServer.js +325 -140
- package/src/engine/network/sim/SimActionExecutor.d.ts +4 -1
- package/src/engine/network/sim/SimActionExecutor.d.ts.map +1 -1
- package/src/engine/network/sim/SimActionExecutor.js +65 -9
- package/src/engine/network/state/PredictionHistory.d.ts.map +1 -1
- package/src/engine/network/state/PredictionHistory.js +6 -1
- package/src/engine/network/time/AdaptiveRenderDelay.d.ts +25 -14
- package/src/engine/network/time/AdaptiveRenderDelay.d.ts.map +1 -1
- package/src/engine/network/time/AdaptiveRenderDelay.js +38 -20
- package/src/engine/network/time/RenderPlayout.d.ts +23 -3
- package/src/engine/network/time/RenderPlayout.d.ts.map +1 -1
- package/src/engine/network/time/RenderPlayout.js +40 -4
- package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
- package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts +5 -1
- package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.d.ts.map +1 -1
- package/src/engine/physics/fluid/obstacle/chunk_fluid_obstacle_record.js +27 -1
- package/src/format/lut/cube/CubeLut.d.ts +38 -0
- package/src/format/lut/cube/CubeLut.d.ts.map +1 -0
- package/src/format/lut/cube/CubeLut.js +23 -0
- package/src/format/lut/cube/cube_read.d.ts +23 -0
- package/src/format/lut/cube/cube_read.d.ts.map +1 -0
- package/src/format/lut/cube/cube_read.js +199 -0
- package/src/format/lut/cube/cube_write.d.ts +15 -0
- package/src/format/lut/cube/cube_write.d.ts.map +1 -0
- package/src/format/lut/cube/cube_write.js +90 -0
- package/src/shade/device/shader/ShaderModuleCompiler.d.ts +2 -0
- package/src/shade/device/shader/ShaderModuleCompiler.d.ts.map +1 -1
- package/src/shade/device/shader/ShaderModuleCompiler.js +25 -2
- package/src/shade/playground/grass_surfaces/index.html +75 -0
- package/src/shade/playground/grass_surfaces/main.d.ts +2 -0
- package/src/shade/playground/grass_surfaces/main.d.ts.map +1 -0
- package/src/shade/playground/grass_surfaces/main.js +593 -0
- package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts +62 -0
- package/src/shade/playground/grass_surfaces/read_grass_surfaces.d.ts.map +1 -0
- package/src/shade/playground/grass_surfaces/read_grass_surfaces.js +188 -0
- package/src/shade/playground/probe_clipmap/README.md +1 -0
- package/src/shade/playground/probe_clipmap/index.html +5 -0
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +7 -0
- package/src/shade/playground/probe_clipmap_box/README.md +5 -1
- package/src/shade/playground/probe_clipmap_box/index.html +12 -0
- package/src/shade/playground/probe_clipmap_box/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap_box/main.js +15 -0
- package/src/shade/playground/probe_clipmap_box/scene.d.ts +8 -1
- package/src/shade/playground/probe_clipmap_box/scene.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap_box/scene.js +74 -6
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +59 -55
- package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts +73 -4
- package/src/shade/renderer/deferred/tonemap/ColorGrade.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/ColorGrade.js +113 -7
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts +12 -0
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/TONEMAP_PURKINJE_SHIFT.js +12 -0
- package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts +15 -1
- package/src/shade/renderer/deferred/tonemap/ToneMapper.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/ToneMapper.js +31 -3
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts +25 -0
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.d.ts.map +1 -0
- package/src/shade/renderer/deferred/tonemap/chunk_tonemap_purkinje.js +51 -0
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts +2 -2
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_HDR_lut.js +6 -3
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts +3 -2
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.d.ts.map +1 -1
- package/src/shade/renderer/deferred/tonemap/shader_tonemap_LDR_lut.js +7 -3
- package/src/shade/renderer/extension/ViewTextures.d.ts +12 -5
- package/src/shade/renderer/extension/ViewTextures.d.ts.map +1 -1
- package/src/shade/renderer/extension/ViewTextures.js +19 -5
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +3 -1
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts.map +1 -1
- package/src/shade/renderer/fluid/GPUFluidCascadeStack.js +6 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -0
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts.map +1 -1
- package/src/shade/renderer/fluid/forcing/GPUFluidForcing.js +10 -0
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +7 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +46 -15
- package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts +3 -2
- package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/bundle/ModelCacheBundle.js +3 -2
- package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts +22 -0
- package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.d.ts.map +1 -0
- package/src/shade/renderer/geometry/sdf/bundle/model_cache_bundle_sort_morton.js +247 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +50 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +101 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +8 -0
- 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 +12 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +12 -6
- 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 +35 -29
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_clipmap.js +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_brick_material.js +6 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts +6 -5
- package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/chunk_brick_material.js +15 -14
- package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/material/shader_brick_material_gather.js +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +19 -2
- 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 +128 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +19 -1
- 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 +27 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +19 -11
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +35 -11
- 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 +3 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts +40 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_box_cages.js +174 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.d.ts +4 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_material.js +10 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts +31 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_parallax.js +54 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts +8 -4
- 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 +10 -21
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts +7 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.js +33 -29
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts +28 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/graph_probe_clipmap_want_meshlets.js +138 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +13 -9
- 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 +18 -11
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +1 -1
- 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 +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.js +2 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts +5 -3
- 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 +15 -30
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +1 -1
- 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 +4 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts +11 -0
- 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 +29 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts +40 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.js +126 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts +36 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.js +221 -0
- package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts +40 -0
- package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.js +86 -0
- package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts +135 -0
- package/src/shade/renderer/grass/blade/GPUGrassBlades.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/GPUGrassBlades.js +676 -0
- package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts +145 -0
- package/src/shade/renderer/grass/blade/GRASS_BLADE.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/GRASS_BLADE.js +179 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts +63 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade.js +244 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts +58 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/chunk_grass_blade_wind.js +174 -0
- package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts +25 -0
- package/src/shade/renderer/grass/blade/grass_blade_id_draw.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/grass_blade_id_draw.js +133 -0
- package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts +80 -0
- package/src/shade/renderer/grass/blade/grass_blade_mechanics.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/grass_blade_mechanics.js +92 -0
- package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts +29 -0
- package/src/shade/renderer/grass/blade/grass_blade_resolve.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/grass_blade_resolve.js +175 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts +14 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_draw_args.js +45 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts +61 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_expand.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/shader_grass_blade_expand.js +340 -0
- package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts +46 -0
- package/src/shade/renderer/grass/blade/shader_grass_cell_count.d.ts.map +1 -0
- package/src/shade/renderer/grass/blade/shader_grass_cell_count.js +280 -0
- package/src/shade/renderer/grass/population/chunk_grass_population.d.ts +60 -0
- package/src/shade/renderer/grass/population/chunk_grass_population.d.ts.map +1 -0
- package/src/shade/renderer/grass/population/chunk_grass_population.js +171 -0
- package/src/shade/renderer/grass/press/GPUGrassPress.d.ts +99 -0
- package/src/shade/renderer/grass/press/GPUGrassPress.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/GPUGrassPress.js +436 -0
- package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts +179 -0
- package/src/shade/renderer/grass/press/GRASS_PRESS.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/GRASS_PRESS.js +217 -0
- package/src/shade/renderer/grass/press/chunk_grass_press.d.ts +65 -0
- package/src/shade/renderer/grass/press/chunk_grass_press.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/chunk_grass_press.js +296 -0
- package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts +31 -0
- package/src/shade/renderer/grass/press/shader_grass_press_mark.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/shader_grass_press_mark.js +169 -0
- package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts +27 -0
- package/src/shade/renderer/grass/press/shader_grass_press_stamp.d.ts.map +1 -0
- package/src/shade/renderer/grass/press/shader_grass_press_stamp.js +183 -0
- package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts +193 -0
- package/src/shade/renderer/grass/surface/GPUGrassSurfaces.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/GPUGrassSurfaces.js +1253 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts +211 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE.js +241 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts +82 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/GRASS_SURFACE_VIEW.js +111 -0
- package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts +39 -0
- package/src/shade/renderer/grass/surface/chunk_grass_column_cross.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_column_cross.js +85 -0
- package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts +29 -0
- package/src/shade/renderer/grass/surface/chunk_grass_directory.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_directory.js +112 -0
- package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts +27 -0
- package/src/shade/renderer/grass/surface/chunk_grass_slot.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_slot.js +50 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts +21 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_frame.js +41 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts +32 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_window.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surface_window.js +136 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts +37 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surfel.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_surfel.js +85 -0
- package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts +25 -0
- package/src/shade/renderer/grass/surface/chunk_grass_tile.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/chunk_grass_tile.js +52 -0
- package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts +23 -0
- package/src/shade/renderer/grass/surface/shader_grass_directory_fill.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_directory_fill.js +87 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts +43 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake.js +265 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts +13 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_bake_command.js +49 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts +62 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_invalidate.js +162 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts +40 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_retire.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_retire.js +155 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts +19 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_schedule.js +58 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts +30 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_want.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_want.js +251 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts +21 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.d.ts.map +1 -0
- package/src/shade/renderer/grass/surface/shader_grass_surface_window_count.js +75 -0
- package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts +35 -9
- package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/eye/GPUCameraExposureManager.js +81 -11
- package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/eye/shader_autoexposure_adapt.js +4 -1
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.d.ts.map +1 -1
- package/src/shade/renderer/postprocess/velocity/graph_add_per_object_velocity.js +4 -23
- package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts +12 -0
- package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.d.ts.map +1 -0
- package/src/shade/renderer/postprocess/velocity/view_velocity_matrices.js +29 -0
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.d.ts.map +1 -1
- package/src/shade/renderer/rasterize/native/avboit/graph_rasterize_meshes_transparent_avboit.js +22 -0
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +3 -0
- package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts +27 -0
- package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/scene/GRASS_SURFACE_PARAMS_STRUCT.js +38 -0
- package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts +28 -0
- package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/scene/MESH_GROUND_COVER_STRUCT.js +58 -0
- package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.d.ts.map +1 -1
- package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.js +8 -0
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts +6 -0
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/conversion/chunk_CRM_REC709_AP1.js +7 -0
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts +4 -4
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/color/grade/chunk_color_grade.js +86 -5
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts +65 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinje/chunk_apply_purkinje_shift.js +136 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts +37 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/geometry/ray/chunk_ray_query_nearest_among.js +148 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts +20 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/sdf/chunk_shape_record_line_span.js +169 -0
- package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts +18 -0
- package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.d.ts.map +1 -1
- package/src/shade/renderer/texture/atlas/chunk_tile_atlas_slot_origin.js +28 -0
- package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts +13 -0
- package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.d.ts.map +1 -0
- package/src/shade/renderer/texture/atlas/tile_atlas_slot_shift.js +22 -0
- package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
- package/src/shade/renderer/water/GPUWaterRenderer.js +4 -0
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +52 -5
- package/src/shade/renderer/wind/GPUSceneWind.d.ts.map +1 -1
- package/src/shade/renderer/wind/GPUSceneWind.js +164 -8
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts +3 -1
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.d.ts.map +1 -1
- package/src/shade/renderer/wind/WIND_FIELD_UNIFORM.js +3 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +2 -1
- 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 +18 -13
- package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts +13 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_previous.d.ts.map +1 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_previous.js +23 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts +1 -0
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.d.ts.map +1 -1
- package/src/shade/renderer/wind/chunk_wind_field_sample_uniform.js +6 -1
- package/src/shade/renderer/wind/wind_field_add_resources.d.ts +11 -0
- package/src/shade/renderer/wind/wind_field_add_resources.d.ts.map +1 -1
- package/src/shade/renderer/wind/wind_field_add_resources.js +15 -0
- package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +2 -0
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts +0 -11
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.d.ts.map +0 -1
- package/src/shade/renderer/shader/chunk/color/tonemap/purkinjie/chunk_apply_purkinjie_shift.js +0 -56
package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_late.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { COLLECTION_U32_STRUCT_READ } from "../../../gpu_primitive/COLLECTION_U32_STRUCT_READ.js";
|
|
2
|
+
import { chunk_collection_u32_append } from "../../../gpu_primitive/chunk_collection_u32_append.js";
|
|
3
|
+
import { chunk_clipmap_contains } from "../../../shader/chunk/clipmap/chunk_clipmap_contains.js";
|
|
4
|
+
import { CLIPMAP_LEVEL_ARRAY, CLIPMAP_LEVEL_STRUCT } from "../../../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
|
|
5
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
6
|
+
import { ComputeShader } from "../../../shader/ComputeShader.js";
|
|
7
|
+
import { ShaderResourceDescriptor } from "../../../shader/resource/ShaderResourceDescriptor.js";
|
|
8
|
+
import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
9
|
+
import { atomic_u32, u32 } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
10
|
+
import { WebGPUArray } from "../../../shader/type/WebGPUArray.js";
|
|
11
|
+
import { WebGPUStruct } from "../../../shader/type/WebGPUStruct.js";
|
|
12
|
+
import {
|
|
13
|
+
chunk_probe_clipmap,
|
|
14
|
+
PROBE_LEVELS_RESOURCE,
|
|
15
|
+
PROBE_WANTED_BITS_RESOURCE,
|
|
16
|
+
PROBE_WANTED_WRITE_RESOURCE
|
|
17
|
+
} from "./chunk_probe_clipmap.js";
|
|
18
|
+
import { PROBE_THREAD_WORKGROUP_SIZE } from "./PROBE_CLIPMAP.js";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @type {WebGPUStruct}
|
|
22
|
+
*/
|
|
23
|
+
export const PROBE_WANT_LATE_SETTINGS = WebGPUStruct.from({
|
|
24
|
+
/** lattice points a cascade's window has a side */
|
|
25
|
+
resolution: u32,
|
|
26
|
+
/** what the frame's wanted list holds at most */
|
|
27
|
+
wanted_capacity: u32,
|
|
28
|
+
/** what the late list holds at most: every key */
|
|
29
|
+
late_capacity: u32,
|
|
30
|
+
}, "ProbeWantLateSettings");
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* The keys wanted since the last lifetime, each once, as the late wants listed them.
|
|
34
|
+
* @type {ShaderResourceDescriptor}
|
|
35
|
+
*/
|
|
36
|
+
export const PROBE_LATE_WANTED_READ_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_late_wanted", COLLECTION_U32_STRUCT_READ);
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A bit a key of the late list, cleared as the key is taken.
|
|
40
|
+
* @type {ShaderResourceDescriptor}
|
|
41
|
+
*/
|
|
42
|
+
export const PROBE_LATE_WANTED_BITS_RESOURCE = ShaderResourceDescriptor.storageBuffer("probe_late_wanted_bits", WebGPUArray.from(atomic_u32), true);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The cage windows the late list's keys were written in: the levels of the frame before.
|
|
46
|
+
* @type {ShaderResourceDescriptor}
|
|
47
|
+
*/
|
|
48
|
+
export const PROBE_LATE_LEVELS_RESOURCE = ShaderResourceDescriptor.uniform("probe_late_levels", CLIPMAP_LEVEL_ARRAY);
|
|
49
|
+
|
|
50
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
51
|
+
|
|
52
|
+
resources.setImmediate("settings", PROBE_WANT_LATE_SETTINGS);
|
|
53
|
+
|
|
54
|
+
resources.createGroup()
|
|
55
|
+
.add(PROBE_LEVELS_RESOURCE)
|
|
56
|
+
.add(PROBE_LATE_LEVELS_RESOURCE)
|
|
57
|
+
.add(PROBE_LATE_WANTED_READ_RESOURCE)
|
|
58
|
+
.add(PROBE_LATE_WANTED_BITS_RESOURCE)
|
|
59
|
+
.add(PROBE_WANTED_BITS_RESOURCE)
|
|
60
|
+
.add(PROBE_WANTED_WRITE_RESOURCE);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The late wants taken into the frame's (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.3): a thread a key of the late
|
|
64
|
+
* list, through a launch its count sizes.
|
|
65
|
+
*
|
|
66
|
+
* A reader whose surface is drawn after the frame's lifetime wants its probes into the late set, through
|
|
67
|
+
* `probe_clipmap_want` as any want does, and the next lifetime runs this between its own wants and admit. A key
|
|
68
|
+
* the frame's set lacks goes on its list; either way the key's late bit is cleared, which leaves the late bits
|
|
69
|
+
* empty, and the host empties the list.
|
|
70
|
+
*
|
|
71
|
+
* A key names a storage cell, and the lattice point it stands for is the one its writer's window held there. Where
|
|
72
|
+
* a window has moved since, the cell of a point it left stands for the point that came in across from it, which
|
|
73
|
+
* nothing wanted: a key is taken only where the present window's point is one the writer's window
|
|
74
|
+
* (`probe_late_levels`) held too.
|
|
75
|
+
*
|
|
76
|
+
* @type {ComputeShader}
|
|
77
|
+
*/
|
|
78
|
+
export const shader_probe_clipmap_want_late = ComputeShader.from({
|
|
79
|
+
label: "Probe Clipmap Want Late",
|
|
80
|
+
resources,
|
|
81
|
+
body: CodeChunk.from(
|
|
82
|
+
//language=WGSL
|
|
83
|
+
`
|
|
84
|
+
@compute @workgroup_size(${PROBE_THREAD_WORKGROUP_SIZE})
|
|
85
|
+
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
|
|
86
|
+
let index = id.x;
|
|
87
|
+
let listed = index < min(probe_late_wanted.count, settings.late_capacity);
|
|
88
|
+
|
|
89
|
+
var key = 0u;
|
|
90
|
+
|
|
91
|
+
if (listed) {
|
|
92
|
+
key = probe_late_wanted.elements[index];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
let bit = 1u << (key & 31u);
|
|
96
|
+
|
|
97
|
+
var wants = false;
|
|
98
|
+
|
|
99
|
+
if (listed) {
|
|
100
|
+
atomicAnd(&probe_late_wanted_bits[key >> 5u], ~bit);
|
|
101
|
+
|
|
102
|
+
let cascade = probe_clipmap_key_cascade(key, settings.resolution);
|
|
103
|
+
let point = probe_clipmap_window_point(probe_clipmap_key_storage(key, settings.resolution), probe_levels[cascade].corner, settings.resolution);
|
|
104
|
+
let written = probe_late_levels[cascade];
|
|
105
|
+
|
|
106
|
+
// a lattice window is a point past its cage window along each axis
|
|
107
|
+
wants = clipmap_contains(point, written.corner, written.size + vec3<i32>(1));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var first = false;
|
|
111
|
+
|
|
112
|
+
if (wants) {
|
|
113
|
+
first = (atomicOr(&probe_wanted_bits[key >> 5u], bit) & bit) == 0u;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// every lane, so that the append stays in uniform control flow
|
|
117
|
+
collection_u32_append(&probe_wanted, first, key, settings.wanted_capacity);
|
|
118
|
+
}
|
|
119
|
+
`, [
|
|
120
|
+
chunk_probe_clipmap,
|
|
121
|
+
chunk_clipmap_contains,
|
|
122
|
+
chunk_collection_u32_append,
|
|
123
|
+
CLIPMAP_LEVEL_STRUCT.declaration_chunk,
|
|
124
|
+
COLLECTION_U32_STRUCT_READ.declaration_chunk,
|
|
125
|
+
]),
|
|
126
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The meshlets' wants, counted (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.3): a thread a listed meshlet, through
|
|
3
|
+
* the launch that walks the list, as `shader_avboit_occupancy` runs over it. `output` receives, for each, the
|
|
4
|
+
* cages a reader anywhere inside its world box can read (`probe_clipmap_box_cage_count`), and the list's count;
|
|
5
|
+
* their prefix sums launch `shader_probe_clipmap_want_meshlets`, a thread a cage.
|
|
6
|
+
*
|
|
7
|
+
* `output` is a count and its elements, cleared at its count for a list of no meshlet; it holds a count for each
|
|
8
|
+
* meshlet it has room for, and names that many.
|
|
9
|
+
*
|
|
10
|
+
* @type {ComputeShader}
|
|
11
|
+
*/
|
|
12
|
+
export const shader_probe_clipmap_want_meshlet_count: ComputeShader;
|
|
13
|
+
/**
|
|
14
|
+
* The meshlets' wants (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.3): a thread a cage a listed meshlet's readers
|
|
15
|
+
* can read, through the launch the prefix sums of `shader_probe_clipmap_want_meshlet_count` size
|
|
16
|
+
* (`shader_prefix_sum_to_command`). The wants of the probes a forward-shaded surface picks from, which no pixel
|
|
17
|
+
* of the G-buffer stands for: every fragment of a meshlet reads cages its box's blocks hold
|
|
18
|
+
* (`chunk_probe_clipmap_box_cages`), so wanting those leaves none of them without its probes.
|
|
19
|
+
*
|
|
20
|
+
* A thread finds its meshlet by its place in the sums, and its cage by its place among the meshlet's blocks,
|
|
21
|
+
* cascade by cascade. It wants the cage where a point near it can select its cascade
|
|
22
|
+
* (`probe_clipmap_cage_is_read`), the cage meets the meshlet's box as that lies in its own space
|
|
23
|
+
* (`probe_clipmap_cage_meets_box`), and it meets the view's frustum.
|
|
24
|
+
*
|
|
25
|
+
* What it wants is a superset of what the meshlet's surface crosses: a box holds cages the surface inside it
|
|
26
|
+
* does not reach, the more the larger and the less flat the meshlet is against its cascade's spacing. The
|
|
27
|
+
* threads a meshlet takes are its blocks' cages.
|
|
28
|
+
*
|
|
29
|
+
* The wanted list and bits it binds are whichever the pass is given: recorded after the frame's lifetime, the
|
|
30
|
+
* late ones (`GPUProbeClipmap.write_want_bindings`).
|
|
31
|
+
*
|
|
32
|
+
* @type {ComputeShader}
|
|
33
|
+
*/
|
|
34
|
+
export const shader_probe_clipmap_want_meshlets: ComputeShader;
|
|
35
|
+
import { ComputeShader } from "../../../shader/ComputeShader.js";
|
|
36
|
+
//# sourceMappingURL=shader_probe_clipmap_want_meshlets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_probe_clipmap_want_meshlets.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_meshlets.js"],"names":[],"mappings":"AAwCA;;;;;;;;;;GAUG;AACH,sDAFU,aAAa,CAwCpB;AAgBH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,iDAFU,aAAa,CAgGpB;8BA9M2B,kCAAkC"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { CAMERA_UNIFORM_STRUCT } from "../../../camera/CAMERA_UNIFORM_STRUCT.js";
|
|
2
|
+
import { MESHLET_METADATA_STRUCT } from "../../../geometry/meshlet/encoding/MESHLET_METADATA_STRUCT.js";
|
|
3
|
+
import { COLLECTION_U32_STRUCT_READ } from "../../../gpu_primitive/COLLECTION_U32_STRUCT_READ.js";
|
|
4
|
+
import { MESHLET_COLLECTION_STRUCT } from "../../../rasterize/MESHLET_COLLECTION_STRUCT.js";
|
|
5
|
+
import { chunk_scene_database_access } from "../../../scene/chunk_scene_database_access.js";
|
|
6
|
+
import { CLIPMAP_LEVEL_LIMIT } from "../../../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
|
|
7
|
+
import { AABB3_STRUCT } from "../../../shader/chunk/geometry/aabb3/AABB3_STRUCT.js";
|
|
8
|
+
import { chunk_aabb3_intersects_frustum } from "../../../shader/chunk/geometry/aabb3/chunk_aabb3_intersects_frustum.js";
|
|
9
|
+
import { chunk_aabb3_project } from "../../../shader/chunk/geometry/aabb3/chunk_aabb3_project.js";
|
|
10
|
+
import { chunk_array_to_aabb3 } from "../../../shader/chunk/geometry/aabb3/chunk_array_to_aabb3.js";
|
|
11
|
+
import { chunk_folded_workgroup_index } from "../../../shader/chunk/grid/chunk_folded_workgroup_index.js";
|
|
12
|
+
import { chunk_lower_bound_branchless } from "../../../shader/chunk/math/chunk_lower_bound_branchless.js";
|
|
13
|
+
import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
|
|
14
|
+
import { COMPUTE_SHADER_DEFAULT_GROUP_SIZE } from "../../../shader/COMPUTE_SHADER_DEFAULT_GROUP_SIZE.js";
|
|
15
|
+
import { ComputeShader } from "../../../shader/ComputeShader.js";
|
|
16
|
+
import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
17
|
+
import { u32 } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
18
|
+
import { WebGPUArray } from "../../../shader/type/WebGPUArray.js";
|
|
19
|
+
import {
|
|
20
|
+
chunk_probe_clipmap,
|
|
21
|
+
PROBE_LEVELS_RESOURCE,
|
|
22
|
+
PROBE_WANTED_BITS_RESOURCE,
|
|
23
|
+
PROBE_WANTED_WRITE_RESOURCE
|
|
24
|
+
} from "./chunk_probe_clipmap.js";
|
|
25
|
+
import { chunk_probe_clipmap_box_cages } from "./chunk_probe_clipmap_box_cages.js";
|
|
26
|
+
import { chunk_probe_clipmap_want } from "./chunk_probe_clipmap_want.js";
|
|
27
|
+
import { PROBE_RECEIVER_BIAS } from "./PROBE_CLIPMAP.js";
|
|
28
|
+
import { PROBE_WANT_SETTINGS } from "./shader_probe_clipmap_want.js";
|
|
29
|
+
|
|
30
|
+
const count_resources = new ShaderResourceSetDescriptor();
|
|
31
|
+
|
|
32
|
+
count_resources.setImmediate("settings", PROBE_WANT_SETTINGS);
|
|
33
|
+
|
|
34
|
+
count_resources.createGroup()
|
|
35
|
+
.addStorageBuffer("scene_database", WebGPUArray.from(u32))
|
|
36
|
+
.addStorageBuffer("meshlet_metadata", WebGPUArray.from(MESHLET_METADATA_STRUCT))
|
|
37
|
+
.addStorageBuffer("input", MESHLET_COLLECTION_STRUCT)
|
|
38
|
+
.addStorageBuffer("output", COLLECTION_U32_STRUCT_READ, true)
|
|
39
|
+
.add(PROBE_LEVELS_RESOURCE);
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The meshlets' wants, counted (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.3): a thread a listed meshlet, through
|
|
43
|
+
* the launch that walks the list, as `shader_avboit_occupancy` runs over it. `output` receives, for each, the
|
|
44
|
+
* cages a reader anywhere inside its world box can read (`probe_clipmap_box_cage_count`), and the list's count;
|
|
45
|
+
* their prefix sums launch `shader_probe_clipmap_want_meshlets`, a thread a cage.
|
|
46
|
+
*
|
|
47
|
+
* `output` is a count and its elements, cleared at its count for a list of no meshlet; it holds a count for each
|
|
48
|
+
* meshlet it has room for, and names that many.
|
|
49
|
+
*
|
|
50
|
+
* @type {ComputeShader}
|
|
51
|
+
*/
|
|
52
|
+
export const shader_probe_clipmap_want_meshlet_count = ComputeShader.from({
|
|
53
|
+
label: "Probe Clipmap Want Meshlets / count",
|
|
54
|
+
resources: count_resources,
|
|
55
|
+
body: CodeChunk.from(
|
|
56
|
+
//language=WGSL
|
|
57
|
+
`
|
|
58
|
+
@compute @workgroup_size(${COMPUTE_SHADER_DEFAULT_GROUP_SIZE})
|
|
59
|
+
fn main(
|
|
60
|
+
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
61
|
+
@builtin(local_invocation_index) lane: u32,
|
|
62
|
+
) {
|
|
63
|
+
let index = folded_workgroup_index(workgroup_id) * ${COMPUTE_SHADER_DEFAULT_GROUP_SIZE}u + lane;
|
|
64
|
+
let listed = min(input.count, arrayLength(&output.elements));
|
|
65
|
+
|
|
66
|
+
if (index >= listed) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (index == 0u) {
|
|
71
|
+
output.count = listed;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let meshlet = input.elements[index];
|
|
75
|
+
let mesh = scene_read_mesh(&scene_database, meshlet.mesh);
|
|
76
|
+
let node = scene_read_node(&scene_database, mesh.node);
|
|
77
|
+
// its world box, as the occupancy and the HZB filter take it
|
|
78
|
+
let box = aabb3_project(array_to_aabb3(meshlet_metadata[meshlet.index].bounds_box), node.global);
|
|
79
|
+
|
|
80
|
+
output.elements[index] = probe_clipmap_box_cage_count(box.min, box.max, settings.cascade_count, settings.anchor, settings.select_half);
|
|
81
|
+
}
|
|
82
|
+
`, [
|
|
83
|
+
chunk_folded_workgroup_index,
|
|
84
|
+
AABB3_STRUCT.declaration_chunk,
|
|
85
|
+
chunk_array_to_aabb3,
|
|
86
|
+
chunk_aabb3_project,
|
|
87
|
+
chunk_scene_database_access,
|
|
88
|
+
chunk_probe_clipmap_box_cages,
|
|
89
|
+
]),
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const want_resources = new ShaderResourceSetDescriptor();
|
|
93
|
+
|
|
94
|
+
want_resources.setImmediate("settings", PROBE_WANT_SETTINGS);
|
|
95
|
+
|
|
96
|
+
want_resources.createGroup()
|
|
97
|
+
.addUniform("camera", CAMERA_UNIFORM_STRUCT)
|
|
98
|
+
.addStorageBuffer("scene_database", WebGPUArray.from(u32))
|
|
99
|
+
.addStorageBuffer("meshlet_metadata", WebGPUArray.from(MESHLET_METADATA_STRUCT))
|
|
100
|
+
.addStorageBuffer("input", MESHLET_COLLECTION_STRUCT)
|
|
101
|
+
.addStorageBuffer("prefix_sums", COLLECTION_U32_STRUCT_READ)
|
|
102
|
+
.add(PROBE_LEVELS_RESOURCE)
|
|
103
|
+
.add(PROBE_WANTED_BITS_RESOURCE)
|
|
104
|
+
.add(PROBE_WANTED_WRITE_RESOURCE);
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The meshlets' wants (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8.3): a thread a cage a listed meshlet's readers
|
|
108
|
+
* can read, through the launch the prefix sums of `shader_probe_clipmap_want_meshlet_count` size
|
|
109
|
+
* (`shader_prefix_sum_to_command`). The wants of the probes a forward-shaded surface picks from, which no pixel
|
|
110
|
+
* of the G-buffer stands for: every fragment of a meshlet reads cages its box's blocks hold
|
|
111
|
+
* (`chunk_probe_clipmap_box_cages`), so wanting those leaves none of them without its probes.
|
|
112
|
+
*
|
|
113
|
+
* A thread finds its meshlet by its place in the sums, and its cage by its place among the meshlet's blocks,
|
|
114
|
+
* cascade by cascade. It wants the cage where a point near it can select its cascade
|
|
115
|
+
* (`probe_clipmap_cage_is_read`), the cage meets the meshlet's box as that lies in its own space
|
|
116
|
+
* (`probe_clipmap_cage_meets_box`), and it meets the view's frustum.
|
|
117
|
+
*
|
|
118
|
+
* What it wants is a superset of what the meshlet's surface crosses: a box holds cages the surface inside it
|
|
119
|
+
* does not reach, the more the larger and the less flat the meshlet is against its cascade's spacing. The
|
|
120
|
+
* threads a meshlet takes are its blocks' cages.
|
|
121
|
+
*
|
|
122
|
+
* The wanted list and bits it binds are whichever the pass is given: recorded after the frame's lifetime, the
|
|
123
|
+
* late ones (`GPUProbeClipmap.write_want_bindings`).
|
|
124
|
+
*
|
|
125
|
+
* @type {ComputeShader}
|
|
126
|
+
*/
|
|
127
|
+
export const shader_probe_clipmap_want_meshlets = ComputeShader.from({
|
|
128
|
+
label: "Probe Clipmap Want Meshlets",
|
|
129
|
+
resources: want_resources,
|
|
130
|
+
body: CodeChunk.from(
|
|
131
|
+
//language=WGSL
|
|
132
|
+
`
|
|
133
|
+
@compute @workgroup_size(${COMPUTE_SHADER_DEFAULT_GROUP_SIZE})
|
|
134
|
+
fn main(
|
|
135
|
+
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
136
|
+
@builtin(local_invocation_index) lane: u32,
|
|
137
|
+
) {
|
|
138
|
+
// the launch's workgroups are shader_prefix_sum_to_command's
|
|
139
|
+
let thread = folded_workgroup_index(workgroup_id) * ${COMPUTE_SHADER_DEFAULT_GROUP_SIZE}u + lane;
|
|
140
|
+
let listed = prefix_sums.count;
|
|
141
|
+
|
|
142
|
+
// the meshlet whose cages hold the thread: the first whose sum is past it
|
|
143
|
+
var meshlet_index = 0u;
|
|
144
|
+
|
|
145
|
+
if (listed > 0u) {
|
|
146
|
+
meshlet_index = lower_bound_branchless(&prefix_sums.elements, thread + 1u, listed);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
var wants = meshlet_index < listed;
|
|
150
|
+
var local = thread;
|
|
151
|
+
|
|
152
|
+
if (wants && meshlet_index > 0u) {
|
|
153
|
+
local = thread - prefix_sums.elements[meshlet_index - 1u];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
var cascade = 0u;
|
|
157
|
+
var cage = vec3<i32>(0);
|
|
158
|
+
|
|
159
|
+
if (wants) {
|
|
160
|
+
let meshlet = input.elements[meshlet_index];
|
|
161
|
+
let mesh = scene_read_mesh(&scene_database, meshlet.mesh);
|
|
162
|
+
let node = scene_read_node(&scene_database, mesh.node);
|
|
163
|
+
let local_box = array_to_aabb3(meshlet_metadata[meshlet.index].bounds_box);
|
|
164
|
+
let box = aabb3_project(local_box, node.global);
|
|
165
|
+
|
|
166
|
+
// its block, cascade by cascade, and its cage in the block
|
|
167
|
+
let cascades = probe_clipmap_box_cascades(box.min, box.max, settings.cascade_count, settings.anchor, settings.select_half);
|
|
168
|
+
|
|
169
|
+
var found = false;
|
|
170
|
+
|
|
171
|
+
for (var i = 0u; i < ${CLIPMAP_LEVEL_LIMIT}u; i++) {
|
|
172
|
+
let c = cascades.x + i;
|
|
173
|
+
|
|
174
|
+
if (c >= cascades.y) {
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
let cages = probe_clipmap_box_cages(box.min, box.max, c, settings.anchor, settings.select_half);
|
|
179
|
+
let count = cages.dims.x * cages.dims.y * cages.dims.z;
|
|
180
|
+
|
|
181
|
+
if (local < count) {
|
|
182
|
+
cascade = c;
|
|
183
|
+
cage = cages.first + vec3<i32>(vec3<u32>(local % cages.dims.x, (local / cages.dims.x) % cages.dims.y, local / (cages.dims.x * cages.dims.y)));
|
|
184
|
+
found = true;
|
|
185
|
+
|
|
186
|
+
break;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
local -= count;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
wants = found
|
|
193
|
+
&& probe_clipmap_cage_is_read(cascade, cage, settings.anchor, settings.select_half)
|
|
194
|
+
&& probe_clipmap_cage_meets_box(cascade, cage, local_box.min, local_box.max, node.global);
|
|
195
|
+
|
|
196
|
+
if (wants) {
|
|
197
|
+
// grown by the bias, as the points that read it lie
|
|
198
|
+
let cell = probe_levels[cascade].cell_size;
|
|
199
|
+
let bias = ${PROBE_RECEIVER_BIAS} * cell;
|
|
200
|
+
let reach = ${AABB3_STRUCT.wgsl_ref}(vec3<f32>(cage) * cell - bias, vec3<f32>(cage + vec3<i32>(1)) * cell + bias);
|
|
201
|
+
|
|
202
|
+
wants = aabb3_intersects_frustum(reach, camera.frustum);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// every lane, so that the appends stay in uniform control flow
|
|
207
|
+
probe_clipmap_want_cage(wants, cascade, cage, settings.resolution, settings.wanted_capacity);
|
|
208
|
+
}
|
|
209
|
+
`, [
|
|
210
|
+
chunk_probe_clipmap,
|
|
211
|
+
chunk_folded_workgroup_index,
|
|
212
|
+
chunk_lower_bound_branchless,
|
|
213
|
+
AABB3_STRUCT.declaration_chunk,
|
|
214
|
+
chunk_array_to_aabb3,
|
|
215
|
+
chunk_aabb3_project,
|
|
216
|
+
chunk_aabb3_intersects_frustum,
|
|
217
|
+
chunk_scene_database_access,
|
|
218
|
+
chunk_probe_clipmap_box_cages,
|
|
219
|
+
chunk_probe_clipmap_want,
|
|
220
|
+
]),
|
|
221
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Buckets entries are sorted into by age. An age's bucket is its count of binary digits: 0 the first, 1 the
|
|
3
|
+
* second, 2 and 3 the third, and the last everything from `2^(AGE_EVICTION_BUCKETS − 2)` on.
|
|
4
|
+
*
|
|
5
|
+
* @type {number}
|
|
6
|
+
*/
|
|
7
|
+
export const AGE_EVICTION_BUCKETS: number;
|
|
8
|
+
/**
|
|
9
|
+
* Eviction from a pool by pressure, oldest first, with no sort: the entries a pool could give up are
|
|
10
|
+
* counted into buckets by age, a plan asks for as many as the pool is short of, from the oldest bucket
|
|
11
|
+
* down, and the next pass over the entries takes what the plan asks for.
|
|
12
|
+
*
|
|
13
|
+
* ```wgsl
|
|
14
|
+
* const AGE_EVICTION_BUCKETS: u32
|
|
15
|
+
* fn age_eviction_bucket(age: u32) -> u32
|
|
16
|
+
* fn age_eviction_plan(counters: ptr<storage, array<atomic<u32>>, read_write>, ages: u32, lacking: u32) -> vec2<u32>
|
|
17
|
+
* fn age_eviction_whole(counted: u32, buckets: u32) -> bool
|
|
18
|
+
* fn age_eviction_partial(counted: u32, buckets: u32) -> bool
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* - `age_eviction_bucket`: the bucket of an age ({@link AGE_EVICTION_BUCKETS}).
|
|
22
|
+
* - `age_eviction_plan`: reads the `AGE_EVICTION_BUCKETS` counts at `counters[ages]` on, how many entries
|
|
23
|
+
* that could be evicted each bucket holds, and empties them. Returns the plan that frees `lacking`
|
|
24
|
+
* entries, oldest first: `x` buckets whole, from the oldest, and `y` entries of the bucket below them. A
|
|
25
|
+
* shortfall the counted entries cannot cover takes them all and no more: past the youngest bucket
|
|
26
|
+
* anything was counted in, nothing is asked for.
|
|
27
|
+
* - `age_eviction_whole`: whether a plan of `buckets` whole buckets takes every entry counted in bucket
|
|
28
|
+
* `counted`.
|
|
29
|
+
* - `age_eviction_partial`: whether bucket `counted` is the one the plan takes some of: the caller takes
|
|
30
|
+
* entries of it while its own count of them is under the plan's `y`.
|
|
31
|
+
*
|
|
32
|
+
* The plan is made from one pass's counts and used by the next, so an entry's `counted` is the bucket it
|
|
33
|
+
* was in when counted, `age_eviction_bucket(age − 1)` a frame on: an entry that has aged into an asked
|
|
34
|
+
* bucket since, uncounted, is not taken for it.
|
|
35
|
+
*
|
|
36
|
+
* @type {CodeChunk}
|
|
37
|
+
*/
|
|
38
|
+
export const chunk_age_eviction: CodeChunk;
|
|
39
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
40
|
+
//# sourceMappingURL=chunk_age_eviction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk_age_eviction.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/age_eviction/chunk_age_eviction.js"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,mCAFU,MAAM,CAEuB;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,iCAFU,SAAS,CA+CjB;0BArFwB,oCAAoC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Buckets entries are sorted into by age. An age's bucket is its count of binary digits: 0 the first, 1 the
|
|
5
|
+
* second, 2 and 3 the third, and the last everything from `2^(AGE_EVICTION_BUCKETS − 2)` on.
|
|
6
|
+
*
|
|
7
|
+
* @type {number}
|
|
8
|
+
*/
|
|
9
|
+
export const AGE_EVICTION_BUCKETS = 32;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Eviction from a pool by pressure, oldest first, with no sort: the entries a pool could give up are
|
|
13
|
+
* counted into buckets by age, a plan asks for as many as the pool is short of, from the oldest bucket
|
|
14
|
+
* down, and the next pass over the entries takes what the plan asks for.
|
|
15
|
+
*
|
|
16
|
+
* ```wgsl
|
|
17
|
+
* const AGE_EVICTION_BUCKETS: u32
|
|
18
|
+
* fn age_eviction_bucket(age: u32) -> u32
|
|
19
|
+
* fn age_eviction_plan(counters: ptr<storage, array<atomic<u32>>, read_write>, ages: u32, lacking: u32) -> vec2<u32>
|
|
20
|
+
* fn age_eviction_whole(counted: u32, buckets: u32) -> bool
|
|
21
|
+
* fn age_eviction_partial(counted: u32, buckets: u32) -> bool
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* - `age_eviction_bucket`: the bucket of an age ({@link AGE_EVICTION_BUCKETS}).
|
|
25
|
+
* - `age_eviction_plan`: reads the `AGE_EVICTION_BUCKETS` counts at `counters[ages]` on, how many entries
|
|
26
|
+
* that could be evicted each bucket holds, and empties them. Returns the plan that frees `lacking`
|
|
27
|
+
* entries, oldest first: `x` buckets whole, from the oldest, and `y` entries of the bucket below them. A
|
|
28
|
+
* shortfall the counted entries cannot cover takes them all and no more: past the youngest bucket
|
|
29
|
+
* anything was counted in, nothing is asked for.
|
|
30
|
+
* - `age_eviction_whole`: whether a plan of `buckets` whole buckets takes every entry counted in bucket
|
|
31
|
+
* `counted`.
|
|
32
|
+
* - `age_eviction_partial`: whether bucket `counted` is the one the plan takes some of: the caller takes
|
|
33
|
+
* entries of it while its own count of them is under the plan's `y`.
|
|
34
|
+
*
|
|
35
|
+
* The plan is made from one pass's counts and used by the next, so an entry's `counted` is the bucket it
|
|
36
|
+
* was in when counted, `age_eviction_bucket(age − 1)` a frame on: an entry that has aged into an asked
|
|
37
|
+
* bucket since, uncounted, is not taken for it.
|
|
38
|
+
*
|
|
39
|
+
* @type {CodeChunk}
|
|
40
|
+
*/
|
|
41
|
+
export const chunk_age_eviction = CodeChunk.from(
|
|
42
|
+
//language=WGSL
|
|
43
|
+
`
|
|
44
|
+
const AGE_EVICTION_BUCKETS: u32 = ${AGE_EVICTION_BUCKETS}u;
|
|
45
|
+
|
|
46
|
+
fn age_eviction_bucket(age: u32) -> u32 {
|
|
47
|
+
return min(32u - countLeadingZeros(age), AGE_EVICTION_BUCKETS - 1u);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
fn age_eviction_plan(counters: ptr<storage, array<atomic<u32>>, read_write>, ages: u32, lacking: u32) -> vec2<u32> {
|
|
51
|
+
var left = lacking;
|
|
52
|
+
var buckets = 0u;
|
|
53
|
+
var remaining = 0u;
|
|
54
|
+
|
|
55
|
+
for (var k = 0u; k < AGE_EVICTION_BUCKETS; k++) {
|
|
56
|
+
let at = ages + AGE_EVICTION_BUCKETS - 1u - k;
|
|
57
|
+
let aged = atomicLoad(&counters[at]);
|
|
58
|
+
|
|
59
|
+
atomicStore(&counters[at], 0u);
|
|
60
|
+
|
|
61
|
+
// a bucket nothing was counted in is taken only for an older one: what ages into a bucket below every
|
|
62
|
+
// entry counted is not asked for
|
|
63
|
+
if (left > 0u && aged > 0u) {
|
|
64
|
+
if (aged <= left) {
|
|
65
|
+
left -= aged;
|
|
66
|
+
buckets = k + 1u;
|
|
67
|
+
} else {
|
|
68
|
+
buckets = k;
|
|
69
|
+
remaining = left;
|
|
70
|
+
left = 0u;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return vec2<u32>(buckets, remaining);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
fn age_eviction_whole(counted: u32, buckets: u32) -> bool {
|
|
79
|
+
return counted >= AGE_EVICTION_BUCKETS - min(buckets, AGE_EVICTION_BUCKETS);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
fn age_eviction_partial(counted: u32, buckets: u32) -> bool {
|
|
83
|
+
return counted + 1u == AGE_EVICTION_BUCKETS - min(buckets, AGE_EVICTION_BUCKETS);
|
|
84
|
+
}
|
|
85
|
+
`
|
|
86
|
+
);
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Grass blades on the device: the species list, and the passes that make a view's blades each frame and
|
|
3
|
+
* draw them (`GRASS_BLADE.js`).
|
|
4
|
+
*
|
|
5
|
+
* Blades stand on the surfels {@link GPUGrassSurfaces} keeps; nothing of a blade outlives its frame.
|
|
6
|
+
*
|
|
7
|
+
* Each frame: {@link update} once; then for every view that draws grass {@link graph_generate}, after the
|
|
8
|
+
* surfaces' own passes for the view, after whatever publishes the scene's wind for the frame (the blades
|
|
9
|
+
* are bent by it), and before anything reads the scene's depth for the frame's image; and
|
|
10
|
+
* {@link graph_draw} at the frame phase where the G-buffer is written into.
|
|
11
|
+
*
|
|
12
|
+
* The blades are pushed over by the scene's fluid obstacles through {@link press}, a field this owns and
|
|
13
|
+
* stamps as part of making a view's blades.
|
|
14
|
+
*/
|
|
15
|
+
export class GPUGrassBlades {
|
|
16
|
+
/**
|
|
17
|
+
* Offer the pipelines the blades' passes run — see {@link PipelineEnquiry}.
|
|
18
|
+
*
|
|
19
|
+
* @param {PipelineEnquiry} enquiry
|
|
20
|
+
*/
|
|
21
|
+
static enquirePipelines(enquiry: PipelineEnquiry): void;
|
|
22
|
+
/**
|
|
23
|
+
* @param {GraphicsContext} graphics
|
|
24
|
+
* @param {GPUGrassSurfaces} surfaces whose surfels the blades stand on
|
|
25
|
+
*/
|
|
26
|
+
constructor(graphics: GraphicsContext, surfaces: GPUGrassSurfaces);
|
|
27
|
+
/**
|
|
28
|
+
* Where obstacles have pressed the grass down, and its settings.
|
|
29
|
+
*
|
|
30
|
+
* @readonly
|
|
31
|
+
* @type {GPUGrassPress}
|
|
32
|
+
*/
|
|
33
|
+
readonly press: GPUGrassPress;
|
|
34
|
+
/**
|
|
35
|
+
* @returns {number} blades a frame's list has room for
|
|
36
|
+
*/
|
|
37
|
+
get blade_capacity(): number;
|
|
38
|
+
/**
|
|
39
|
+
* @returns {number} the most blades a view's list was asked to hold, as last read off the device
|
|
40
|
+
*/
|
|
41
|
+
get blades_asked(): number;
|
|
42
|
+
/**
|
|
43
|
+
* The species list on the device. Null before the first {@link update}, and replaced when it grows.
|
|
44
|
+
*
|
|
45
|
+
* @returns {GPUBuffer|null}
|
|
46
|
+
*/
|
|
47
|
+
get species_buffer(): any;
|
|
48
|
+
/**
|
|
49
|
+
* The blades' clock on the device (`GRASS_BLADE_CLOCK_STRUCT`). Null before the first {@link update}.
|
|
50
|
+
*
|
|
51
|
+
* @returns {GPUBuffer|null}
|
|
52
|
+
*/
|
|
53
|
+
get clock_buffer(): any;
|
|
54
|
+
/**
|
|
55
|
+
* Set a species' record.
|
|
56
|
+
*
|
|
57
|
+
* @param {number} index the species' place in the list, as `mesh_ground_covers` rows name it
|
|
58
|
+
* @param {object} species
|
|
59
|
+
* @param {number} species.blade_length metres
|
|
60
|
+
* @param {number} species.blade_width metres
|
|
61
|
+
* @param {number} species.density blades a square metre
|
|
62
|
+
* @param {number} species.roughness
|
|
63
|
+
* @param {number[]} species.color_root linear rgb
|
|
64
|
+
* @param {number[]} species.color_tip linear rgb
|
|
65
|
+
* @param {number} species.length_variation how much of its length a blade can lack, 0 to 1
|
|
66
|
+
* @param {number} species.lean the most a blade leans from upright at its root, radians
|
|
67
|
+
* @param {number} species.curl the most a blade's tip turns further than its root leans, radians
|
|
68
|
+
* @param {number} species.tint how far a blade's colour strays from its species', as a share of it
|
|
69
|
+
* @param {number} species.roundness how far a blade's normal turns towards its edges
|
|
70
|
+
* @param {number} species.elastic_modulus of the blade's tissue in bending, Pa
|
|
71
|
+
* @param {number} species.blade_depth depth of the blade's section in bending, metres
|
|
72
|
+
* @param {number} species.turbulence how unsteady the wind a blade feels is, as a share of its speed
|
|
73
|
+
*/
|
|
74
|
+
set_species(index: number, species: {
|
|
75
|
+
blade_length: number;
|
|
76
|
+
blade_width: number;
|
|
77
|
+
density: number;
|
|
78
|
+
roughness: number;
|
|
79
|
+
color_root: number[];
|
|
80
|
+
color_tip: number[];
|
|
81
|
+
length_variation: number;
|
|
82
|
+
lean: number;
|
|
83
|
+
curl: number;
|
|
84
|
+
tint: number;
|
|
85
|
+
roundness: number;
|
|
86
|
+
elastic_modulus: number;
|
|
87
|
+
blade_depth: number;
|
|
88
|
+
turbulence: number;
|
|
89
|
+
}): void;
|
|
90
|
+
/**
|
|
91
|
+
* Begin a frame: move the blades' clock and the press's on, bring the device's species list up to
|
|
92
|
+
* date, and make room for the blades the last frames' lists were asked to hold. Call once a frame,
|
|
93
|
+
* before any view's {@link graph_generate}.
|
|
94
|
+
*
|
|
95
|
+
* @param {number} time_delta_seconds how far the scene's clock has moved since the last call
|
|
96
|
+
*/
|
|
97
|
+
update(time_delta_seconds: number): void;
|
|
98
|
+
/**
|
|
99
|
+
* Record the passes that make a view's blades: stamp the press field, count the cells, sum, and make
|
|
100
|
+
* the blades the counts allow. Records nothing while nothing grows.
|
|
101
|
+
*
|
|
102
|
+
* @param {object} options
|
|
103
|
+
* @param {FrameGraph} options.graph
|
|
104
|
+
* @param {GPUViewContext} options.view the view; its scene is the surfaces' scene
|
|
105
|
+
* @param {GPUFluidForcing|null} [options.forcing] the scene's GPU fluid forcing, whose obstacles press
|
|
106
|
+
* the blades; none press without it
|
|
107
|
+
*/
|
|
108
|
+
graph_generate({ graph, view, forcing }: {
|
|
109
|
+
graph: FrameGraph;
|
|
110
|
+
view: GPUViewContext;
|
|
111
|
+
forcing?: GPUFluidForcing | null;
|
|
112
|
+
}): void;
|
|
113
|
+
/**
|
|
114
|
+
* Record a view's blade draw: its blades into the blade id target under the scene's depth, then the
|
|
115
|
+
* G-buffer's surface, the visibility word and the velocity under every pixel a blade covers. Publishes
|
|
116
|
+
* the depth, the G-buffer targets, the visibility buffer and the velocity buffer it wrote. Records nothing for a view {@link graph_generate} made no blades for this frame.
|
|
117
|
+
*
|
|
118
|
+
* @param {FrameContext} frame at the phase where the G-buffer is written into
|
|
119
|
+
*/
|
|
120
|
+
graph_draw(frame: FrameContext): void;
|
|
121
|
+
/**
|
|
122
|
+
* Let go of everything on the device. The species stay listed.
|
|
123
|
+
*/
|
|
124
|
+
destroy(): void;
|
|
125
|
+
#private;
|
|
126
|
+
}
|
|
127
|
+
export type FrameGraph = import("../../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph;
|
|
128
|
+
export type PipelineEnquiry = import("../../../device/pipeline/PipelineEnquiry.js").PipelineEnquiry;
|
|
129
|
+
export type FrameContext = import("../../extension/FrameContext.js").FrameContext;
|
|
130
|
+
export type GPUFluidForcing = import("../../fluid/forcing/GPUFluidForcing.js").GPUFluidForcing;
|
|
131
|
+
export type GraphicsContext = import("../../GraphicsContext.js").GraphicsContext;
|
|
132
|
+
export type GPUViewContext = import("../../view/GPUViewContext.js").GPUViewContext;
|
|
133
|
+
export type GPUGrassSurfaces = import("../surface/GPUGrassSurfaces.js").GPUGrassSurfaces;
|
|
134
|
+
import { GPUGrassPress } from "../press/GPUGrassPress.js";
|
|
135
|
+
//# sourceMappingURL=GPUGrassBlades.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GPUGrassBlades.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/blade/GPUGrassBlades.js"],"names":[],"mappings":"AAsFA;;;;;;;;;;;;;GAaG;AACH;IAEI;;;;OAIG;IACH,iCAFW,eAAe,QAWzB;IAmED;;;OAGG;IACH,sBAHW,eAAe,YACf,gBAAgB,EAW1B;IA9ED;;;;;OAKG;IACH,gBAFU,aAAa,CAEjB;IA0EN;;OAEG;IACH,6BAEC;IAED;;OAEG;IACH,2BAEC;IAED;;;;OAIG;IACH,0BAEC;IAED;;;;OAIG;IACH,wBAEC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,mBAjBW,MAAM;QAEU,YAAY,EAA5B,MAAM;QACU,WAAW,EAA3B,MAAM;QACU,OAAO,EAAvB,MAAM;QACU,SAAS,EAAzB,MAAM;QACY,UAAU,EAA5B,MAAM,EAAE;QACU,SAAS,EAA3B,MAAM,EAAE;QACQ,gBAAgB,EAAhC,MAAM;QACU,IAAI,EAApB,MAAM;QACU,IAAI,EAApB,MAAM;QACU,IAAI,EAApB,MAAM;QACU,SAAS,EAAzB,MAAM;QACU,eAAe,EAA/B,MAAM;QACU,WAAW,EAA3B,MAAM;QACU,UAAU,EAA1B,MAAM;aA0ChB;IAED;;;;;;OAMG;IACH,2BAFW,MAAM,QAyDhB;IAED;;;;;;;;;OASG;IACH;QAL+B,KAAK,EAAzB,UAAU;QACc,IAAI,EAA5B,cAAc;QACiB,OAAO,GAAtC,eAAe,GAAC,IAAI;aA8J9B;IAED;;;;;;OAMG;IACH,kBAFW,YAAY,QAqItB;IAED;;OAEG;IACH,gBAQC;;CACJ;yBA/nBY,OAAO,8DAA8D,EAAE,UAAU;8BACjF,OAAO,6CAA6C,EAAE,eAAe;2BACrE,OAAO,iCAAiC,EAAE,YAAY;8BACtD,OAAO,wCAAwC,EAAE,eAAe;8BAChE,OAAO,0BAA0B,EAAE,eAAe;6BAClD,OAAO,8BAA8B,EAAE,cAAc;+BACrD,OAAO,gCAAgC,EAAE,gBAAgB;8BA1BxC,2BAA2B"}
|