@woosh/meep-engine 3.59.0 → 3.60.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/package.json +1 -1
- package/src/shade/playground/probe_clipmap/index.html +12 -0
- package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
- package/src/shade/playground/probe_clipmap/main.js +5 -0
- package/src/shade/renderer/Renderer.d.ts.map +1 -1
- package/src/shade/renderer/Renderer.js +4 -6
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +63 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +228 -16
- package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts +27 -4
- package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js +526 -23
- package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.d.ts +11 -0
- package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.d.ts.map +1 -0
- package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.js +21 -0
- package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.d.ts +65 -0
- package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.d.ts.map +1 -0
- package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.js +376 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.d.ts +7 -3
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.d.ts.map +1 -1
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.js +70 -6
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.d.ts +20 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.d.ts.map +1 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.js +80 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.d.ts +18 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.d.ts.map +1 -0
- package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.js +113 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts +47 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.js +80 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts +91 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.js +902 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts +16 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.js +67 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts +17 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.js +145 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts +12 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts.map +1 -0
- package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.js +105 -0
- package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +3 -9
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +13 -31
- package/src/shade/renderer/global_illumination/probe_clipmap/PROBE_CLIPMAP_PROPOSAL_2026_10_27.md +764 -48
- package/src/shade/renderer/global_illumination/probe_clipmap/PROBE_RAYS_VARIABLE_AND_SORTED_SCOPE_2026_10_30.md +410 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts +3 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +4 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +41 -17
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +57 -33
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.d.ts +11 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.js +13 -4
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +9 -18
- 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 +8 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts +12 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.js +28 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +1 -29
- 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 +1 -74
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts +161 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.js +219 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.d.ts +1 -8
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.js +1 -9
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts +40 -12
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.js +373 -31
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.js +2 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.d.ts +15 -8
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.js +28 -14
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts +23 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +66 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.d.ts +29 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.js +210 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.d.ts +29 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.js +86 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts +41 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +439 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.d.ts +23 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.js +135 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts +3 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.js +12 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +21 -18
- 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 +254 -73
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +149 -8
- 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 +181 -13
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +179 -7
- 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 +412 -31
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.js +4 -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 +4 -3
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts +36 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js +218 -29
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts +5 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.js +24 -14
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +15 -6
- 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 +21 -22
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts +36 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.js +257 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +18 -7
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +157 -51
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts +23 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.js +110 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts +24 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.js +90 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts +45 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts.map +1 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.js +205 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts +16 -3
- 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 +55 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts +19 -4
- 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 +60 -6
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts +4 -8
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +21 -36
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts +21 -14
- 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 +100 -30
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts +6 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.js +26 -10
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts +3 -2
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts.map +1 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.js +12 -12
- package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.d.ts +10 -0
- package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.js +21 -0
- package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.d.ts +5 -2
- package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.js +31 -23
- package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.d.ts +10 -0
- package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.js +22 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.d.ts +9 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.js +18 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.d.ts +8 -3
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.js +41 -32
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.d.ts +31 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.js +71 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.d.ts +47 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.js +210 -0
- package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +5 -4
- package/src/shade/renderer/gpu_primitive/sort/defs.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/defs.js +5 -4
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +56 -15
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +410 -61
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.d.ts +4 -1
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.js +16 -42
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.d.ts +15 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.js +60 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.d.ts +25 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.js +89 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.d.ts +3 -8
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.js +28 -160
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.d.ts +12 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.d.ts.map +1 -0
- package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.js +74 -0
- package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.d.ts +3 -1
- package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.d.ts.map +1 -1
- package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.js +387 -188
- package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_irradiance_flat.js +1 -1
- package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_sh.js +1 -1
- package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts.map +1 -1
- package/src/shade/renderer/material/resident/GPUResidentMaterialContext.js +90 -72
- package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.d.ts +5 -0
- package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.d.ts.map +1 -1
- package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.js +9 -0
- package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.d.ts +13 -0
- package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.js +14 -0
- package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.d.ts +10 -0
- package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.js +15 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.d.ts +4 -3
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.js +6 -5
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.d.ts +17 -2
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.js +25 -57
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.d.ts +13 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.js +70 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.d.ts +10 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.js +59 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.d.ts +12 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.d.ts.map +1 -0
- package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.js +49 -0
- package/src/shade/renderer/path_tracer/shader/chunk_ray_hit_to_opacity.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_ray_hit_to_opacity.js +1 -0
- package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.js +1 -0
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material.js +2 -1
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts +7 -0
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts.map +1 -1
- package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.js +15 -6
- package/src/shade/renderer/scene/GPUSceneContext.d.ts +7 -1
- package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
- package/src/shade/renderer/scene/GPUSceneContext.js +26 -1
- package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.d.ts +7 -7
- package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.js +262 -294
- package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.d.ts +9 -0
- package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.js +21 -0
- package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts +43 -0
- package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js +87 -0
- package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.d.ts +7 -1
- package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.d.ts.map +1 -1
- package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.js +1 -1
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.d.ts +21 -0
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.d.ts.map +1 -0
- package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.js +42 -0
- package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
- package/src/shade/wgsl/emulator/CPUBitmapData.d.ts +19 -0
- package/src/shade/wgsl/emulator/CPUBitmapData.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/CPUBitmapData.js +27 -0
- package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
- package/src/shade/wgsl/emulator/WGSLLanguageCore.js +39 -18
- package/src/view/elements/progress/segmented/GhostTrail.d.ts +56 -0
- package/src/view/elements/progress/segmented/GhostTrail.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/GhostTrail.js +98 -0
- package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.d.ts +3 -1
- package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.d.ts.map +1 -1
- package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.js +3 -1
- package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.d.ts +11 -0
- package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.js +15 -0
- package/src/view/elements/progress/segmented/SegmentDefinition.d.ts +3 -0
- package/src/view/elements/progress/segmented/SegmentDefinition.d.ts.map +1 -1
- package/src/view/elements/progress/segmented/SegmentDefinition.js +3 -0
- package/src/view/elements/progress/segmented/SegmentTier.d.ts +38 -0
- package/src/view/elements/progress/segmented/SegmentTier.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/SegmentTier.js +50 -0
- package/src/view/elements/progress/segmented/SegmentedResourceBarView.d.ts +155 -10
- package/src/view/elements/progress/segmented/SegmentedResourceBarView.d.ts.map +1 -1
- package/src/view/elements/progress/segmented/SegmentedResourceBarView.js +427 -101
- package/src/view/elements/progress/segmented/playground/index.html +78 -0
- package/src/view/elements/progress/segmented/playground/main.d.ts +2 -0
- package/src/view/elements/progress/segmented/playground/main.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/playground/main.js +173 -0
- package/src/view/elements/progress/segmented/segment_cell_layout.d.ts +48 -0
- package/src/view/elements/progress/segmented/segment_cell_layout.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/segment_cell_layout.js +75 -0
- package/src/view/elements/progress/segmented/segment_notch_place.d.ts +18 -0
- package/src/view/elements/progress/segmented/segment_notch_place.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/segment_notch_place.js +28 -0
- package/src/view/elements/progress/segmented/segment_tick_positions.d.ts +32 -0
- package/src/view/elements/progress/segmented/segment_tick_positions.d.ts.map +1 -0
- package/src/view/elements/progress/segmented/segment_tick_positions.js +103 -0
- package/src/view/elements/progress/segmented/segmented-resource-bar.css +142 -0
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.d.ts +0 -35
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.js +0 -238
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.d.ts +0 -99
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.js +0 -139
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.d.ts +0 -65
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.js +0 -393
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.d.ts +0 -17
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.js +0 -36
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.d.ts +0 -29
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.js +0 -108
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.d.ts +0 -31
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.js +0 -113
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.d.ts +0 -36
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.js +0 -85
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.d.ts +0 -23
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.js +0 -273
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.d.ts +0 -13
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.js +0 -151
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.d.ts +0 -13
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.js +0 -133
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.d.ts +0 -22
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.d.ts.map +0 -1
- package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.js +0 -135
|
@@ -1,75 +1,49 @@
|
|
|
1
|
-
import { u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
2
|
-
import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
|
|
3
1
|
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
4
2
|
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
5
3
|
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
4
|
+
import {
|
|
5
|
+
chunk_sort_histogram_tile,
|
|
6
|
+
SORT_HISTOGRAM_KEYS_RESOURCE,
|
|
7
|
+
SORT_HISTOGRAM_SPINE_RESOURCE
|
|
8
|
+
} from "./chunk_sort_histogram_tile.js";
|
|
8
9
|
import { SORT_PASS_SETTINGS_STRUCT } from "./SORT_PASS_SETTINGS_STRUCT.js";
|
|
9
10
|
|
|
10
11
|
const resources = new ShaderResourceSetDescriptor();
|
|
11
12
|
|
|
12
|
-
// per-pass,
|
|
13
|
+
// per-pass, 16 bytes, read-only: immediate data rather than a uniform buffer. A 32-bit key sort
|
|
13
14
|
// runs four passes, and both this shader and the scatter took a buffer of their own in each.
|
|
14
15
|
resources.setImmediate("settings", SORT_PASS_SETTINGS_STRUCT);
|
|
15
16
|
|
|
16
17
|
resources.createGroup()
|
|
17
|
-
.
|
|
18
|
-
|
|
19
|
-
// Every cell is produced by exactly one thread of one workgroup, so no atomics: the only
|
|
20
|
-
// consumer is a later dispatch, and WebGPU orders dispatches against each other.
|
|
21
|
-
.addStorageBuffer("spine", WebGPUArray.from(u32), true);
|
|
18
|
+
.add(SORT_HISTOGRAM_KEYS_RESOURCE)
|
|
19
|
+
.add(SORT_HISTOGRAM_SPINE_RESOURCE);
|
|
22
20
|
|
|
23
21
|
const body = CodeChunk.from(
|
|
24
22
|
//language=WGSL
|
|
25
23
|
`
|
|
26
|
-
|
|
27
|
-
const KEYS_PER_THREAD = ${SORT_KEYS_PER_THREAD}u;
|
|
28
|
-
const TILE_SIZE = ${SORT_TILE_SIZE}u;
|
|
29
|
-
const RADIX = ${RADIX}u;
|
|
30
|
-
|
|
31
|
-
// One bin per thread — RADIX and the workgroup size are equal, so the clear and the write-out are
|
|
32
|
-
// both a single unstrided step.
|
|
33
|
-
var<workgroup> wg_histogram: array<atomic<u32>, RADIX>;
|
|
34
|
-
|
|
35
|
-
@compute @workgroup_size(WORKGROUP_SIZE, 1, 1)
|
|
24
|
+
@compute @workgroup_size(SORT_WORKGROUP_SIZE, 1, 1)
|
|
36
25
|
fn main(
|
|
37
26
|
@builtin(local_invocation_index) thread_id: u32,
|
|
38
27
|
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
39
28
|
) {
|
|
40
29
|
let tile = workgroup_id.x;
|
|
41
30
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
workgroupBarrier();
|
|
45
|
-
|
|
46
|
-
// Striped so that neighbouring threads read neighbouring addresses. The tail tile is partial;
|
|
47
|
-
// the keys past the end are not counted, which is what lets the scatter recognise them later
|
|
48
|
-
// by position alone.
|
|
49
|
-
let tile_base = tile * TILE_SIZE;
|
|
50
|
-
for (var k = 0u; k < KEYS_PER_THREAD; k += 1u) {
|
|
51
|
-
let source = tile_base + k * WORKGROUP_SIZE + thread_id;
|
|
52
|
-
|
|
53
|
-
if (source < settings.element_count) {
|
|
54
|
-
atomicAdd(&wg_histogram[sort_extract_digit(keys[source], settings.shift)], 1u);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
workgroupBarrier();
|
|
59
|
-
|
|
60
|
-
spine[sort_spine_index(thread_id, tile, settings.tile_count)] = atomicLoad(&wg_histogram[thread_id]);
|
|
31
|
+
sort_histogram_tile(tile, settings.element_count, settings.tile_count, settings.shift, settings.key_mask, thread_id);
|
|
61
32
|
|
|
62
33
|
// The scan is indirect-dispatched off an element count it reads from word 0 of this buffer.
|
|
63
34
|
if (tile == 0u && thread_id == 0u) {
|
|
64
|
-
spine[0] = settings.tile_count *
|
|
35
|
+
spine[0] = settings.tile_count * SORT_RADIX;
|
|
65
36
|
}
|
|
66
37
|
}
|
|
67
38
|
`, [
|
|
68
|
-
|
|
39
|
+
chunk_sort_histogram_tile,
|
|
69
40
|
]);
|
|
70
41
|
|
|
71
42
|
/**
|
|
72
|
-
* Per-tile 256-bin digit histogram — stage (a) of one digit pass of {@link graph_radix_sort}
|
|
43
|
+
* Per-tile 256-bin digit histogram — stage (a) of one digit pass of {@link graph_radix_sort} over a
|
|
44
|
+
* host count, which it dispatches directly, a workgroup per tile. The tile's work is
|
|
45
|
+
* {@link chunk_sort_histogram_tile}; {@link shader_radix_sort_histogram_indirect} is the same work
|
|
46
|
+
* over a device count.
|
|
73
47
|
*
|
|
74
48
|
* One workgroup per tile; the counts land in the spine bin-major, so that the single scan that
|
|
75
49
|
* follows produces global digit offsets and per-tile offsets in one traversal.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-tile 256-bin digit histogram — stage (a) of one digit pass of {@link graph_radix_sort} over a
|
|
3
|
+
* device count. Dispatched indirectly through the command {@link shader_radix_sort_prepare} folded
|
|
4
|
+
* over the live tile count, it finds its tile with `folded_workgroup_index`, and reads the live size
|
|
5
|
+
* that pass wrote. The tile's work is {@link chunk_sort_histogram_tile}, as it is
|
|
6
|
+
* {@link shader_radix_sort_histogram}'s.
|
|
7
|
+
*
|
|
8
|
+
* Unlike the host-count histogram it leaves the spine's count word alone: the prepare writes it, once
|
|
9
|
+
* for every digit pass, because an empty sort runs no tile that could.
|
|
10
|
+
*
|
|
11
|
+
* @type {ComputeShader}
|
|
12
|
+
*/
|
|
13
|
+
export const shader_radix_sort_histogram_indirect: ComputeShader;
|
|
14
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
15
|
+
//# sourceMappingURL=shader_radix_sort_histogram_indirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_radix_sort_histogram_indirect.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.js"],"names":[],"mappings":"AA2CA;;;;;;;;;;;GAWG;AACH,mDAFU,aAAa,CAMpB;8BAzD2B,+BAA+B"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { chunk_folded_workgroup_index } from "../../shader/chunk/grid/chunk_folded_workgroup_index.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 {
|
|
6
|
+
chunk_sort_histogram_tile,
|
|
7
|
+
SORT_HISTOGRAM_KEYS_RESOURCE,
|
|
8
|
+
SORT_HISTOGRAM_SPINE_RESOURCE
|
|
9
|
+
} from "./chunk_sort_histogram_tile.js";
|
|
10
|
+
import { SORT_DIGIT_SETTINGS_STRUCT } from "./SORT_DIGIT_SETTINGS_STRUCT.js";
|
|
11
|
+
import { SORT_SIZE_STRUCT } from "./SORT_SIZE_STRUCT.js";
|
|
12
|
+
|
|
13
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
14
|
+
|
|
15
|
+
resources.setImmediate("settings", SORT_DIGIT_SETTINGS_STRUCT);
|
|
16
|
+
|
|
17
|
+
resources.createGroup()
|
|
18
|
+
.add(SORT_HISTOGRAM_KEYS_RESOURCE)
|
|
19
|
+
.add(SORT_HISTOGRAM_SPINE_RESOURCE)
|
|
20
|
+
.addStorageBuffer("sort_size", SORT_SIZE_STRUCT, false);
|
|
21
|
+
|
|
22
|
+
const body = CodeChunk.from(
|
|
23
|
+
//language=WGSL
|
|
24
|
+
`
|
|
25
|
+
@compute @workgroup_size(SORT_WORKGROUP_SIZE, 1, 1)
|
|
26
|
+
fn main(
|
|
27
|
+
@builtin(local_invocation_index) thread_id: u32,
|
|
28
|
+
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
29
|
+
) {
|
|
30
|
+
let tile = folded_workgroup_index(workgroup_id);
|
|
31
|
+
|
|
32
|
+
// A folded grid's last row runs past the live tiles. Uniform, the whole workgroup leaves.
|
|
33
|
+
if (tile >= sort_size.tile_count) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
sort_histogram_tile(tile, sort_size.element_count, sort_size.tile_count, settings.shift, settings.key_mask, thread_id);
|
|
38
|
+
}
|
|
39
|
+
`, [
|
|
40
|
+
chunk_folded_workgroup_index,
|
|
41
|
+
chunk_sort_histogram_tile,
|
|
42
|
+
]);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Per-tile 256-bin digit histogram — stage (a) of one digit pass of {@link graph_radix_sort} over a
|
|
46
|
+
* device count. Dispatched indirectly through the command {@link shader_radix_sort_prepare} folded
|
|
47
|
+
* over the live tile count, it finds its tile with `folded_workgroup_index`, and reads the live size
|
|
48
|
+
* that pass wrote. The tile's work is {@link chunk_sort_histogram_tile}, as it is
|
|
49
|
+
* {@link shader_radix_sort_histogram}'s.
|
|
50
|
+
*
|
|
51
|
+
* Unlike the host-count histogram it leaves the spine's count word alone: the prepare writes it, once
|
|
52
|
+
* for every digit pass, because an empty sort runs no tile that could.
|
|
53
|
+
*
|
|
54
|
+
* @type {ComputeShader}
|
|
55
|
+
*/
|
|
56
|
+
export const shader_radix_sort_histogram_indirect = ComputeShader.from({
|
|
57
|
+
label: "RadixSort/Histogram (indirect)",
|
|
58
|
+
resources,
|
|
59
|
+
body,
|
|
60
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @type {WebGPUStruct}
|
|
3
|
+
*/
|
|
4
|
+
export const SORT_PREPARE_SETTINGS_STRUCT: WebGPUStruct;
|
|
5
|
+
/**
|
|
6
|
+
* One thread ahead of every digit pass of {@link graph_radix_sort} over a device count: it reads the
|
|
7
|
+
* count, clamps it to what the memory holds, and writes what the passes after it are dispatched and
|
|
8
|
+
* bounded by —
|
|
9
|
+
*
|
|
10
|
+
* - `sort_size`, the live key and tile counts ({@link SORT_SIZE_STRUCT}), which the histogram and
|
|
11
|
+
* scatter read;
|
|
12
|
+
* - `command`, their indirect dispatch, a workgroup a live tile folded as
|
|
13
|
+
* {@link chunk_folded_dispatch} folds it — `(0, 1, 1)` for no keys, which dispatches nothing;
|
|
14
|
+
* - the spine's count word, the `{count, elements}` header `graph_prefix_scan_csdldf` reads, a
|
|
15
|
+
* 256-bin histogram a live tile. The spine is laid out bin-major with the live tile count as its
|
|
16
|
+
* stride, so the scan covers exactly the cells the histogram writes.
|
|
17
|
+
*
|
|
18
|
+
* Every digit pass reads these, and they cannot change between passes, so one thread writes them once.
|
|
19
|
+
*
|
|
20
|
+
* @type {ComputeShader}
|
|
21
|
+
*/
|
|
22
|
+
export const shader_radix_sort_prepare: ComputeShader;
|
|
23
|
+
import { WebGPUStruct } from "../../shader/type/WebGPUStruct.js";
|
|
24
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
25
|
+
//# sourceMappingURL=shader_radix_sort_prepare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_radix_sort_prepare.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.js"],"names":[],"mappings":"AAWA;;GAEG;AACH,2CAFU,YAAY,CAWI;AA4C1B;;;;;;;;;;;;;;;;GAgBG;AACH,wCAFU,aAAa,CAMpB;6BAjF0B,mCAAmC;8BAJlC,+BAA+B"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { chunk_folded_dispatch } from "../indirect/chunk_folded_dispatch.js";
|
|
2
|
+
import { chunk_divide_round_up_u32 } from "../../shader/chunk/math/chunk_divide_round_up_u32.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_sort_constants } from "./chunk_sort_constants.js";
|
|
10
|
+
import { SORT_SIZE_STRUCT } from "./SORT_SIZE_STRUCT.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @type {WebGPUStruct}
|
|
14
|
+
*/
|
|
15
|
+
export const SORT_PREPARE_SETTINGS_STRUCT = WebGPUStruct.from({
|
|
16
|
+
/**
|
|
17
|
+
* The `u32` of `count_source` that holds the count: its byte offset over four.
|
|
18
|
+
*/
|
|
19
|
+
count_word: u32,
|
|
20
|
+
/**
|
|
21
|
+
* Keys the sort's memory holds — its spine and scratch, and the caller's buffers.
|
|
22
|
+
*/
|
|
23
|
+
element_max_count: u32,
|
|
24
|
+
}, "SortPrepareSettings");
|
|
25
|
+
|
|
26
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
27
|
+
|
|
28
|
+
resources.setImmediate("settings", SORT_PREPARE_SETTINGS_STRUCT);
|
|
29
|
+
|
|
30
|
+
resources.createGroup()
|
|
31
|
+
// the caller's buffer, whole, so that its count can sit at any word of it
|
|
32
|
+
.addStorageBuffer("count_source", WebGPUArray.from(u32), false)
|
|
33
|
+
.addStorageBuffer("sort_size", SORT_SIZE_STRUCT, true)
|
|
34
|
+
.addStorageBuffer("command", WebGPUArray.from(u32), true)
|
|
35
|
+
// the spine, for its `{count, elements}` header alone
|
|
36
|
+
.addStorageBuffer("spine", WebGPUArray.from(u32), true);
|
|
37
|
+
|
|
38
|
+
const body = CodeChunk.from(
|
|
39
|
+
//language=WGSL
|
|
40
|
+
`
|
|
41
|
+
@compute @workgroup_size(1)
|
|
42
|
+
fn main() {
|
|
43
|
+
// A count past what the memory was sized for sorts the first element_max_count keys, rather than
|
|
44
|
+
// running the histogram and scatter past the ends of the spine and the scratch.
|
|
45
|
+
let element_count = min(count_source[settings.count_word], settings.element_max_count);
|
|
46
|
+
let tile_count = divide_round_up_u32(element_count, SORT_TILE_SIZE);
|
|
47
|
+
|
|
48
|
+
sort_size.element_count = element_count;
|
|
49
|
+
sort_size.tile_count = tile_count;
|
|
50
|
+
|
|
51
|
+
// a workgroup a tile, folded: x to the limit, then rows of x, then slices of x·y
|
|
52
|
+
let groups = folded_dispatch(tile_count);
|
|
53
|
+
|
|
54
|
+
command[0] = groups.x;
|
|
55
|
+
command[1] = groups.y;
|
|
56
|
+
command[2] = groups.z;
|
|
57
|
+
|
|
58
|
+
// The spine's element count, which every digit pass's scan is dispatched over. Written here and
|
|
59
|
+
// not by a histogram tile, because an empty sort runs none.
|
|
60
|
+
spine[0] = tile_count * SORT_RADIX;
|
|
61
|
+
}
|
|
62
|
+
`, [
|
|
63
|
+
chunk_sort_constants,
|
|
64
|
+
chunk_divide_round_up_u32,
|
|
65
|
+
chunk_folded_dispatch,
|
|
66
|
+
]);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* One thread ahead of every digit pass of {@link graph_radix_sort} over a device count: it reads the
|
|
70
|
+
* count, clamps it to what the memory holds, and writes what the passes after it are dispatched and
|
|
71
|
+
* bounded by —
|
|
72
|
+
*
|
|
73
|
+
* - `sort_size`, the live key and tile counts ({@link SORT_SIZE_STRUCT}), which the histogram and
|
|
74
|
+
* scatter read;
|
|
75
|
+
* - `command`, their indirect dispatch, a workgroup a live tile folded as
|
|
76
|
+
* {@link chunk_folded_dispatch} folds it — `(0, 1, 1)` for no keys, which dispatches nothing;
|
|
77
|
+
* - the spine's count word, the `{count, elements}` header `graph_prefix_scan_csdldf` reads, a
|
|
78
|
+
* 256-bin histogram a live tile. The spine is laid out bin-major with the live tile count as its
|
|
79
|
+
* stride, so the scan covers exactly the cells the histogram writes.
|
|
80
|
+
*
|
|
81
|
+
* Every digit pass reads these, and they cannot change between passes, so one thread writes them once.
|
|
82
|
+
*
|
|
83
|
+
* @type {ComputeShader}
|
|
84
|
+
*/
|
|
85
|
+
export const shader_radix_sort_prepare = ComputeShader.from({
|
|
86
|
+
label: "RadixSort/Prepare",
|
|
87
|
+
resources,
|
|
88
|
+
body,
|
|
89
|
+
});
|
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Rank-and-scatter — stage (c) of one digit pass of {@link graph_radix_sort}
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* what an LSD radix sort's correctness rests on, and it is also what lets the tail tile's padding
|
|
6
|
-
* be identified by position), the tile's own histogram is re-derived rather than carried over from
|
|
7
|
-
* the histogram pass — the scan is inclusive-only, and re-counting is cheaper than preserving
|
|
8
|
-
* pre-scan counts — and each key is written to
|
|
9
|
-
* `spine_inclusive[bin] - local_count[bin] - bin_start[bin] + sorted_position`.
|
|
2
|
+
* Rank-and-scatter — stage (c) of one digit pass of {@link graph_radix_sort} over a host count, which
|
|
3
|
+
* it dispatches directly, a workgroup per tile. The tile's work is {@link chunk_sort_scatter_tile};
|
|
4
|
+
* {@link shader_radix_sort_scatter_indirect} is the same work over a device count.
|
|
10
5
|
*
|
|
11
6
|
* @type {ComputeShader}
|
|
12
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader_radix_sort_scatter.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shader_radix_sort_scatter.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.js"],"names":[],"mappings":"AAkDA;;;;;;GAMG;AACH,wCAFU,aAAa,CAMpB;8BA5D2B,+BAA+B"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { WebGPUExtensionType } from "../../../descriptor/WebGPUExtensionType.js";
|
|
2
|
-
import { u32 } from "../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
|
|
3
|
-
import { WebGPUArray } from "../../shader/type/WebGPUArray.js";
|
|
4
1
|
import { CodeChunk } from "../../shader/compiler/CodeChunk.js";
|
|
5
2
|
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
6
3
|
import { ShaderResourceSetDescriptor } from "../../shader/resource/ShaderResourceSetDescriptor.js";
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import {
|
|
5
|
+
chunk_sort_scatter_tile,
|
|
6
|
+
SORT_SCATTER_IN_KEYS_RESOURCE,
|
|
7
|
+
SORT_SCATTER_IN_VALUES_RESOURCE,
|
|
8
|
+
SORT_SCATTER_OUT_KEYS_RESOURCE,
|
|
9
|
+
SORT_SCATTER_OUT_VALUES_RESOURCE,
|
|
10
|
+
SORT_SCATTER_SPINE_RESOURCE
|
|
11
|
+
} from "./chunk_sort_scatter_tile.js";
|
|
11
12
|
import { SORT_PASS_SETTINGS_STRUCT } from "./SORT_PASS_SETTINGS_STRUCT.js";
|
|
12
13
|
|
|
13
14
|
const resources = new ShaderResourceSetDescriptor();
|
|
@@ -16,174 +17,41 @@ const resources = new ShaderResourceSetDescriptor();
|
|
|
16
17
|
resources.setImmediate("settings", SORT_PASS_SETTINGS_STRUCT);
|
|
17
18
|
|
|
18
19
|
resources.createGroup()
|
|
19
|
-
.
|
|
20
|
-
.
|
|
21
|
-
.
|
|
22
|
-
.
|
|
23
|
-
|
|
24
|
-
.addStorageBuffer("spine", WebGPUArray.from(u32), false);
|
|
20
|
+
.add(SORT_SCATTER_IN_KEYS_RESOURCE)
|
|
21
|
+
.add(SORT_SCATTER_IN_VALUES_RESOURCE)
|
|
22
|
+
.add(SORT_SCATTER_OUT_KEYS_RESOURCE)
|
|
23
|
+
.add(SORT_SCATTER_OUT_VALUES_RESOURCE)
|
|
24
|
+
.add(SORT_SCATTER_SPINE_RESOURCE);
|
|
25
25
|
|
|
26
26
|
const body = CodeChunk.from(
|
|
27
27
|
//language=WGSL
|
|
28
28
|
`
|
|
29
|
-
|
|
30
|
-
const KEYS_PER_THREAD = ${SORT_KEYS_PER_THREAD}u;
|
|
31
|
-
const TILE_SIZE = ${SORT_TILE_SIZE}u;
|
|
32
|
-
const RADIX = ${RADIX}u;
|
|
33
|
-
const RADIX_LOG = ${RADIX_LOG}u;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* The key a slot past the end of the input is filled with. It is the largest u32, so its digit is
|
|
37
|
-
* the largest in every pass and the stable in-tile sort parks every one of them behind every real
|
|
38
|
-
* key — which is what makes "sorted position < the tile's real key count" a sufficient test for
|
|
39
|
-
* whether a slot holds a real key.
|
|
40
|
-
*/
|
|
41
|
-
const PADDING_KEY = 0xffffffffu;
|
|
42
|
-
|
|
43
|
-
var<workgroup> wg_keys: array<u32, TILE_SIZE>;
|
|
44
|
-
var<workgroup> wg_values: array<u32, TILE_SIZE>;
|
|
45
|
-
// one bin per thread; RADIX == WORKGROUP_SIZE
|
|
46
|
-
var<workgroup> wg_histogram: array<atomic<u32>, RADIX>;
|
|
47
|
-
var<workgroup> wg_base: array<u32, RADIX>;
|
|
48
|
-
|
|
49
|
-
@compute @workgroup_size(WORKGROUP_SIZE, 1, 1)
|
|
29
|
+
@compute @workgroup_size(SORT_WORKGROUP_SIZE, 1, 1)
|
|
50
30
|
fn main(
|
|
51
31
|
@builtin(local_invocation_index) thread_id: u32,
|
|
52
32
|
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
53
33
|
@builtin(subgroup_invocation_id) lane_id: u32,
|
|
54
34
|
@builtin(subgroup_size) lane_count: u32,
|
|
55
35
|
) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var key = PADDING_KEY;
|
|
68
|
-
var value = 0u;
|
|
69
|
-
|
|
70
|
-
if (source < settings.element_count) {
|
|
71
|
-
key = in_keys[source];
|
|
72
|
-
value = in_values[source];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
wg_keys[slot] = key;
|
|
76
|
-
wg_values[slot] = value;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
workgroupBarrier();
|
|
80
|
-
|
|
81
|
-
// Local histogram over the real keys only — it has to agree with what the histogram pass
|
|
82
|
-
// counted, because the spine value this tile reads back was built from that count.
|
|
83
|
-
for (var k = 0u; k < KEYS_PER_THREAD; k += 1u) {
|
|
84
|
-
let slot = k * WORKGROUP_SIZE + thread_id;
|
|
85
|
-
|
|
86
|
-
if (tile_base + slot < settings.element_count) {
|
|
87
|
-
atomicAdd(&wg_histogram[sort_extract_digit(wg_keys[slot], shift)], 1u);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
workgroupBarrier();
|
|
92
|
-
|
|
93
|
-
// this thread's bin, captured before the in-tile sort touches anything
|
|
94
|
-
let local_count = atomicLoad(&wg_histogram[thread_id]);
|
|
95
|
-
|
|
96
|
-
// Order the tile by this pass's digit, one bit at a time, least significant first. Eight stable
|
|
97
|
-
// binary splits are a sort by the whole 8-bit digit; ranking a key against its same-digit peers
|
|
98
|
-
// then costs nothing, because the rank IS the sorted position, and the device writes that
|
|
99
|
-
// follow come out contiguous per bin.
|
|
100
|
-
for (var bit_index = 0u; bit_index < RADIX_LOG; bit_index += 1u) {
|
|
101
|
-
let bit = shift + bit_index;
|
|
102
|
-
|
|
103
|
-
// Blocked ownership for the permutation: thread t owns the tile's slots
|
|
104
|
-
// [t*KEYS_PER_THREAD, (t+1)*KEYS_PER_THREAD), so the offsets a thread hands its own keys
|
|
105
|
-
// are consecutive and the scan below only has to run over one value per thread.
|
|
106
|
-
var keys: array<u32, KEYS_PER_THREAD>;
|
|
107
|
-
var values: array<u32, KEYS_PER_THREAD>;
|
|
108
|
-
var ones = 0u;
|
|
109
|
-
|
|
110
|
-
for (var j = 0u; j < KEYS_PER_THREAD; j += 1u) {
|
|
111
|
-
let slot = thread_id * KEYS_PER_THREAD + j;
|
|
112
|
-
|
|
113
|
-
keys[j] = wg_keys[slot];
|
|
114
|
-
values[j] = wg_values[slot];
|
|
115
|
-
ones += (keys[j] >> bit) & 1u;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
// The scan's first barrier is what fences every thread's reads above against the writes
|
|
119
|
-
// below — by the time it returns, no read of wg_keys/wg_values is outstanding.
|
|
120
|
-
let scan = sort_workgroup_exclusive_scan(ones, thread_id, lane_id, lane_count);
|
|
121
|
-
|
|
122
|
-
let total_zeros = TILE_SIZE - scan.y;
|
|
123
|
-
|
|
124
|
-
var ones_before = scan.x;
|
|
125
|
-
var zeros_before = thread_id * KEYS_PER_THREAD - scan.x;
|
|
126
|
-
|
|
127
|
-
for (var j = 0u; j < KEYS_PER_THREAD; j += 1u) {
|
|
128
|
-
let is_one = ((keys[j] >> bit) & 1u) != 0u;
|
|
129
|
-
let destination = sort_split_destination(is_one, zeros_before, ones_before, total_zeros);
|
|
130
|
-
|
|
131
|
-
if (is_one) {
|
|
132
|
-
ones_before += 1u;
|
|
133
|
-
} else {
|
|
134
|
-
zeros_before += 1u;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
wg_keys[destination] = keys[j];
|
|
138
|
-
wg_values[destination] = values[j];
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
workgroupBarrier();
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Exclusive prefix of the local histogram — for a tile now sorted by digit this is exactly the
|
|
145
|
-
// slot each bin's run begins at, and the total is the tile's real key count, because the
|
|
146
|
-
// padding was never counted.
|
|
147
|
-
let histogram_scan = sort_workgroup_exclusive_scan(local_count, thread_id, lane_id, lane_count);
|
|
148
|
-
|
|
149
|
-
let bin_start = histogram_scan.x;
|
|
150
|
-
let valid_count = histogram_scan.y;
|
|
151
|
-
|
|
152
|
-
let spine_inclusive = spine[sort_spine_index(thread_id, tile, settings.tile_count)];
|
|
153
|
-
|
|
154
|
-
wg_base[thread_id] = sort_scatter_base(spine_inclusive, local_count, bin_start);
|
|
155
|
-
|
|
156
|
-
workgroupBarrier();
|
|
157
|
-
|
|
158
|
-
for (var k = 0u; k < KEYS_PER_THREAD; k += 1u) {
|
|
159
|
-
let slot = k * WORKGROUP_SIZE + thread_id;
|
|
160
|
-
|
|
161
|
-
if (slot < valid_count) {
|
|
162
|
-
let key = wg_keys[slot];
|
|
163
|
-
let destination = wg_base[sort_extract_digit(key, shift)] + slot;
|
|
164
|
-
|
|
165
|
-
out_keys[destination] = key;
|
|
166
|
-
out_values[destination] = wg_values[slot];
|
|
167
|
-
}
|
|
168
|
-
}
|
|
36
|
+
sort_scatter_tile(
|
|
37
|
+
workgroup_id.x,
|
|
38
|
+
settings.element_count,
|
|
39
|
+
settings.tile_count,
|
|
40
|
+
settings.shift,
|
|
41
|
+
settings.key_mask,
|
|
42
|
+
thread_id,
|
|
43
|
+
lane_id,
|
|
44
|
+
lane_count
|
|
45
|
+
);
|
|
169
46
|
}
|
|
170
47
|
`, [
|
|
171
|
-
|
|
172
|
-
chunk_sort_rank,
|
|
173
|
-
chunk_sort_workgroup_scan,
|
|
48
|
+
chunk_sort_scatter_tile,
|
|
174
49
|
]);
|
|
175
50
|
|
|
176
|
-
body.addExtension(WebGPUExtensionType.Subgroups);
|
|
177
|
-
|
|
178
51
|
/**
|
|
179
|
-
* Rank-and-scatter — stage (c) of one digit pass of {@link graph_radix_sort}
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* what an LSD radix sort's correctness rests on, and it is also what lets the tail tile's padding
|
|
183
|
-
* be identified by position), the tile's own histogram is re-derived rather than carried over from
|
|
184
|
-
* the histogram pass — the scan is inclusive-only, and re-counting is cheaper than preserving
|
|
185
|
-
* pre-scan counts — and each key is written to
|
|
186
|
-
* `spine_inclusive[bin] - local_count[bin] - bin_start[bin] + sorted_position`.
|
|
52
|
+
* Rank-and-scatter — stage (c) of one digit pass of {@link graph_radix_sort} over a host count, which
|
|
53
|
+
* it dispatches directly, a workgroup per tile. The tile's work is {@link chunk_sort_scatter_tile};
|
|
54
|
+
* {@link shader_radix_sort_scatter_indirect} is the same work over a device count.
|
|
187
55
|
*
|
|
188
56
|
* @type {ComputeShader}
|
|
189
57
|
*/
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rank-and-scatter — stage (c) of one digit pass of {@link graph_radix_sort} over a device count.
|
|
3
|
+
* Dispatched indirectly through the command {@link shader_radix_sort_prepare} folded over the live
|
|
4
|
+
* tile count, it finds its tile with `folded_workgroup_index`, and reads the live size that pass
|
|
5
|
+
* wrote. The tile's work is {@link chunk_sort_scatter_tile}, as it is
|
|
6
|
+
* {@link shader_radix_sort_scatter}'s.
|
|
7
|
+
*
|
|
8
|
+
* @type {ComputeShader}
|
|
9
|
+
*/
|
|
10
|
+
export const shader_radix_sort_scatter_indirect: ComputeShader;
|
|
11
|
+
import { ComputeShader } from "../../shader/ComputeShader.js";
|
|
12
|
+
//# sourceMappingURL=shader_radix_sort_scatter_indirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader_radix_sort_scatter_indirect.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.js"],"names":[],"mappings":"AA4DA;;;;;;;;GAQG;AACH,iDAFU,aAAa,CAMpB;8BAvE2B,+BAA+B"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { chunk_folded_workgroup_index } from "../../shader/chunk/grid/chunk_folded_workgroup_index.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 {
|
|
6
|
+
chunk_sort_scatter_tile,
|
|
7
|
+
SORT_SCATTER_IN_KEYS_RESOURCE,
|
|
8
|
+
SORT_SCATTER_IN_VALUES_RESOURCE,
|
|
9
|
+
SORT_SCATTER_OUT_KEYS_RESOURCE,
|
|
10
|
+
SORT_SCATTER_OUT_VALUES_RESOURCE,
|
|
11
|
+
SORT_SCATTER_SPINE_RESOURCE
|
|
12
|
+
} from "./chunk_sort_scatter_tile.js";
|
|
13
|
+
import { SORT_DIGIT_SETTINGS_STRUCT } from "./SORT_DIGIT_SETTINGS_STRUCT.js";
|
|
14
|
+
import { SORT_SIZE_STRUCT } from "./SORT_SIZE_STRUCT.js";
|
|
15
|
+
|
|
16
|
+
const resources = new ShaderResourceSetDescriptor();
|
|
17
|
+
|
|
18
|
+
resources.setImmediate("settings", SORT_DIGIT_SETTINGS_STRUCT);
|
|
19
|
+
|
|
20
|
+
resources.createGroup()
|
|
21
|
+
.add(SORT_SCATTER_IN_KEYS_RESOURCE)
|
|
22
|
+
.add(SORT_SCATTER_IN_VALUES_RESOURCE)
|
|
23
|
+
.add(SORT_SCATTER_OUT_KEYS_RESOURCE)
|
|
24
|
+
.add(SORT_SCATTER_OUT_VALUES_RESOURCE)
|
|
25
|
+
.add(SORT_SCATTER_SPINE_RESOURCE)
|
|
26
|
+
.addStorageBuffer("sort_size", SORT_SIZE_STRUCT, false);
|
|
27
|
+
|
|
28
|
+
const body = CodeChunk.from(
|
|
29
|
+
//language=WGSL
|
|
30
|
+
`
|
|
31
|
+
@compute @workgroup_size(SORT_WORKGROUP_SIZE, 1, 1)
|
|
32
|
+
fn main(
|
|
33
|
+
@builtin(local_invocation_index) thread_id: u32,
|
|
34
|
+
@builtin(workgroup_id) workgroup_id: vec3<u32>,
|
|
35
|
+
@builtin(subgroup_invocation_id) lane_id: u32,
|
|
36
|
+
@builtin(subgroup_size) lane_count: u32,
|
|
37
|
+
) {
|
|
38
|
+
let tile = folded_workgroup_index(workgroup_id);
|
|
39
|
+
|
|
40
|
+
// A folded grid's last row runs past the live tiles. Uniform, the whole workgroup leaves.
|
|
41
|
+
if (tile >= sort_size.tile_count) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
sort_scatter_tile(
|
|
46
|
+
tile,
|
|
47
|
+
sort_size.element_count,
|
|
48
|
+
sort_size.tile_count,
|
|
49
|
+
settings.shift,
|
|
50
|
+
settings.key_mask,
|
|
51
|
+
thread_id,
|
|
52
|
+
lane_id,
|
|
53
|
+
lane_count
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
`, [
|
|
57
|
+
chunk_folded_workgroup_index,
|
|
58
|
+
chunk_sort_scatter_tile,
|
|
59
|
+
]);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Rank-and-scatter — stage (c) of one digit pass of {@link graph_radix_sort} over a device count.
|
|
63
|
+
* Dispatched indirectly through the command {@link shader_radix_sort_prepare} folded over the live
|
|
64
|
+
* tile count, it finds its tile with `folded_workgroup_index`, and reads the live size that pass
|
|
65
|
+
* wrote. The tile's work is {@link chunk_sort_scatter_tile}, as it is
|
|
66
|
+
* {@link shader_radix_sort_scatter}'s.
|
|
67
|
+
*
|
|
68
|
+
* @type {ComputeShader}
|
|
69
|
+
*/
|
|
70
|
+
export const shader_radix_sort_scatter_indirect = ComputeShader.from({
|
|
71
|
+
label: "RadixSort/Scatter (indirect)",
|
|
72
|
+
resources,
|
|
73
|
+
body,
|
|
74
|
+
});
|
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* On-device verification of {@link graph_radix_sort}: sorts deterministic key/payload sets across
|
|
3
3
|
* tile-boundary element counts and three key distributions, reads the results back, and checks on
|
|
4
4
|
* the CPU that the keys are ascending, that the payload is a permutation of the input indices, that
|
|
5
|
-
* every payload still sits next to ITS key, and that equal keys kept their input order.
|
|
5
|
+
* every payload still sits next to ITS key, and that equal keys kept their input order. Then the same
|
|
6
|
+
* by part of the key, with random bits above it, and over counts that live on the device — where the
|
|
7
|
+
* entries past the count must also come back as they went in.
|
|
6
8
|
*
|
|
7
9
|
* Logs one `[SORT]` PASS/FAIL line per case.
|
|
8
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify_radix_sort.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/sort/verify_radix_sort.js"],"names":[],"mappings":"AA+
|
|
1
|
+
{"version":3,"file":"verify_radix_sort.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/gpu_primitive/sort/verify_radix_sort.js"],"names":[],"mappings":"AA+QA;;;;;;;;;;;GAWG;AACH,mEAuGC"}
|