@woosh/meep-engine 3.60.5 → 3.60.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/build/bundle-worker-terrain.js +1 -1
  3. package/package.json +1 -1
  4. package/src/core/binary/BitSet.d.ts.map +1 -1
  5. package/src/core/binary/BitSet.js +2 -1
  6. package/src/{format/image/avif/av1/util → core/binary/operations}/ceil_log2.d.ts +2 -2
  7. package/src/core/binary/operations/ceil_log2.d.ts.map +1 -0
  8. package/src/{format/image/avif/av1/util → core/binary/operations}/ceil_log2.js +18 -18
  9. package/src/core/binary/zstd/ZstdReverseBitReader.d.ts.map +1 -1
  10. package/src/core/binary/zstd/ZstdReverseBitReader.js +225 -223
  11. package/src/core/binary/zstd/zstd_fse.d.ts.map +1 -1
  12. package/src/core/binary/zstd/zstd_fse.js +267 -265
  13. package/src/core/binary/zstd/zstd_huffman.d.ts.map +1 -1
  14. package/src/core/binary/zstd/zstd_huffman.js +246 -244
  15. package/src/core/bvh2/binary/2/BinaryUint32BVH.d.ts.map +1 -1
  16. package/src/core/bvh2/binary/2/BinaryUint32BVH.js +8 -2
  17. package/src/core/bvh2/bvh3/ebvh_optimize_treelet.d.ts.map +1 -1
  18. package/src/core/bvh2/bvh3/ebvh_optimize_treelet.js +8 -7
  19. package/src/core/collection/PairUint32Map.d.ts.map +1 -1
  20. package/src/core/collection/PairUint32Map.js +2 -2
  21. package/src/core/collection/Uint32Map.d.ts.map +1 -1
  22. package/src/core/collection/Uint32Map.js +2 -4
  23. package/src/core/collection/heap/FibonacciHeap.d.ts.map +1 -1
  24. package/src/core/collection/heap/FibonacciHeap.js +2 -1
  25. package/src/core/geom/2d/r-tree/StaticR2Tree.d.ts.map +1 -1
  26. package/src/core/geom/2d/r-tree/StaticR2Tree.js +8 -2
  27. package/src/core/geom/3d/shape/util/mesh_compute_triangle_edge_flags.d.ts.map +1 -1
  28. package/src/core/geom/3d/shape/util/mesh_compute_triangle_edge_flags.js +2 -3
  29. package/src/engine/graphics/texture/atlas/TextureAtlas.d.ts.map +1 -1
  30. package/src/engine/graphics/texture/atlas/TextureAtlas.js +13 -14
  31. package/src/engine/graphics/texture/atlas/sprite_atlas_border.d.ts.map +1 -1
  32. package/src/engine/graphics/texture/atlas/sprite_atlas_border.js +70 -69
  33. package/src/engine/graphics/texture/reflection/convolve_equirectangular_reflection.d.ts.map +1 -1
  34. package/src/engine/graphics/texture/reflection/convolve_equirectangular_reflection.js +2 -1
  35. package/src/engine/graphics3/GPUParticleEmitterSystem.d.ts.map +1 -1
  36. package/src/engine/graphics3/GPUParticleEmitterSystem.js +2 -1
  37. package/src/engine/graphics3/decal/GPUDecalRenderer.d.ts.map +1 -1
  38. package/src/engine/graphics3/decal/GPUDecalRenderer.js +2 -1
  39. package/src/engine/graphics3/decal/chunk_decal_record.d.ts +14 -0
  40. package/src/engine/graphics3/decal/chunk_decal_record.d.ts.map +1 -0
  41. package/src/engine/graphics3/decal/chunk_decal_record.js +44 -0
  42. package/src/engine/graphics3/decal/shader_cluster_assign_decals.d.ts.map +1 -1
  43. package/src/engine/graphics3/decal/shader_cluster_assign_decals.js +2 -15
  44. package/src/engine/graphics3/decal/shader_cull_decals_frustum.d.ts.map +1 -1
  45. package/src/engine/graphics3/decal/shader_cull_decals_frustum.js +3 -16
  46. package/src/engine/graphics3/decal/shader_decal_composite.d.ts.map +1 -1
  47. package/src/engine/graphics3/decal/shader_decal_composite.js +3 -23
  48. package/src/engine/graphics3/terrain/TERRAIN_MATERIAL_TEMPLATE.d.ts.map +1 -1
  49. package/src/engine/graphics3/terrain/TERRAIN_MATERIAL_TEMPLATE.js +2 -1
  50. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  51. package/src/engine/physics/queries/shape_cast.js +2 -2
  52. package/src/format/image/avif/av1/decode/decode_palette.js +442 -442
  53. package/src/format/image/avif/av1/entropy/SymbolWriter.d.ts.map +1 -1
  54. package/src/format/image/avif/av1/entropy/SymbolWriter.js +2 -1
  55. package/src/generation/foliage/material/foliage_tile.d.ts.map +1 -1
  56. package/src/generation/foliage/material/foliage_tile.js +2 -1
  57. package/src/shade/device/mock/SoftwareGPUDevice.d.ts.map +1 -1
  58. package/src/shade/device/mock/SoftwareGPUDevice.js +6 -13
  59. package/src/shade/playground/caldera/main.js +3 -2
  60. package/src/shade/playground/probe_clipmap/README.md +2 -1
  61. package/src/shade/playground/probe_clipmap/index.html +7 -2
  62. package/src/shade/playground/probe_clipmap/main.d.ts.map +1 -1
  63. package/src/shade/playground/probe_clipmap/main.js +17 -7
  64. package/src/shade/playground/sh_exponential/sh_exp_playground_shaders.d.ts.map +1 -1
  65. package/src/shade/playground/sh_exponential/sh_exp_playground_shaders.js +7 -13
  66. package/src/shade/playground/vgeo_scene/main.js +2 -1
  67. package/src/shade/playground/vsm/VSMDebugOverlay.d.ts.map +1 -1
  68. package/src/shade/playground/vsm/VSMDebugOverlay.js +3 -1
  69. package/src/shade/renderer/Renderer.d.ts +11 -0
  70. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  71. package/src/shade/renderer/Renderer.js +43 -1
  72. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  73. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  74. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  75. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  76. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_coarsest.d.ts.map +1 -1
  77. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_coarsest.js +5 -4
  78. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_residual_restrict.d.ts.map +1 -1
  79. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_residual_restrict.js +168 -166
  80. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_smooth.d.ts.map +1 -1
  81. package/src/shade/renderer/fluid/pressure/shader_fluid_mg_smooth.js +221 -219
  82. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  83. package/src/shade/renderer/fow/shader_fog_of_war.d.ts.map +1 -1
  84. package/src/shade/renderer/fow/shader_fog_of_war.js +8 -19
  85. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +26 -43
  86. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  87. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +115 -123
  88. package/src/shade/renderer/geometry/sdf/MeshSDFLayout.d.ts.map +1 -1
  89. package/src/shade/renderer/geometry/sdf/MeshSDFLayout.js +2 -1
  90. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts +20 -2
  91. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts.map +1 -1
  92. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js +66 -2
  93. package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.d.ts +19 -0
  94. package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.d.ts.map +1 -0
  95. package/src/shade/renderer/geometry/virtual/proxy/vgeo_proxy_triangle_limit.js +25 -0
  96. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -1
  97. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +2 -1
  98. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.d.ts.map +1 -1
  99. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.js +2 -1
  100. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts +15 -0
  101. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts.map +1 -1
  102. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.js +38 -0
  103. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts +28 -59
  104. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts.map +1 -1
  105. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.js +84 -789
  106. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_decode_from_storage.d.ts.map +1 -1
  107. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_decode_from_storage.js +10 -31
  108. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_encode_to_storage.d.ts.map +1 -1
  109. package/src/shade/renderer/global_illumination/brick4/gpu/encoding/v1/chunk_brick4_sh3_color_encode_to_storage.js +9 -15
  110. package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.d.ts +2 -1
  111. package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.d.ts.map +1 -1
  112. package/src/shade/renderer/global_illumination/clipmap/shader_debug_clipmap.js +6 -5
  113. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.d.ts.map +1 -1
  114. package/src/shade/renderer/global_illumination/probe/octahedral/convolve/graph_reduce_atlas_to_sh.js +2 -1
  115. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +15 -3
  116. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  117. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +168 -18
  118. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts +2 -1
  119. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts.map +1 -1
  120. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +2 -1
  121. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts +98 -57
  122. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.d.ts.map +1 -1
  123. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSettings.js +168 -77
  124. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +4 -2
  125. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
  126. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +27 -12
  127. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.d.ts.map +1 -1
  128. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap.js +12 -7
  129. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  130. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +8 -2
  131. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.d.ts +2 -2
  132. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_instance.js +2 -2
  133. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.d.ts.map +1 -1
  134. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/chunk_mesh_brick_walk.js +5 -2
  135. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_batch.js +1 -1
  136. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.d.ts.map +1 -1
  137. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_gather.js +5 -3
  138. package/src/shade/renderer/global_illumination/probe_clipmap/brick/mesh/shader_mesh_brick_resolve.js +1 -1
  139. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.d.ts.map +1 -1
  140. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_free.js +1 -1
  141. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_movers_command.d.ts.map +1 -1
  142. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_movers_command.js +4 -2
  143. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_scroll.d.ts.map +1 -1
  144. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_scroll.js +1 -1
  145. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_store.d.ts.map +1 -1
  146. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_store.js +1 -1
  147. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_take.d.ts.map +1 -1
  148. package/src/shade/renderer/global_illumination/probe_clipmap/brick/shader_brick_clipmap_take.js +3 -1
  149. package/src/shade/renderer/global_illumination/probe_clipmap/debug/graph_probe_clipmap_debug_mesh_cards.js +2 -2
  150. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +114 -41
  151. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
  152. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +424 -207
  153. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts +34 -25
  154. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.d.ts.map +1 -1
  155. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP.js +41 -31
  156. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.d.ts +7 -5
  157. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.d.ts.map +1 -1
  158. package/src/shade/renderer/global_illumination/probe_clipmap/probe/PROBE_CLIPMAP_RESAMPLING.js +7 -5
  159. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts +47 -0
  160. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.d.ts.map +1 -0
  161. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapHitWants.js +84 -0
  162. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts +48 -0
  163. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.d.ts.map +1 -0
  164. package/src/shade/renderer/global_illumination/probe_clipmap/probe/ProbeClipmapScreenWants.js +101 -0
  165. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts +58 -4
  166. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.d.ts.map +1 -1
  167. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap.js +127 -30
  168. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.d.ts +18 -7
  169. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.d.ts.map +1 -1
  170. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_cage.js +39 -13
  171. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.d.ts +29 -8
  172. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.d.ts.map +1 -1
  173. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_pick.js +112 -56
  174. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.d.ts +19 -0
  175. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.d.ts.map +1 -0
  176. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_resample.js +35 -0
  177. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.d.ts.map +1 -1
  178. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_sample_radiance.js +9 -3
  179. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.d.ts +3 -3
  180. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_want.js +5 -5
  181. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts +8 -12
  182. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.d.ts.map +1 -1
  183. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_accumulate.js +23 -56
  184. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts +0 -3
  185. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.d.ts.map +1 -1
  186. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_admit.js +11 -15
  187. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.d.ts +26 -0
  188. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.d.ts.map +1 -0
  189. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_bounce.js +173 -0
  190. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.d.ts +32 -0
  191. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.d.ts.map +1 -0
  192. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_candidate.js +166 -0
  193. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts +3 -4
  194. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.d.ts.map +1 -1
  195. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_due.js +3 -4
  196. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.d.ts.map +1 -1
  197. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_guide.js +3 -1
  198. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts +6 -12
  199. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
  200. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +15 -65
  201. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.d.ts.map +1 -1
  202. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_order.js +7 -2
  203. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts +4 -4
  204. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.d.ts.map +1 -1
  205. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_project.js +24 -17
  206. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.d.ts +7 -5
  207. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.d.ts.map +1 -1
  208. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_publish.js +18 -10
  209. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts +2 -2
  210. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.d.ts.map +1 -1
  211. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_ray_layout.js +9 -5
  212. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts +3 -0
  213. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.d.ts.map +1 -1
  214. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_relocate.js +9 -6
  215. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.d.ts +1 -1
  216. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.d.ts.map +1 -1
  217. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample.js +16 -16
  218. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.d.ts +36 -0
  219. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.d.ts.map +1 -0
  220. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_resample_rays.js +233 -0
  221. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.d.ts.map +1 -1
  222. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_schedule.js +7 -5
  223. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts.map +1 -1
  224. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +5 -3
  225. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.d.ts.map +1 -1
  226. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace.js +10 -4
  227. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts +2 -1
  228. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.d.ts.map +1 -1
  229. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_trace_command.js +12 -6
  230. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts +1 -2
  231. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.d.ts.map +1 -1
  232. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want.js +5 -6
  233. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts +14 -18
  234. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.d.ts.map +1 -1
  235. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_want_hits.js +25 -35
  236. package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.d.ts +13 -0
  237. package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.d.ts.map +1 -0
  238. package/src/shade/renderer/gpu_primitive/WEBGPU_GUARANTEED_MAX_UNIFORM_BUFFER_BINDING_SIZE.js +12 -0
  239. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.d.ts +27 -2
  240. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.d.ts.map +1 -1
  241. package/src/shade/renderer/gpu_primitive/hash_table/cpu_build_hash_table.js +62 -6
  242. package/src/shade/renderer/gpu_primitive/indirect/IndirectComputeCommandBuildPass.d.ts.map +1 -1
  243. package/src/shade/renderer/gpu_primitive/indirect/IndirectComputeCommandBuildPass.js +10 -19
  244. package/src/shade/renderer/gpu_primitive/indirect/chunk_folded_dispatch.d.ts.map +1 -1
  245. package/src/shade/renderer/gpu_primitive/indirect/chunk_folded_dispatch.js +6 -3
  246. package/src/shade/renderer/hiz/hzb_pick_alignment.d.ts.map +1 -1
  247. package/src/shade/renderer/hiz/hzb_pick_alignment.js +149 -148
  248. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_environment_cells.d.ts.map +1 -1
  249. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_environment_cells.js +4 -2
  250. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_log_floor.d.ts.map +1 -1
  251. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_log_floor.js +6 -5
  252. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_project.d.ts.map +1 -1
  253. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_project.js +3 -1
  254. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_reference_reflectance.d.ts.map +1 -1
  255. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_reference_reflectance.js +3 -1
  256. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_solve.d.ts.map +1 -1
  257. package/src/shade/renderer/light/environment/sh_exponential/shader_sh_exp_solve.js +3 -1
  258. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts +0 -5
  259. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts.map +1 -1
  260. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.js +0 -7
  261. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts +15 -2
  262. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts.map +1 -1
  263. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.js +51 -16
  264. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.d.ts.map +1 -1
  265. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.js +3 -2
  266. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  267. package/src/shade/renderer/material/GPUMaterialManager.d.ts +4 -1
  268. package/src/shade/renderer/material/GPUMaterialManager.d.ts.map +1 -1
  269. package/src/shade/renderer/material/GPUMaterialManager.js +5 -8
  270. package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.d.ts +17 -0
  271. package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.d.ts.map +1 -0
  272. package/src/shade/renderer/postprocess/dof/raymarch/chunk_dof_lds_coc_cache.js +81 -0
  273. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.d.ts.map +1 -1
  274. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_raymarch_compute.js +5 -48
  275. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.d.ts.map +1 -1
  276. package/src/shade/renderer/postprocess/dof/raymarch/shader_dof_slice_compute.js +4 -44
  277. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts +7 -3
  278. package/src/shade/renderer/postprocess/gtao/GTAO.d.ts.map +1 -1
  279. package/src/shade/renderer/postprocess/gtao/GTAO.js +26 -13
  280. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts +14 -0
  281. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.d.ts.map +1 -1
  282. package/src/shade/renderer/postprocess/gtao/ao_reproject_shader.js +196 -68
  283. package/src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.d.ts.map +1 -1
  284. package/src/shade/renderer/postprocess/gtao/chunk_integrate_lighting_sample.js +4 -1
  285. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.d.ts.map +1 -1
  286. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao.js +42 -28
  287. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.d.ts.map +1 -1
  288. package/src/shade/renderer/postprocess/gtao/fragment_shader_gtao_with_irradiance.js +430 -414
  289. package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.d.ts +16 -0
  290. package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.d.ts.map +1 -0
  291. package/src/shade/renderer/postprocess/gtao/shader_gtao_spatial_denoise.js +156 -0
  292. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  293. package/src/shade/renderer/postprocess/nss/chunk_nss_luma_derivative.d.ts.map +1 -1
  294. package/src/shade/renderer/postprocess/nss/chunk_nss_luma_derivative.js +5 -7
  295. package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.d.ts +17 -0
  296. package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.d.ts.map +1 -0
  297. package/src/shade/renderer/postprocess/nss/chunk_nss_tonemap.js +56 -0
  298. package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.d.ts.map +1 -1
  299. package/src/shade/renderer/postprocess/nss/shader_nss_postprocess.js +2 -22
  300. package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.d.ts.map +1 -1
  301. package/src/shade/renderer/postprocess/nss/shader_nss_preprocess.js +2 -13
  302. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  303. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +10 -13
  304. package/src/shade/renderer/rasterize/expand/bucket/RASTERIZATION_BUCKET_LIMIT.d.ts.map +1 -1
  305. package/src/shade/renderer/rasterize/expand/bucket/RASTERIZATION_BUCKET_LIMIT.js +39 -38
  306. package/src/shade/renderer/rasterize/expand/mesh/shader_prefix_sum_to_command.d.ts.map +1 -1
  307. package/src/shade/renderer/rasterize/expand/mesh/shader_prefix_sum_to_command.js +7 -12
  308. package/src/shade/renderer/scene/GPUSceneContext.d.ts +2 -2
  309. package/src/shade/renderer/scene/GPUSceneContext.js +5 -5
  310. package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.d.ts +8 -6
  311. package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.d.ts.map +1 -1
  312. package/src/shade/renderer/shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js +10 -7
  313. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.d.ts +16 -0
  314. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.d.ts.map +1 -0
  315. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_key.js +35 -0
  316. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.d.ts +5 -2
  317. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.d.ts.map +1 -1
  318. package/src/shade/renderer/shader/chunk/clipmap/chunk_clipmap_select_finest.js +27 -18
  319. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh2_color_get_irradiance_at.d.ts.map +1 -1
  320. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh2_color_get_irradiance_at.js +5 -15
  321. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh3_convolve_with_cosine_kernel.d.ts.map +1 -1
  322. package/src/shade/renderer/shader/chunk/spherical_harmonics/chunk_sh3_convolve_with_cosine_kernel.js +5 -19
  323. package/src/shade/renderer/shader/chunk/spherical_harmonics/dering/chunk_sh3_windowing.d.ts.map +1 -1
  324. package/src/shade/renderer/shader/chunk/spherical_harmonics/dering/chunk_sh3_windowing.js +3 -22
  325. package/src/shade/renderer/shadow/map/ShadowmapDrawSelector.d.ts.map +1 -1
  326. package/src/shade/renderer/shadow/map/ShadowmapDrawSelector.js +2 -1
  327. package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_shadow_group_list.d.ts.map +1 -1
  328. package/src/shade/renderer/volumetrics/chunk_volumetrics_sun_shadow_group_list.js +154 -152
  329. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts.map +1 -1
  330. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.js +2 -1
  331. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts +3 -1
  332. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts.map +1 -1
  333. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.js +4 -3
  334. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts +7 -1
  335. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.d.ts.map +1 -1
  336. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP_STRUCT.js +54 -47
  337. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.d.ts.map +1 -1
  338. package/src/shade/renderer/volumetrics/irradiance_clipmap/chunk_irradiance_clipmap_sample.js +371 -370
  339. package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
  340. package/src/shade/renderer/water/GPUWaterRenderer.js +2 -1
  341. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  342. package/src/shade/renderer/water/surface/lod/shader_water_lod.d.ts.map +1 -1
  343. package/src/shade/renderer/water/surface/lod/shader_water_lod.js +12 -14
  344. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.d.ts.map +1 -1
  345. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +2 -9
  346. package/src/shade/renderer/water/surface/particles/chunk_water_particle.d.ts.map +1 -1
  347. package/src/shade/renderer/water/surface/particles/chunk_water_particle.js +2 -1
  348. package/src/shade/renderer/wind/WIND_FIELD.d.ts +3 -1
  349. package/src/shade/renderer/wind/WIND_FIELD.d.ts.map +1 -1
  350. package/src/shade/renderer/wind/WIND_FIELD.js +4 -3
  351. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts +8 -2
  352. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.d.ts.map +1 -1
  353. package/src/shade/renderer/wind/WIND_FIELD_STRUCT.js +11 -4
  354. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts +2 -2
  355. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.d.ts.map +1 -1
  356. package/src/shade/renderer/wind/chunk_wind_field_sample_cascades.js +13 -4
  357. package/src/shade/util/texture_mip_extent.d.ts.map +1 -1
  358. package/src/shade/util/texture_mip_extent.js +88 -87
  359. package/src/shade/wgsl/emulator/WGSLLanguageCore.d.ts.map +1 -1
  360. package/src/shade/wgsl/emulator/WGSLLanguageCore.js +9 -7
  361. package/src/format/image/avif/av1/util/ceil_log2.d.ts.map +0 -1
  362. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts +0 -47
  363. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.d.ts.map +0 -1
  364. package/src/shade/renderer/geometry/virtual/sdf/VGEO_SDF.js +0 -80
  365. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts +0 -16
  366. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.d.ts.map +0 -1
  367. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_collect.js +0 -67
  368. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts +0 -17
  369. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.d.ts.map +0 -1
  370. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_decode.js +0 -145
  371. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts +0 -12
  372. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.d.ts.map +0 -1
  373. package/src/shade/renderer/geometry/virtual/sdf/shader_vgeo_sdf_traverse.js +0 -105
  374. package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.d.ts +0 -1
  375. package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.d.ts.map +0 -1
  376. package/src/shade/renderer/shader/chunk/color/chunk_hash_squirrel3.js +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"GPUWaterRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/water/GPUWaterRenderer.js"],"names":[],"mappings":"AAqBA,sFAAsF;AACtF;IACI,WAAa;IACb,mBAAe;IACf,yBAAqB;IACrB,aAAS;IACT,WAAa;IACb;;;;;;;;;;;MAE6B;IAmB7B;;;OAGG;IACH;;;;;MAA8F;IAC9F;;;OAGG;IACH,wBAAyD;IAMzD,oCAIC;IAED,8FAA8F;IAC9F,qCAgBC;IAED,gBASC;IAuDD;;;;;;;;;;;;;;;;;MAyIC;IAQD;;;;;YAMC;IAED;;;;;;;;;;MAOC;IAED;;;;;;;;;;;;;;MAwBC;IAED,gGAAgG;IAChG,mEAYC;;CAyBJ;gCAtX+B,uCAAuC"}
1
+ {"version":3,"file":"GPUWaterRenderer.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/water/GPUWaterRenderer.js"],"names":[],"mappings":"AAsBA,sFAAsF;AACtF;IACI,WAAa;IACb,mBAAe;IACf,yBAAqB;IACrB,aAAS;IACT,WAAa;IACb;;;;;;;;;;;MAE6B;IAmB7B;;;OAGG;IACH;;;;;MAA8F;IAC9F;;;OAGG;IACH,wBAAyD;IAMzD,oCAIC;IAED,8FAA8F;IAC9F,qCAgBC;IAED,gBASC;IAuDD;;;;;;;;;;;;;;;;;MAyIC;IAQD;;;;;YAMC;IAED;;;;;;;;;;MAOC;IAED;;;;;;;;;;;;;;MAwBC;IAED,gGAAgG;IAChG,mEAYC;;CAyBJ;gCAvX+B,uCAAuC"}
@@ -18,6 +18,7 @@ import { create_water_finalize_pipeline, create_water_pipeline, WATER_FINALIZE_R
18
18
  import { WATER_BAND_SAMPLER } from "./surface/GPUWaterSurface.js";
19
19
  import { shader_water_background_copy, shader_water_debug, shader_water_draw,
20
20
  shader_water_occupancy, shader_water_splat } from "./shader_water_avboit.js";
21
+ import { ceilPowerOfTwo } from "../../../core/binary/operations/ceilPowerOfTwo.js";
21
22
 
22
23
  /** Production water channel. Only AVBOIT's shared resolve composites its radiance. */
23
24
  export class GPUWaterRenderer {
@@ -118,7 +119,7 @@ export class GPUWaterRenderer {
118
119
  // statistics words: candidates, interior, boundary, flat triangles (sized by the scene, not grown), patches
119
120
  const keys = { candidates: 0, interior: 1, boundary: 2, patches: 4 };
120
121
  for (const [key, i] of Object.entries(keys)) {
121
- if (totals[i] > budgets[key]) { budgets[key] = 2 ** Math.ceil(Math.log2(totals[i] * 1.25)); }
122
+ if (totals[i] > budgets[key]) { budgets[key] = ceilPowerOfTwo(Math.ceil(totals[i] * 1.25)); }
122
123
  }
123
124
  }
124
125
 
@@ -24,7 +24,7 @@ export class GPUWaterQueries {
24
24
  * @param {PipelineEnquiry} enquiry
25
25
  */
26
26
  static enquirePipelines(enquiry: PipelineEnquiry): void;
27
- static "__#275@#execute"(pass: any, resources: any, context: any): void;
27
+ static "__#277@#execute"(pass: any, resources: any, context: any): void;
28
28
  /**
29
29
  * @param {object} options
30
30
  * @param {GPUDevice} options.device
@@ -1 +1 @@
1
- {"version":3,"file":"shader_water_lod.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/lod/shader_water_lod.js"],"names":[],"mappings":"AA8BA,sHAAsH;AACtH,4CAA6C;AAC7C,6CAA8C;AAC9C,4CAA6C;AAC7C,sFAAsF;AACtF,iDAAkD;AAClD,iDAAkD;AAClD,kFAAkF;AAClF,8CAA+C;AAC/C,oFAAoF;AACpF,qCAAsC;AAEtC;;;;GAIG;AACH,kDASK;AAEL,kHAAkH;AAClH,0CAA2C;AAC3C,0EAA0E;AAC1E,+CAA+E;AAE/E,yGAAyG;AACzG,wCAAyC;AAEzC,wEAAwE;AACxE;;;;;GAA+F;AAE/F;;;;GAIG;AACH,sDAEwB;AAExB;;;;GAIG;AACH,mDAE4B;AAE5B;;;GAGG;AACH,2CAA4C;AA0I5C;;;;;;GAMG;AACH,oDAuD0E;AAsD1E;;;;;GAKG;AACH,uDAkCsH;AAWtH;;;GAGG;AACH,mDAYoE;AAIpE,kFAAkF;AAClF,+CAAgD;AAiBhD;;;;;;;GAOG;AACH,wDAqF0C;AAiB1C;;;;;;;GAOG;AACH,mDAqEmF;AAInF,oEAAoE;AACpE;IACI,6EAA6E;;IAE7E,oCAAoC;;IAEpC,0EAA0E;;IAE1E,qCAAqC;;IAErC,oDAAoD;;IAEpD,iCAAiC;;GAElC;AACH,0CAA2C;AA4B3C;;;GAGG;AACH,+DAcM;AASN,mHAAmH;AACnH,2DA4BmC;6BA7rBN,sCAAsC;AAuFnE,+CAIgD;8BAxGlB,kCAAkC;AA2GhE,kDAgG6G;AAkF7G,8FAA8F;AAC9F,+CAmCsH;0BAhU5F,uCAAuC"}
1
+ {"version":3,"file":"shader_water_lod.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/lod/shader_water_lod.js"],"names":[],"mappings":"AA6BA,sHAAsH;AACtH,4CAA6C;AAC7C,6CAA8C;AAC9C,4CAA6C;AAC7C,sFAAsF;AACtF,iDAAkD;AAClD,iDAAkD;AAClD,kFAAkF;AAClF,8CAA+C;AAC/C,oFAAoF;AACpF,qCAAsC;AAEtC;;;;GAIG;AACH,kDASK;AAEL,kHAAkH;AAClH,0CAA2C;AAC3C,0EAA0E;AAC1E,+CAA+E;AAE/E,yGAAyG;AACzG,wCAAyC;AAEzC,wEAAwE;AACxE;;;;;GAA+F;AAE/F;;;;GAIG;AACH,sDAEwB;AAExB;;;;GAIG;AACH,mDAE4B;AAE5B;;;GAGG;AACH,2CAA4C;AA0I5C;;;;;;GAMG;AACH,oDAuD0E;AAsD1E;;;;;GAKG;AACH,uDAkCsH;AAWtH;;;GAGG;AACH,mDAYoE;AAIpE,kFAAkF;AAClF,+CAAgD;AAiBhD;;;;;;;GAOG;AACH,wDAqF0C;AAiB1C;;;;;;;GAOG;AACH,mDAqEmF;AAInF,oEAAoE;AACpE;IACI,6EAA6E;;IAE7E,oCAAoC;;IAEpC,0EAA0E;;IAE1E,qCAAqC;;IAErC,oDAAoD;;IAEpD,iCAAiC;;GAElC;AACH,0CAA2C;AA2B3C;;;GAGG;AACH,+DAc0D;AAS1D,mHAAmH;AACnH,2DA4BqF;6BA5rBxD,sCAAsC;AAuFnE,+CAIgD;8BAzGlB,kCAAkC;AA4GhE,kDAgG6G;AAkF7G,8FAA8F;AAC9F,+CAmCsH;0BAjU5F,uCAAuC"}
@@ -3,9 +3,7 @@ import { GEOMETRY_METADATA_STRUCT } from "../../../geometry/GEOMETRY_METADATA_ST
3
3
  import { GEOMETRY_MESHLET_TRIANGLE_LIMIT } from "../../../geometry/meshlet/GEOMETRY_MESHLET_TRIANGLE_LIMIT.js";
4
4
  import { MESHLET_METADATA_STRUCT } from "../../../geometry/meshlet/encoding/MESHLET_METADATA_STRUCT.js";
5
5
  import { COLLECTION_U32_STRUCT_READ } from "../../../gpu_primitive/COLLECTION_U32_STRUCT_READ.js";
6
- import {
7
- WEBGPU_GUARANTEED_MAX_COMPUTE_WORKGROUPS_PER_DIMENSION
8
- } from "../../../gpu_primitive/indirect/WEBGPU_GUARANTEED_MAX_COMPUTE_WORKGROUPS_PER_DIMENSION.js";
6
+ import { chunk_folded_dispatch } from "../../../gpu_primitive/indirect/chunk_folded_dispatch.js";
9
7
  import { MESHLET_COLLECTION_STRUCT } from "../../../rasterize/MESHLET_COLLECTION_STRUCT.js";
10
8
  import { chunk_scene_database_access } from "../../../scene/chunk_scene_database_access.js";
11
9
  import { ComputeShader } from "../../../shader/ComputeShader.js";
@@ -17,6 +15,7 @@ import { chunk_mat3_inverse } from "../../../shader/chunk/geometry/mat3/chunk_ma
17
15
  import { chunk_mat4_linear_determinant } from "../../../shader/chunk/geometry/mat4/chunk_mat4_linear_determinant.js";
18
16
  import { chunk_read_meshlet_vertex_by_draw_index } from "../../../shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_by_draw_index.js";
19
17
  import { chunk_folded_workgroup_index } from "../../../shader/chunk/grid/chunk_folded_workgroup_index.js";
18
+ import { chunk_divide_round_up_u32 } from "../../../shader/chunk/math/chunk_divide_round_up_u32.js";
20
19
  import { chunk_lower_bound_branchless } from "../../../shader/chunk/math/chunk_lower_bound_branchless.js";
21
20
  import { ShaderResourceSetDescriptor } from "../../../shader/resource/ShaderResourceSetDescriptor.js";
22
21
  import { atomic_u32, f32, u32, vec2i } from "../../../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
@@ -642,11 +641,10 @@ export const WATER_LOD_COMMAND_BYTES = 160;
642
641
 
643
642
  const fold = `
644
643
  fn water_lod_dispatch(at: u32, groups: u32) {
645
- const LIMIT = ${WEBGPU_GUARANTEED_MAX_COMPUTE_WORKGROUPS_PER_DIMENSION}u;
646
- let rows = (groups + LIMIT - 1u) / LIMIT;
647
- commands[at] = min(groups, LIMIT);
648
- commands[at + 1u] = max(min(rows, LIMIT), 1u);
649
- commands[at + 2u] = max((rows + LIMIT - 1u) / LIMIT, 1u);
644
+ let folded = folded_dispatch(groups);
645
+ commands[at] = folded.x;
646
+ commands[at + 1u] = folded.y;
647
+ commands[at + 2u] = folded.z;
650
648
  }
651
649
  fn water_lod_total(sums_count: u32, last: u32) -> u32 { return select(0u, last, sums_count > 0u); }
652
650
  fn water_lod_draw(list: u32, count: u32, vertices: u32, first: u32) {
@@ -679,12 +677,12 @@ fn main() {
679
677
  let flats = water_lod_total(flat_sums.count, flat_sums.elements[max(flat_sums.count, 1u) - 1u]);
680
678
  statistics[0] = total;
681
679
  statistics[3] = flats;
682
- water_lod_dispatch(${WaterLodCommand.Candidates / 4}u, (min(total, limits.candidates) + 63u) / 64u);
680
+ water_lod_dispatch(${WaterLodCommand.Candidates / 4}u, divide_round_up_u32(min(total, limits.candidates), 64u));
683
681
  let drawn = min(flats, limits.triangles);
684
- water_lod_dispatch(${WaterLodCommand.Flats / 4}u, (drawn + 63u) / 64u);
682
+ water_lod_dispatch(${WaterLodCommand.Flats / 4}u, divide_round_up_u32(drawn, 64u));
685
683
  water_lod_draw(${WaterLodList.Triangle}u, drawn, ${WATER_LOD_TRIANGLE_VERTICES}u, ${WATER_LOD_TRIANGLE_FIRST_VERTEX}u);
686
684
  }
687
- `) });
685
+ `, [chunk_folded_dispatch, chunk_divide_round_up_u32]) });
688
686
 
689
687
  const draw_command_resources = new ShaderResourceSetDescriptor();
690
688
  draw_command_resources.createGroup()
@@ -700,7 +698,7 @@ ${fold}
700
698
  fn water_lod_list(list: u32, total: u32, budget: u32, vertices: u32, first: u32) {
701
699
  statistics[1u + list] = total;
702
700
  let count = min(total, budget);
703
- water_lod_dispatch(${WaterLodCommand.Cells / 4}u + 4u * list, (count + 63u) / 64u);
701
+ water_lod_dispatch(${WaterLodCommand.Cells / 4}u + 4u * list, divide_round_up_u32(count, 64u));
704
702
  water_lod_draw(list, count, vertices, first);
705
703
  }
706
704
 
@@ -714,7 +712,7 @@ fn main() {
714
712
  let patches = water_lod_list_span(&sums.elements, sums.count, 2u).y;
715
713
  statistics[4] = patches;
716
714
  let count = min(patches, limits.patches);
717
- water_lod_dispatch(${WaterLodCommand.PatchCells / 4}u, (count + 63u) / 64u);
715
+ water_lod_dispatch(${WaterLodCommand.PatchCells / 4}u, divide_round_up_u32(count, 64u));
718
716
  let draw = ${WaterLodCommand.PatchDraw / 4}u;
719
717
  commands[draw] = ${WATER_LOD_PATCH_INDICES.length}u;
720
718
  commands[draw + 1u] = count;
@@ -722,6 +720,6 @@ fn main() {
722
720
  commands[draw + 3u] = ${WATER_LOD_PATCH_FIRST_VERTEX}u;
723
721
  commands[draw + 4u] = 0u;
724
722
  }
725
- `, [chunk_water_lod_list_sums]) });
723
+ `, [chunk_water_lod_list_sums, chunk_folded_dispatch, chunk_divide_round_up_u32]) });
726
724
 
727
725
  export { chunk_water_lod_candidate, chunk_water_lod_source };
@@ -1 +1 @@
1
- {"version":3,"file":"GPUWaterParticles.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/GPUWaterParticles.js"],"names":[],"mappings":"AAkCA,kHAAkH;AAClH,+CAAgD;AAUhD;;;;GAIG;AACH;IAwBI,uFAAuF;IACvF,yBAAuC;IACvC,kGAAkG;IAClG,yBAAuC;IACvC,uGAAuG;IACvG,6BAA+C;IAC/C,mEAAmE;IACnE,2BAAyD;IACzD,uBAAyC;IAEzC;;;;;;;;;;;OAWG;IACH,qCALW,MAAM,QACN,MAAM,UACK,OAAO,8CAA8C,EAAE,sBAAsB,KAAE,IAAI,GAAC,IAAI,CA4D7G;IAED,gBAeC;IAED;;;;;;;;;;;;;;;OAeG;IACH;QATyG,KAAK,EAAnG,OAAO,iEAAiE,EAAE,UAAU;QACpE,KAAK,EAArB,MAAM;QACa,KAAK;QACL,QAAQ;QACR,SAAS;QACT,QAAQ;QACX,YAAY,EAA5B,MAAM;QACU,EAAE,EAAlB,MAAM;aA8FhB;;CACJ"}
1
+ {"version":3,"file":"GPUWaterParticles.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/GPUWaterParticles.js"],"names":[],"mappings":"AAmCA,kHAAkH;AAClH,+CAAgD;AAEhD;;;;GAIG;AACH;IAwBI,uFAAuF;IACvF,yBAAuC;IACvC,kGAAkG;IAClG,yBAAuC;IACvC,uGAAuG;IACvG,6BAA+C;IAC/C,mEAAmE;IACnE,2BAAyD;IACzD,uBAAyC;IAEzC;;;;;;;;;;;OAWG;IACH,qCALW,MAAM,QACN,MAAM,UACK,OAAO,8CAA8C,EAAE,sBAAsB,KAAE,IAAI,GAAC,IAAI,CA4D7G;IAED,gBAeC;IAED;;;;;;;;;;;;;;;OAeG;IACH;QATyG,KAAK,EAAnG,OAAO,iEAAiE,EAAE,UAAU;QACpE,KAAK,EAArB,MAAM;QACa,KAAK;QACL,QAAQ;QACR,SAAS;QACT,QAAQ;QACX,YAAY,EAA5B,MAAM;QACU,EAAE,EAAlB,MAAM;aA8FhB;;CACJ"}
@@ -31,18 +31,11 @@ import {
31
31
  WATER_PARTICLE_CROWD_WORDS,
32
32
  WATER_PARTICLE_NEST_WORDS
33
33
  } from "./shader_water_particles.js";
34
+ import { ceilPowerOfTwo } from "../../../../../core/binary/operations/ceilPowerOfTwo.js";
34
35
 
35
36
  /** The longest step a particle takes in one frame, seconds: a stalled tab does not fling fronts across a lake. */
36
37
  export const WATER_PARTICLE_STEP_LIMIT = 1 / 15;
37
38
 
38
- /**
39
- * @param {number} value
40
- * @returns {number} the smallest power of two at least value
41
- */
42
- function power_of_two_at_least(value) {
43
- return 2 ** Math.ceil(Math.log2(Math.max(value, 1)));
44
- }
45
-
46
39
  /**
47
40
  * The wave particles of every water body of a scene, on the device (WATER_SURFACE_SIMULATION_PLAN_2026_10_06.md
48
41
  * §5.4): ping-pong particle arrays, and each frame's hash of them for the surface sampler. Counts never leave
@@ -101,7 +94,7 @@ export class GPUWaterParticles {
101
94
  this.dispose();
102
95
  this.#device = device;
103
96
  this.#capacity = capacity;
104
- this.#table_limit = power_of_two_at_least(2 * WATER_PARTICLE_CORNERS * capacity);
97
+ this.#table_limit = ceilPowerOfTwo(2 * WATER_PARTICLE_CORNERS * capacity);
105
98
  const buffer = (label, size, usage = 0) => device.createBuffer({ label: `Water / particles ${label}`,
106
99
  size: Math.max(16, size), usage: GPUBufferUsage.STORAGE | GPUBufferUsage.COPY_DST | GPUBufferUsage.COPY_SRC | usage });
107
100
  const array_size = 16 + capacity * WATER_PARTICLE_STRUCT.size;
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_water_particle.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/chunk_water_particle.js"],"names":[],"mappings":"AAKA;;;GAGG;AACH,uCAAwC;AAKxC,yHAAyH;AACzH,gDAAkD;AAElD;;;;;;;;;;;;GAYG;AACH,8CAIE;AAKF,+GAA+G;AAC/G,oDAAqD;AAErD,qHAAqH;AACrH,uDAAwD;AAExD,wEAAwE;AACxE,qDAAsD;AAEtD,wFAAwF;AACxF,yCAA2G;AAE3G;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mCAFU,SAAS,CAgP6G;0BArTtG,uCAAuC"}
1
+ {"version":3,"file":"chunk_water_particle.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/water/surface/particles/chunk_water_particle.js"],"names":[],"mappings":"AAMA;;;GAGG;AACH,uCAAwC;AAKxC,yHAAyH;AACzH,gDAAkD;AAElD;;;;;;;;;;;;GAYG;AACH,8CAIE;AAKF,+GAA+G;AAC/G,oDAAqD;AAErD,qHAAqH;AACrH,uDAAwD;AAExD,wEAAwE;AACxE,qDAAsD;AAEtD,wFAAwF;AACxF,yCAA2G;AAE3G;;;;;;;;;;;;;;;;;;;GAmBG;AACH,mCAFU,SAAS,CAgP6G;0BAtTtG,uCAAuC"}
@@ -2,6 +2,7 @@ import { CodeChunk } from "../../../shader/compiler/CodeChunk.js";
2
2
  import { chunk_pcg3d } from "../../../shader/chunk/random/pcg/chunk_pcg3d.js";
3
3
  import { WATER_PARTICLE_ENTRY_STRUCT, WATER_PARTICLE_STRUCT } from "./WATER_PARTICLE_STRUCT.js";
4
4
  import { chunk_water_spectrum } from "../spectrum/chunk_water_spectrum.js";
5
+ import { ceil_log2 } from "../../../../../core/binary/operations/ceil_log2.js";
5
6
 
6
7
  /**
7
8
  * Levels of the particle hash: cell sizes 4 mm · 2^level, so supports up to 256 m, which a 2 m splash's stretched
@@ -10,7 +11,7 @@ import { chunk_water_spectrum } from "../spectrum/chunk_water_spectrum.js";
10
11
  export const WATER_PARTICLE_LEVELS = 18;
11
12
 
12
13
  /** Bits of a hash key that hold the level, below the body's row. */
13
- const WATER_PARTICLE_LEVEL_BITS = Math.ceil(Math.log2(WATER_PARTICLE_LEVELS));
14
+ const WATER_PARTICLE_LEVEL_BITS = ceil_log2(WATER_PARTICLE_LEVELS);
14
15
 
15
16
  /** Cell size of level 0, metres. A particle sits at the smallest level whose cell is at least its support's diameter. */
16
17
  export const WATER_PARTICLE_LEVEL0_CELL = 1 / 256;
@@ -8,7 +8,9 @@
8
8
  * a reader takes it through the atmosphere identity (`chunk_wind_field_sample`).
9
9
  */
10
10
  /**
11
- * Cascades the field holds at most: the clipmap table it is selected through.
11
+ * Cascades the field holds at most: the rows of its windows and its read records, which sit in
12
+ * {@link WIND_FIELD_STRUCT}, the one uniform every reader binds and the host writes whole each frame.
13
+ * The wind's own figure, not the shared clipmap table's, which is a uniform of its own.
12
14
  * @type {number}
13
15
  */
14
16
  export const WIND_FIELD_CASCADE_LIMIT: number;
@@ -1 +1 @@
1
- {"version":3,"file":"WIND_FIELD.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/WIND_FIELD.js"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH;;;GAGG;AACH,uCAFU,MAAM,CAE4C;AAE5D;;;;;;;;;;;;GAYG;AACH,sDAAoD;AAEpD;;;;GAIG;AACH,qCAFU,MAAM,CAEwB;AAExC;;;;;;;;;;GAUG;AACH,oCAFU,MAAM,CAEuB;AAEvC;;;;GAIG;AACH,4CAFU,OAAO,+CAA+C,EAAE,iBAAiB,CAEf"}
1
+ {"version":3,"file":"WIND_FIELD.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/WIND_FIELD.js"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH,uCAFU,MAAM,CAE2B;AAE3C;;;;;;;;;;;;GAYG;AACH,sDAAoD;AAEpD;;;;GAIG;AACH,qCAFU,MAAM,CAEwB;AAExC;;;;;;;;;;GAUG;AACH,oCAFU,MAAM,CAEuB;AAEvC;;;;GAIG;AACH,4CAFU,OAAO,+CAA+C,EAAE,iBAAiB,CAEf"}
@@ -1,4 +1,3 @@
1
- import { CLIPMAP_LEVEL_LIMIT } from "../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
2
1
  import { SAMPLER_LINEAR_UPSCALE } from "../texture/SAMPLER_LINEAR_UPSCALE.js";
3
2
 
4
3
  /**
@@ -12,10 +11,12 @@ import { SAMPLER_LINEAR_UPSCALE } from "../texture/SAMPLER_LINEAR_UPSCALE.js";
12
11
  */
13
12
 
14
13
  /**
15
- * Cascades the field holds at most: the clipmap table it is selected through.
14
+ * Cascades the field holds at most: the rows of its windows and its read records, which sit in
15
+ * {@link WIND_FIELD_STRUCT}, the one uniform every reader binds and the host writes whole each frame.
16
+ * The wind's own figure, not the shared clipmap table's, which is a uniform of its own.
16
17
  * @type {number}
17
18
  */
18
- export const WIND_FIELD_CASCADE_LIMIT = CLIPMAP_LEVEL_LIMIT;
19
+ export const WIND_FIELD_CASCADE_LIMIT = 16;
19
20
 
20
21
  /**
21
22
  * A tile's texel format.
@@ -5,6 +5,12 @@
5
5
  * @type {WebGPUStruct}
6
6
  */
7
7
  export const WIND_CASCADE_STRUCT: WebGPUStruct;
8
+ /**
9
+ * The cascades' windows, finest first, as a field of {@link WIND_FIELD_STRUCT}: clipmap levels, walked
10
+ * with `clipmap_level_select`.
11
+ * @type {WebGPUArray}
12
+ */
13
+ export const WIND_LEVEL_ARRAY: WebGPUArray;
8
14
  /**
9
15
  * The cascades' read records, finest first, as a field of {@link WIND_FIELD_STRUCT}.
10
16
  * @type {WebGPUArray}
@@ -17,8 +23,8 @@ export const WIND_CASCADE_ARRAY: WebGPUArray;
17
23
  * Cascade `c` (finest first, below `cascade_count`) is two rows at index `c`:
18
24
  * - `levels[c]`: its window as a clipmap level (`CLIPMAP_LEVEL_STRUCT`) — the world cell at
19
25
  * window-local 0 (`corner`, in the cascade's cells), the cell's edge in metres (`cell_size`), and
20
- * the window's cells on each axis (`size`). A world corner is `corner · cell_size`. The table is
21
- * the shared clipmap module's, so `clipmap_select_finest` walks it as it is;
26
+ * the window's cells on each axis (`size`). A world corner is `corner · cell_size`. Its rows are
27
+ * the shared clipmap module's, so `clipmap_level_select` tests each as it is;
22
28
  * - `cascades[c]`: its tile and its decay ({@link WIND_CASCADE_STRUCT}).
23
29
  *
24
30
  * Rows at and past `cascade_count` are never read.
@@ -1 +1 @@
1
- {"version":3,"file":"WIND_FIELD_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/WIND_FIELD_STRUCT.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,kCAFU,YAAY,CAgBJ;AAElB;;;GAGG;AACH,iCAFU,WAAW,CAE6E;AAElG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,gCAFU,YAAY,CAQN;6BAzDa,gCAAgC;4BADjC,+BAA+B"}
1
+ {"version":3,"file":"WIND_FIELD_STRUCT.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/WIND_FIELD_STRUCT.js"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,kCAFU,YAAY,CAgBJ;AAElB;;;;GAIG;AACH,+BAFU,WAAW,CAE4E;AAEjG;;;GAGG;AACH,iCAFU,WAAW,CAE6E;AAElG;;;;;;;;;;;;;;;;;;;GAmBG;AACH,gCAFU,YAAY,CAQN;6BAhEa,gCAAgC;4BADjC,+BAA+B"}
@@ -1,4 +1,4 @@
1
- import { CLIPMAP_LEVEL_ARRAY } from "../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
1
+ import { CLIPMAP_LEVEL_STRUCT } from "../shader/chunk/clipmap/CLIPMAP_LEVEL_STRUCT.js";
2
2
  import { f32, u32, vec3f } from "../shader/type/WEBGPU_WGSL_PRIMITIVE_TYPES.js";
3
3
  import { WebGPUArray } from "../shader/type/WebGPUArray.js";
4
4
  import { WebGPUStruct } from "../shader/type/WebGPUStruct.js";
@@ -26,6 +26,13 @@ export const WIND_CASCADE_STRUCT = WebGPUStruct.from({
26
26
  decay: f32,
27
27
  }, "WindCascade");
28
28
 
29
+ /**
30
+ * The cascades' windows, finest first, as a field of {@link WIND_FIELD_STRUCT}: clipmap levels, walked
31
+ * with `clipmap_level_select`.
32
+ * @type {WebGPUArray}
33
+ */
34
+ export const WIND_LEVEL_ARRAY = WebGPUArray.from(CLIPMAP_LEVEL_STRUCT, WIND_FIELD_CASCADE_LIMIT);
35
+
29
36
  /**
30
37
  * The cascades' read records, finest first, as a field of {@link WIND_FIELD_STRUCT}.
31
38
  * @type {WebGPUArray}
@@ -39,8 +46,8 @@ export const WIND_CASCADE_ARRAY = WebGPUArray.from(WIND_CASCADE_STRUCT, WIND_FIE
39
46
  * Cascade `c` (finest first, below `cascade_count`) is two rows at index `c`:
40
47
  * - `levels[c]`: its window as a clipmap level (`CLIPMAP_LEVEL_STRUCT`) — the world cell at
41
48
  * window-local 0 (`corner`, in the cascade's cells), the cell's edge in metres (`cell_size`), and
42
- * the window's cells on each axis (`size`). A world corner is `corner · cell_size`. The table is
43
- * the shared clipmap module's, so `clipmap_select_finest` walks it as it is;
49
+ * the window's cells on each axis (`size`). A world corner is `corner · cell_size`. Its rows are
50
+ * the shared clipmap module's, so `clipmap_level_select` tests each as it is;
44
51
  * - `cascades[c]`: its tile and its decay ({@link WIND_CASCADE_STRUCT}).
45
52
  *
46
53
  * Rows at and past `cascade_count` are never read.
@@ -53,7 +60,7 @@ export const WIND_CASCADE_ARRAY = WebGPUArray.from(WIND_CASCADE_STRUCT, WIND_FIE
53
60
  * @type {WebGPUStruct}
54
61
  */
55
62
  export const WIND_FIELD_STRUCT = WebGPUStruct.from({
56
- levels: CLIPMAP_LEVEL_ARRAY,
63
+ levels: WIND_LEVEL_ARRAY,
57
64
  cascades: WIND_CASCADE_ARRAY,
58
65
  far_velocity: vec3f,
59
66
  cascade_count: u32,
@@ -7,8 +7,8 @@
7
7
  * {@link wind_field_add_resources} declares them.
8
8
  *
9
9
  * **The read:**
10
- * - `clipmap_select_finest` walks the cascades' windows, finest first, and the first holding the point
11
- * answers, with how far into its edge band of {@link WIND_FIELD_BAND_WIDTH} cells the point is;
10
+ * - the cascades' windows are walked finest first, each by `clipmap_level_select`, and the first holding
11
+ * the point answers, with how far into its edge band of {@link WIND_FIELD_BAND_WIDTH} cells the point is;
12
12
  * - a cascade's read is the atmosphere identity, `v_far(t) + tap · k_c`: one trilinear tap of its tile,
13
13
  * which holds `v − v_far(t_s,c)` at cell centres, times its decay;
14
14
  * - in the band, a second read blends in linearly, all of it on the window's face: the parent's
@@ -1 +1 @@
1
- {"version":3,"file":"chunk_wind_field_sample_cascades.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/chunk_wind_field_sample_cascades.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,+CAFU,SAAS,CAmDjB;0BA1FwB,iCAAiC"}
1
+ {"version":3,"file":"chunk_wind_field_sample_cascades.d.ts","sourceRoot":"","sources":["../../../../../src/shade/renderer/wind/chunk_wind_field_sample_cascades.js"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,+CAFU,SAAS,CA4DjB;0BAnGwB,iCAAiC"}
@@ -1,6 +1,6 @@
1
1
  import { chunk_clipmap_select_finest } from "../shader/chunk/clipmap/chunk_clipmap_select_finest.js";
2
2
  import { CodeChunk } from "../shader/compiler/CodeChunk.js";
3
- import { WIND_FIELD_BAND_WIDTH } from "./WIND_FIELD.js";
3
+ import { WIND_FIELD_BAND_WIDTH, WIND_FIELD_CASCADE_LIMIT } from "./WIND_FIELD.js";
4
4
  import { WIND_FIELD_STRUCT } from "./WIND_FIELD_STRUCT.js";
5
5
 
6
6
  /**
@@ -12,8 +12,8 @@ import { WIND_FIELD_STRUCT } from "./WIND_FIELD_STRUCT.js";
12
12
  * {@link wind_field_add_resources} declares them.
13
13
  *
14
14
  * **The read:**
15
- * - `clipmap_select_finest` walks the cascades' windows, finest first, and the first holding the point
16
- * answers, with how far into its edge band of {@link WIND_FIELD_BAND_WIDTH} cells the point is;
15
+ * - the cascades' windows are walked finest first, each by `clipmap_level_select`, and the first holding
16
+ * the point answers, with how far into its edge band of {@link WIND_FIELD_BAND_WIDTH} cells the point is;
17
17
  * - a cascade's read is the atmosphere identity, `v_far(t) + tap · k_c`: one trilinear tap of its tile,
18
18
  * which holds `v − v_far(t_s,c)` at cell centres, times its decay;
19
19
  * - in the band, a second read blends in linearly, all of it on the window's face: the parent's
@@ -62,7 +62,16 @@ fn wind_field_cascade_read(c: u32, position_ws: vec3<f32>) -> vec3<f32> {
62
62
  fn wind_field_sample(position_ws: vec3<f32>) -> vec3<f32> {
63
63
  let count = wind_field.cascade_count;
64
64
 
65
- let selection = clipmap_select_finest(&wind_field.levels, count, position_ws, WIND_FIELD_BAND_WIDTH);
65
+ var selection = ClipmapSelection(CLIPMAP_LEVEL_NONE, 0.0);
66
+
67
+ for (var i = 0u; i < min(count, ${WIND_FIELD_CASCADE_LIMIT}u); i++) {
68
+ let weight = clipmap_level_select(wind_field.levels[i], position_ws, WIND_FIELD_BAND_WIDTH);
69
+
70
+ if (weight >= 0.0) {
71
+ selection = ClipmapSelection(i, weight);
72
+ break;
73
+ }
74
+ }
66
75
 
67
76
  if (selection.level == CLIPMAP_LEVEL_NONE) {
68
77
  return wind_field.far_velocity;
@@ -1 +1 @@
1
- {"version":3,"file":"texture_mip_extent.d.ts","sourceRoot":"","sources":["../../../../src/shade/util/texture_mip_extent.js"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,uCAJW,MAAM,SACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,0CARW,MAAM,UACN,MAAM,mBACN,MAAM,aACN,sBAAoB,MAAM,SAC1B,MAAM,GACJ,MAAM,EAAE,CAYpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,+CANW,MAAM,UACN,MAAM,mBACN,MAAM,aACN,sBAAoB,MAAM,GACxB,MAAM,CA0BlB"}
1
+ {"version":3,"file":"texture_mip_extent.d.ts","sourceRoot":"","sources":["../../../../src/shade/util/texture_mip_extent.js"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,uCAJW,MAAM,SACN,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,0CARW,MAAM,UACN,MAAM,mBACN,MAAM,aACN,sBAAoB,MAAM,SAC1B,MAAM,GACJ,MAAM,EAAE,CAYpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,+CANW,MAAM,UACN,MAAM,mBACN,MAAM,aACN,sBAAoB,MAAM,GACxB,MAAM,CA0BlB"}
@@ -1,87 +1,88 @@
1
- import { assert } from "../../core/assert.js";
2
-
3
- /**
4
- * One dimension of a texture at `level`.
5
- *
6
- * Halving, floored at 1 — a 1024-wide texture is still 1 texel wide at level 10 and at level 20.
7
- * Trivial, and re-derived in enough places that getting it wrong is a real event rather than a
8
- * hypothetical one.
9
- *
10
- * @param {number} size texels, at the base level
11
- * @param {number} level
12
- * @returns {number} texels, at `level`
13
- */
14
- export function texture_mip_size(size, level) {
15
- return Math.max(size >> level, 1);
16
- }
17
-
18
- /**
19
- * The extent of a texture at `level`.
20
- *
21
- * **Only a 3D texture's depth halves.** The third component of an array texture is a layer count,
22
- * and every layer carries every mip — so it does not shrink with the others. That single distinction
23
- * is the reason this exists as a named thing: written out by hand it reads as an obvious `>> level`
24
- * on all three components, and that mistake under-reported a six-layer cube map's memory by close to
25
- * half and would have uploaded its levels at the wrong extent.
26
- *
27
- * @param {number} width texels, at the base level
28
- * @param {number} height texels, at the base level
29
- * @param {number} depth_or_layers depth for a 3D texture, layer count otherwise
30
- * @param {GPUTextureDimension|string} dimension
31
- * @param {number} level
32
- * @returns {number[]} `[width, height, depthOrArrayLayers]` at `level`, in the shape
33
- * `GPUExtent3D` takes
34
- */
35
- export function texture_mip_extent(width, height, depth_or_layers, dimension, level) {
36
- assert.isString(dimension, 'dimension');
37
- assert.isNonNegativeInteger(level, 'level');
38
-
39
- return [
40
- texture_mip_size(width, level),
41
- texture_mip_size(height, level),
42
- dimension === "3d" ? texture_mip_size(depth_or_layers, level) : depth_or_layers,
43
- ];
44
- }
45
-
46
- /**
47
- * The number of levels in a texture's full mip chain.
48
- *
49
- * The count that {@link texture_mip_extent} implies: the chain runs until every halving axis has
50
- * reached 1, so it is as long as the longest axis that halves. **Only a 3D texture's depth halves**
51
- * — the same distinction, one derivative up. Written as `max(width, height)` it silently truncates
52
- * every volume deeper than it is wide: a 4x4x16 has five levels and that reading gives three, while
53
- * `texture_mip_extent` will happily report the extent of all five.
54
- *
55
- * A zero-sized texture has no levels. Any other size has at least one, which is what the `+ 1` is.
56
- *
57
- * @param {number} width texels, at the base level
58
- * @param {number} height texels, at the base level
59
- * @param {number} depth_or_layers depth for a 3D texture, layer count otherwise
60
- * @param {GPUTextureDimension|string} dimension
61
- * @returns {number}
62
- */
63
- export function texture_mip_level_count(width, height, depth_or_layers, dimension) {
64
- assert.isString(dimension, 'dimension');
65
-
66
- assert.isNumber(width, 'width');
67
- assert.isNumber(height, 'height');
68
- assert.isNumber(depth_or_layers, 'depth_or_layers');
69
-
70
- assert.notNaN(width, 'width');
71
- assert.notNaN(height, 'height');
72
- assert.notNaN(depth_or_layers, 'depth_or_layers');
73
-
74
- assert.greaterThanOrEqual(width, 0, 'width');
75
- assert.greaterThanOrEqual(height, 0, 'height');
76
- assert.greaterThanOrEqual(depth_or_layers, 0, 'depth_or_layers');
77
-
78
- const longest = dimension === "3d"
79
- ? Math.max(width, height, depth_or_layers)
80
- : Math.max(width, height);
81
-
82
- if (longest === 0) {
83
- return 0;
84
- }
85
-
86
- return Math.floor(Math.log2(longest)) + 1;
87
- }
1
+ import { assert } from "../../core/assert.js";
2
+ import { msb_32 } from "../../core/binary/msb_32.js";
3
+
4
+ /**
5
+ * One dimension of a texture at `level`.
6
+ *
7
+ * Halving, floored at 1 — a 1024-wide texture is still 1 texel wide at level 10 and at level 20.
8
+ * Trivial, and re-derived in enough places that getting it wrong is a real event rather than a
9
+ * hypothetical one.
10
+ *
11
+ * @param {number} size texels, at the base level
12
+ * @param {number} level
13
+ * @returns {number} texels, at `level`
14
+ */
15
+ export function texture_mip_size(size, level) {
16
+ return Math.max(size >> level, 1);
17
+ }
18
+
19
+ /**
20
+ * The extent of a texture at `level`.
21
+ *
22
+ * **Only a 3D texture's depth halves.** The third component of an array texture is a layer count,
23
+ * and every layer carries every mip — so it does not shrink with the others. That single distinction
24
+ * is the reason this exists as a named thing: written out by hand it reads as an obvious `>> level`
25
+ * on all three components, and that mistake under-reported a six-layer cube map's memory by close to
26
+ * half and would have uploaded its levels at the wrong extent.
27
+ *
28
+ * @param {number} width texels, at the base level
29
+ * @param {number} height texels, at the base level
30
+ * @param {number} depth_or_layers depth for a 3D texture, layer count otherwise
31
+ * @param {GPUTextureDimension|string} dimension
32
+ * @param {number} level
33
+ * @returns {number[]} `[width, height, depthOrArrayLayers]` at `level`, in the shape
34
+ * `GPUExtent3D` takes
35
+ */
36
+ export function texture_mip_extent(width, height, depth_or_layers, dimension, level) {
37
+ assert.isString(dimension, 'dimension');
38
+ assert.isNonNegativeInteger(level, 'level');
39
+
40
+ return [
41
+ texture_mip_size(width, level),
42
+ texture_mip_size(height, level),
43
+ dimension === "3d" ? texture_mip_size(depth_or_layers, level) : depth_or_layers,
44
+ ];
45
+ }
46
+
47
+ /**
48
+ * The number of levels in a texture's full mip chain.
49
+ *
50
+ * The count that {@link texture_mip_extent} implies: the chain runs until every halving axis has
51
+ * reached 1, so it is as long as the longest axis that halves. **Only a 3D texture's depth halves**
52
+ * — the same distinction, one derivative up. Written as `max(width, height)` it silently truncates
53
+ * every volume deeper than it is wide: a 4x4x16 has five levels and that reading gives three, while
54
+ * `texture_mip_extent` will happily report the extent of all five.
55
+ *
56
+ * A zero-sized texture has no levels. Any other size has at least one, which is what the `+ 1` is.
57
+ *
58
+ * @param {number} width texels, at the base level
59
+ * @param {number} height texels, at the base level
60
+ * @param {number} depth_or_layers depth for a 3D texture, layer count otherwise
61
+ * @param {GPUTextureDimension|string} dimension
62
+ * @returns {number}
63
+ */
64
+ export function texture_mip_level_count(width, height, depth_or_layers, dimension) {
65
+ assert.isString(dimension, 'dimension');
66
+
67
+ assert.isNumber(width, 'width');
68
+ assert.isNumber(height, 'height');
69
+ assert.isNumber(depth_or_layers, 'depth_or_layers');
70
+
71
+ assert.notNaN(width, 'width');
72
+ assert.notNaN(height, 'height');
73
+ assert.notNaN(depth_or_layers, 'depth_or_layers');
74
+
75
+ assert.greaterThanOrEqual(width, 0, 'width');
76
+ assert.greaterThanOrEqual(height, 0, 'height');
77
+ assert.greaterThanOrEqual(depth_or_layers, 0, 'depth_or_layers');
78
+
79
+ const longest = dimension === "3d"
80
+ ? Math.max(width, height, depth_or_layers)
81
+ : Math.max(width, height);
82
+
83
+ if (longest === 0) {
84
+ return 0;
85
+ }
86
+
87
+ return msb_32(longest) + 1;
88
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"WGSLLanguageCore.d.ts","sourceRoot":"","sources":["../../../../../src/shade/wgsl/emulator/WGSLLanguageCore.js"],"names":[],"mappings":";IAg3DA;;;;;;;;;;;;;OAaG;IACH,+DAyFC"}
1
+ {"version":3,"file":"WGSLLanguageCore.d.ts","sourceRoot":"","sources":["../../../../../src/shade/wgsl/emulator/WGSLLanguageCore.js"],"names":[],"mappings":";IAk3DA;;;;;;;;;;;;;OAaG;IACH,+DAyFC"}
@@ -1,6 +1,8 @@
1
1
  import { assert } from "../../../core/assert.js";
2
2
  import { cpu_texture_gather, evaluate_gpu_compare_function } from "./cpu_texture_gather.js";
3
3
  import { cpu_texture_sample } from "./cpu_texture_sample.js";
4
+ import { msb_32 } from "../../../core/binary/msb_32.js";
5
+ import { ctz32 } from "../../../core/binary/ctz32.js";
4
6
 
5
7
  /**
6
8
  * Default sampler descriptor for `textureSample` / `textureSampleLevel`
@@ -728,7 +730,7 @@ export const WGSLLanguageCore = {
728
730
  countLeadingZeros: (e) => unop(e, x => Math.clz32(x)),
729
731
 
730
732
  /** `countTrailingZeros(e)` — number of consecutive zero bits below the least significant set bit; 32 for 0. */
731
- countTrailingZeros: (e) => unop(e, x => (x === 0 ? 32 : 31 - Math.clz32(x & -x))),
733
+ countTrailingZeros: (e) => unop(e, x => ctz32(x)),
732
734
 
733
735
  /** `countOneBits(e)` — population count. */
734
736
  countOneBits: (e) => unop(e, x => {
@@ -744,10 +746,10 @@ export const WGSLLanguageCore = {
744
746
  }),
745
747
 
746
748
  /** `firstLeadingBit(e)` — index of the most significant set bit; `0xffffffff` for 0 (u32 reading). */
747
- firstLeadingBit: (e) => unop(e, x => (x === 0 ? 0xffffffff : 31 - Math.clz32(x))),
749
+ firstLeadingBit: (e) => unop(e, x => (x === 0 ? 0xffffffff : msb_32(x))),
748
750
 
749
751
  /** `firstLeadingBit(e: u32)` — as above; named so the compiler can pick it by operand type. */
750
- firstLeadingBit_u32: (e) => unop(e, x => (x === 0 ? 0xffffffff : 31 - Math.clz32(x >>> 0))),
752
+ firstLeadingBit_u32: (e) => unop(e, x => (x === 0 ? 0xffffffff : msb_32(x))),
751
753
 
752
754
  /**
753
755
  * `firstLeadingBit(e: i32)` — the position of the most significant bit DIFFERENT from the sign
@@ -765,17 +767,17 @@ export const WGSLLanguageCore = {
765
767
  }
766
768
 
767
769
  // for a negative value the search is for the most significant ZERO
768
- return 31 - Math.clz32((v < 0 ? ~v : v) >>> 0);
770
+ return msb_32(v < 0 ? ~v : v);
769
771
  }),
770
772
 
771
773
  /** `firstTrailingBit(e)` — index of the least significant set bit; `0xffffffff` for 0. */
772
- firstTrailingBit: (e) => unop(e, x => (x === 0 ? 0xffffffff : 31 - Math.clz32(x & -x))),
774
+ firstTrailingBit: (e) => unop(e, x => (x === 0 ? 0xffffffff : ctz32(x))),
773
775
 
774
776
  /** `firstTrailingBit(e: u32)` — as above. */
775
- firstTrailingBit_u32: (e) => unop(e, x => (x === 0 ? 0xffffffff : 31 - Math.clz32(x & -x))),
777
+ firstTrailingBit_u32: (e) => unop(e, x => (x === 0 ? 0xffffffff : ctz32(x))),
776
778
 
777
779
  /** `firstTrailingBit(e: i32)` — as above, but the "no bit" answer is -1, in this type's sign. */
778
- firstTrailingBit_i32: (e) => unop(e, x => ((x | 0) === 0 ? -1 : 31 - Math.clz32(x & -x))),
780
+ firstTrailingBit_i32: (e) => unop(e, x => ((x | 0) === 0 ? -1 : ctz32(x))),
779
781
 
780
782
  /** `reverseBits(e)` — reverse the order of all 32 bits. */
781
783
  reverseBits: (e) => unop(e, x => {
@@ -1 +0,0 @@
1
- {"version":3,"file":"ceil_log2.d.ts","sourceRoot":"","sources":["../../../../../../../src/format/image/avif/av1/util/ceil_log2.js"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,6BAPW,MAAM,GACJ,MAAM,CAYlB"}