@woosh/meep-engine 3.64.1 → 3.65.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/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_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 +47 -43
- 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/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/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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A rectangle of a grass surface whose ground has changed.
|
|
3
|
+
*
|
|
4
|
+
* - `surface`: the surface's `transforms` row.
|
|
5
|
+
* - `low_x`, `low_z`, `high_x`, `high_z`: the rectangle on the x and z of the surface's frame; low is not
|
|
6
|
+
* past high.
|
|
7
|
+
*
|
|
8
|
+
* 20 bytes: five words.
|
|
9
|
+
*
|
|
10
|
+
* @type {WebGPUStruct}
|
|
11
|
+
*/
|
|
12
|
+
export const GRASS_INVALIDATION_STRUCT: WebGPUStruct;
|
|
13
|
+
/**
|
|
14
|
+
* Words in a {@link GRASS_INVALIDATION_STRUCT}.
|
|
15
|
+
*
|
|
16
|
+
* @type {number}
|
|
17
|
+
*/
|
|
18
|
+
export const GRASS_INVALIDATION_WORDS: number;
|
|
19
|
+
/**
|
|
20
|
+
* Threads in a workgroup of {@link shader_grass_surface_invalidate}, along the dispatch's x.
|
|
21
|
+
*
|
|
22
|
+
* @type {number}
|
|
23
|
+
*/
|
|
24
|
+
export const GRASS_SURFACE_INVALIDATE_WORKGROUP_SIZE: number;
|
|
25
|
+
/**
|
|
26
|
+
* Records a thread of {@link shader_grass_surface_invalidate} reads: the dispatch's y counts runs of this
|
|
27
|
+
* many.
|
|
28
|
+
*
|
|
29
|
+
* @type {number}
|
|
30
|
+
*/
|
|
31
|
+
export const GRASS_SURFACE_INVALIDATE_RUN: number;
|
|
32
|
+
/**
|
|
33
|
+
* The pass's immediate.
|
|
34
|
+
*
|
|
35
|
+
* - `finest_spacing`: the spacing of level 0's columns.
|
|
36
|
+
* - `record_count`: how many records `grass_invalidations` holds.
|
|
37
|
+
* - `slot_capacity`: slots in the pool.
|
|
38
|
+
*
|
|
39
|
+
* @type {WebGPUStruct}
|
|
40
|
+
*/
|
|
41
|
+
export const GRASS_SURFACE_INVALIDATE_SETTINGS: WebGPUStruct;
|
|
42
|
+
/**
|
|
43
|
+
* Marks stale the baked slots whose tiles lie on ground that has changed: the rectangles in
|
|
44
|
+
* `grass_invalidations`.
|
|
45
|
+
*
|
|
46
|
+
* Thread `(x, y)` is slot `x` against the records `[y * GRASS_SURFACE_INVALIDATE_RUN, (y + 1) *
|
|
47
|
+
* GRASS_SURFACE_INVALIDATE_RUN)`. A slot that is baked, and whose tile's square touches a rectangle of its
|
|
48
|
+
* own surface among them, is marked stale: it reads as it was, and is baked again when a view next asks for
|
|
49
|
+
* it ({@link shader_grass_surface_want}). A square and a rectangle that share only an edge touch. Slots
|
|
50
|
+
* that are free, pending or stale already read no record, so the pass costs by the baked slots and the
|
|
51
|
+
* records, whatever area the rectangles cover.
|
|
52
|
+
*
|
|
53
|
+
* Dispatch `ceil(slot_capacity / GRASS_SURFACE_INVALIDATE_WORKGROUP_SIZE)` groups along x and
|
|
54
|
+
* `ceil(record_count / GRASS_SURFACE_INVALIDATE_RUN)` along y; threads past either count do nothing. Runs
|
|
55
|
+
* before the frame's asks.
|
|
56
|
+
*
|
|
57
|
+
* @type {ComputeShader}
|
|
58
|
+
*/
|
|
59
|
+
export const shader_grass_surface_invalidate: ComputeShader;
|
|
60
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
61
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
62
|
+
//# sourceMappingURL=shader_grass_surface_invalidate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_grass_surface_invalidate.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/surface/shader_grass_surface_invalidate.js"],"names":[],"mappings":"AAmBA;;;;;;;;;;GAUG;AACH,wCAFU,YAAY,CAQE;AAExB;;;;GAIG;AACH,uCAFU,MAAM,CAE0B;AAE1C;;;;GAIG;AACH,sDAFU,MAAM,CAE0C;AAE1D;;;;;GAKG;AACH,2CAFU,MAAM,CAE+B;AAE/C;;;;;;;;GAQG;AACH,gDAFU,YAAY,CAMe;AAUrC;;;;;;;;;;;;;;;;GAgBG;AACH,8CAFU,aAAa,CA+DpB;6BA5J0B,mCAAmC;8BAJlC,+BAA+B"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
2
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
3
|
+
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
4
|
+
import { f32, u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
5
|
+
import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
|
|
6
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
7
|
+
import { chunk_grass_slot } from "./chunk_grass_slot.js";
|
|
8
|
+
import { chunk_grass_tile } from "./chunk_grass_tile.js";
|
|
9
|
+
import {
|
|
10
|
+
GRASS_SLOT_LEVEL_LAYER,
|
|
11
|
+
GRASS_SLOT_STATE,
|
|
12
|
+
GRASS_SLOT_STATE_BAKED,
|
|
13
|
+
GRASS_SLOT_STATE_STALE,
|
|
14
|
+
GRASS_SLOT_SURFACE,
|
|
15
|
+
GRASS_SLOT_TILE_X,
|
|
16
|
+
GRASS_SLOT_TILE_Z
|
|
17
|
+
} from "./GRASS_SURFACE.js";
|
|
18
|
+
import { GRASS_POOL_RESOURCE } from "./GRASS_SURFACE_VIEW.js";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A rectangle of a grass surface whose ground has changed.
|
|
22
|
+
*
|
|
23
|
+
* - `surface`: the surface's `transforms` row.
|
|
24
|
+
* - `low_x`, `low_z`, `high_x`, `high_z`: the rectangle on the x and z of the surface's frame; low is not
|
|
25
|
+
* past high.
|
|
26
|
+
*
|
|
27
|
+
* 20 bytes: five words.
|
|
28
|
+
*
|
|
29
|
+
* @type {WebGPUStruct}
|
|
30
|
+
*/
|
|
31
|
+
export const GRASS_INVALIDATION_STRUCT = WebGPUStruct.from({
|
|
32
|
+
surface: u32,
|
|
33
|
+
low_x: f32,
|
|
34
|
+
low_z: f32,
|
|
35
|
+
high_x: f32,
|
|
36
|
+
high_z: f32,
|
|
37
|
+
}, "GrassInvalidation");
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Words in a {@link GRASS_INVALIDATION_STRUCT}.
|
|
41
|
+
*
|
|
42
|
+
* @type {number}
|
|
43
|
+
*/
|
|
44
|
+
export const GRASS_INVALIDATION_WORDS = 5;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Threads in a workgroup of {@link shader_grass_surface_invalidate}, along the dispatch's x.
|
|
48
|
+
*
|
|
49
|
+
* @type {number}
|
|
50
|
+
*/
|
|
51
|
+
export const GRASS_SURFACE_INVALIDATE_WORKGROUP_SIZE = 64;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Records a thread of {@link shader_grass_surface_invalidate} reads: the dispatch's y counts runs of this
|
|
55
|
+
* many.
|
|
56
|
+
*
|
|
57
|
+
* @type {number}
|
|
58
|
+
*/
|
|
59
|
+
export const GRASS_SURFACE_INVALIDATE_RUN = 64;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The pass's immediate.
|
|
63
|
+
*
|
|
64
|
+
* - `finest_spacing`: the spacing of level 0's columns.
|
|
65
|
+
* - `record_count`: how many records `grass_invalidations` holds.
|
|
66
|
+
* - `slot_capacity`: slots in the pool.
|
|
67
|
+
*
|
|
68
|
+
* @type {WebGPUStruct}
|
|
69
|
+
*/
|
|
70
|
+
export const GRASS_SURFACE_INVALIDATE_SETTINGS = WebGPUStruct.from({
|
|
71
|
+
finest_spacing: f32,
|
|
72
|
+
record_count: u32,
|
|
73
|
+
slot_capacity: u32,
|
|
74
|
+
}, "GrassSurfaceInvalidateSettings");
|
|
75
|
+
|
|
76
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
77
|
+
|
|
78
|
+
resources.setImmediate("settings", GRASS_SURFACE_INVALIDATE_SETTINGS);
|
|
79
|
+
|
|
80
|
+
resources.createGroup()
|
|
81
|
+
.addStorageBuffer("grass_invalidations", WebGPUArray.from(GRASS_INVALIDATION_STRUCT))
|
|
82
|
+
.add(GRASS_POOL_RESOURCE);
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Marks stale the baked slots whose tiles lie on ground that has changed: the rectangles in
|
|
86
|
+
* `grass_invalidations`.
|
|
87
|
+
*
|
|
88
|
+
* Thread `(x, y)` is slot `x` against the records `[y * GRASS_SURFACE_INVALIDATE_RUN, (y + 1) *
|
|
89
|
+
* GRASS_SURFACE_INVALIDATE_RUN)`. A slot that is baked, and whose tile's square touches a rectangle of its
|
|
90
|
+
* own surface among them, is marked stale: it reads as it was, and is baked again when a view next asks for
|
|
91
|
+
* it ({@link shader_grass_surface_want}). A square and a rectangle that share only an edge touch. Slots
|
|
92
|
+
* that are free, pending or stale already read no record, so the pass costs by the baked slots and the
|
|
93
|
+
* records, whatever area the rectangles cover.
|
|
94
|
+
*
|
|
95
|
+
* Dispatch `ceil(slot_capacity / GRASS_SURFACE_INVALIDATE_WORKGROUP_SIZE)` groups along x and
|
|
96
|
+
* `ceil(record_count / GRASS_SURFACE_INVALIDATE_RUN)` along y; threads past either count do nothing. Runs
|
|
97
|
+
* before the frame's asks.
|
|
98
|
+
*
|
|
99
|
+
* @type {ComputeShader}
|
|
100
|
+
*/
|
|
101
|
+
export const shader_grass_surface_invalidate = ComputeShader.from({
|
|
102
|
+
label: "Grass Surface Invalidate",
|
|
103
|
+
resources,
|
|
104
|
+
body: CodeChunk.from(
|
|
105
|
+
//language=WGSL
|
|
106
|
+
`
|
|
107
|
+
@compute @workgroup_size(${GRASS_SURFACE_INVALIDATE_WORKGROUP_SIZE})
|
|
108
|
+
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
|
|
109
|
+
let slot = id.x;
|
|
110
|
+
|
|
111
|
+
if (slot >= settings.slot_capacity) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
let record = grass_slot_record(slot);
|
|
116
|
+
let state = record + ${GRASS_SLOT_STATE}u;
|
|
117
|
+
|
|
118
|
+
if (atomicLoad(&grass_pool[state]) != ${GRASS_SLOT_STATE_BAKED}u) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
let surface = atomicLoad(&grass_pool[record + ${GRASS_SLOT_SURFACE}u]);
|
|
123
|
+
let level = atomicLoad(&grass_pool[record + ${GRASS_SLOT_LEVEL_LAYER}u]) & 0xffu;
|
|
124
|
+
|
|
125
|
+
let tile = vec2<i32>(
|
|
126
|
+
bitcast<i32>(atomicLoad(&grass_pool[record + ${GRASS_SLOT_TILE_X}u])),
|
|
127
|
+
bitcast<i32>(atomicLoad(&grass_pool[record + ${GRASS_SLOT_TILE_Z}u])),
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
// the tile's square on the frame's x and z
|
|
131
|
+
let edge = grass_level_spacing(settings.finest_spacing, level) * f32(GRASS_TILE_COLUMNS);
|
|
132
|
+
|
|
133
|
+
let low = vec2<f32>(tile) * edge;
|
|
134
|
+
let high = low + edge;
|
|
135
|
+
|
|
136
|
+
let first = id.y * ${GRASS_SURFACE_INVALIDATE_RUN}u;
|
|
137
|
+
|
|
138
|
+
for (var i = 0u; i < ${GRASS_SURFACE_INVALIDATE_RUN}u; i++) {
|
|
139
|
+
let at = first + i;
|
|
140
|
+
|
|
141
|
+
if (at >= settings.record_count) {
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
let change = grass_invalidations[at];
|
|
146
|
+
|
|
147
|
+
if (change.surface != surface) {
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (change.low_x <= high.x && change.low_z <= high.y && change.high_x >= low.x && change.high_z >= low.y) {
|
|
152
|
+
atomicStore(&grass_pool[state], ${GRASS_SLOT_STATE_STALE}u);
|
|
153
|
+
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
`, [
|
|
159
|
+
chunk_grass_slot,
|
|
160
|
+
chunk_grass_tile,
|
|
161
|
+
]),
|
|
162
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Threads in a workgroup of {@link shader_grass_surface_retire}.
|
|
3
|
+
*
|
|
4
|
+
* @type {number}
|
|
5
|
+
*/
|
|
6
|
+
export const GRASS_SURFACE_RETIRE_WORKGROUP_SIZE: number;
|
|
7
|
+
/**
|
|
8
|
+
* The pass's immediate.
|
|
9
|
+
*
|
|
10
|
+
* - `frame`: the frame, as the asks stamp it.
|
|
11
|
+
* - `slot_capacity`: slots in the pool.
|
|
12
|
+
*
|
|
13
|
+
* @type {WebGPUStruct}
|
|
14
|
+
*/
|
|
15
|
+
export const GRASS_SURFACE_RETIRE_SETTINGS: WebGPUStruct;
|
|
16
|
+
/**
|
|
17
|
+
* Gives slots back to the grass surfaces' pool, a thread a slot: once a frame, before any view asks.
|
|
18
|
+
*
|
|
19
|
+
* - A slot the directory never listed (`GRASS_SLOT_STATE_ORPHAN`) is freed.
|
|
20
|
+
* - A baked or stale slot no view asked for this frame or the one before can be evicted. It is, when the
|
|
21
|
+
* plan the last frame's schedule left asks for it ({@link shader_grass_surface_schedule},
|
|
22
|
+
* `chunk_age_eviction`): its record leaves the directory, the pool's count of removals rises, its state
|
|
23
|
+
* goes to free and it is pushed on the free stack. One the plan does not ask for is counted into its
|
|
24
|
+
* age's bucket, from `GRASS_POOL_AGES`, for the frame's schedule.
|
|
25
|
+
* - A pending slot, and one a view asked for this frame or the last, is left as it is.
|
|
26
|
+
*
|
|
27
|
+
* Eviction follows the pressure on the slots, not a time: a plan asks for nothing while the free slots
|
|
28
|
+
* cover what views need, and a tile nothing looks at keeps its surfels until then.
|
|
29
|
+
*
|
|
30
|
+
* Every push to the free stack and every removal from the directory is here; the pops, finds and inserts
|
|
31
|
+
* are the asks', in other dispatches. Dispatch `ceil(slot_capacity / GRASS_SURFACE_RETIRE_WORKGROUP_SIZE)`
|
|
32
|
+
* groups: the pool's capacity follows what views hold, so a thread a slot is a thread a tile in use, to
|
|
33
|
+
* within the pool's growth.
|
|
34
|
+
*
|
|
35
|
+
* @type {ComputeShader}
|
|
36
|
+
*/
|
|
37
|
+
export const shader_grass_surface_retire: ComputeShader;
|
|
38
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
39
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
40
|
+
//# sourceMappingURL=shader_grass_surface_retire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_grass_surface_retire.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/surface/shader_grass_surface_retire.js"],"names":[],"mappings":"AA6BA;;;;GAIG;AACH,kDAFU,MAAM,CAEsC;AAEtD;;;;;;;GAOG;AACH,4CAFU,YAAY,CAKW;AAWjC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,0CAFU,aAAa,CA6EpB;6BAnJ0B,mCAAmC;8BAJlC,+BAA+B"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { chunk_age_eviction } from "../../gpu_primitive/age_eviction/chunk_age_eviction.js";
|
|
2
|
+
import { chunk_slot_stack } from "../../gpu_primitive/slot_stack/chunk_slot_stack.js";
|
|
3
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
4
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
5
|
+
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
6
|
+
import { u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
7
|
+
import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
|
|
8
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
9
|
+
import { chunk_grass_directory } from "./chunk_grass_directory.js";
|
|
10
|
+
import {
|
|
11
|
+
GRASS_POOL_AGES,
|
|
12
|
+
GRASS_POOL_EVICT_BUCKETS,
|
|
13
|
+
GRASS_POOL_EVICT_REMAINING,
|
|
14
|
+
GRASS_POOL_EVICTED,
|
|
15
|
+
GRASS_POOL_FREE_COUNT,
|
|
16
|
+
GRASS_POOL_REMOVED,
|
|
17
|
+
GRASS_SLOT_LEVEL_LAYER,
|
|
18
|
+
GRASS_SLOT_STATE,
|
|
19
|
+
GRASS_SLOT_STATE_BAKED,
|
|
20
|
+
GRASS_SLOT_STATE_FREE,
|
|
21
|
+
GRASS_SLOT_STATE_ORPHAN,
|
|
22
|
+
GRASS_SLOT_STATE_STALE,
|
|
23
|
+
GRASS_SLOT_SURFACE,
|
|
24
|
+
GRASS_SLOT_TILE_X,
|
|
25
|
+
GRASS_SLOT_TILE_Z,
|
|
26
|
+
GRASS_SLOT_WANTED_FRAME
|
|
27
|
+
} from "./GRASS_SURFACE.js";
|
|
28
|
+
import { GRASS_DIRECTORY_RESOURCE, GRASS_POOL_RESOURCE } from "./GRASS_SURFACE_VIEW.js";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Threads in a workgroup of {@link shader_grass_surface_retire}.
|
|
32
|
+
*
|
|
33
|
+
* @type {number}
|
|
34
|
+
*/
|
|
35
|
+
export const GRASS_SURFACE_RETIRE_WORKGROUP_SIZE = 64;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* The pass's immediate.
|
|
39
|
+
*
|
|
40
|
+
* - `frame`: the frame, as the asks stamp it.
|
|
41
|
+
* - `slot_capacity`: slots in the pool.
|
|
42
|
+
*
|
|
43
|
+
* @type {WebGPUStruct}
|
|
44
|
+
*/
|
|
45
|
+
export const GRASS_SURFACE_RETIRE_SETTINGS = WebGPUStruct.from({
|
|
46
|
+
frame: u32,
|
|
47
|
+
slot_capacity: u32,
|
|
48
|
+
}, "GrassSurfaceRetireSettings");
|
|
49
|
+
|
|
50
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
51
|
+
|
|
52
|
+
resources.setImmediate("settings", GRASS_SURFACE_RETIRE_SETTINGS);
|
|
53
|
+
|
|
54
|
+
resources.createGroup()
|
|
55
|
+
.add(GRASS_POOL_RESOURCE)
|
|
56
|
+
.add(GRASS_DIRECTORY_RESOURCE)
|
|
57
|
+
.addStorageBuffer("grass_free", WebGPUArray.u32, true);
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Gives slots back to the grass surfaces' pool, a thread a slot: once a frame, before any view asks.
|
|
61
|
+
*
|
|
62
|
+
* - A slot the directory never listed (`GRASS_SLOT_STATE_ORPHAN`) is freed.
|
|
63
|
+
* - A baked or stale slot no view asked for this frame or the one before can be evicted. It is, when the
|
|
64
|
+
* plan the last frame's schedule left asks for it ({@link shader_grass_surface_schedule},
|
|
65
|
+
* `chunk_age_eviction`): its record leaves the directory, the pool's count of removals rises, its state
|
|
66
|
+
* goes to free and it is pushed on the free stack. One the plan does not ask for is counted into its
|
|
67
|
+
* age's bucket, from `GRASS_POOL_AGES`, for the frame's schedule.
|
|
68
|
+
* - A pending slot, and one a view asked for this frame or the last, is left as it is.
|
|
69
|
+
*
|
|
70
|
+
* Eviction follows the pressure on the slots, not a time: a plan asks for nothing while the free slots
|
|
71
|
+
* cover what views need, and a tile nothing looks at keeps its surfels until then.
|
|
72
|
+
*
|
|
73
|
+
* Every push to the free stack and every removal from the directory is here; the pops, finds and inserts
|
|
74
|
+
* are the asks', in other dispatches. Dispatch `ceil(slot_capacity / GRASS_SURFACE_RETIRE_WORKGROUP_SIZE)`
|
|
75
|
+
* groups: the pool's capacity follows what views hold, so a thread a slot is a thread a tile in use, to
|
|
76
|
+
* within the pool's growth.
|
|
77
|
+
*
|
|
78
|
+
* @type {ComputeShader}
|
|
79
|
+
*/
|
|
80
|
+
export const shader_grass_surface_retire = ComputeShader.from({
|
|
81
|
+
label: "Grass Surface Retire",
|
|
82
|
+
resources,
|
|
83
|
+
body: CodeChunk.from(
|
|
84
|
+
//language=WGSL
|
|
85
|
+
`
|
|
86
|
+
@compute @workgroup_size(${GRASS_SURFACE_RETIRE_WORKGROUP_SIZE})
|
|
87
|
+
fn main(@builtin(global_invocation_id) id: vec3<u32>) {
|
|
88
|
+
let slot = id.x;
|
|
89
|
+
|
|
90
|
+
if (slot >= settings.slot_capacity) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
let record = grass_slot_record(slot);
|
|
95
|
+
let state = atomicLoad(&grass_pool[record + ${GRASS_SLOT_STATE}u]);
|
|
96
|
+
|
|
97
|
+
if (state != ${GRASS_SLOT_STATE_ORPHAN}u) {
|
|
98
|
+
if (state != ${GRASS_SLOT_STATE_BAKED}u && state != ${GRASS_SLOT_STATE_STALE}u) {
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let wanted_frame = atomicLoad(&grass_pool[record + ${GRASS_SLOT_WANTED_FRAME}u]);
|
|
103
|
+
|
|
104
|
+
// not asked for the frame before: wanted_frame < frame − 1, which does not wrap at the first frame
|
|
105
|
+
if (wanted_frame + 1u >= settings.frame) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
let age = settings.frame - wanted_frame;
|
|
110
|
+
|
|
111
|
+
// the bucket the last frame's schedule counted it in, a frame younger
|
|
112
|
+
let counted = age_eviction_bucket(age - 1u);
|
|
113
|
+
|
|
114
|
+
let buckets = atomicLoad(&grass_pool[${GRASS_POOL_EVICT_BUCKETS}u]);
|
|
115
|
+
let remaining = atomicLoad(&grass_pool[${GRASS_POOL_EVICT_REMAINING}u]);
|
|
116
|
+
|
|
117
|
+
var evicted = age_eviction_whole(counted, buckets);
|
|
118
|
+
|
|
119
|
+
if (age_eviction_partial(counted, buckets) && remaining > 0u) {
|
|
120
|
+
evicted = atomicAdd(&grass_pool[${GRASS_POOL_EVICTED}u], 1u) < remaining;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!evicted) {
|
|
124
|
+
atomicAdd(&grass_pool[${GRASS_POOL_AGES}u + age_eviction_bucket(age)], 1u);
|
|
125
|
+
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
let tile = vec2<i32>(
|
|
130
|
+
bitcast<i32>(atomicLoad(&grass_pool[record + ${GRASS_SLOT_TILE_X}u])),
|
|
131
|
+
bitcast<i32>(atomicLoad(&grass_pool[record + ${GRASS_SLOT_TILE_Z}u])),
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
let removed = grass_directory_remove(
|
|
135
|
+
atomicLoad(&grass_pool[record + ${GRASS_SLOT_SURFACE}u]),
|
|
136
|
+
atomicLoad(&grass_pool[record + ${GRASS_SLOT_LEVEL_LAYER}u]),
|
|
137
|
+
tile,
|
|
138
|
+
slot,
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
if (removed) {
|
|
142
|
+
atomicAdd(&grass_pool[${GRASS_POOL_REMOVED}u], 1u);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
atomicStore(&grass_pool[record + ${GRASS_SLOT_STATE}u], ${GRASS_SLOT_STATE_FREE}u);
|
|
147
|
+
|
|
148
|
+
slot_stack_push(&grass_pool[${GRASS_POOL_FREE_COUNT}u], &grass_free, slot);
|
|
149
|
+
}
|
|
150
|
+
`, [
|
|
151
|
+
chunk_grass_directory,
|
|
152
|
+
chunk_slot_stack,
|
|
153
|
+
chunk_age_eviction,
|
|
154
|
+
]),
|
|
155
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plans the next frame's eviction from the grass surfaces' pool: one thread, once a frame, after the
|
|
3
|
+
* frame's retire and its first view's asks.
|
|
4
|
+
*
|
|
5
|
+
* The pool is short by as many slots as its free ones fall below `slack`. The plan frees that many of
|
|
6
|
+
* the slots retire counted as evictable, the longest unasked first (`age_eviction_plan` over
|
|
7
|
+
* `GRASS_POOL_AGES`, emptied by it), and is left in `GRASS_POOL_EVICT_BUCKETS` and
|
|
8
|
+
* `GRASS_POOL_EVICT_REMAINING` for the next retire, with `GRASS_POOL_EVICTED` at zero. With `slack`
|
|
9
|
+
* slots free it asks for nothing.
|
|
10
|
+
*
|
|
11
|
+
* `slack` is the bake's places a frame, across its views: a layer is taken a slot only with a place in
|
|
12
|
+
* the bake, so no more slots than that are taken in a frame, and with that many free an ask starves only
|
|
13
|
+
* when the slots in use fill the pool.
|
|
14
|
+
*
|
|
15
|
+
* @type {ComputeShader}
|
|
16
|
+
*/
|
|
17
|
+
export const shader_grass_surface_schedule: ComputeShader;
|
|
18
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
19
|
+
//# sourceMappingURL=shader_grass_surface_schedule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_grass_surface_schedule.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/surface/shader_grass_surface_schedule.js"],"names":[],"mappings":"AAsBA;;;;;;;;;;;;;;;GAeG;AACH,4CAFU,aAAa,CAqBpB;8BAvD2B,+BAA+B"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { chunk_age_eviction } from "../../gpu_primitive/age_eviction/chunk_age_eviction.js";
|
|
2
|
+
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
3
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
4
|
+
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
5
|
+
import { u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
6
|
+
import {
|
|
7
|
+
GRASS_POOL_AGES,
|
|
8
|
+
GRASS_POOL_EVICT_BUCKETS,
|
|
9
|
+
GRASS_POOL_EVICT_REMAINING,
|
|
10
|
+
GRASS_POOL_EVICTED,
|
|
11
|
+
GRASS_POOL_FREE_COUNT
|
|
12
|
+
} from "./GRASS_SURFACE.js";
|
|
13
|
+
import { GRASS_POOL_RESOURCE } from "./GRASS_SURFACE_VIEW.js";
|
|
14
|
+
|
|
15
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
16
|
+
|
|
17
|
+
// free slots the pool is to have when the next frame's asks begin
|
|
18
|
+
resources.setImmediate("slack", u32);
|
|
19
|
+
|
|
20
|
+
resources.createGroup()
|
|
21
|
+
.add(GRASS_POOL_RESOURCE);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Plans the next frame's eviction from the grass surfaces' pool: one thread, once a frame, after the
|
|
25
|
+
* frame's retire and its first view's asks.
|
|
26
|
+
*
|
|
27
|
+
* The pool is short by as many slots as its free ones fall below `slack`. The plan frees that many of
|
|
28
|
+
* the slots retire counted as evictable, the longest unasked first (`age_eviction_plan` over
|
|
29
|
+
* `GRASS_POOL_AGES`, emptied by it), and is left in `GRASS_POOL_EVICT_BUCKETS` and
|
|
30
|
+
* `GRASS_POOL_EVICT_REMAINING` for the next retire, with `GRASS_POOL_EVICTED` at zero. With `slack`
|
|
31
|
+
* slots free it asks for nothing.
|
|
32
|
+
*
|
|
33
|
+
* `slack` is the bake's places a frame, across its views: a layer is taken a slot only with a place in
|
|
34
|
+
* the bake, so no more slots than that are taken in a frame, and with that many free an ask starves only
|
|
35
|
+
* when the slots in use fill the pool.
|
|
36
|
+
*
|
|
37
|
+
* @type {ComputeShader}
|
|
38
|
+
*/
|
|
39
|
+
export const shader_grass_surface_schedule = ComputeShader.from({
|
|
40
|
+
label: "Grass Surface Schedule",
|
|
41
|
+
resources,
|
|
42
|
+
body: CodeChunk.from(
|
|
43
|
+
//language=WGSL
|
|
44
|
+
`
|
|
45
|
+
@compute @workgroup_size(1)
|
|
46
|
+
fn main() {
|
|
47
|
+
let free = atomicLoad(&grass_pool[${GRASS_POOL_FREE_COUNT}u]);
|
|
48
|
+
|
|
49
|
+
let plan = age_eviction_plan(&grass_pool, ${GRASS_POOL_AGES}u, select(0u, slack - free, slack > free));
|
|
50
|
+
|
|
51
|
+
atomicStore(&grass_pool[${GRASS_POOL_EVICT_BUCKETS}u], plan.x);
|
|
52
|
+
atomicStore(&grass_pool[${GRASS_POOL_EVICT_REMAINING}u], plan.y);
|
|
53
|
+
atomicStore(&grass_pool[${GRASS_POOL_EVICTED}u], 0u);
|
|
54
|
+
}
|
|
55
|
+
`, [
|
|
56
|
+
chunk_age_eviction,
|
|
57
|
+
]),
|
|
58
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Asks for the tiles of the grass surfaces a view wants, a thread a tile of a window
|
|
3
|
+
* ({@link shader_grass_surface_window_count}, whose counts, summed, are `prefix_sums`).
|
|
4
|
+
*
|
|
5
|
+
* A thread finds its level of its surface from the sums and its tile from its place among that window's
|
|
6
|
+
* threads. A tile outside its level's ring (`grass_tile_wanted`) or outside the view's frustum is not
|
|
7
|
+
* wanted, and the thread ends.
|
|
8
|
+
*
|
|
9
|
+
* **A wanted tile's layers.** Layer 0 always; and once layer 0 is baked, the layers past it that its record
|
|
10
|
+
* counts. For each:
|
|
11
|
+
*
|
|
12
|
+
* - held by a slot (`grass_directory_find`): the slot's record is stamped with the frame. A stale slot also
|
|
13
|
+
* takes a place in the frame's bake list, with what a bake gathers into its record reset, and keeps its
|
|
14
|
+
* state: it reads as it was until the bake has run;
|
|
15
|
+
* - not held: the thread takes a place in the frame's bake list (`grass_jobs`, at most `job_capacity`
|
|
16
|
+
* places, a count that keeps rising past them) and a slot off the free stack, writes the slot's record
|
|
17
|
+
* for the layer, pending, and lists it in the directory. With the bake list full the layer waits for a
|
|
18
|
+
* later frame. With no slot free the place holds `GRASS_SLOT_NONE` and the pool's starved count rises.
|
|
19
|
+
* A slot the directory has no room for is marked an orphan and its place holds `GRASS_SLOT_NONE`.
|
|
20
|
+
*
|
|
21
|
+
* Every thread's layers are its own, so no two threads of a dispatch ask for the same one; two views ask
|
|
22
|
+
* in two dispatches, and the second finds what the first took.
|
|
23
|
+
*
|
|
24
|
+
* Dispatched through `shader_prefix_sum_to_command`'s folded command.
|
|
25
|
+
*
|
|
26
|
+
* @type {ComputeShader}
|
|
27
|
+
*/
|
|
28
|
+
export const shader_grass_surface_want: ComputeShader;
|
|
29
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
30
|
+
//# sourceMappingURL=shader_grass_surface_want.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_grass_surface_want.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/grass/surface/shader_grass_surface_want.js"],"names":[],"mappings":"AA2DA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wCAFU,aAAa,CAsKpB;8BA9O2B,+BAA+B"}
|