@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.
Files changed (326) hide show
  1. package/package.json +1 -1
  2. package/src/shade/playground/probe_clipmap/index.html +12 -0
  3. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  4. package/src/shade/playground/probe_clipmap/main.js +5 -0
  5. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  6. package/src/shade/renderer/Renderer.js +4 -6
  7. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +63 -1
  8. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  9. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +228 -16
  10. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts +27 -4
  11. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts.map +1 -1
  12. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js +526 -23
  13. package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.d.ts +11 -0
  14. package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.d.ts.map +1 -0
  15. package/src/shade/renderer/geometry/sdf/cards/MeshCardCaptureMode.js +21 -0
  16. package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.d.ts +65 -0
  17. package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.d.ts.map +1 -0
  18. package/src/shade/renderer/geometry/sdf/cards/mesh_cards_raster_pass_descriptor.js +376 -0
  19. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.d.ts +7 -3
  20. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.d.ts.map +1 -1
  21. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_capture.js +70 -6
  22. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.d.ts +20 -0
  23. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.d.ts.map +1 -0
  24. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_args.js +80 -0
  25. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.d.ts +18 -0
  26. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.d.ts.map +1 -0
  27. package/src/shade/renderer/geometry/sdf/cards/shader_mesh_cards_raster_scatter.js +113 -0
  28. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts +47 -0
  29. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts.map +1 -0
  30. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.js +80 -0
  31. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts +91 -0
  32. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts.map +1 -0
  33. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.js +902 -0
  34. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts +16 -0
  35. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts.map +1 -0
  36. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.js +67 -0
  37. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts +17 -0
  38. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts.map +1 -0
  39. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.js +145 -0
  40. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts +12 -0
  41. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts.map +1 -0
  42. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.js +105 -0
  43. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.d.ts.map +1 -1
  44. package/src/shade/renderer/global_illumination/probe/octahedral/shader_lpv_build_gbuffer.js +2 -1
  45. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +3 -9
  46. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  47. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +13 -31
  48. package/src/shade/renderer/global_illumination/probe_clipmap/PROBE_CLIPMAP_PROPOSAL_2026_10_27.md +764 -48
  49. package/src/shade/renderer/global_illumination/probe_clipmap/PROBE_RAYS_VARIABLE_AND_SORTED_SCOPE_2026_10_30.md +410 -0
  50. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts +3 -2
  51. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts.map +1 -1
  52. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +4 -3
  53. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +41 -17
  54. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  55. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +57 -33
  56. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.d.ts +11 -3
  57. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.d.ts.map +1 -1
  58. package/src/shade/renderer/global_illumination/probe_clipmap/brick/BRICK_CLIPMAP.js +13 -4
  59. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +9 -18
  60. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
  61. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +8 -10
  62. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts +12 -0
  63. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts.map +1 -1
  64. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.js +28 -0
  65. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +1 -29
  66. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  67. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +1 -74
  68. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts +161 -0
  69. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.d.ts.map +1 -0
  70. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK.js +219 -0
  71. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.d.ts +1 -8
  72. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.d.ts.map +1 -1
  73. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MESH_BRICK_INSTANCE_STRUCT.js +1 -9
  74. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts +40 -12
  75. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.d.ts.map +1 -1
  76. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/MeshSDFBrickProvider.js +373 -31
  77. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts +2 -1
  78. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts.map +1 -1
  79. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.js +2 -1
  80. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.d.ts +15 -8
  81. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.d.ts.map +1 -1
  82. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_texel.js +28 -14
  83. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts +23 -0
  84. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts.map +1 -0
  85. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +66 -0
  86. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.d.ts +29 -0
  87. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.d.ts.map +1 -0
  88. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.js +210 -0
  89. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.d.ts +29 -0
  90. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.d.ts.map +1 -0
  91. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_command.js +86 -0
  92. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts +41 -0
  93. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -0
  94. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +439 -0
  95. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.d.ts +23 -0
  96. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.d.ts.map +1 -0
  97. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.js +135 -0
  98. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts +3 -1
  99. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts.map +1 -1
  100. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.js +12 -3
  101. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +21 -18
  102. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
  103. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +254 -73
  104. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +149 -8
  105. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
  106. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +181 -13
  107. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +179 -7
  108. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
  109. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +412 -31
  110. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.js +4 -4
  111. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
  112. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +4 -3
  113. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts +36 -10
  114. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts.map +1 -1
  115. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js +218 -29
  116. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts +5 -1
  117. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts.map +1 -1
  118. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.js +24 -14
  119. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +15 -6
  120. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
  121. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +21 -22
  122. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts +36 -0
  123. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts.map +1 -0
  124. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.js +257 -0
  125. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +18 -7
  126. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
  127. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +157 -51
  128. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts +23 -0
  129. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts.map +1 -0
  130. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.js +110 -0
  131. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts +24 -2
  132. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts.map +1 -1
  133. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.js +90 -10
  134. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts +45 -0
  135. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts.map +1 -0
  136. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.js +205 -0
  137. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +1 -1
  138. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts +16 -3
  139. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.d.ts.map +1 -1
  140. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_retire.js +55 -10
  141. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts +19 -4
  142. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
  143. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +60 -6
  144. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts +4 -8
  145. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts.map +1 -1
  146. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +21 -36
  147. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts +21 -14
  148. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  149. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +100 -30
  150. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts +6 -2
  151. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts.map +1 -1
  152. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.js +26 -10
  153. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts +3 -2
  154. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts.map +1 -1
  155. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.js +12 -12
  156. package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.d.ts +10 -0
  157. package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.d.ts.map +1 -0
  158. package/src/shade/renderer/gpu_primitive/sort/SORT_DIGIT_SETTINGS_STRUCT.js +21 -0
  159. package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.d.ts +5 -2
  160. package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.d.ts.map +1 -1
  161. package/src/shade/renderer/gpu_primitive/sort/SORT_PASS_SETTINGS_STRUCT.js +31 -23
  162. package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.d.ts +10 -0
  163. package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.d.ts.map +1 -0
  164. package/src/shade/renderer/gpu_primitive/sort/SORT_SIZE_STRUCT.js +22 -0
  165. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.d.ts +9 -0
  166. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.d.ts.map +1 -0
  167. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_constants.js +18 -0
  168. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.d.ts +8 -3
  169. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.d.ts.map +1 -1
  170. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_digit.js +41 -32
  171. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.d.ts +31 -0
  172. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.d.ts.map +1 -0
  173. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_histogram_tile.js +71 -0
  174. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.d.ts +47 -0
  175. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.d.ts.map +1 -0
  176. package/src/shade/renderer/gpu_primitive/sort/chunk_sort_scatter_tile.js +210 -0
  177. package/src/shade/renderer/gpu_primitive/sort/defs.d.ts +5 -4
  178. package/src/shade/renderer/gpu_primitive/sort/defs.d.ts.map +1 -1
  179. package/src/shade/renderer/gpu_primitive/sort/defs.js +5 -4
  180. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts +56 -15
  181. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.d.ts.map +1 -1
  182. package/src/shade/renderer/gpu_primitive/sort/graph_radix_sort.js +410 -61
  183. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.d.ts +4 -1
  184. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.d.ts.map +1 -1
  185. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram.js +16 -42
  186. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.d.ts +15 -0
  187. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.d.ts.map +1 -0
  188. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_histogram_indirect.js +60 -0
  189. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.d.ts +25 -0
  190. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.d.ts.map +1 -0
  191. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_prepare.js +89 -0
  192. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.d.ts +3 -8
  193. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.d.ts.map +1 -1
  194. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter.js +28 -160
  195. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.d.ts +12 -0
  196. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.d.ts.map +1 -0
  197. package/src/shade/renderer/gpu_primitive/sort/shader_radix_sort_scatter_indirect.js +74 -0
  198. package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.d.ts +3 -1
  199. package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.d.ts.map +1 -1
  200. package/src/shade/renderer/gpu_primitive/sort/verify_radix_sort.js +387 -188
  201. package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_irradiance_flat.js +1 -1
  202. package/src/shade/renderer/lightmap/bake/shader_lightmap_viz_to_sh.js +1 -1
  203. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts.map +1 -1
  204. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.js +90 -72
  205. package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.d.ts +5 -0
  206. package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.d.ts.map +1 -1
  207. package/src/shade/renderer/material/resident/RESIDENT_MATERIAL_TEXTURE_LAYOUT.js +9 -0
  208. package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.d.ts +13 -0
  209. package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.d.ts.map +1 -0
  210. package/src/shade/renderer/path_tracer/shader/INDIRECT_TEXTURE_FILTER.js +14 -0
  211. package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.d.ts +10 -0
  212. package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.d.ts.map +1 -0
  213. package/src/shade/renderer/path_tracer/shader/IndirectTextureFilter.js +15 -0
  214. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.d.ts +4 -3
  215. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.d.ts.map +1 -1
  216. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_tangent_normal.js +6 -5
  217. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.d.ts +17 -2
  218. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.d.ts.map +1 -1
  219. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture.js +25 -57
  220. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.d.ts +13 -0
  221. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.d.ts.map +1 -0
  222. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_exact.js +70 -0
  223. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.d.ts +10 -0
  224. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.d.ts.map +1 -0
  225. package/src/shade/renderer/path_tracer/shader/chunk_indirect_sample_texture_stochastic.js +59 -0
  226. package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.d.ts +12 -0
  227. package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.d.ts.map +1 -0
  228. package/src/shade/renderer/path_tracer/shader/chunk_indirect_texture_load.js +49 -0
  229. package/src/shade/renderer/path_tracer/shader/chunk_ray_hit_to_opacity.d.ts.map +1 -1
  230. package/src/shade/renderer/path_tracer/shader/chunk_ray_hit_to_opacity.js +1 -0
  231. package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.d.ts.map +1 -1
  232. package/src/shade/renderer/path_tracer/shader/chunk_render_trace_path.js +1 -0
  233. package/src/shade/renderer/path_tracer/shader/chunk_sample_material.d.ts.map +1 -1
  234. package/src/shade/renderer/path_tracer/shader/chunk_sample_material.js +2 -1
  235. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts +7 -0
  236. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.d.ts.map +1 -1
  237. package/src/shade/renderer/path_tracer/shader/chunk_sample_material_data.js +15 -6
  238. package/src/shade/renderer/scene/GPUSceneContext.d.ts +7 -1
  239. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  240. package/src/shade/renderer/scene/GPUSceneContext.js +26 -1
  241. package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.d.ts +7 -7
  242. package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.d.ts.map +1 -1
  243. package/src/shade/renderer/shader/chunk/bvh/chunk_bvh_query_aabb_cooperative.js +262 -294
  244. package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.d.ts +9 -0
  245. package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.d.ts.map +1 -0
  246. package/src/shade/renderer/shader/chunk/filter/MULTISCALE_MEAN_STRUCT.js +21 -0
  247. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts +43 -0
  248. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.d.ts.map +1 -0
  249. package/src/shade/renderer/shader/chunk/filter/chunk_multiscale_mean.js +87 -0
  250. package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.d.ts +7 -1
  251. package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.d.ts.map +1 -1
  252. package/src/shade/renderer/shader/chunk/noise/r/chunk_r2_canonical.js +1 -1
  253. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.d.ts +21 -0
  254. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.d.ts.map +1 -0
  255. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve_workgroup.js +42 -0
  256. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
  257. package/src/shade/wgsl/emulator/CPUBitmapData.d.ts +19 -0
  258. package/src/shade/wgsl/emulator/CPUBitmapData.d.ts.map +1 -1
  259. package/src/shade/wgsl/emulator/CPUBitmapData.js +27 -0
  260. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  261. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +39 -18
  262. package/src/view/elements/progress/segmented/GhostTrail.d.ts +56 -0
  263. package/src/view/elements/progress/segmented/GhostTrail.d.ts.map +1 -0
  264. package/src/view/elements/progress/segmented/GhostTrail.js +98 -0
  265. package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.d.ts +3 -1
  266. package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.d.ts.map +1 -1
  267. package/src/view/elements/progress/segmented/RESOURCE_BAR_SEGMENTS.js +3 -1
  268. package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.d.ts +11 -0
  269. package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.d.ts.map +1 -0
  270. package/src/view/elements/progress/segmented/SEGMENT_TIERS_DEFAULT.js +15 -0
  271. package/src/view/elements/progress/segmented/SegmentDefinition.d.ts +3 -0
  272. package/src/view/elements/progress/segmented/SegmentDefinition.d.ts.map +1 -1
  273. package/src/view/elements/progress/segmented/SegmentDefinition.js +3 -0
  274. package/src/view/elements/progress/segmented/SegmentTier.d.ts +38 -0
  275. package/src/view/elements/progress/segmented/SegmentTier.d.ts.map +1 -0
  276. package/src/view/elements/progress/segmented/SegmentTier.js +50 -0
  277. package/src/view/elements/progress/segmented/SegmentedResourceBarView.d.ts +155 -10
  278. package/src/view/elements/progress/segmented/SegmentedResourceBarView.d.ts.map +1 -1
  279. package/src/view/elements/progress/segmented/SegmentedResourceBarView.js +427 -101
  280. package/src/view/elements/progress/segmented/playground/index.html +78 -0
  281. package/src/view/elements/progress/segmented/playground/main.d.ts +2 -0
  282. package/src/view/elements/progress/segmented/playground/main.d.ts.map +1 -0
  283. package/src/view/elements/progress/segmented/playground/main.js +173 -0
  284. package/src/view/elements/progress/segmented/segment_cell_layout.d.ts +48 -0
  285. package/src/view/elements/progress/segmented/segment_cell_layout.d.ts.map +1 -0
  286. package/src/view/elements/progress/segmented/segment_cell_layout.js +75 -0
  287. package/src/view/elements/progress/segmented/segment_notch_place.d.ts +18 -0
  288. package/src/view/elements/progress/segmented/segment_notch_place.d.ts.map +1 -0
  289. package/src/view/elements/progress/segmented/segment_notch_place.js +28 -0
  290. package/src/view/elements/progress/segmented/segment_tick_positions.d.ts +32 -0
  291. package/src/view/elements/progress/segmented/segment_tick_positions.d.ts.map +1 -0
  292. package/src/view/elements/progress/segmented/segment_tick_positions.js +103 -0
  293. package/src/view/elements/progress/segmented/segmented-resource-bar.css +142 -0
  294. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.d.ts +0 -35
  295. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.d.ts.map +0 -1
  296. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_provider.js +0 -238
  297. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.d.ts +0 -99
  298. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.d.ts.map +0 -1
  299. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGEO_BRICK.js +0 -139
  300. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.d.ts +0 -65
  301. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.d.ts.map +0 -1
  302. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/VGeoBrickProvider.js +0 -393
  303. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.d.ts +0 -17
  304. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.d.ts.map +0 -1
  305. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_box.js +0 -36
  306. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.d.ts +0 -29
  307. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.d.ts.map +0 -1
  308. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_pair.js +0 -108
  309. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.d.ts +0 -31
  310. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.d.ts.map +0 -1
  311. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_texel.js +0 -113
  312. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.d.ts +0 -36
  313. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.d.ts.map +0 -1
  314. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/chunk_vgeo_brick_triangle.js +0 -85
  315. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.d.ts +0 -23
  316. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.d.ts.map +0 -1
  317. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_distance.js +0 -273
  318. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.d.ts +0 -13
  319. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.d.ts.map +0 -1
  320. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_gather.js +0 -151
  321. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.d.ts +0 -13
  322. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.d.ts.map +0 -1
  323. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_traverse.js +0 -133
  324. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.d.ts +0 -22
  325. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.d.ts.map +0 -1
  326. package/src/shade/renderer/global_illumination/probe_clipmap/brick/vgeo/shader_vgeo_brick_wait.js +0 -135
@@ -4,6 +4,11 @@ import { BufferDescriptor } from "../../../../descriptor/buffer/BufferDescriptor
4
4
  import { graph_read_buffer } from "../../../buffer/graph_read_buffer.js";
5
5
  import { graph_build_world_light_clusters } from "../../../light/world_cluster/graph_build_world_light_clusters.js";
6
6
  import { WEBGPU_GUARANTEED_MAX_COMPUTE_WORKGROUPS_PER_DIMENSION } from "../../../gpu_primitive/indirect/WEBGPU_GUARANTEED_MAX_COMPUTE_WORKGROUPS_PER_DIMENSION.js";
7
+ import {
8
+ PREFIX_SCAN_CSDLDF_PARTITION_SIZE,
9
+ shader_prefix_scan_csdldf,
10
+ shader_prefix_scan_csdldf_prepare
11
+ } from "../../../gpu_primitive/prefix_sum/v1/shader_prefix_scan_csdldf.js";
7
12
  import { shader_slot_stack_fill, SLOT_STACK_FILL_WORKGROUP_SIZE } from "../../../gpu_primitive/slot_stack/shader_slot_stack_fill.js";
8
13
  import {
9
14
  shader_slot_stack_push_range,
@@ -18,7 +23,7 @@ import {
18
23
  PROBE_CLIPMAP_OCTAHEDRAL_RESOLUTION_MAX,
19
24
  PROBE_CLIPMAP_OCTAHEDRAL_RESOLUTION_MIN
20
25
  } from "../ProbeClipmapSettings.js";
21
- import { PROBE_PROJECTION_ROW_STRUCT, PROBE_RAY_STRUCT, PROBE_RECORD_STRUCT } from "./chunk_probe_clipmap.js";
26
+ import { PROBE_EVICTION_STRUCT, PROBE_PROJECTION_ROW_STRUCT, PROBE_RAY_STRUCT, PROBE_RECORD_STRUCT, PROBE_REQUEST_STRUCT } from "./chunk_probe_clipmap.js";
22
27
  import { PROBE_SAMPLING_STRUCT } from "./chunk_probe_clipmap_pick.js";
23
28
  import {
24
29
  PROBE_COUNTER_FREE,
@@ -30,24 +35,42 @@ import {
30
35
  PROBE_DISPATCH_RAYS,
31
36
  PROBE_DISPATCH_ROWS,
32
37
  PROBE_DISPATCH_TEXELS,
38
+ PROBE_DISPATCH_ORDER,
33
39
  PROBE_DISPATCH_TRACED,
34
40
  PROBE_DISPATCH_WORDS,
41
+ PROBE_FREE_SLACK,
42
+ PROBE_RAYS_PER_TEXEL_MAX,
43
+ PROBE_RAYS_PER_TEXEL_MIN,
44
+ PROBE_THREAD_WORKGROUP_SIZE,
35
45
  PROBE_WANT_TILE,
36
46
  PROBE_WANT_WORKGROUP_TILES,
47
+ PROBE_UNIFORM_PERIOD,
48
+ probe_clipmap_guide_words,
37
49
  probe_clipmap_maps_words
38
50
  } from "./PROBE_CLIPMAP.js";
39
51
  import { shader_probe_clipmap_accumulate } from "./shader_probe_clipmap_accumulate.js";
40
52
  import { shader_probe_clipmap_admit, shader_probe_clipmap_admit_command } from "./shader_probe_clipmap_admit.js";
41
53
  import { shader_probe_clipmap_due } from "./shader_probe_clipmap_due.js";
42
54
  import { shader_probe_clipmap_fill } from "./shader_probe_clipmap_fill.js";
55
+ import {
56
+ shader_probe_clipmap_guide_rows,
57
+ shader_probe_clipmap_guide_starts,
58
+ shader_probe_clipmap_guide_weights
59
+ } from "./shader_probe_clipmap_guide.js";
43
60
  import { shader_probe_clipmap_project, shader_probe_clipmap_project_rows } from "./shader_probe_clipmap_project.js";
44
61
  import { shader_probe_clipmap_publish } from "./shader_probe_clipmap_publish.js";
45
62
  import { shader_probe_clipmap_relocate } from "./shader_probe_clipmap_relocate.js";
46
63
  import { shader_probe_clipmap_retire } from "./shader_probe_clipmap_retire.js";
47
64
  import { shader_probe_clipmap_schedule } from "./shader_probe_clipmap_schedule.js";
48
65
  import { shader_probe_clipmap_light } from "./shader_probe_clipmap_light.js";
66
+ import {
67
+ shader_probe_clipmap_ray_command,
68
+ shader_probe_clipmap_ray_counts,
69
+ shader_probe_clipmap_ray_layout
70
+ } from "./shader_probe_clipmap_ray_layout.js";
49
71
  import { shader_probe_clipmap_shade } from "./shader_probe_clipmap_shade.js";
50
72
  import { shader_probe_clipmap_trace } from "./shader_probe_clipmap_trace.js";
73
+ import { shader_probe_clipmap_order } from "./shader_probe_clipmap_order.js";
51
74
  import { shader_probe_clipmap_trace_command } from "./shader_probe_clipmap_trace_command.js";
52
75
  import { shader_probe_clipmap_want } from "./shader_probe_clipmap_want.js";
53
76
  import { shader_probe_clipmap_want_hits } from "./shader_probe_clipmap_want_hits.js";
@@ -91,15 +114,16 @@ const SAMPLING_RADIANCE_TILES_PER_ROW_RECIPROCAL = PROBE_SAMPLING_STRUCT.get("ra
91
114
  /**
92
115
  * What shading samples (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md §8): {@link cascade_count} cascades of
93
116
  * {@link resolution}³ lattice points around the view, {@link spacing} metres apart in the finest
94
- * cascade and twice as far apart in each one around it. A point holds a probe only while a pixel wants
95
- * it, or a hit of a probe a pixel wants, so probes are a sparse cache over the lattice.
117
+ * cascade and twice as far apart in each one around it. A point gets a probe when a pixel wants it, or
118
+ * a hit of a probe a pixel wants, and keeps it until its window leaves it or the slots are wanted for
119
+ * others, so probes are a sparse cache over the lattice.
96
120
  *
97
121
  * **Storage** (§8.2):
98
122
  * - {@link indirection}, `r32uint`, a texel a lattice point in storage that wraps, the cascades
99
123
  * stacked along z: the slot of the point's probe, or none. Allocated whole, since the lattice follows
100
124
  * from the structure alone.
101
125
  * - a slot each: a state of two words, the kind and updates and then where relocation moved it
102
- * (`PROBE_CLIPMAP.js`), a 64-byte record (`PROBE_RECORD_STRUCT`), an octahedral radiance tile of
126
+ * (`PROBE_CLIPMAP.js`), a 48-byte record (`PROBE_RECORD_STRUCT`), an octahedral radiance tile of
103
127
  * {@link radiance_resolution}² texels and a depth-moment tile of {@link depth_resolution}², each with
104
128
  * a one-texel skirt, in two 2-D tile atlases. The slots are handed out by a free list on the device.
105
129
  * - the active lists, double-buffered: each frame's retire reads the last frame's and writes the
@@ -108,13 +132,22 @@ const SAMPLING_RADIANCE_TILES_PER_ROW_RECIPROCAL = PROBE_SAMPLING_STRUCT.get("ra
108
132
  *
109
133
  * **A frame's lifetime** ({@link graph_update}, §8.3, §8.5): the windows are placed around the anchor,
110
134
  * coarsest first, each a parent cell inside its parent. Retire frees the probes whose points left
111
- * their windows or that nothing wanted for `retention_time`, want marks the cages one pixel of each
135
+ * their windows and those the last frame's schedule evicted, want marks the cages one pixel of each
112
136
  * screen tile reads, the hits' wants the cages the last frame's hits read their bounce from, admit
113
- * gives each wanted point without a probe a NEW one, schedule sets the period T from the wanted count,
114
- * and the due passes list the frame's updates, NEW probes first.
137
+ * gives each wanted point without a probe a NEW one, schedule sets the period T from the probes waiting
138
+ * for an update and the next frame's eviction from the pressure on the slots (`PROBE_FREE_SLACK`), and
139
+ * the due passes list the frame's updates, NEW probes first.
115
140
  *
116
- * **The frame's update** (§8.4, §8.6), once the brick clipmap is built: relocate, then trace, a ray a
117
- * thread, R a probe, each with its hit and the suns' soft shadows there.
141
+ * **The frame's rays** (§8.6): the lifetime's last passes lay them out. Each listed probe's rays this update
142
+ * are a count the budget does not scale (a uniform update's R, a DEAD probe's fewest) and a request it
143
+ * does (a guided update's, `probe_requests`, which projection sets after each update). Both are scanned
144
+ * (`graph_prefix_scan_csdldf`'s shaders), the requests are scaled into what the budget leaves, and the
145
+ * sums of the two are `probe_ray_sums`: a probe's rays follow one another in the trace list's order, and
146
+ * the last sum is the frame's count, which the rays' command dispatches.
147
+ *
148
+ * **The frame's update** (§8.4, §8.6), once the brick clipmap is built: relocate; then the guide, the
149
+ * CDF over each listed probe's history that its guided updates' rays follow (`PROBE_UNIFORM_PERIOD`);
150
+ * then trace, a ray a thread, each with its hit and the suns' shadow rays from there.
118
151
  *
119
152
  * Retire, admit, due and the update run through commands written on the device, want over the screen's
120
153
  * tiles: nothing is sized by the capacity.
@@ -189,6 +222,9 @@ export class GPUProbeClipmap {
189
222
  /** What the one-thread passes write for the passes after them to dispatch through. @type {GPUBuffer} */
190
223
  #dispatch;
191
224
 
225
+ /** What the next frame's retire evicts, `PROBE_EVICTION_STRUCT`, as schedule writes it. @type {GPUBuffer} */
226
+ #eviction;
227
+
192
228
  /** The two active lists; the frame reads `#active[#parity]` and writes the other. @type {GPUBuffer[]} */
193
229
  #active = [];
194
230
 
@@ -212,22 +248,46 @@ export class GPUProbeClipmap {
212
248
  /** The listed probes' maps, as accumulation writes them, as many as the trace list holds. @type {GPUBuffer|null} */
213
249
  #maps = null;
214
250
 
251
+ /** The listed probes' guides, as the guide passes write them, as many as the trace list holds. @type {GPUBuffer|null} */
252
+ #guide = null;
253
+
215
254
  /** The listed probes' projected rows, n_r a probe, as many as the trace list holds. @type {GPUBuffer|null} */
216
255
  #projection = null;
217
256
 
218
- /** The frame's rays, R a listed probe. @type {GPUBuffer|null} */
257
+ /** The frame's rays, laid out by listed probe (`#ray_sums`). @type {GPUBuffer|null} */
219
258
  #rays = null;
220
259
 
221
- /** Rays the rays buffer holds: U·R as it last grew. */
260
+ /** Rays the rays buffer holds: U·R, to the next whole workgroup, as it last grew. */
222
261
  #ray_capacity = 0;
223
262
 
224
- /** U and R of the rays the last frame traced, which the hits' wants read. */
225
- #rays_trace_capacity = 0;
226
- #rays_per_probe = 0;
263
+ /** Each listed probe's rays this update that the budget does not scale, `{count, elements}`, as many as the trace list holds. @type {GPUBuffer|null} */
264
+ #ray_counts = null;
265
+
266
+ /** Each listed probe's rays this update that the budget scales: a guided update's request. @type {GPUBuffer|null} */
267
+ #ray_requests = null;
268
+
269
+ /** The scans' outputs, the inclusive sums of the counts and of the requests. @type {GPUBuffer|null} */
270
+ #ray_count_sums = null;
271
+ /** @type {GPUBuffer|null} */
272
+ #ray_request_sums = null;
273
+
274
+ /** The rays' layout, inclusive sums of each listed probe's rays. @type {GPUBuffer|null} */
275
+ #ray_sums = null;
276
+
277
+ /** The ray counts' scan's spine, cleared before each scan, and its command. @type {GPUBuffer|null} */
278
+ #ray_scan_spine = null;
279
+ /** @type {GPUBuffer|null} */
280
+ #ray_scan_command = null;
227
281
 
228
282
  /** @type {GPUTileAtlas2D} */
229
283
  #radiance;
230
284
 
285
+ /** Each slot's radiance estimators, `vec4<u32>` a texel, n_r² a slot: the atlas's mean's multi-scale state. @type {GPUBuffer} */
286
+ #estimators;
287
+
288
+ /** Each slot's ray request, `PROBE_REQUEST_STRUCT`: the rays its next guided update asks for. @type {GPUBuffer} */
289
+ #requests;
290
+
231
291
  /** @type {GPUTileAtlas2D} */
232
292
  #depth;
233
293
 
@@ -247,9 +307,8 @@ export class GPUProbeClipmap {
247
307
  #starved = 0;
248
308
  #grow_pending = false;
249
309
 
250
- /** Frames recorded, and the caller's time at the first: the clock the records keep. */
310
+ /** Frames recorded: the clock the records keep. */
251
311
  #frame = 0;
252
- #time_origin = 0;
253
312
 
254
313
  #destroyed = false;
255
314
 
@@ -264,27 +323,33 @@ export class GPUProbeClipmap {
264
323
  #levels_i32 = new Int32Array(this.#levels_data);
265
324
  #levels_f32 = new Float32Array(this.#levels_data);
266
325
 
267
- #retire_settings = { capacity: 0, resolution: 0, time: 0, retention_time: 0 };
326
+ #retire_settings = { capacity: 0, resolution: 0, frame: 0 };
268
327
  #want_settings = { cascade_count: 0, resolution: 0, frame: 0, key_count: 0 };
269
- #want_hits_settings = { cascade_count: 0, resolution: 0, key_count: 0, trace_capacity: 0, rays_per_probe: 0 };
328
+ #want_hits_settings = { cascade_count: 0, resolution: 0, key_count: 0 };
270
329
  #admit_command_settings = { key_count: 0 };
271
- #admit_settings = { capacity: 0, resolution: 0, key_count: 0, time: 0 };
272
- #schedule_settings = { capacity: 0, key_count: 0, trace_capacity: 0 };
273
- #due_settings = { capacity: 0, resolution: 0, trace_capacity: 0, frame: 0, new_only: 0 };
274
- #trace_command_settings = { trace_capacity: 0, rays_per_probe: 0 };
330
+ #admit_settings = { capacity: 0, resolution: 0, key_count: 0, frame: 0 };
331
+ #schedule_settings = { capacity: 0, key_count: 0, trace_capacity: 0, slack: 0 };
332
+ #due_settings = { capacity: 0, trace_capacity: 0, frame: 0, new_only: 0 };
333
+ #trace_command_settings = { trace_capacity: 0, radiance_resolution: 0, depth_resolution: 0 };
334
+ #order_settings = { trace_capacity: 0, resolution: 0, axis_bits: 0 };
335
+ #ray_counts_settings = { trace_capacity: 0, rays_per_probe: 0, rays_min: 0, radiance_resolution: 0, uniform_period: PROBE_UNIFORM_PERIOD };
336
+ #ray_layout_settings = { trace_capacity: 0, ray_budget: 0 };
275
337
  #relocate_settings = { trace_capacity: 0, brick_cascade_count: 0 };
276
- #trace_settings = { trace_capacity: 0, rays_per_probe: 0, radiance_resolution: 0, brick_cascade_count: 0, t_max: 0 };
277
- #shade_settings = { trace_capacity: 0, rays_per_probe: 0 };
278
- #accumulate_settings = { trace_capacity: 0, rays_per_probe: 0, radiance_resolution: 0, depth_resolution: 0, radiance_tiles_per_row: 0, depth_tiles_per_row: 0, time: 0, response_time: 0 };
279
- #project_settings = { trace_capacity: 0, radiance_resolution: 0, depth_resolution: 0, time: 0 };
338
+ #guide_settings = { trace_capacity: 0, rays_per_probe: 0, radiance_resolution: 0, radiance_tiles_per_row: 0 };
339
+ #trace_settings = { trace_capacity: 0, rays_per_probe: 0, radiance_resolution: 0, brick_cascade_count: 0, t_max: 0, uniform_period: PROBE_UNIFORM_PERIOD };
340
+ #accumulate_settings = { trace_capacity: 0, rays_per_probe: 0, radiance_resolution: 0, depth_resolution: 0, radiance_tiles_per_row: 0, depth_tiles_per_row: 0, frame: 0, response_frames: 0, uniform_period: PROBE_UNIFORM_PERIOD };
341
+ #project_settings = { trace_capacity: 0, rays_per_probe: 0, radiance_resolution: 0, depth_resolution: 0, frame: 0, uniform_period: PROBE_UNIFORM_PERIOD, rays_min: 0, rays_max: 0, response_frames: 0 };
280
342
  #publish_settings = { trace_capacity: 0, radiance_resolution: 0, depth_resolution: 0, radiance_tiles_per_row: 0, depth_tiles_per_row: 0 };
281
343
  #push_settings = { first: 0, count: 0, counter: PROBE_COUNTER_FREE };
282
344
 
283
345
  #bindings = {};
284
346
 
347
+ /** The ray counts' scan's, which names its buffers its own way. */
348
+ #ray_scan_bindings = { scan_in: null, scan_out: null, spine: null, command: null };
349
+
285
350
  #lifetime_data = { counters: -1, depth: -1, normal: -1, stbn: -1 };
286
351
 
287
- #update_data = { counters: -1, bricks: -1, world_cluster_lookup: -1, world_cluster_data: -1, shadowmap_atlas: -1 };
352
+ #update_data = { counters: -1, bricks: -1, world_cluster_lookup: -1, world_cluster_data: -1 };
288
353
 
289
354
  /** The coarsest brick window's box, metres, which the world light clusters cull lights against. */
290
355
  #clusters_min = [0, 0, 0];
@@ -384,6 +449,8 @@ export class GPUProbeClipmap {
384
449
 
385
450
  // two words a slot: the state, then the relocation offset
386
451
  this.#states = this.#create_buffer('probe states', 8 * capacity, GPUBufferUsage.COPY_SRC);
452
+ this.#estimators = this.#create_buffer('probe estimators', 16 * radiance_resolution * radiance_resolution * capacity, GPUBufferUsage.COPY_SRC);
453
+ this.#requests = this.#create_buffer('probe requests', PROBE_REQUEST_STRUCT.size * capacity, GPUBufferUsage.COPY_SRC);
387
454
  this.#records = this.#create_buffer('probe records', PROBE_RECORD_STRUCT.size * capacity, GPUBufferUsage.COPY_SRC);
388
455
  this.#free = this.#create_buffer('probe free list', 4 * capacity, GPUBufferUsage.COPY_SRC);
389
456
  this.#active.push(
@@ -395,6 +462,8 @@ export class GPUProbeClipmap {
395
462
  this.#counters = this.#create_buffer('probe counters', 4 * PROBE_COUNTER_WORDS, GPUBufferUsage.COPY_SRC | GPUBufferUsage.COPY_DST);
396
463
  // zero: the first frame's retire dispatches nothing
397
464
  this.#dispatch = this.#create_buffer('probe dispatch', 4 * PROBE_DISPATCH_WORDS, GPUBufferUsage.INDIRECT);
465
+ // zero: the first frame's retire evicts nothing
466
+ this.#eviction = this.#create_buffer('probe eviction', PROBE_EVICTION_STRUCT.size, GPUBufferUsage.COPY_SRC);
398
467
 
399
468
  // every slot free, once the first frame has filled the list
400
469
  const counters = new Uint32Array(PROBE_COUNTER_WORDS);
@@ -506,9 +575,7 @@ export class GPUProbeClipmap {
506
575
  * @param {GPUBuffer} options.camera the view's camera uniform
507
576
  * @param {*} options.stbn the 2-channel spatio-temporal blue noise, `STATIC_GRAPHICS_ENGINE_ASSETS.stbn_vec2`
508
577
  * @param {ArrayLike<number>} options.resolution the frame's pixels, x and y
509
- * @param {number} options.time the caller's clock, seconds
510
- * @param {number} options.retention_time seconds an unwanted probe keeps its slot
511
- * @param {number} options.response_time seconds of the blend's response, τ (§8.8)
578
+ * @param {number} options.response_frames frames of the blend's response, τ (§8.8)
512
579
  * @param {number} options.ray_budget rays a frame
513
580
  * @param {number} options.rays_per_probe rays an update, R: the frame updates ⌊ray_budget / R⌋ probes at most
514
581
  * @param {import("../brick/GPUBrickClipmap.js").GPUBrickClipmap} options.brick_clipmap the world the
@@ -520,18 +587,13 @@ export class GPUProbeClipmap {
520
587
  * @param {import("../../../material/resident/GPUResidentMaterialContext.js").GPUResidentMaterialContext} options.materials
521
588
  * the resident materials, updated this frame: what a hit no card sees takes
522
589
  * @param {GPUBuffer} options.card_rows the row → card set table, a word a `meshes` row
523
- * @param {number} options.shadowmap_atlas graph handle of the frame's shadow map atlas, which the hits'
524
- * local lights are shadowed by
525
590
  */
526
- graph_update({ graph, x, y, z, depth, normal, camera, stbn, resolution, time, retention_time, response_time, ray_budget, rays_per_probe, brick_clipmap, bricks, scene, materials, card_rows, shadowmap_atlas }) {
591
+ graph_update({ graph, x, y, z, depth, normal, camera, stbn, resolution, response_frames, ray_budget, rays_per_probe, brick_clipmap, bricks, scene, materials, card_rows }) {
527
592
  assert.defined(graph, 'graph');
528
593
  assert.defined(camera, 'camera');
529
594
  assert.defined(stbn, 'stbn');
530
- assert.isFinite(time, 'time');
531
- assert.isFinite(retention_time, 'retention_time');
532
- assert.greaterThan(retention_time, 0, 'retention_time');
533
- assert.isFinite(response_time, 'response_time');
534
- assert.greaterThan(response_time, 0, 'response_time');
595
+ assert.isFinite(response_frames, 'response_frames');
596
+ assert.greaterThan(response_frames, 0, 'response_frames');
535
597
  assert.isPositiveInteger(rays_per_probe, 'rays_per_probe');
536
598
  assert.greaterThanOrEqual(ray_budget, rays_per_probe, 'ray_budget');
537
599
  assert.defined(brick_clipmap, 'brick_clipmap');
@@ -539,7 +601,6 @@ export class GPUProbeClipmap {
539
601
  assert.defined(scene, 'scene');
540
602
  assert.defined(materials, 'materials');
541
603
  assert.defined(card_rows, 'card_rows');
542
- assert.isNonNegativeInteger(shadowmap_atlas, 'shadowmap_atlas');
543
604
  assert.notOk(this.#destroyed, 'destroyed');
544
605
 
545
606
  if (this.#grow_pending) {
@@ -548,13 +609,13 @@ export class GPUProbeClipmap {
548
609
  }
549
610
 
550
611
  const trace_capacity = Math.floor(ray_budget / rays_per_probe);
612
+ const texels = this.radiance_resolution * this.radiance_resolution;
613
+ const rays_min = PROBE_RAYS_PER_TEXEL_MIN * texels;
614
+ const rays_max = PROBE_RAYS_PER_TEXEL_MAX * texels;
551
615
 
552
616
  this.#ensure_trace(trace_capacity);
553
- this.#ensure_rays(trace_capacity * rays_per_probe);
554
-
555
- if (this.#frame === 0) {
556
- this.#time_origin = time;
557
- }
617
+ // the requests share what the counts leave of the budget, so the frame's rays are at most it
618
+ this.#ensure_rays(ray_budget);
558
619
 
559
620
  this.#place(x, y, z);
560
621
 
@@ -580,51 +641,66 @@ export class GPUProbeClipmap {
580
641
 
581
642
  this.#device.queue.writeBuffer(this.#sampling, 0, this.#sampling_data);
582
643
 
583
- const clock = time - this.#time_origin;
584
-
585
644
  this.#retire_settings.capacity = this.#capacity;
586
645
  this.#retire_settings.resolution = this.resolution;
587
- this.#retire_settings.time = clock;
588
- this.#retire_settings.retention_time = retention_time;
646
+ this.#retire_settings.frame = this.#frame;
589
647
 
590
648
  this.#want_settings.cascade_count = this.cascade_count;
591
649
  this.#want_settings.resolution = this.resolution;
592
650
  this.#want_settings.frame = this.#frame;
593
651
  this.#want_settings.key_count = this.#key_count;
594
652
 
595
- // the hits' wants read the last frame's rays, as that frame laid them out
653
+ // the hits' wants read the last frame's rays, each naming its probe
596
654
  const want_hits = this.#want_hits_settings;
597
655
 
598
656
  want_hits.cascade_count = this.cascade_count;
599
657
  want_hits.resolution = this.resolution;
600
658
  want_hits.key_count = this.#key_count;
601
- want_hits.trace_capacity = this.#rays_trace_capacity;
602
- want_hits.rays_per_probe = this.#rays_per_probe;
603
-
604
- this.#rays_trace_capacity = trace_capacity;
605
- this.#rays_per_probe = rays_per_probe;
606
659
 
607
660
  this.#admit_command_settings.key_count = this.#key_count;
608
661
 
609
662
  this.#admit_settings.capacity = this.#capacity;
610
663
  this.#admit_settings.resolution = this.resolution;
611
664
  this.#admit_settings.key_count = this.#key_count;
612
- this.#admit_settings.time = clock;
665
+ this.#admit_settings.frame = this.#frame;
613
666
 
614
667
  this.#schedule_settings.capacity = this.#capacity;
615
668
  this.#schedule_settings.key_count = this.#key_count;
616
669
  this.#schedule_settings.trace_capacity = trace_capacity;
670
+ this.#schedule_settings.slack = Math.ceil(this.#capacity * PROBE_FREE_SLACK);
617
671
 
618
672
  this.#due_settings.capacity = this.#capacity;
619
- this.#due_settings.resolution = this.resolution;
620
673
  this.#due_settings.trace_capacity = trace_capacity;
621
674
  this.#due_settings.frame = this.#frame;
622
675
 
623
676
  this.#trace_command_settings.trace_capacity = trace_capacity;
624
- this.#trace_command_settings.rays_per_probe = rays_per_probe;
625
677
  this.#trace_command_settings.radiance_resolution = this.radiance_resolution;
626
678
  this.#trace_command_settings.depth_resolution = this.depth_resolution;
627
679
 
680
+ const order = this.#order_settings;
681
+
682
+ order.trace_capacity = trace_capacity;
683
+ order.resolution = this.resolution;
684
+ order.axis_bits = Math.ceil(Math.log2(this.resolution));
685
+
686
+ // the order's key: the cascade above the Morton code of a lattice point in its window
687
+ assert.lessThanOrEqual(3 * order.axis_bits + Math.ceil(Math.log2(this.cascade_count)), 32, 'the order key fits a word');
688
+
689
+ this.#ray_counts_settings.trace_capacity = trace_capacity;
690
+ this.#ray_counts_settings.rays_per_probe = rays_per_probe;
691
+ this.#ray_counts_settings.rays_min = rays_min;
692
+ this.#ray_counts_settings.radiance_resolution = this.radiance_resolution;
693
+
694
+ this.#ray_layout_settings.trace_capacity = trace_capacity;
695
+ this.#ray_layout_settings.ray_budget = ray_budget;
696
+
697
+ const guide = this.#guide_settings;
698
+
699
+ guide.trace_capacity = trace_capacity;
700
+ guide.rays_per_probe = rays_per_probe;
701
+ guide.radiance_resolution = this.radiance_resolution;
702
+ guide.radiance_tiles_per_row = this.#radiance.tiles_per_row;
703
+
628
704
  // past the coarsest window's far corner every ray has left the clipmap
629
705
  const coarsest = brick_clipmap.cascade_count - 1;
630
706
 
@@ -637,9 +713,6 @@ export class GPUProbeClipmap {
637
713
  this.#relocate_settings.trace_capacity = trace_capacity;
638
714
  this.#relocate_settings.brick_cascade_count = brick_clipmap.cascade_count;
639
715
 
640
- this.#shade_settings.trace_capacity = trace_capacity;
641
- this.#shade_settings.rays_per_probe = rays_per_probe;
642
-
643
716
  const accumulate = this.#accumulate_settings;
644
717
 
645
718
  accumulate.trace_capacity = trace_capacity;
@@ -648,13 +721,17 @@ export class GPUProbeClipmap {
648
721
  accumulate.depth_resolution = this.depth_resolution;
649
722
  accumulate.radiance_tiles_per_row = this.#radiance.tiles_per_row;
650
723
  accumulate.depth_tiles_per_row = this.#depth.tiles_per_row;
651
- accumulate.time = clock;
652
- accumulate.response_time = response_time;
724
+ accumulate.frame = this.#frame;
725
+ accumulate.response_frames = response_frames;
653
726
 
654
727
  this.#project_settings.trace_capacity = trace_capacity;
728
+ this.#project_settings.rays_per_probe = rays_per_probe;
655
729
  this.#project_settings.radiance_resolution = this.radiance_resolution;
656
730
  this.#project_settings.depth_resolution = this.depth_resolution;
657
- this.#project_settings.time = clock;
731
+ this.#project_settings.frame = this.#frame;
732
+ this.#project_settings.rays_min = rays_min;
733
+ this.#project_settings.rays_max = rays_max;
734
+ this.#project_settings.response_frames = response_frames;
658
735
 
659
736
  const publish = this.#publish_settings;
660
737
 
@@ -715,7 +792,6 @@ export class GPUProbeClipmap {
715
792
  update_data.bricks = update.read(bricks);
716
793
  update_data.world_cluster_lookup = update.read(clusters.lookup);
717
794
  update_data.world_cluster_data = update.read(clusters.data);
718
- update_data.shadowmap_atlas = update.read(shadowmap_atlas);
719
795
 
720
796
  update.make_side_effect();
721
797
 
@@ -732,6 +808,9 @@ export class GPUProbeClipmap {
732
808
  } finally {
733
809
  reference.release();
734
810
  }
811
+ })
812
+ .catch(() => {
813
+ // a reading lost to a timeout or a lost device: the count runs on, and a later reading carries it
735
814
  });
736
815
 
737
816
  this.#frame++;
@@ -779,6 +858,8 @@ export class GPUProbeClipmap {
779
858
  this.#depth.ensure_capacity(capacity);
780
859
 
781
860
  this.#states = this.#regrow(this.#states, 'probe states', 8 * capacity);
861
+ this.#estimators = this.#regrow(this.#estimators, 'probe estimators', 16 * this.radiance_resolution * this.radiance_resolution * capacity);
862
+ this.#requests = this.#regrow(this.#requests, 'probe requests', PROBE_REQUEST_STRUCT.size * capacity);
782
863
  this.#records = this.#regrow(this.#records, 'probe records', PROBE_RECORD_STRUCT.size * capacity);
783
864
  this.#free = this.#regrow(this.#free, 'probe free list', 4 * capacity);
784
865
  this.#active[0] = this.#regrow(this.#active[0], 'probe active 0', LIST_HEADER_BYTES + 4 * capacity);
@@ -800,25 +881,46 @@ export class GPUProbeClipmap {
800
881
  this.#trace?.destroy();
801
882
  this.#origins?.destroy();
802
883
  this.#maps?.destroy();
884
+ this.#guide?.destroy();
803
885
  this.#projection?.destroy();
886
+ this.#ray_counts?.destroy();
887
+ this.#ray_requests?.destroy();
888
+ this.#ray_count_sums?.destroy();
889
+ this.#ray_request_sums?.destroy();
890
+ this.#ray_sums?.destroy();
891
+ this.#ray_scan_spine?.destroy();
892
+ this.#ray_scan_command?.destroy();
804
893
  this.#trace_capacity = trace_capacity;
805
894
  this.#trace = this.#create_buffer('probe trace', LIST_HEADER_BYTES + 4 * trace_capacity, GPUBufferUsage.COPY_DST);
895
+ // the scan reads and writes whole blocks of four
896
+ const counts_size = LIST_HEADER_BYTES + 16 * Math.max(1, Math.ceil(trace_capacity / 4));
897
+ this.#ray_counts = this.#create_buffer('probe ray counts', counts_size, 0);
898
+ this.#ray_requests = this.#create_buffer('probe ray requests', counts_size, 0);
899
+ this.#ray_count_sums = this.#create_buffer('probe ray count sums', counts_size, 0);
900
+ this.#ray_request_sums = this.#create_buffer('probe ray request sums', counts_size, 0);
901
+ this.#ray_sums = this.#create_buffer('probe ray sums', counts_size, 0);
902
+ this.#ray_scan_spine = this.#create_buffer('probe ray scan spine', 8 * Math.ceil(trace_capacity / PREFIX_SCAN_CSDLDF_PARTITION_SIZE), GPUBufferUsage.COPY_DST);
903
+ this.#ray_scan_command = this.#create_buffer('probe ray scan command', 12, GPUBufferUsage.INDIRECT);
806
904
  this.#origins = this.#create_buffer('probe origins', 16 * trace_capacity, 0);
807
905
  this.#maps = this.#create_buffer('probe maps', 4 * probe_clipmap_maps_words(this.radiance_resolution, this.depth_resolution) * trace_capacity, 0);
906
+ this.#guide = this.#create_buffer('probe guide', 4 * probe_clipmap_guide_words(this.radiance_resolution) * trace_capacity, 0);
808
907
  this.#projection = this.#create_buffer('probe projection', PROBE_PROJECTION_ROW_STRUCT.size * this.radiance_resolution * trace_capacity, 0);
809
908
  }
810
909
 
811
910
  /**
812
- * Room for `ray_count` rays, U·R: the update's rays, which the ray settings size.
911
+ * Room for `ray_count` rays, U·R, which the ray settings size, to the next whole workgroup: the last
912
+ * workgroup's threads past the frame's last ray write a record of no ray.
813
913
  */
814
914
  #ensure_rays(ray_count) {
815
- if (this.#rays !== null && this.#ray_capacity >= ray_count) {
915
+ const room = Math.ceil(ray_count / PROBE_THREAD_WORKGROUP_SIZE) * PROBE_THREAD_WORKGROUP_SIZE;
916
+
917
+ if (this.#rays !== null && this.#ray_capacity >= room) {
816
918
  return;
817
919
  }
818
920
 
819
921
  this.#rays?.destroy();
820
- this.#ray_capacity = ray_count;
821
- this.#rays = this.#create_buffer('probe rays', PROBE_RAY_STRUCT.size * ray_count, 0);
922
+ this.#ray_capacity = room;
923
+ this.#rays = this.#create_buffer('probe rays', PROBE_RAY_STRUCT.size * room, 0);
822
924
  }
823
925
 
824
926
  #execute_lifetime = (data, resources, context) => {
@@ -883,6 +985,7 @@ export class GPUProbeClipmap {
883
985
  b.probe_wanted_bits = this.#wanted_bits;
884
986
  b.probe_trace = this.#trace;
885
987
  b.probe_dispatch = this.#dispatch;
988
+ b.probe_eviction = this.#eviction;
886
989
 
887
990
  b.settings = this.#retire_settings;
888
991
 
@@ -954,11 +1057,74 @@ export class GPUProbeClipmap {
954
1057
  });
955
1058
  }
956
1059
 
1060
+ b.probe_ray_counts = this.#ray_counts;
1061
+ b.probe_ray_requests = this.#ray_requests;
1062
+ b.probe_ray_sums = this.#ray_sums;
957
1063
  b.settings = this.#trace_command_settings;
958
1064
 
959
1065
  shader_probe_clipmap_trace_command.dispatch({ encoder, bindings: b });
1066
+
1067
+ // the list in its probes' order, before anything reads a probe's place in it
1068
+ b.settings = this.#order_settings;
1069
+
1070
+ shader_probe_clipmap_order.dispatchIndirect({
1071
+ encoder,
1072
+ bindings: b,
1073
+ command: this.#dispatch,
1074
+ command_offset: 4 * PROBE_DISPATCH_ORDER,
1075
+ });
1076
+
1077
+ // the frame's rays: each listed probe's count and request, their scans, the layout that scales the
1078
+ // requests into the budget, and the command over its last sum
1079
+ b.probe_requests = this.#requests;
1080
+ b.settings = this.#ray_counts_settings;
1081
+
1082
+ shader_probe_clipmap_ray_counts.dispatchIndirect({
1083
+ encoder,
1084
+ bindings: b,
1085
+ command: this.#dispatch,
1086
+ command_offset: 4 * PROBE_DISPATCH_TRACED,
1087
+ });
1088
+
1089
+ this.#scan(encoder, this.#ray_counts, this.#ray_count_sums);
1090
+ this.#scan(encoder, this.#ray_requests, this.#ray_request_sums);
1091
+
1092
+ b.probe_ray_count_sums = this.#ray_count_sums;
1093
+ b.probe_ray_request_sums = this.#ray_request_sums;
1094
+ b.settings = this.#ray_layout_settings;
1095
+
1096
+ shader_probe_clipmap_ray_layout.dispatchIndirect({
1097
+ encoder,
1098
+ bindings: b,
1099
+ command: this.#dispatch,
1100
+ command_offset: 4 * PROBE_DISPATCH_TRACED,
1101
+ });
1102
+
1103
+ shader_probe_clipmap_ray_command.dispatch({ encoder, bindings: b });
960
1104
  };
961
1105
 
1106
+ /**
1107
+ * Inclusive sums of a listed probe's counts, `{count, elements}`, into `output`: the CSDLDF scan's
1108
+ * shaders, its spine cleared first, since its flags are read across workgroups.
1109
+ *
1110
+ * @param {GPUCommandEncoder} encoder
1111
+ * @param {GPUBuffer} input
1112
+ * @param {GPUBuffer} output
1113
+ */
1114
+ #scan(encoder, input, output) {
1115
+ const scan = this.#ray_scan_bindings;
1116
+
1117
+ scan.scan_in = input;
1118
+ scan.scan_out = output;
1119
+ scan.spine = this.#ray_scan_spine;
1120
+ scan.command = this.#ray_scan_command;
1121
+
1122
+ encoder.clearBuffer(this.#ray_scan_spine);
1123
+
1124
+ shader_prefix_scan_csdldf_prepare.dispatch({ encoder, bindings: scan });
1125
+ shader_prefix_scan_csdldf.dispatchIndirect({ encoder, bindings: scan, command: this.#ray_scan_command });
1126
+ }
1127
+
962
1128
  #execute_update = (data, resources, context) => {
963
1129
  const encoder = context.encoder;
964
1130
  const b = this.#bindings;
@@ -967,6 +1133,7 @@ export class GPUProbeClipmap {
967
1133
 
968
1134
  b.probe_counters = resources.get(data.counters);
969
1135
  b.probe_origins = this.#origins;
1136
+ b.probe_ray_sums = this.#ray_sums;
970
1137
  b.settings = this.#relocate_settings;
971
1138
 
972
1139
  shader_probe_clipmap_relocate.dispatchIndirect({
@@ -976,6 +1143,20 @@ export class GPUProbeClipmap {
976
1143
  command_offset: 4 * PROBE_DISPATCH_TRACED,
977
1144
  });
978
1145
 
1146
+ // the guide each probe's rays follow, from its history as the atlas holds it
1147
+ b.probe_radiance = this.#radiance.texture_at(0).obtainView();
1148
+ b.probe_guide = this.#guide;
1149
+ b.settings = this.#guide_settings;
1150
+
1151
+ for (const shader of [shader_probe_clipmap_guide_rows, shader_probe_clipmap_guide_weights, shader_probe_clipmap_guide_starts]) {
1152
+ shader.dispatchIndirect({
1153
+ encoder,
1154
+ bindings: b,
1155
+ command: this.#dispatch,
1156
+ command_offset: 4 * PROBE_DISPATCH_ROWS,
1157
+ });
1158
+ }
1159
+
979
1160
  const scene = this.#scene;
980
1161
  const lights = scene.lights;
981
1162
 
@@ -1004,7 +1185,6 @@ export class GPUProbeClipmap {
1004
1185
  b.materials = this.#materials.buffer_materials;
1005
1186
  b.texture_means = this.#materials.buffer_texture_means;
1006
1187
  b.tEnvironment = lights.environment.obtainView();
1007
- b.settings = this.#shade_settings;
1008
1188
 
1009
1189
  shader_probe_clipmap_shade.dispatchIndirect({
1010
1190
  encoder,
@@ -1013,12 +1193,11 @@ export class GPUProbeClipmap {
1013
1193
  command_offset: 4 * PROBE_DISPATCH_RAYS,
1014
1194
  });
1015
1195
 
1016
- // the light each hit takes from beyond the trace: its cell's local lights, and the next bounce from
1017
- // last frame's probes
1196
+ // the light each hit takes from beyond the trace: one of its cell's local lights through the bricks, and
1197
+ // the next bounce from last frame's probes
1018
1198
  this.write_sampling_bindings(b);
1019
1199
  b.world_cluster_lookup = resources.get(data.world_cluster_lookup);
1020
1200
  b.world_cluster_data = resources.get(data.world_cluster_data);
1021
- b.shadowmapAtlas = resources.get(data.shadowmap_atlas).obtainView();
1022
1201
  b.settings = this.#trace_settings;
1023
1202
 
1024
1203
  shader_probe_clipmap_light.dispatchIndirect({
@@ -1032,8 +1211,10 @@ export class GPUProbeClipmap {
1032
1211
  // maps; then the atlases from the maps
1033
1212
  b.probe_maps = this.#maps;
1034
1213
  b.probe_projection = this.#projection;
1214
+ b.probe_requests = this.#requests;
1035
1215
  b.probe_radiance = this.#radiance.texture_at(0).obtainView();
1036
1216
  b.probe_depth = this.#depth.texture_at(0).obtainView();
1217
+ b.probe_estimators = this.#estimators;
1037
1218
  b.settings = this.#accumulate_settings;
1038
1219
 
1039
1220
  shader_probe_clipmap_accumulate.dispatchIndirect({
@@ -1117,7 +1298,7 @@ export class GPUProbeClipmap {
1117
1298
  this.#radiance.destroy();
1118
1299
  this.#depth.destroy();
1119
1300
 
1120
- for (const buffer of [this.#levels, this.#states, this.#records, this.#free, this.#counters, this.#dispatch, ...this.#active, this.#wanted, this.#wanted_bits, this.#trace, this.#origins, this.#maps, this.#projection, this.#rays, this.#sampling]) {
1301
+ for (const buffer of [this.#levels, this.#states, this.#estimators, this.#records, this.#free, this.#counters, this.#dispatch, this.#eviction, ...this.#active, this.#wanted, this.#wanted_bits, this.#trace, this.#origins, this.#maps, this.#guide, this.#projection, this.#requests, this.#ray_counts, this.#ray_requests, this.#ray_count_sums, this.#ray_request_sums, this.#ray_sums, this.#ray_scan_spine, this.#ray_scan_command, this.#rays, this.#sampling]) {
1121
1302
  buffer?.destroy();
1122
1303
  }
1123
1304
  }