@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
@@ -14,7 +14,8 @@ export const MESH_SDF_BAKE_BUDGET_MAX: number;
14
14
  * queues a bake; the last one going leaves the cache in place until {@link trim}, which only a user of
15
15
  * the caches calls, so a cache outlives a mode that stops using it and is there when the mode comes
16
16
  * back (D28). {@link forget} drops a geometry the geometry manager has let go of, whatever holds it.
17
- * {@link alias} points a skinned clone's id at its source's cache, which readers follow.
17
+ * {@link alias} points a geometry's id at another's cache, which readers follow, and whose holders and card sets
18
+ * the aliased geometry's become: a skinned clone's at its source's, a virtual geometry's at its proxy's.
18
19
  *
19
20
  * **Side.** A holder says whether it draws both sides of the geometry. A field is baked two-sided
20
21
  * while any of its holders does: its vote then counts no back face, so nothing is inside it.
@@ -36,11 +37,11 @@ export const MESH_SDF_BAKE_BUDGET_MAX: number;
36
37
  * {@link cards}, whose card sets — one per (geometry, material) pair — are captured after the bake,
37
38
  * `capture_budget` pages a frame.
38
39
  *
39
- * **Sources** ({@link add_source}) make the caches of geometries with no tree of their own to bake from,
40
- * a virtual geometry's: such a geometry waits queued, as one whose tree is not resident yet does. A
41
- * source hears of each geometry queued ({@link onRequested}), records its own work each frame ahead of
42
- * the bake, and bakes a proxy of it here as any geometry, whose resident cache it then gives the
43
- * geometry ({@link adopt}).
40
+ * **A geometry with no tree of its own** to bake from, a virtual geometry's, waits queued, as one whose
41
+ * tree is not resident yet does, until it is pointed at a stand-in ({@link alias}): an ordinary geometry
42
+ * in the same local space, baked, placed and captured here as any is. Whoever makes stand-ins hears of
43
+ * each geometry queued ({@link onRequested}) and let go ({@link onForgotten}), and aliases between
44
+ * frames, its stand-in added to the geometry manager as any geometry is.
44
45
  *
45
46
  * **Readers** bind {@link headers}, {@link indirection}, {@link texture} and {@link MESH_SDF_SAMPLER}
46
47
  * (see {@link write_bindings}) and sample through `mesh_sdf_sample`, which only a resident header
@@ -55,15 +56,23 @@ export class GPUGeometrySDFManager {
55
56
  */
56
57
  constructor(device: GPUDevice, geometries: GPUGeometryManager);
57
58
  /**
58
- * Sent with a geometry id when its cache turns resident, on the frame its completion is read back.
59
+ * Sent with a geometry id when its cache turns resident, on the frame its completion is read back, and with each
60
+ * geometry aliased to it, whose readers read that cache: also when the alias is made to a cache resident already.
59
61
  * @type {Signal<number>}
60
62
  */
61
63
  onBaked: any;
62
64
  /**
63
- * Sent with a geometry's record each time its cache is queued for a bake: what a source listens to.
65
+ * Sent with a geometry's record each time its cache is queued for a bake: what a maker of stand-ins
66
+ * listens to.
64
67
  * @type {Signal<GPUGeometryMetadata>}
65
68
  */
66
69
  onRequested: any;
70
+ /**
71
+ * Sent with a geometry's record when {@link forget} lets it go: what a maker of stand-ins that made one for it
72
+ * listens to.
73
+ * @type {Signal<GPUGeometryMetadata>}
74
+ */
75
+ onForgotten: any;
67
76
  /**
68
77
  * The card sets: one capture of a geometry's layout per (geometry, material) pair, which their
69
78
  * user acquires and releases. Layouts reach it as they are placed.
@@ -87,14 +96,14 @@ export class GPUGeometrySDFManager {
87
96
  */
88
97
  get max_bricks(): number;
89
98
  /**
90
- * One more holder of a geometry's cache; the first queues its bake.
99
+ * One more holder of a geometry's cache; the first queues its bake. A holder of an alias holds its source.
91
100
  *
92
101
  * @param {GPUGeometryMetadata} record
93
102
  * @param {boolean} two_sided whether the holder draws both sides of the geometry
94
103
  */
95
104
  acquire(record: GPUGeometryMetadata, two_sided: boolean): void;
96
105
  /**
97
- * One holder fewer. The cache stays until {@link trim}.
106
+ * One holder fewer. The cache stays until {@link trim}. A holder of an alias holds its source.
98
107
  *
99
108
  * @param {GPUGeometryMetadata} record
100
109
  * @param {boolean} two_sided as the holder acquired it
@@ -113,7 +122,13 @@ export class GPUGeometrySDFManager {
113
122
  forget(record: GPUGeometryMetadata): void;
114
123
  /**
115
124
  * Readers of `clone` read `source`'s cache: the hook for a skinned clone, whose unskinned shape is
116
- * its source's (§6.3). Written once; it follows the source through its bake.
125
+ * its source's (§6.3), and for a virtual geometry, whose proxy is its stand-in (§17). Written once; it
126
+ * follows the source through its bake.
127
+ *
128
+ * Whatever held `clone`'s own cache holds `source`'s from here on, its side included, as does every holder of
129
+ * `clone` after; and `clone`'s card sets capture `source`'s layout through `source`'s meshlets
130
+ * ({@link GPUMeshCardSets#alias}). So a source whose stand-in arrives after `clone` was asked for needs
131
+ * nothing moved by its holders.
117
132
  *
118
133
  * @param {GPUGeometryMetadata} clone
119
134
  * @param {GPUGeometryMetadata} source
@@ -141,27 +156,6 @@ export class GPUGeometrySDFManager {
141
156
  * @returns {boolean}
142
157
  */
143
158
  holds_two_sided(record: GPUGeometryMetadata): boolean;
144
- /**
145
- * @param {MeshSDFSource} source run first in each {@link graph_bake} from here on
146
- */
147
- add_source(source: MeshSDFSource): void;
148
- /**
149
- * @param {MeshSDFSource} source
150
- */
151
- remove_source(source: MeshSDFSource): void;
152
- /**
153
- * Give `target` the resident cache baked for `proxy`: a source's hand-in, for a geometry with no tree of its own,
154
- * of a proxy in the same local space baked as any geometry is. Nothing is copied. The target's header takes the
155
- * proxy's layout, entries and side, and the proxy's reads None, as dropped; {@link onBaked} is sent with the
156
- * target. The cache has no cards, the target having no tree to capture them with. Held for another side than the
157
- * proxy was baked for, it is queued again at the next bake, as any cache is.
158
- *
159
- * @param {GPUGeometryMetadata} target waiting for its bake ({@link is_requested})
160
- * @param {GPUGeometryMetadata} proxy whose cache is resident
161
- * @returns {boolean} whether it was adopted: false, changing nothing, when `target` no longer waits or `proxy`'s
162
- * cache is not resident
163
- */
164
- adopt(target: GPUGeometryMetadata, proxy: GPUGeometryMetadata): boolean;
165
159
  /**
166
160
  * Geometries whose layout was coarsened by the cap, of those baked: coarser than asked.
167
161
  * @returns {number}
@@ -265,17 +259,6 @@ export type GPUGeometryManager = import("../GPUGeometryManager.js").GPUGeometryM
265
259
  export type GPUGeometryMetadata = import("../GPUGeometryMetadata.js").GPUGeometryMetadata;
266
260
  export type GPUResidentMaterialContext = import("../../material/resident/GPUResidentMaterialContext.js").GPUResidentMaterialContext;
267
261
  export type GPUMaterialManager = import("../../material/GPUMaterialManager.js").GPUMaterialManager;
268
- /**
269
- * What makes caches for geometries the bake cannot bake from a tree of their own
270
- * ({@link GPUGeometrySDFManageradd_source }): it learns what is asked for from `onRequested`, records its own work in
271
- * each frame's graph ahead of the bake, and hands each cache in through `adopt`.
272
- */
273
- export type MeshSDFSource = {
274
- /**
275
- * records the source's work for the frame, ahead of the bake
276
- */
277
- graph_update: (arg0: FrameGraph) => void;
278
- };
279
262
  import { GPUMeshCardSets } from "./cards/GPUMeshCardSets.js";
280
263
  import { MeshSDFState } from "./MESH_SDF.js";
281
264
  //# sourceMappingURL=GPUGeometrySDFManager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GPUGeometrySDFManager.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js"],"names":[],"mappings":"AA+IA;;;;GAIG;AACH,uCAFU,MAAM,CAEuH;AAgDvI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH;IAsQI;;;OAGG;IACH,2CAFW,kBAAkB,EAS5B;IArQD;;;OAGG;IACH,aAAuB;IAEvB;;;OAGG;IACH,iBAA2B;IA6P3B;;;;OAIG;IACH,6BAEC;IAED;;;;;;OAMG;IACH,sBAHW,MAAM,cACN,MAAM,QAkChB;IAED;;OAEG;IACH,yBAEC;IAED;;OAEG;IACH,yBAEC;IAED;;;;;OAKG;IACH,gBAHW,mBAAmB,aACnB,OAAO,QAqBjB;IAED;;;;;OAKG;IACH,gBAHW,mBAAmB,aACnB,OAAO,QAqBjB;IAED;;OAEG;IACH,aAYC;IAED;;;;;OAKG;IACH,eAFW,mBAAmB,QAe7B;IAED;;;;;;OAMG;IACH,aAHW,mBAAmB,UACnB,mBAAmB,QA0B7B;IAQD;;;;;OAKG;IACH,iBAHW,mBAAmB,GACjB,YAAY,CAaxB;IAED;;;;;;OAMG;IACH,qBAHW,mBAAmB,GACjB,OAAO,CAInB;IAED;;;;;OAKG;IACH,wBAHW,mBAAmB,GACjB,OAAO,CAInB;IAED;;OAEG;IACH,mBAFW,aAAa,QAOvB;IAED;;OAEG;IACH,sBAFW,aAAa,QAQvB;IAED;;;;;;;;;;;OAWG;IACH,cALW,mBAAmB,SACnB,mBAAmB,GACjB,OAAO,CA4CnB;IAED;;;OAGG;IACH,8BAEC;IAED;;OAEG;IACH,6BAEC;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,2BAUC;IAED;;;OAGG;IACH,6BAEC;IAED;;;OAGG;IACH,+BAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;OAGG;IACH,4BAEC;IAED;;;OAGG;IACH,yBAIC;IAED;;;OAGG;IACH,6BAIC;IAED;;;OAGG;IACH,8EAIC;IAED;;;;;;OAMG;IACH,mCAOC;IAED;;OAEG;IACH,+BAcC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH;QAT+B,KAAK,EAAzB,UAAU;QACM,MAAM,EAAtB,MAAM;QACW,cAAc,GAA/B,MAAM;QAEoC,SAAS,GAAnD,0BAA0B,GAAC,IAAI;QAEG,iBAAiB,GAAnD,kBAAkB,GAAC,IAAI;aA8EjC;IAwiCD,gBAsBC;;CACJ;yBAljEY,OAAO,8DAA8D,EAAE,UAAU;iCACjF,OAAO,0BAA0B,EAAE,kBAAkB;kCACrD,OAAO,2BAA2B,EAAE,mBAAmB;yCACvD,OAAO,uDAAuD,EAAE,0BAA0B;iCAC1F,OAAO,sCAAsC,EAAE,kBAAkB;;;;;;;;;;yBASvD,UAAU,KAAG,IAAI;;gCA3BsB,4BAA4B;6BAQf,eAAe"}
1
+ {"version":3,"file":"GPUGeometrySDFManager.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js"],"names":[],"mappings":"AAuIA;;;;GAIG;AACH,uCAFU,MAAM,CAEuH;AAgDvI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH;IAyQI;;;OAGG;IACH,2CAFW,kBAAkB,EAS5B;IAxQD;;;;OAIG;IACH,aAAuB;IAEvB;;;;OAIG;IACH,iBAA2B;IAE3B;;;;OAIG;IACH,iBAA2B;IAuP3B;;;;OAIG;IACH,6BAEC;IAED;;;;;;OAMG;IACH,sBAHW,MAAM,cACN,MAAM,QAkChB;IAED;;OAEG;IACH,yBAEC;IAED;;OAEG;IACH,yBAEC;IAED;;;;;OAKG;IACH,gBAHW,mBAAmB,aACnB,OAAO,QAajB;IAiCD;;;;;OAKG;IACH,gBAHW,mBAAmB,aACnB,OAAO,QAqBjB;IAED;;OAEG;IACH,aAYC;IAED;;;;;OAKG;IACH,eAFW,mBAAmB,QAiB7B;IAED;;;;;;;;;;;;OAYG;IACH,aAHW,mBAAmB,UACnB,mBAAmB,QAwD7B;IAcD;;;;;OAKG;IACH,iBAHW,mBAAmB,GACjB,YAAY,CAaxB;IAED;;;;;;OAMG;IACH,qBAHW,mBAAmB,GACjB,OAAO,CAInB;IAED;;;;;OAKG;IACH,wBAHW,mBAAmB,GACjB,OAAO,CAInB;IAED;;;OAGG;IACH,8BAEC;IAED;;OAEG;IACH,6BAEC;IAED;;;OAGG;IACH,2BAEC;IAED;;;OAGG;IACH,2BAUC;IAED;;;OAGG;IACH,6BAEC;IAED;;;OAGG;IACH,+BAEC;IAED;;;OAGG;IACH,yBAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;OAGG;IACH,4BAEC;IAED;;;OAGG;IACH,yBAIC;IAED;;;OAGG;IACH,6BAIC;IAED;;;OAGG;IACH,8EAIC;IAED;;;;;;OAMG;IACH,mCAOC;IAED;;OAEG;IACH,+BAcC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH;QAT+B,KAAK,EAAzB,UAAU;QACM,MAAM,EAAtB,MAAM;QACW,cAAc,GAA/B,MAAM;QAEoC,SAAS,GAAnD,0BAA0B,GAAC,IAAI;QAEG,iBAAiB,GAAnD,kBAAkB,GAAC,IAAI;aAuEjC;IAojCD,gBAsBC;;CACJ;yBAziEY,OAAO,8DAA8D,EAAE,UAAU;iCACjF,OAAO,0BAA0B,EAAE,kBAAkB;kCACrD,OAAO,2BAA2B,EAAE,mBAAmB;yCACvD,OAAO,uDAAuD,EAAE,0BAA0B;iCAC1F,OAAO,sCAAsC,EAAE,kBAAkB;gCAnBhB,4BAA4B;6BAQf,eAAe"}
@@ -47,6 +47,7 @@ import { MESH_SDF_BRICK_TEXELS, MESH_SDF_BRICK_VOXELS, MeshSDFState } from "./ME
47
47
  import { MESH_SDF_SAMPLER } from "./MESH_SDF_RESOURCES.js";
48
48
  import { MESH_SDF_STRUCT } from "./MESH_SDF_STRUCT.js";
49
49
  import { MeshSDFLayout } from "./MeshSDFLayout.js";
50
+ import { ceilPowerOfTwo } from "../../../../core/binary/operations/ceilPowerOfTwo.js";
50
51
 
51
52
  /**
52
53
  * @typedef {import("../../../../engine/graphics/render/frame_graph/FrameGraph.js").FrameGraph} FrameGraph
@@ -56,15 +57,6 @@ import { MeshSDFLayout } from "./MeshSDFLayout.js";
56
57
  * @typedef {import("../../material/GPUMaterialManager.js").GPUMaterialManager} GPUMaterialManager
57
58
  */
58
59
 
59
- /**
60
- * What makes caches for geometries the bake cannot bake from a tree of their own
61
- * ({@link GPUGeometrySDFManager#add_source}): it learns what is asked for from `onRequested`, records its own work in
62
- * each frame's graph ahead of the bake, and hands each cache in through `adopt`.
63
- *
64
- * @typedef {Object} MeshSDFSource
65
- * @property {function(FrameGraph): void} graph_update records the source's work for the frame, ahead of the bake
66
- */
67
-
68
60
  /*
69
61
  What the host knows of a geometry id. `Queued` is the host's alone: the header reads None until the
70
62
  bake is admitted and the indirection range is the geometry's.
@@ -204,7 +196,8 @@ function grow_typed(array, length) {
204
196
  * queues a bake; the last one going leaves the cache in place until {@link trim}, which only a user of
205
197
  * the caches calls, so a cache outlives a mode that stops using it and is there when the mode comes
206
198
  * back (D28). {@link forget} drops a geometry the geometry manager has let go of, whatever holds it.
207
- * {@link alias} points a skinned clone's id at its source's cache, which readers follow.
199
+ * {@link alias} points a geometry's id at another's cache, which readers follow, and whose holders and card sets
200
+ * the aliased geometry's become: a skinned clone's at its source's, a virtual geometry's at its proxy's.
208
201
  *
209
202
  * **Side.** A holder says whether it draws both sides of the geometry. A field is baked two-sided
210
203
  * while any of its holders does: its vote then counts no back face, so nothing is inside it.
@@ -226,11 +219,11 @@ function grow_typed(array, length) {
226
219
  * {@link cards}, whose card sets — one per (geometry, material) pair — are captured after the bake,
227
220
  * `capture_budget` pages a frame.
228
221
  *
229
- * **Sources** ({@link add_source}) make the caches of geometries with no tree of their own to bake from,
230
- * a virtual geometry's: such a geometry waits queued, as one whose tree is not resident yet does. A
231
- * source hears of each geometry queued ({@link onRequested}), records its own work each frame ahead of
232
- * the bake, and bakes a proxy of it here as any geometry, whose resident cache it then gives the
233
- * geometry ({@link adopt}).
222
+ * **A geometry with no tree of its own** to bake from, a virtual geometry's, waits queued, as one whose
223
+ * tree is not resident yet does, until it is pointed at a stand-in ({@link alias}): an ordinary geometry
224
+ * in the same local space, baked, placed and captured here as any is. Whoever makes stand-ins hears of
225
+ * each geometry queued ({@link onRequested}) and let go ({@link onForgotten}), and aliases between
226
+ * frames, its stand-in added to the geometry manager as any geometry is.
234
227
  *
235
228
  * **Readers** bind {@link headers}, {@link indirection}, {@link texture} and {@link MESH_SDF_SAMPLER}
236
229
  * (see {@link write_bindings}) and sample through `mesh_sdf_sample`, which only a resident header
@@ -251,22 +244,25 @@ export class GPUGeometrySDFManager {
251
244
  #geometries;
252
245
 
253
246
  /**
254
- * Sent with a geometry id when its cache turns resident, on the frame its completion is read back.
247
+ * Sent with a geometry id when its cache turns resident, on the frame its completion is read back, and with each
248
+ * geometry aliased to it, whose readers read that cache: also when the alias is made to a cache resident already.
255
249
  * @type {Signal<number>}
256
250
  */
257
251
  onBaked = new Signal();
258
252
 
259
253
  /**
260
- * Sent with a geometry's record each time its cache is queued for a bake: what a source listens to.
254
+ * Sent with a geometry's record each time its cache is queued for a bake: what a maker of stand-ins
255
+ * listens to.
261
256
  * @type {Signal<GPUGeometryMetadata>}
262
257
  */
263
258
  onRequested = new Signal();
264
259
 
265
260
  /**
266
- * Run first in each {@link graph_bake}.
267
- * @type {MeshSDFSource[]}
261
+ * Sent with a geometry's record when {@link forget} lets it go: what a maker of stand-ins that made one for it
262
+ * listens to.
263
+ * @type {Signal<GPUGeometryMetadata>}
268
264
  */
269
- #sources = [];
265
+ onForgotten = new Signal();
270
266
 
271
267
  #voxel_size = 0.125;
272
268
  #max_bricks = 18;
@@ -578,7 +574,7 @@ export class GPUGeometrySDFManager {
578
574
  }
579
575
 
580
576
  /**
581
- * One more holder of a geometry's cache; the first queues its bake.
577
+ * One more holder of a geometry's cache; the first queues its bake. A holder of an alias holds its source.
582
578
  *
583
579
  * @param {GPUGeometryMetadata} record
584
580
  * @param {boolean} two_sided whether the holder draws both sides of the geometry
@@ -587,17 +583,40 @@ export class GPUGeometrySDFManager {
587
583
  assert.defined(record, 'record');
588
584
  assert.isBoolean(two_sided, 'two_sided');
589
585
 
590
- const id = record.index;
586
+ this.#ensure_id(record.index);
591
587
 
592
- this.#ensure_id(id);
588
+ if (this.#state[record.index] !== HOST_ALIAS) {
589
+ this.#records[record.index] = record;
590
+ }
593
591
 
594
- this.#records[id] = record;
592
+ this.#hold(this.#holder_id(record.index), 1, two_sided ? 1 : 0);
593
+ }
595
594
 
596
- if (two_sided) {
597
- this.#two_sided_references[id]++;
598
- }
595
+ /**
596
+ * The id a holder of `id` holds: its source's, for an alias.
597
+ *
598
+ * @param {number} id
599
+ * @returns {number}
600
+ */
601
+ #holder_id(id) {
602
+ return this.#state[id] === HOST_ALIAS ? this.#aliases.get(id) : id;
603
+ }
604
+
605
+ /**
606
+ * `count` more holders of `id`, `two_sided` of them drawing both sides; the first queues its bake.
607
+ *
608
+ * @param {number} id
609
+ * @param {number} count
610
+ * @param {number} two_sided
611
+ */
612
+ #hold(id, count, two_sided) {
613
+ this.#two_sided_references[id] += two_sided;
614
+
615
+ const before = this.#references[id];
599
616
 
600
- if (++this.#references[id] === 1 && this.#state[id] === HOST_NONE) {
617
+ this.#references[id] = before + count;
618
+
619
+ if (before === 0 && this.#state[id] === HOST_NONE) {
601
620
  this.#request(id);
602
621
  }
603
622
 
@@ -605,7 +624,7 @@ export class GPUGeometrySDFManager {
605
624
  }
606
625
 
607
626
  /**
608
- * One holder fewer. The cache stays until {@link trim}.
627
+ * One holder fewer. The cache stays until {@link trim}. A holder of an alias holds its source.
609
628
  *
610
629
  * @param {GPUGeometryMetadata} record
611
630
  * @param {boolean} two_sided as the holder acquired it
@@ -614,7 +633,7 @@ export class GPUGeometrySDFManager {
614
633
  assert.defined(record, 'record');
615
634
  assert.isBoolean(two_sided, 'two_sided');
616
635
 
617
- const id = record.index;
636
+ const id = this.#holder_id(record.index);
618
637
 
619
638
  assert.greaterThan(this.#references[id] ?? 0, 0, `geometry ${id} released more often than acquired`);
620
639
 
@@ -667,11 +686,19 @@ export class GPUGeometrySDFManager {
667
686
  this.#two_sided_references[id] = 0;
668
687
  this.#drop(id);
669
688
  this.#records[id] = undefined;
689
+
690
+ this.onForgotten.send1(record);
670
691
  }
671
692
 
672
693
  /**
673
694
  * Readers of `clone` read `source`'s cache: the hook for a skinned clone, whose unskinned shape is
674
- * its source's (§6.3). Written once; it follows the source through its bake.
695
+ * its source's (§6.3), and for a virtual geometry, whose proxy is its stand-in (§17). Written once; it
696
+ * follows the source through its bake.
697
+ *
698
+ * Whatever held `clone`'s own cache holds `source`'s from here on, its side included, as does every holder of
699
+ * `clone` after; and `clone`'s card sets capture `source`'s layout through `source`'s meshlets
700
+ * ({@link GPUMeshCardSets#alias}). So a source whose stand-in arrives after `clone` was asked for needs
701
+ * nothing moved by its holders.
675
702
  *
676
703
  * @param {GPUGeometryMetadata} clone
677
704
  * @param {GPUGeometryMetadata} source
@@ -693,6 +720,20 @@ export class GPUGeometrySDFManager {
693
720
 
694
721
  this.#state[id] = HOST_ALIAS;
695
722
 
723
+ const held = this.#references[id];
724
+ const held_two_sided = this.#two_sided_references[id];
725
+
726
+ this.#references[id] = 0;
727
+ this.#two_sided_references[id] = 0;
728
+
729
+ if (this.#state[source.index] !== HOST_ALIAS) {
730
+ this.#records[source.index] = source;
731
+ }
732
+
733
+ if (held > 0) {
734
+ this.#hold(source.index, held, held_two_sided);
735
+ }
736
+
696
737
  if (this.#headers !== null) {
697
738
  this.#ensure_headers(id + 1);
698
739
  this.#write_header_alias(id, source.index);
@@ -700,6 +741,22 @@ export class GPUGeometrySDFManager {
700
741
 
701
742
  this.#records[id] = clone;
702
743
  this.#aliases.set(id, source.index);
744
+
745
+ let clones = this.#clones_of.get(source.index);
746
+
747
+ if (clones === undefined) {
748
+ clones = [];
749
+ this.#clones_of.set(source.index, clones);
750
+ }
751
+
752
+ clones.push(id);
753
+
754
+ this.#cards.alias(id, source.index);
755
+
756
+ if (this.#state[source.index] === HOST_RESIDENT) {
757
+ // its readers read a resident cache from here on
758
+ this.onBaked.send1(id);
759
+ }
703
760
  }
704
761
 
705
762
  /**
@@ -708,6 +765,12 @@ export class GPUGeometrySDFManager {
708
765
  */
709
766
  #aliases = new Map();
710
767
 
768
+ /**
769
+ * The ids aliased to each source id: the readers {@link onBaked} tells of the source's bake too.
770
+ * @type {Map<number, number[]>}
771
+ */
772
+ #clones_of = new Map();
773
+
711
774
  /**
712
775
  * What a reader finds in the geometry's header.
713
776
  *
@@ -748,82 +811,6 @@ export class GPUGeometrySDFManager {
748
811
  return (this.#two_sided_references[record.index] ?? 0) > 0;
749
812
  }
750
813
 
751
- /**
752
- * @param {MeshSDFSource} source run first in each {@link graph_bake} from here on
753
- */
754
- add_source(source) {
755
- assert.defined(source, 'source');
756
- assert.equal(this.#sources.includes(source), false, 'source added already');
757
-
758
- this.#sources.push(source);
759
- }
760
-
761
- /**
762
- * @param {MeshSDFSource} source
763
- */
764
- remove_source(source) {
765
- const index = this.#sources.indexOf(source);
766
-
767
- if (index !== -1) {
768
- this.#sources.splice(index, 1);
769
- }
770
- }
771
-
772
- /**
773
- * Give `target` the resident cache baked for `proxy`: a source's hand-in, for a geometry with no tree of its own,
774
- * of a proxy in the same local space baked as any geometry is. Nothing is copied. The target's header takes the
775
- * proxy's layout, entries and side, and the proxy's reads None, as dropped; {@link onBaked} is sent with the
776
- * target. The cache has no cards, the target having no tree to capture them with. Held for another side than the
777
- * proxy was baked for, it is queued again at the next bake, as any cache is.
778
- *
779
- * @param {GPUGeometryMetadata} target waiting for its bake ({@link is_requested})
780
- * @param {GPUGeometryMetadata} proxy whose cache is resident
781
- * @returns {boolean} whether it was adopted: false, changing nothing, when `target` no longer waits or `proxy`'s
782
- * cache is not resident
783
- */
784
- adopt(target, proxy) {
785
- assert.defined(target, 'target');
786
- assert.defined(proxy, 'proxy');
787
- assert.notEqual(target.index, proxy.index, 'a geometry cannot adopt its own cache');
788
-
789
- const id = target.index;
790
- const from = proxy.index;
791
-
792
- if (!this.is_requested(target) || this.#state[from] !== HOST_RESIDENT) {
793
- return false;
794
- }
795
-
796
- this.#drop_cards(from);
797
-
798
- const range = this.#ranges[from];
799
-
800
- this.#ranges[id] = range;
801
- this.#ranges[from] = null;
802
- this.#brick_count[id] = this.#brick_count[from];
803
- this.#two_sided[id] = this.#two_sided[from];
804
- this.#generation[id]++;
805
-
806
- this.#state[from] = HOST_NONE;
807
- this.#state[id] = HOST_RESIDENT;
808
-
809
- // the layout the proxy was admitted with: a configure since would have dropped its cache
810
- const layout = this.#layout;
811
-
812
- layout.compute(proxy.geometry.bounding_box, this.#voxel_size, this.#max_bricks);
813
-
814
- this.#write_header(id, layout, range.offset + 1, MeshSDFState.Resident);
815
-
816
- this.#word_scratch[0] = MeshSDFState.None;
817
- this.#device.queue.writeBuffer(this.#headers, from * HEADER_BYTES + HEADER_STATE, this.#word_scratch, 0, 1);
818
-
819
- // the side its holders draw is checked at the next bake
820
- this.#holders_changed.push(id);
821
-
822
- this.onBaked.send1(id);
823
-
824
- return true;
825
- }
826
-
827
814
  /**
828
815
  * Geometries whose layout was coarsened by the cap, of those baked: coarser than asked.
829
816
  * @returns {number}
@@ -994,13 +981,6 @@ export class GPUGeometrySDFManager {
994
981
 
995
982
  this.#frame++;
996
983
 
997
- // the sources first: a cache adopted here is not admitted to a bake of its own below
998
- const sources = this.#sources;
999
-
1000
- for (let i = 0; i < sources.length; i++) {
1001
- sources[i].graph_update(graph);
1002
- }
1003
-
1004
984
  this.#follow_sides();
1005
985
 
1006
986
  // the last bake's commands were submitted before this call: what they read may be handed out
@@ -1233,7 +1213,7 @@ export class GPUGeometrySDFManager {
1233
1213
  /**
1234
1214
  * Whether a queued geometry's tree is traceable, so that a bake could admit it. A geometry that
1235
1215
  * waits for its tree, or for a source's cache, records no bake while it waits. Drops from the queue
1236
- * what was dropped, or adopted, since it was queued.
1216
+ * what was dropped, or aliased, since it was queued.
1237
1217
  *
1238
1218
  * @returns {boolean}
1239
1219
  */
@@ -1264,8 +1244,8 @@ export class GPUGeometrySDFManager {
1264
1244
  }
1265
1245
 
1266
1246
  /**
1267
- * Whether a resident geometry's cards wait for placement. Drops from the queue what was dropped, or
1268
- * adopted away, since it was queued.
1247
+ * Whether a resident geometry's cards wait for placement. Drops from the queue what was dropped
1248
+ * since it was queued.
1269
1249
  *
1270
1250
  * @returns {boolean}
1271
1251
  */
@@ -1693,6 +1673,14 @@ export class GPUGeometrySDFManager {
1693
1673
  this.#place_queue.push(id);
1694
1674
 
1695
1675
  this.onBaked.send1(id);
1676
+
1677
+ const clones = this.#clones_of.get(id);
1678
+
1679
+ if (clones !== undefined) {
1680
+ for (let i = 0; i < clones.length; i++) {
1681
+ this.onBaked.send1(clones[i]);
1682
+ }
1683
+ }
1696
1684
  }
1697
1685
  }
1698
1686
 
@@ -1779,7 +1767,12 @@ export class GPUGeometrySDFManager {
1779
1767
  }
1780
1768
 
1781
1769
  if (state === HOST_ALIAS) {
1770
+ const clones = this.#clones_of.get(this.#aliases.get(id));
1771
+
1772
+ clones.splice(clones.indexOf(id), 1);
1773
+
1782
1774
  this.#aliases.delete(id);
1775
+ this.#cards.unalias(id);
1783
1776
  } else {
1784
1777
  if (state === HOST_BAKING) {
1785
1778
  this.#baking--;
@@ -1940,7 +1933,7 @@ export class GPUGeometrySDFManager {
1940
1933
  * A ring for twice the bricks of the largest geometry the cap allows, emptied.
1941
1934
  */
1942
1935
  #reset_ring() {
1943
- const capacity = 2 ** Math.ceil(Math.log2(2 * max_bricks_of_a_geometry(this.#max_bricks)));
1936
+ const capacity = ceilPowerOfTwo(2 * max_bricks_of_a_geometry(this.#max_bricks));
1944
1937
 
1945
1938
  if (this.#ring === null || this.#ring_capacity !== capacity) {
1946
1939
  this.#ring?.destroy();
@@ -2077,11 +2070,7 @@ export class GPUGeometrySDFManager {
2077
2070
 
2078
2071
  buffer?.destroy();
2079
2072
 
2080
- let capacity = 64;
2081
-
2082
- while (8 * capacity < size) {
2083
- capacity *= 2;
2084
- }
2073
+ const capacity = Math.max(64, ceilPowerOfTwo(runs));
2085
2074
 
2086
2075
  return this.#create_buffer(name, 8 * capacity, GPUBufferUsage.COPY_DST);
2087
2076
  }
@@ -2093,6 +2082,9 @@ export class GPUGeometrySDFManager {
2093
2082
  * @returns {GPUBuffer}
2094
2083
  */
2095
2084
  #create_buffer(name, size, usage) {
2085
+ // bound whole, as storage
2086
+ assert.lessThanOrEqual(size, this.#device.limits.maxStorageBufferBindingSize, `${name} past maxStorageBufferBindingSize`);
2087
+
2096
2088
  return this.#device.createBuffer(BufferDescriptor.fromJSON({
2097
2089
  label: `GPUGeometrySDFManager/${name}`,
2098
2090
  size,
@@ -1 +1 @@
1
- {"version":3,"file":"MeshSDFLayout.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/geometry/sdf/MeshSDFLayout.js"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IACI;;;OAGG;IACH,QAFU,YAAY,CAEO;IAE7B;;;OAGG;IACH,OAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,QAFU,UAAU,CAEO;IAE3B;;OAEG;IACH,aAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,WAFU,OAAO,CAEC;IAElB;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;;;OAIG;IACH,oBAJW,MAAM,QACN,MAAM,GACJ,MAAM,CAMlB;IAED;;;OAGG;IACH,yBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;OAGG;IACH,oBAHW,MAAM,GACJ,MAAM,CAUlB;IAED;;;;;;;OAOG;IACH,gBALW,UAAU,MAAM,CAAC,cACjB,MAAM,cACN,MAAM,GACJ,aAAa,CAuDzB;CACJ"}
1
+ {"version":3,"file":"MeshSDFLayout.d.ts","sourceRoot":"","sources":["../../../../../../src/shade/renderer/geometry/sdf/MeshSDFLayout.js"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH;IACI;;;OAGG;IACH,QAFU,YAAY,CAEO;IAE7B;;;OAGG;IACH,OAFU,MAAM,CAEN;IAEV;;;OAGG;IACH,QAFU,UAAU,CAEO;IAE3B;;OAEG;IACH,aAFU,MAAM,CAEA;IAEhB;;;OAGG;IACH,WAFU,OAAO,CAEC;IAElB;;;OAGG;IACH,aAFU,MAAM,CAEA;IAEhB;;;;OAIG;IACH,oBAJW,MAAM,QACN,MAAM,GACJ,MAAM,CAMlB;IAED;;;OAGG;IACH,yBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;OAGG;IACH,oBAHW,MAAM,GACJ,MAAM,CAUlB;IAED;;;;;;;OAOG;IACH,gBALW,UAAU,MAAM,CAAC,cACjB,MAAM,cACN,MAAM,GACJ,aAAa,CAuDzB;CACJ"}
@@ -1,5 +1,6 @@
1
1
  import { assert } from "../../../../core/assert.js";
2
2
  import { MESH_SDF_BAND_VOXELS, MESH_SDF_BRICK_VOXELS } from "./MESH_SDF.js";
3
+ import { ceil_log2 } from "../../../../core/binary/operations/ceil_log2.js";
3
4
 
4
5
  /**
5
6
  * Where a geometry's sparse distance field sits and how it is cut (PROBE_CLIPMAP_PROPOSAL_2026_10_27.md
@@ -142,7 +143,7 @@ export class MeshSDFLayout {
142
143
  longest = Math.max(longest, bricks);
143
144
  }
144
145
 
145
- this.level_count = 1 + Math.ceil(Math.log2(longest));
146
+ this.level_count = 1 + ceil_log2(longest);
146
147
 
147
148
  let total = 0;
148
149
 
@@ -24,7 +24,8 @@ export const MESH_CARD_CAPTURE_BUDGET_MAX: number;
24
24
  * - Its record (`MESH_CARD_SET_STRUCT`) is written when a capture starts.
25
25
  *
26
26
  * **Lifetime.** {@link acquire} makes a card set for a pair and {@link release} gives it back; the
27
- * caller keeps one per pair. A card set waits until its geometry's layout is placed
27
+ * caller keeps one per pair. A card set of an aliased geometry ({@link alias}) is its source's: it
28
+ * captures the source's layout through the source's meshlets. A card set waits until its geometry's layout is placed
28
29
  * ({@link set_layout}), is then captured, and turns resident ({@link onResident}) on the frame its
29
30
  * last page is recorded: the capture's writes come before any later pass reads it. A layout that
30
31
  * goes ({@link drop_layout}) withdraws its card sets ({@link onWithdrawn}) back to waiting.
@@ -121,7 +122,8 @@ export class GPUMeshCardSets {
121
122
  /**
122
123
  * A card set for a pair. The caller keeps one per pair.
123
124
  *
124
- * @param {number} geometry the geometry id whose layout it captures: the source's, for a skinned row
125
+ * @param {number} geometry the geometry id the pair draws; an aliased one's card set captures its source's
126
+ * layout ({@link alias})
125
127
  * @param {ShadeMaterial} material
126
128
  * @returns {number} card set id
127
129
  */
@@ -152,6 +154,22 @@ export class GPUMeshCardSets {
152
154
  * @param {number} geometry
153
155
  */
154
156
  drop_layout(geometry: number): void;
157
+ /**
158
+ * The geometry `clone` is drawn as `source` from here on: its card sets, and those acquired for it after, capture
159
+ * `source`'s layout through `source`'s meshlets, the two being in one local space. A card set of `clone` waits
160
+ * for `source`'s layout, as one acquired for `source` does.
161
+ *
162
+ * @param {number} clone
163
+ * @param {number} source
164
+ */
165
+ alias(clone: number, source: number): void;
166
+ /**
167
+ * `clone` is no longer aliased: card sets acquired for it from here on capture its own layout. Those it has keep
168
+ * capturing its source's until they are given back.
169
+ *
170
+ * @param {number} clone
171
+ */
172
+ unalias(clone: number): void;
155
173
  /**
156
174
  * Record the frame's capture: at most `budget` pages. Records nothing when nothing waits. Card
157
175
  * sets whose first capture this completes are resident from here, and {@link onResident} is sent
@@ -1 +1 @@
1
- {"version":3,"file":"GPUMeshCardSets.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js"],"names":[],"mappings":"AAyEA;;;;;;GAMG;AACH,sDAHW,aAAa,GACX,MAAM,CAUlB;AApCD;;;GAGG;AACH,2CAFU,MAAM,CAEmF;AA0DnG;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH;IA2LI;;OAEG;IACH,+BAIC;IA3LD;;;OAGG;IACH,gBAA0B;IAE1B;;;OAGG;IACH,iBAA2B;IAmL3B;;;OAGG;IACH,oBAUC;IAED;;OAEG;IACH,6BAEC;IAED;;;OAGG;IACH,mCAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;;OAIG;IACH,mCAIC;IAED;;;OAGG;IACH,2BAcC;IASD;;;;;OAKG;IACH,+BAgBC;IA7BD;;OAEG;IACH,2BAEC;IA0BD;;;;;OAKG;IACH,gBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;OAKG;IACH,gBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;OAGG;IACH,yBAIC;IAED;;;OAGG;IACH,4BAIC;IAED;;;;;;OAMG;IACH,kBAJW,MAAM,YACN,aAAa,GACX,MAAM,CA+BlB;IAED;;OAEG;IACH,YAFW,MAAM,QA2BhB;IAED;;;;;OAKG;IACH,cAFW,MAAM,QAqBhB;IAED;;;;;;;OAOG;IACH,qBALW,MAAM,SACN,MAAM,QACN,MAAM,QAqBhB;IAED;;;;OAIG;IACH,sBAFW,MAAM,QA+BhB;IA0SD;;;;;;;;;;;;;;;;OAgBG;IACH;QAX+B,KAAK,EAAzB,UAAU;QACM,MAAM,EAAtB,MAAM;QACU,KAAK,EAArB,MAAM;QACa,OAAO;QACU,SAAS,EAA7C,0BAA0B;QAEE,iBAAiB,EAA7C,kBAAkB;QAEF,IAAI;aAsG9B;IAiTD;;OAEG;IACH,+BAuBC;IAED,gBAoBC;;CACJ;yBA91CY,OAAO,iEAAiE,EAAE,UAAU;4BACpF,OAAO,oCAAoC,EAAE,aAAa;yCAC1D,OAAO,0DAA0D,EAAE,0BAA0B;iCAC7F,OAAO,yCAAyC,EAAE,kBAAkB;iCACpE,OAAO,yCAAyC,EAAE,kBAAkB;yBACpE,OAAO,yDAAyD,EAAE,UAAU;+BAxB1D,0CAA0C"}
1
+ {"version":3,"file":"GPUMeshCardSets.d.ts","sourceRoot":"","sources":["../../../../../../../src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js"],"names":[],"mappings":"AAyEA;;;;;;GAMG;AACH,sDAHW,aAAa,GACX,MAAM,CAUlB;AApCD;;;GAGG;AACH,2CAFU,MAAM,CAEmF;AA0DnG;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IAiMI;;OAEG;IACH,+BAIC;IAjMD;;;OAGG;IACH,gBAA0B;IAE1B;;;OAGG;IACH,iBAA2B;IAyL3B;;;OAGG;IACH,oBAUC;IAED;;OAEG;IACH,6BAEC;IAED;;;OAGG;IACH,mCAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;;OAIG;IACH,mCAIC;IAED;;;OAGG;IACH,2BAcC;IASD;;;;;OAKG;IACH,+BAgBC;IA7BD;;OAEG;IACH,2BAEC;IA0BD;;;;;OAKG;IACH,gBAHW,MAAM,GACJ,OAAO,CAInB;IAED;;;;;OAKG;IACH,gBAHW,MAAM,GACJ,MAAM,CAIlB;IAED;;;OAGG;IACH,yBAIC;IAED;;;OAGG;IACH,4BAIC;IAED;;;;;;;OAOG;IACH,kBALW,MAAM,YAEN,aAAa,GACX,MAAM,CAiClB;IAED;;OAEG;IACH,YAFW,MAAM,QA2BhB;IAED;;;;;OAKG;IACH,cAFW,MAAM,QAqBhB;IAED;;;;;;;OAOG;IACH,qBALW,MAAM,SACN,MAAM,QACN,MAAM,QAqBhB;IAED;;;;OAIG;IACH,sBAFW,MAAM,QA+BhB;IAED;;;;;;;OAOG;IACH,aAHW,MAAM,UACN,MAAM,QAoChB;IAED;;;;;OAKG;IACH,eAFW,MAAM,QAIhB;IA0SD;;;;;;;;;;;;;;;;OAgBG;IACH;QAX+B,KAAK,EAAzB,UAAU;QACM,MAAM,EAAtB,MAAM;QACU,KAAK,EAArB,MAAM;QACa,OAAO;QACU,SAAS,EAA7C,0BAA0B;QAEE,iBAAiB,EAA7C,kBAAkB;QAEF,IAAI;aAsG9B;IAiTD;;OAEG;IACH,+BAuBC;IAED,gBAoBC;;CACJ;yBA95CY,OAAO,iEAAiE,EAAE,UAAU;4BACpF,OAAO,oCAAoC,EAAE,aAAa;yCAC1D,OAAO,0DAA0D,EAAE,0BAA0B;iCAC7F,OAAO,yCAAyC,EAAE,kBAAkB;iCACpE,OAAO,yCAAyC,EAAE,kBAAkB;yBACpE,OAAO,yDAAyD,EAAE,UAAU;+BAxB1D,0CAA0C"}