@woosh/meep-engine 3.73.0 → 3.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1171) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/build/bundle-worker-terrain.js +1 -1
  3. package/package.json +1 -1
  4. package/src/core/collection/list/IndexedIntrusiveList.d.ts +91 -0
  5. package/src/core/collection/list/IndexedIntrusiveList.d.ts.map +1 -0
  6. package/src/core/collection/list/IndexedIntrusiveList.js +283 -0
  7. package/src/core/geom/2d/hilbert/v2_hilbert_encode.d.ts +11 -0
  8. package/src/core/geom/2d/hilbert/v2_hilbert_encode.d.ts.map +1 -0
  9. package/src/core/geom/2d/hilbert/v2_hilbert_encode.js +46 -0
  10. package/src/core/geom/3d/cone/cone_compute_from_indexed_triangles.d.ts +18 -0
  11. package/src/core/geom/3d/cone/cone_compute_from_indexed_triangles.d.ts.map +1 -0
  12. package/src/core/geom/3d/cone/cone_compute_from_indexed_triangles.js +136 -0
  13. package/src/core/geom/3d/hilbert/v3_hilbert_encode.d.ts +18 -0
  14. package/src/core/geom/3d/hilbert/v3_hilbert_encode.d.ts.map +1 -0
  15. package/src/core/geom/3d/hilbert/v3_hilbert_encode.js +71 -0
  16. package/src/core/geom/3d/hilbert/v3_hilbert_encode_bounded.d.ts +17 -0
  17. package/src/core/geom/3d/hilbert/v3_hilbert_encode_bounded.d.ts.map +1 -0
  18. package/src/core/geom/3d/hilbert/v3_hilbert_encode_bounded.js +47 -0
  19. package/src/core/geom/3d/hilbert/v3_hilbert_encode_normalized.d.ts +16 -0
  20. package/src/core/geom/3d/hilbert/v3_hilbert_encode_normalized.d.ts.map +1 -0
  21. package/src/core/geom/3d/hilbert/v3_hilbert_encode_normalized.js +33 -0
  22. package/src/core/geom/3d/quadric/quadric_attribute_set_from_triangle.d.ts +3 -1
  23. package/src/core/geom/3d/quadric/quadric_attribute_set_from_triangle.d.ts.map +1 -1
  24. package/src/core/geom/3d/quadric/quadric_attribute_set_from_triangle.js +28 -21
  25. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compute_vertex_quadrics.d.ts +3 -1
  26. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compute_vertex_quadrics.d.ts.map +1 -1
  27. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compute_vertex_quadrics.js +337 -251
  28. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compute_wedge_attribute_quadrics.d.ts.map +1 -1
  29. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_compute_wedge_attribute_quadrics.js +137 -104
  30. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.d.ts +20 -5
  31. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.d.ts.map +1 -1
  32. package/src/core/geom/3d/topology/struct/binary/io/bt_mesh_simplify.js +776 -128
  33. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_fold_limit.d.ts +9 -6
  34. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_fold_limit.d.ts.map +1 -1
  35. package/src/core/geom/3d/topology/struct/binary/query/bt_edge_collapse_fold_limit.js +85 -9
  36. package/src/core/math/hash/xxh3_128_slices.d.ts +14 -0
  37. package/src/core/math/hash/xxh3_128_slices.d.ts.map +1 -0
  38. package/src/core/math/hash/xxh3_128_slices.js +57 -0
  39. package/src/core/math/hash/xxh3_64_slices.d.ts +13 -0
  40. package/src/core/math/hash/xxh3_64_slices.d.ts.map +1 -0
  41. package/src/core/math/hash/xxh3_64_slices.js +42 -0
  42. package/src/core/math/hash/xxh3_common.d.ts +38 -11
  43. package/src/core/math/hash/xxh3_common.d.ts.map +1 -1
  44. package/src/core/math/hash/xxh3_common.js +211 -26
  45. package/src/core/process/delay.d.ts +4 -2
  46. package/src/core/process/delay.d.ts.map +1 -1
  47. package/src/core/process/delay.js +30 -6
  48. package/src/engine/control/first-person/FirstPersonPlayerController.d.ts +20 -4
  49. package/src/engine/control/first-person/FirstPersonPlayerController.d.ts.map +1 -1
  50. package/src/engine/control/first-person/FirstPersonPlayerController.js +15 -3
  51. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts +75 -12
  52. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.d.ts.map +1 -1
  53. package/src/engine/control/first-person/FirstPersonPlayerControllerSystem.js +444 -88
  54. package/src/engine/control/first-person/abilities/AbilitySet.d.ts +4 -0
  55. package/src/engine/control/first-person/abilities/AbilitySet.d.ts.map +1 -1
  56. package/src/engine/control/first-person/abilities/AbilitySet.js +4 -0
  57. package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts +111 -14
  58. package/src/engine/control/first-person/composer/EyeOffsetStack.d.ts.map +1 -1
  59. package/src/engine/control/first-person/composer/EyeOffsetStack.js +352 -15
  60. package/src/engine/control/first-person/mastery/MasterySet.d.ts +4 -0
  61. package/src/engine/control/first-person/mastery/MasterySet.d.ts.map +1 -1
  62. package/src/engine/control/first-person/mastery/MasterySet.js +4 -0
  63. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts +13 -1
  64. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.d.ts.map +1 -1
  65. package/src/engine/control/first-person/sensors/FirstPersonSensorsSystem.js +83 -5
  66. package/src/engine/ecs/storage/populateEngineSerializationRegistry.d.ts.map +1 -1
  67. package/src/engine/ecs/storage/populateEngineSerializationRegistry.js +6 -0
  68. package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts +11 -0
  69. package/src/engine/graphics/render/frame_graph/FrameGraph.d.ts.map +1 -1
  70. package/src/engine/graphics/render/frame_graph/FrameGraph.js +1191 -1174
  71. package/src/engine/graphics3/GPUAcousticSystem.d.ts +143 -0
  72. package/src/engine/graphics3/GPUAcousticSystem.d.ts.map +1 -0
  73. package/src/engine/graphics3/GPUAcousticSystem.js +691 -0
  74. package/src/engine/graphics3/prefab/prefab_skin_clip_scale_conflicts.d.ts +10 -26
  75. package/src/engine/graphics3/prefab/prefab_skin_clip_scale_conflicts.d.ts.map +1 -1
  76. package/src/engine/graphics3/prefab/prefab_skin_clip_scale_conflicts.js +505 -128
  77. package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts +2 -3
  78. package/src/engine/physics/cloth/collider/ClothColliderIndex.d.ts.map +1 -1
  79. package/src/engine/physics/cloth/collider/ClothColliderIndex.js +2 -3
  80. package/src/engine/physics/cloth/ecs/ClothColliderSystem.d.ts +1 -3
  81. package/src/engine/physics/cloth/ecs/ClothColliderSystem.d.ts.map +1 -1
  82. package/src/engine/physics/cloth/ecs/ClothColliderSystem.js +1 -3
  83. package/src/engine/physics/ecs/ColliderObserverSystem.d.ts +40 -9
  84. package/src/engine/physics/ecs/ColliderObserverSystem.d.ts.map +1 -1
  85. package/src/engine/physics/ecs/ColliderObserverSystem.js +301 -20
  86. package/src/engine/physics/ecs/PhysicsSystem.d.ts +16 -0
  87. package/src/engine/physics/ecs/PhysicsSystem.d.ts.map +1 -1
  88. package/src/engine/physics/ecs/PhysicsSystem.js +31 -0
  89. package/src/engine/physics/ecs/RigidBody.d.ts +27 -4
  90. package/src/engine/physics/ecs/RigidBody.d.ts.map +1 -1
  91. package/src/engine/physics/ecs/RigidBody.js +37 -4
  92. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  93. package/src/engine/physics/inertia/rigid_body_set_mass_properties.d.ts.map +1 -1
  94. package/src/engine/physics/inertia/rigid_body_set_mass_properties.js +5 -0
  95. package/src/engine/physics/inertia/rigid_body_set_shape_mass.d.ts +21 -0
  96. package/src/engine/physics/inertia/rigid_body_set_shape_mass.d.ts.map +1 -0
  97. package/src/engine/physics/inertia/rigid_body_set_shape_mass.js +90 -0
  98. package/src/engine/physics/inertia/shape_mass_properties.d.ts +28 -0
  99. package/src/engine/physics/inertia/shape_mass_properties.d.ts.map +1 -0
  100. package/src/engine/physics/inertia/shape_mass_properties.js +413 -0
  101. package/src/engine/physics/inverse_kinematics/two_bone_path_solve.d.ts +4 -1
  102. package/src/engine/physics/inverse_kinematics/two_bone_path_solve.d.ts.map +1 -1
  103. package/src/engine/physics/inverse_kinematics/two_bone_path_solve.js +9 -2
  104. package/src/engine/physics/inverse_kinematics/two_joint_ik.d.ts +7 -2
  105. package/src/engine/physics/inverse_kinematics/two_joint_ik.d.ts.map +1 -1
  106. package/src/engine/physics/inverse_kinematics/two_joint_ik.js +71 -2
  107. package/src/engine/sound/SoundEngine.d.ts +3 -7
  108. package/src/engine/sound/SoundEngine.d.ts.map +1 -1
  109. package/src/engine/sound/SoundEngine.js +142 -146
  110. package/src/engine/sound/ecs/audio/AudioEmitter.d.ts.map +1 -1
  111. package/src/engine/sound/ecs/audio/AudioEmitter.js +3 -4
  112. package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts +0 -6
  113. package/src/engine/sound/ecs/audio/AudioEmitterSystem.d.ts.map +1 -1
  114. package/src/engine/sound/ecs/audio/AudioEmitterSystem.js +44 -56
  115. package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts +2 -3
  116. package/src/engine/sound/ecs/audio/LiveEmitterSet.d.ts.map +1 -1
  117. package/src/engine/sound/ecs/audio/LiveEmitterSet.js +7 -9
  118. package/src/engine/sound/simulation/AcousticSimulator.d.ts +36 -98
  119. package/src/engine/sound/simulation/AcousticSimulator.d.ts.map +1 -1
  120. package/src/engine/sound/simulation/AcousticSimulator.js +160 -467
  121. package/src/engine/sound/simulation/README.md +216 -217
  122. package/src/engine/sound/simulation/configureAcousticSimulation.d.ts +12 -22
  123. package/src/engine/sound/simulation/configureAcousticSimulation.d.ts.map +1 -1
  124. package/src/engine/sound/simulation/configureAcousticSimulation.js +13 -31
  125. package/src/engine/sound/simulation/core/AcousticPropagation.d.ts +51 -0
  126. package/src/engine/sound/simulation/core/AcousticPropagation.d.ts.map +1 -0
  127. package/src/engine/sound/simulation/core/AcousticPropagation.js +58 -0
  128. package/src/engine/sound/simulation/core/AcousticRegionIndex.d.ts +2 -2
  129. package/src/engine/sound/simulation/core/AcousticRegionIndex.js +2 -2
  130. package/src/engine/sound/simulation/core/AcousticSolution.d.ts +41 -38
  131. package/src/engine/sound/simulation/core/AcousticSolution.d.ts.map +1 -1
  132. package/src/engine/sound/simulation/core/AcousticSolution.js +63 -53
  133. package/src/engine/sound/simulation/core/DEFAULT_ACOUSTIC_SOURCE_RADIUS.d.ts +9 -0
  134. package/src/engine/sound/simulation/core/DEFAULT_ACOUSTIC_SOURCE_RADIUS.d.ts.map +1 -0
  135. package/src/engine/sound/simulation/core/DEFAULT_ACOUSTIC_SOURCE_RADIUS.js +8 -0
  136. package/src/engine/sound/simulation/core/air_tilt_gain.d.ts +10 -0
  137. package/src/engine/sound/simulation/core/air_tilt_gain.d.ts.map +1 -0
  138. package/src/engine/sound/simulation/core/air_tilt_gain.js +13 -0
  139. package/src/engine/sound/simulation/ecs/AcousticBody.d.ts +4 -6
  140. package/src/engine/sound/simulation/ecs/AcousticBody.d.ts.map +1 -1
  141. package/src/engine/sound/simulation/ecs/AcousticBody.js +4 -6
  142. package/src/engine/sound/simulation/legacy/AcousticProbeField.d.ts +24 -0
  143. package/src/engine/sound/simulation/legacy/AcousticProbeField.d.ts.map +1 -0
  144. package/src/engine/sound/simulation/legacy/AcousticProbeField.js +28 -0
  145. package/src/engine/sound/simulation/{probe → legacy}/AcousticProbeFieldSerializationAdapter.d.ts +4 -5
  146. package/src/engine/sound/simulation/legacy/AcousticProbeFieldSerializationAdapter.d.ts.map +1 -0
  147. package/src/engine/sound/simulation/legacy/AcousticProbeFieldSerializationAdapter.js +37 -0
  148. package/src/engine/sound/simulation/{core → oracle}/RayHit.d.ts +4 -5
  149. package/src/engine/sound/simulation/oracle/RayHit.d.ts.map +1 -0
  150. package/src/engine/sound/simulation/{core → oracle}/RayHit.js +4 -5
  151. package/src/engine/sound/simulation/{probe → oracle}/acoustic_trace_energy.d.ts +5 -2
  152. package/src/engine/sound/simulation/oracle/acoustic_trace_energy.d.ts.map +1 -0
  153. package/src/engine/sound/simulation/{probe → oracle}/acoustic_trace_energy.js +2 -2
  154. package/src/engine/sound/simulation/oracle/echogram_band_rt60.d.ts.map +1 -0
  155. package/src/engine/sound/simulation/serialization/populateAcousticSerializationRegistry.d.ts +3 -2
  156. package/src/engine/sound/simulation/serialization/populateAcousticSerializationRegistry.d.ts.map +1 -1
  157. package/src/engine/sound/simulation/serialization/populateAcousticSerializationRegistry.js +4 -3
  158. package/src/engine/sound/sopra/README.md +93 -1
  159. package/src/engine/sound/sopra/SopraEngine.d.ts +6 -0
  160. package/src/engine/sound/sopra/SopraEngine.d.ts.map +1 -1
  161. package/src/engine/sound/sopra/SopraEngine.js +31 -0
  162. package/src/engine/sound/sopra/definition/EventDescription.d.ts +0 -5
  163. package/src/engine/sound/sopra/definition/EventDescription.d.ts.map +1 -1
  164. package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts +0 -5
  165. package/src/engine/sound/sopra/definition/clip/SwitchContainerAudioClip.d.ts.map +1 -1
  166. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts +8 -1
  167. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.d.ts.map +1 -1
  168. package/src/engine/sound/sopra/definition/effect/AbstractAudioEffect.js +4 -1
  169. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.d.ts +37 -0
  170. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.d.ts.map +1 -0
  171. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffect.js +62 -0
  172. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffectSerializationAdapter.d.ts +20 -0
  173. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffectSerializationAdapter.d.ts.map +1 -0
  174. package/src/engine/sound/sopra/definition/effect/AcousticReverbEffectSerializationAdapter.js +24 -0
  175. package/src/engine/sound/sopra/definition/effect/ReverbEffect.d.ts.map +1 -1
  176. package/src/engine/sound/sopra/definition/effect/ReverbEffect.js +2 -4
  177. package/src/engine/sound/sopra/music/MusicCue.d.ts +88 -0
  178. package/src/engine/sound/sopra/music/MusicCue.d.ts.map +1 -0
  179. package/src/engine/sound/sopra/music/MusicCue.js +139 -0
  180. package/src/engine/sound/sopra/music/MusicGrid.d.ts +125 -0
  181. package/src/engine/sound/sopra/music/MusicGrid.d.ts.map +1 -0
  182. package/src/engine/sound/sopra/music/MusicGrid.js +210 -0
  183. package/src/engine/sound/sopra/music/MusicLeadIn.d.ts +15 -0
  184. package/src/engine/sound/sopra/music/MusicLeadIn.d.ts.map +1 -0
  185. package/src/engine/sound/sopra/music/MusicLeadIn.js +24 -0
  186. package/src/engine/sound/sopra/music/MusicPlayer.d.ts +241 -0
  187. package/src/engine/sound/sopra/music/MusicPlayer.d.ts.map +1 -0
  188. package/src/engine/sound/sopra/music/MusicPlayer.js +1102 -0
  189. package/src/engine/sound/sopra/music/MusicQuantize.d.ts +16 -0
  190. package/src/engine/sound/sopra/music/MusicQuantize.d.ts.map +1 -0
  191. package/src/engine/sound/sopra/music/MusicQuantize.js +29 -0
  192. package/src/engine/sound/sopra/music/MusicSegment.d.ts +110 -0
  193. package/src/engine/sound/sopra/music/MusicSegment.d.ts.map +1 -0
  194. package/src/engine/sound/sopra/music/MusicSegment.js +168 -0
  195. package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.d.ts +118 -0
  196. package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.d.ts.map +1 -0
  197. package/src/engine/sound/sopra/runtime/AcousticReverbConvolution.js +472 -0
  198. package/src/engine/sound/sopra/runtime/AcousticReverbLines.d.ts +166 -0
  199. package/src/engine/sound/sopra/runtime/AcousticReverbLines.d.ts.map +1 -0
  200. package/src/engine/sound/sopra/runtime/AcousticReverbLines.js +447 -0
  201. package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.d.ts +139 -0
  202. package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.d.ts.map +1 -0
  203. package/src/engine/sound/sopra/runtime/AcousticReverbNetwork.js +537 -0
  204. package/src/engine/sound/sopra/runtime/AcousticSpeakers.d.ts +102 -0
  205. package/src/engine/sound/sopra/runtime/AcousticSpeakers.d.ts.map +1 -0
  206. package/src/engine/sound/sopra/runtime/AcousticSpeakers.js +232 -0
  207. package/src/engine/sound/sopra/runtime/BusGraph.d.ts +32 -2
  208. package/src/engine/sound/sopra/runtime/BusGraph.d.ts.map +1 -1
  209. package/src/engine/sound/sopra/runtime/BusGraph.js +105 -4
  210. package/src/engine/sound/sopra/runtime/EffectChain.d.ts +5 -0
  211. package/src/engine/sound/sopra/runtime/EffectChain.d.ts.map +1 -1
  212. package/src/engine/sound/sopra/runtime/EffectChain.js +308 -286
  213. package/src/engine/sound/sopra/runtime/EventInstance.d.ts +29 -11
  214. package/src/engine/sound/sopra/runtime/EventInstance.d.ts.map +1 -1
  215. package/src/engine/sound/sopra/runtime/EventInstance.js +383 -180
  216. package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.d.ts +13 -0
  217. package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.d.ts.map +1 -0
  218. package/src/engine/sound/sopra/runtime/acoustic_reverb_decay.js +15 -0
  219. package/src/engine/sound/sopra/runtime/acoustic_writes.d.ts +62 -0
  220. package/src/engine/sound/sopra/runtime/acoustic_writes.d.ts.map +1 -0
  221. package/src/engine/sound/sopra/runtime/acoustic_writes.js +114 -0
  222. package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.d.ts.map +1 -1
  223. package/src/engine/sound/sopra/serialization/populateSopraSerializationRegistry.js +2 -0
  224. package/src/engine/sound/sopra/serialization/sopraJSON.d.ts.map +1 -1
  225. package/src/engine/sound/sopra/serialization/sopraJSON.js +4 -0
  226. package/src/engine/sound/sopra/util/MockAudioContext.d.ts +13 -1
  227. package/src/engine/sound/sopra/util/MockAudioContext.d.ts.map +1 -1
  228. package/src/engine/sound/sopra/util/MockAudioContext.js +27 -2
  229. package/src/engine/sound/sopra/util/biquad_shelf.d.ts +22 -0
  230. package/src/engine/sound/sopra/util/biquad_shelf.d.ts.map +1 -0
  231. package/src/engine/sound/sopra/util/biquad_shelf.js +69 -0
  232. package/src/engine/sound/{simulation/render → sopra/util}/reverbImpulseResponse.d.ts +3 -3
  233. package/src/engine/sound/sopra/util/reverbImpulseResponse.d.ts.map +1 -0
  234. package/src/engine/sound/{simulation/render → sopra/util}/reverbImpulseResponse.js +4 -12
  235. package/src/engine/sound/{simulation/render → sopra/util}/reverb_band_tails.d.ts +5 -12
  236. package/src/engine/sound/sopra/util/reverb_band_tails.d.ts.map +1 -0
  237. package/src/engine/sound/{simulation/render → sopra/util}/reverb_band_tails.js +5 -12
  238. package/src/engine/sound/sopra/util/three_band_split.d.ts +41 -0
  239. package/src/engine/sound/sopra/util/three_band_split.d.ts.map +1 -0
  240. package/src/engine/sound/sopra/util/three_band_split.js +86 -0
  241. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.d.ts.map +1 -1
  242. package/src/generation/grid/generation/discrete/GridTaskConnectRooms.js +4 -6
  243. package/src/shade/device/SHADE_DEVICE_FLOOR.d.ts.map +1 -1
  244. package/src/shade/device/SHADE_DEVICE_FLOOR.js +2 -0
  245. package/src/shade/playground/acoustics/index.html +111 -0
  246. package/src/shade/playground/acoustics/main.d.ts +2 -0
  247. package/src/shade/playground/acoustics/main.d.ts.map +1 -0
  248. package/src/shade/playground/acoustics/main.js +466 -0
  249. package/src/shade/playground/acoustics/scene.d.ts +60 -0
  250. package/src/shade/playground/acoustics/scene.d.ts.map +1 -0
  251. package/src/shade/playground/acoustics/scene.js +179 -0
  252. package/src/shade/playground/contact_shadows/ContactShadowLab.js +1 -1
  253. package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.d.ts.map +1 -1
  254. package/src/shade/playground/skinned_blas_refit/diff_traced_against_rasterized.js +4 -5
  255. package/src/shade/playground/skinned_blas_refit/main.d.ts.map +1 -1
  256. package/src/shade/playground/skinned_blas_refit/main.js +6 -12
  257. package/src/shade/playground/skinned_mesh_soup/main.d.ts.map +1 -1
  258. package/src/shade/playground/skinned_mesh_soup/main.js +1 -2
  259. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.d.ts.map +1 -1
  260. package/src/shade/playground/skinned_mesh_soup/verify_clone_vertices.js +2 -1
  261. package/src/shade/playground/vgeo_scene/README.md +18 -6
  262. package/src/shade/playground/vgeo_scene/main.js +80 -35
  263. package/src/shade/playground/volumetrics_froxel/README.md +191 -191
  264. package/src/shade/playground/volumetrics_froxel/measure.d.ts +3 -3
  265. package/src/shade/playground/volumetrics_froxel/measure.d.ts.map +1 -1
  266. package/src/shade/playground/volumetrics_froxel/measure.js +11 -13
  267. package/src/shade/playground/vsm/main.d.ts.map +1 -1
  268. package/src/shade/playground/vsm/main.js +5 -6
  269. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  270. package/src/shade/renderer/Renderer.js +98 -4
  271. package/src/shade/renderer/acoustics/ACOUSTICS.d.ts +107 -0
  272. package/src/shade/renderer/acoustics/ACOUSTICS.d.ts.map +1 -0
  273. package/src/shade/renderer/acoustics/ACOUSTICS.js +127 -0
  274. package/src/shade/renderer/acoustics/ACOUSTIC_DATABASE_SPEC.d.ts +61 -0
  275. package/src/shade/renderer/acoustics/ACOUSTIC_DATABASE_SPEC.d.ts.map +1 -0
  276. package/src/shade/renderer/acoustics/ACOUSTIC_DATABASE_SPEC.js +134 -0
  277. package/src/shade/renderer/acoustics/ACOUSTIC_FRAME_STRUCT.d.ts +10 -0
  278. package/src/shade/renderer/acoustics/ACOUSTIC_FRAME_STRUCT.d.ts.map +1 -0
  279. package/src/shade/renderer/acoustics/ACOUSTIC_FRAME_STRUCT.js +35 -0
  280. package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.d.ts +28 -0
  281. package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.d.ts.map +1 -0
  282. package/src/shade/renderer/acoustics/ACOUSTIC_LISTENER_RESOURCES.js +42 -0
  283. package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.d.ts +58 -0
  284. package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.d.ts.map +1 -0
  285. package/src/shade/renderer/acoustics/ACOUSTIC_PROBE_DATABASE_SPEC.js +108 -0
  286. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts +119 -0
  287. package/src/shade/renderer/acoustics/GPUAcousticLattice.d.ts.map +1 -0
  288. package/src/shade/renderer/acoustics/GPUAcousticLattice.js +356 -0
  289. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts +161 -0
  290. package/src/shade/renderer/acoustics/GPUAcousticProbes.d.ts.map +1 -0
  291. package/src/shade/renderer/acoustics/GPUAcousticProbes.js +760 -0
  292. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts +201 -0
  293. package/src/shade/renderer/acoustics/GPUAcoustics.d.ts.map +1 -0
  294. package/src/shade/renderer/acoustics/GPUAcoustics.js +983 -0
  295. package/src/shade/renderer/acoustics/GPUBrickAcoustics.d.ts +91 -0
  296. package/src/shade/renderer/acoustics/GPUBrickAcoustics.d.ts.map +1 -0
  297. package/src/shade/renderer/acoustics/GPUBrickAcoustics.js +260 -0
  298. package/src/shade/renderer/acoustics/acoustic_allocate_parts.d.ts +19 -0
  299. package/src/shade/renderer/acoustics/acoustic_allocate_parts.d.ts.map +1 -0
  300. package/src/shade/renderer/acoustics/acoustic_allocate_parts.js +78 -0
  301. package/src/shade/renderer/acoustics/acoustic_listener_order.d.ts +12 -0
  302. package/src/shade/renderer/acoustics/acoustic_listener_order.d.ts.map +1 -0
  303. package/src/shade/renderer/acoustics/acoustic_listener_order.js +56 -0
  304. package/src/shade/renderer/acoustics/chunk_acoustic_age.d.ts +18 -0
  305. package/src/shade/renderer/acoustics/chunk_acoustic_age.d.ts.map +1 -0
  306. package/src/shade/renderer/acoustics/chunk_acoustic_age.js +25 -0
  307. package/src/shade/renderer/acoustics/chunk_acoustic_direct.d.ts +39 -0
  308. package/src/shade/renderer/acoustics/chunk_acoustic_direct.d.ts.map +1 -0
  309. package/src/shade/renderer/acoustics/chunk_acoustic_direct.js +133 -0
  310. package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.d.ts +57 -0
  311. package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.d.ts.map +1 -0
  312. package/src/shade/renderer/acoustics/chunk_acoustic_direct_cone.js +314 -0
  313. package/src/shade/renderer/acoustics/chunk_acoustic_finite.d.ts +15 -0
  314. package/src/shade/renderer/acoustics/chunk_acoustic_finite.d.ts.map +1 -0
  315. package/src/shade/renderer/acoustics/chunk_acoustic_finite.js +21 -0
  316. package/src/shade/renderer/acoustics/chunk_acoustic_gather.d.ts +37 -0
  317. package/src/shade/renderer/acoustics/chunk_acoustic_gather.d.ts.map +1 -0
  318. package/src/shade/renderer/acoustics/chunk_acoustic_gather.js +128 -0
  319. package/src/shade/renderer/acoustics/chunk_acoustic_lean.d.ts +27 -0
  320. package/src/shade/renderer/acoustics/chunk_acoustic_lean.d.ts.map +1 -0
  321. package/src/shade/renderer/acoustics/chunk_acoustic_lean.js +42 -0
  322. package/src/shade/renderer/acoustics/chunk_acoustic_listener.d.ts +80 -0
  323. package/src/shade/renderer/acoustics/chunk_acoustic_listener.d.ts.map +1 -0
  324. package/src/shade/renderer/acoustics/chunk_acoustic_listener.js +274 -0
  325. package/src/shade/renderer/acoustics/chunk_acoustic_lobe.d.ts +27 -0
  326. package/src/shade/renderer/acoustics/chunk_acoustic_lobe.d.ts.map +1 -0
  327. package/src/shade/renderer/acoustics/chunk_acoustic_lobe.js +42 -0
  328. package/src/shade/renderer/acoustics/chunk_acoustic_partials.d.ts +43 -0
  329. package/src/shade/renderer/acoustics/chunk_acoustic_partials.d.ts.map +1 -0
  330. package/src/shade/renderer/acoustics/chunk_acoustic_partials.js +65 -0
  331. package/src/shade/renderer/acoustics/chunk_acoustic_phonon.d.ts +115 -0
  332. package/src/shade/renderer/acoustics/chunk_acoustic_phonon.d.ts.map +1 -0
  333. package/src/shade/renderer/acoustics/chunk_acoustic_phonon.js +326 -0
  334. package/src/shade/renderer/acoustics/chunk_acoustic_reconnect.d.ts +41 -0
  335. package/src/shade/renderer/acoustics/chunk_acoustic_reconnect.d.ts.map +1 -0
  336. package/src/shade/renderer/acoustics/chunk_acoustic_reconnect.js +163 -0
  337. package/src/shade/renderer/acoustics/chunk_acoustic_resample.d.ts +32 -0
  338. package/src/shade/renderer/acoustics/chunk_acoustic_resample.d.ts.map +1 -0
  339. package/src/shade/renderer/acoustics/chunk_acoustic_resample.js +139 -0
  340. package/src/shade/renderer/acoustics/chunk_acoustic_reservoir.d.ts +92 -0
  341. package/src/shade/renderer/acoustics/chunk_acoustic_reservoir.d.ts.map +1 -0
  342. package/src/shade/renderer/acoustics/chunk_acoustic_reservoir.js +429 -0
  343. package/src/shade/renderer/acoustics/chunk_acoustic_through.d.ts +43 -0
  344. package/src/shade/renderer/acoustics/chunk_acoustic_through.d.ts.map +1 -0
  345. package/src/shade/renderer/acoustics/chunk_acoustic_through.js +153 -0
  346. package/src/shade/renderer/acoustics/chunk_acoustic_trace.d.ts +34 -0
  347. package/src/shade/renderer/acoustics/chunk_acoustic_trace.d.ts.map +1 -0
  348. package/src/shade/renderer/acoustics/chunk_acoustic_trace.js +88 -0
  349. package/src/shade/renderer/acoustics/chunk_brick_acoustics.d.ts +84 -0
  350. package/src/shade/renderer/acoustics/chunk_brick_acoustics.d.ts.map +1 -0
  351. package/src/shade/renderer/acoustics/chunk_brick_acoustics.js +203 -0
  352. package/src/shade/renderer/acoustics/shader_acoustic_combine.d.ts +21 -0
  353. package/src/shade/renderer/acoustics/shader_acoustic_combine.d.ts.map +1 -0
  354. package/src/shade/renderer/acoustics/shader_acoustic_combine.js +205 -0
  355. package/src/shade/renderer/acoustics/shader_acoustic_coupling.d.ts +14 -0
  356. package/src/shade/renderer/acoustics/shader_acoustic_coupling.d.ts.map +1 -0
  357. package/src/shade/renderer/acoustics/shader_acoustic_coupling.js +102 -0
  358. package/src/shade/renderer/acoustics/shader_acoustic_listener.d.ts +12 -0
  359. package/src/shade/renderer/acoustics/shader_acoustic_listener.d.ts.map +1 -0
  360. package/src/shade/renderer/acoustics/shader_acoustic_listener.js +80 -0
  361. package/src/shade/renderer/acoustics/shader_acoustic_phonon_step.d.ts +22 -0
  362. package/src/shade/renderer/acoustics/shader_acoustic_phonon_step.d.ts.map +1 -0
  363. package/src/shade/renderer/acoustics/shader_acoustic_phonon_step.js +106 -0
  364. package/src/shade/renderer/acoustics/shader_acoustic_receive.d.ts +33 -0
  365. package/src/shade/renderer/acoustics/shader_acoustic_receive.d.ts.map +1 -0
  366. package/src/shade/renderer/acoustics/shader_acoustic_receive.js +327 -0
  367. package/src/shade/renderer/acoustics/shader_acoustic_room.d.ts +11 -0
  368. package/src/shade/renderer/acoustics/shader_acoustic_room.d.ts.map +1 -0
  369. package/src/shade/renderer/acoustics/shader_acoustic_room.js +111 -0
  370. package/src/shade/renderer/acoustics/shader_acoustic_source.d.ts +18 -0
  371. package/src/shade/renderer/acoustics/shader_acoustic_source.d.ts.map +1 -0
  372. package/src/shade/renderer/acoustics/shader_acoustic_source.js +130 -0
  373. package/src/shade/renderer/acoustics/shader_brick_acoustics_gather.d.ts +20 -0
  374. package/src/shade/renderer/acoustics/shader_brick_acoustics_gather.d.ts.map +1 -0
  375. package/src/shade/renderer/acoustics/shader_brick_acoustics_gather.js +121 -0
  376. package/src/shade/renderer/animation/ShadeAnimationChannel.d.ts.map +1 -1
  377. package/src/shade/renderer/animation/ShadeAnimationChannel.js +67 -0
  378. package/src/shade/renderer/animation/skin_clip_scale_conflicts.d.ts +34 -8
  379. package/src/shade/renderer/animation/skin_clip_scale_conflicts.d.ts.map +1 -1
  380. package/src/shade/renderer/animation/skin_clip_scale_conflicts.js +296 -75
  381. package/src/shade/renderer/animation/skinning/GPUMeshSkinningContext.js +2 -2
  382. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_reduce.d.ts.map +1 -1
  383. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_reduce.js +13 -1
  384. package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.d.ts.map +1 -1
  385. package/src/shade/renderer/animation/skinning/shader_meshlet_apply_skinning.js +52 -62
  386. package/src/shade/renderer/buffer/table/GPUDatabaseReadback.d.ts +16 -10
  387. package/src/shade/renderer/buffer/table/GPUDatabaseReadback.d.ts.map +1 -1
  388. package/src/shade/renderer/buffer/table/GPUDatabaseReadback.js +60 -29
  389. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts +4 -5
  390. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.d.ts.map +1 -1
  391. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct.js +6 -11
  392. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.d.ts.map +1 -1
  393. package/src/shade/renderer/deferred/chunk_shade_standard_material_direct_restir.js +0 -3
  394. package/src/shade/renderer/deferred/shader_deferred_main.d.ts +0 -6
  395. package/src/shade/renderer/deferred/shader_deferred_main.d.ts.map +1 -1
  396. package/src/shade/renderer/deferred/shader_deferred_main.js +0 -9
  397. package/src/shade/renderer/extension/FrameContext.d.ts +12 -1
  398. package/src/shade/renderer/extension/FrameContext.d.ts.map +1 -1
  399. package/src/shade/renderer/extension/FrameContext.js +24 -1
  400. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  401. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  402. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +7 -7
  403. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  404. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  405. package/src/shade/renderer/geometry/GEOMETRY_ATTRIBUTE_DATA_TYPE.d.ts +2 -1
  406. package/src/shade/renderer/geometry/GEOMETRY_ATTRIBUTE_DATA_TYPE.d.ts.map +1 -1
  407. package/src/shade/renderer/geometry/GEOMETRY_ATTRIBUTE_DATA_TYPE.js +3 -2
  408. package/src/shade/renderer/geometry/GPUGeometryManager.d.ts +48 -0
  409. package/src/shade/renderer/geometry/GPUGeometryManager.d.ts.map +1 -1
  410. package/src/shade/renderer/geometry/GPUGeometryManager.js +285 -19
  411. package/src/shade/renderer/geometry/MESHLET_GEOMETRY_TREE_TAG_BVH8.d.ts +13 -0
  412. package/src/shade/renderer/geometry/MESHLET_GEOMETRY_TREE_TAG_BVH8.d.ts.map +1 -0
  413. package/src/shade/renderer/geometry/MESHLET_GEOMETRY_TREE_TAG_BVH8.js +12 -0
  414. package/src/shade/renderer/geometry/MeshletGeometry.d.ts +8 -0
  415. package/src/shade/renderer/geometry/MeshletGeometry.d.ts.map +1 -1
  416. package/src/shade/renderer/geometry/MeshletGeometry.js +11 -0
  417. package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.d.ts +12 -15
  418. package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.d.ts.map +1 -1
  419. package/src/shade/renderer/geometry/MeshletGeometrySerializationAdapter.js +40 -16
  420. package/src/shade/renderer/geometry/MeshletGeometrySerializationUpgrader_0_1.d.ts +17 -0
  421. package/src/shade/renderer/geometry/MeshletGeometrySerializationUpgrader_0_1.d.ts.map +1 -0
  422. package/src/shade/renderer/geometry/MeshletGeometrySerializationUpgrader_0_1.js +65 -0
  423. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts +43 -0
  424. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.d.ts.map +1 -1
  425. package/src/shade/renderer/geometry/bvh/GPUGeometryBVHManager.js +121 -1
  426. package/src/shade/renderer/geometry/geometry_build_from_meshlet_geometry.d.ts +2 -1
  427. package/src/shade/renderer/geometry/geometry_build_from_meshlet_geometry.d.ts.map +1 -1
  428. package/src/shade/renderer/geometry/geometry_build_from_meshlet_geometry.js +78 -132
  429. package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.d.ts +10 -4
  430. package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.d.ts.map +1 -1
  431. package/src/shade/renderer/geometry/meshlet/GPUMeshletManager.js +89 -30
  432. package/src/shade/renderer/geometry/meshlet/MeshletBatch.d.ts.map +1 -1
  433. package/src/shade/renderer/geometry/meshlet/MeshletBatch.js +151 -204
  434. package/src/shade/renderer/geometry/meshlet/encoding/ENCODED_ATTRIBUTE_DEFAULT_VALUES.d.ts +1 -7
  435. package/src/shade/renderer/geometry/meshlet/encoding/ENCODED_ATTRIBUTE_DEFAULT_VALUES.d.ts.map +1 -1
  436. package/src/shade/renderer/geometry/meshlet/encoding/ENCODED_ATTRIBUTE_DEFAULT_VALUES.js +9 -25
  437. package/src/shade/renderer/geometry/meshlet/encoding/ENCODED_ATTRIBUTE_SIZES.d.ts +5 -1
  438. package/src/shade/renderer/geometry/meshlet/encoding/ENCODED_ATTRIBUTE_SIZES.d.ts.map +1 -1
  439. package/src/shade/renderer/geometry/meshlet/encoding/ENCODED_ATTRIBUTE_SIZES.js +7 -6
  440. package/src/shade/renderer/geometry/meshlet/encoding/ENCODED_ORDERED_ATTRIBUTES.d.ts +5 -0
  441. package/src/shade/renderer/geometry/meshlet/encoding/ENCODED_ORDERED_ATTRIBUTES.d.ts.map +1 -1
  442. package/src/shade/renderer/geometry/meshlet/encoding/ENCODED_ORDERED_ATTRIBUTES.js +5 -2
  443. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_ATTRIBUTE_COMPRESSION_FLAGS.d.ts.map +1 -1
  444. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_ATTRIBUTE_COMPRESSION_FLAGS.js +1 -2
  445. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_FLAG_FIELD.d.ts +14 -0
  446. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_FLAG_FIELD.d.ts.map +1 -0
  447. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_FLAG_FIELD.js +33 -0
  448. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_FORMAT_VERSION.d.ts +12 -0
  449. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_FORMAT_VERSION.d.ts.map +1 -0
  450. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_FORMAT_VERSION.js +11 -0
  451. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_FRAME_NORMAL_REACH.d.ts +13 -0
  452. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_FRAME_NORMAL_REACH.d.ts.map +1 -0
  453. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_FRAME_NORMAL_REACH.js +12 -0
  454. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_METADATA_FLAGS.d.ts +4 -0
  455. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_METADATA_FLAGS.d.ts.map +1 -1
  456. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_METADATA_FLAGS.js +10 -1
  457. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_METADATA_STRUCT.d.ts +4 -0
  458. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_METADATA_STRUCT.d.ts.map +1 -1
  459. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_METADATA_STRUCT.js +19 -6
  460. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_POSITION_EXPONENT_FLOOR.d.ts +10 -0
  461. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_POSITION_EXPONENT_FLOOR.d.ts.map +1 -0
  462. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_POSITION_EXPONENT_FLOOR.js +9 -0
  463. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_POSITION_FORM.d.ts +14 -0
  464. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_POSITION_FORM.d.ts.map +1 -0
  465. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_POSITION_FORM.js +25 -0
  466. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_UV0_EXPONENT.d.ts +7 -0
  467. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_UV0_EXPONENT.d.ts.map +1 -0
  468. package/src/shade/renderer/geometry/meshlet/encoding/MESHLET_UV0_EXPONENT.js +6 -0
  469. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_frame_decode.d.ts +18 -0
  470. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_frame_decode.d.ts.map +1 -0
  471. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_frame_decode.js +52 -0
  472. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_frame_encode.d.ts +23 -0
  473. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_frame_encode.d.ts.map +1 -0
  474. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_frame_encode.js +71 -0
  475. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_lattice_snap.d.ts +18 -0
  476. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_lattice_snap.d.ts.map +1 -0
  477. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_lattice_snap.js +28 -0
  478. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_payload_encode.d.ts +32 -0
  479. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_payload_encode.d.ts.map +1 -0
  480. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_payload_encode.js +155 -0
  481. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_decode.d.ts +15 -0
  482. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_decode.d.ts.map +1 -0
  483. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_decode.js +65 -0
  484. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_encode.d.ts +34 -0
  485. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_encode.d.ts.map +1 -0
  486. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_encode.js +170 -0
  487. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_exponent.d.ts +16 -0
  488. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_exponent.d.ts.map +1 -0
  489. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_exponent.js +26 -0
  490. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_exponent_from_measure.d.ts +17 -0
  491. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_exponent_from_measure.d.ts.map +1 -0
  492. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_exponent_from_measure.js +46 -0
  493. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_measure.d.ts +14 -0
  494. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_measure.d.ts.map +1 -0
  495. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_measure.js +65 -0
  496. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_words.d.ts +6 -0
  497. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_words.d.ts.map +1 -0
  498. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_position_words.js +12 -0
  499. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_uv0_decode.d.ts +13 -0
  500. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_uv0_decode.d.ts.map +1 -0
  501. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_uv0_decode.js +40 -0
  502. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_uv0_encode.d.ts +23 -0
  503. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_uv0_encode.d.ts.map +1 -0
  504. package/src/shade/renderer/geometry/meshlet/encoding/meshlet_uv0_encode.js +103 -0
  505. package/src/shade/renderer/geometry/meshlet/meshlet_can_compress_attribute.d.ts +6 -4
  506. package/src/shade/renderer/geometry/meshlet/meshlet_can_compress_attribute.d.ts.map +1 -1
  507. package/src/shade/renderer/geometry/meshlet/meshlet_can_compress_attribute.js +11 -13
  508. package/src/shade/renderer/geometry/meshlet/meshlet_data_words.d.ts +9 -0
  509. package/src/shade/renderer/geometry/meshlet/meshlet_data_words.d.ts.map +1 -0
  510. package/src/shade/renderer/geometry/meshlet/meshlet_data_words.js +23 -0
  511. package/src/shade/renderer/geometry/meshlet/meshlet_encode_attribute.d.ts +3 -0
  512. package/src/shade/renderer/geometry/meshlet/meshlet_encode_attribute.d.ts.map +1 -1
  513. package/src/shade/renderer/geometry/meshlet/meshlet_encode_attribute.js +3 -66
  514. package/src/shade/renderer/geometry/meshlet/meshlet_get_attribute_size.d.ts +3 -2
  515. package/src/shade/renderer/geometry/meshlet/meshlet_get_attribute_size.d.ts.map +1 -1
  516. package/src/shade/renderer/geometry/meshlet/meshlet_get_attribute_size.js +27 -6
  517. package/src/shade/renderer/geometry/meshlet/meshlet_get_payload_size.d.ts +13 -0
  518. package/src/shade/renderer/geometry/meshlet/meshlet_get_payload_size.d.ts.map +1 -0
  519. package/src/shade/renderer/geometry/meshlet/meshlet_get_payload_size.js +20 -0
  520. package/src/shade/renderer/geometry/meshlet/meshlet_payload_collapse.d.ts +27 -0
  521. package/src/shade/renderer/geometry/meshlet/meshlet_payload_collapse.d.ts.map +1 -0
  522. package/src/shade/renderer/geometry/meshlet/meshlet_payload_collapse.js +102 -0
  523. package/src/shade/renderer/geometry/meshlet/upgrade/MESHLET_ROW_0.d.ts +39 -0
  524. package/src/shade/renderer/geometry/meshlet/upgrade/MESHLET_ROW_0.d.ts.map +1 -0
  525. package/src/shade/renderer/geometry/meshlet/upgrade/MESHLET_ROW_0.js +30 -0
  526. package/src/shade/renderer/geometry/meshlet/upgrade/meshlet_batch_upgrade_0_1.d.ts +31 -0
  527. package/src/shade/renderer/geometry/meshlet/upgrade/meshlet_batch_upgrade_0_1.d.ts.map +1 -0
  528. package/src/shade/renderer/geometry/meshlet/upgrade/meshlet_batch_upgrade_0_1.js +333 -0
  529. package/src/shade/renderer/geometry/meshlet/upgrade/meshlet_payload_words_0.d.ts +12 -0
  530. package/src/shade/renderer/geometry/meshlet/upgrade/meshlet_payload_words_0.d.ts.map +1 -0
  531. package/src/shade/renderer/geometry/meshlet/upgrade/meshlet_payload_words_0.js +42 -0
  532. package/src/shade/renderer/geometry/meshlet_geometry_from_transfer.d.ts +31 -0
  533. package/src/shade/renderer/geometry/meshlet_geometry_from_transfer.d.ts.map +1 -0
  534. package/src/shade/renderer/geometry/meshlet_geometry_from_transfer.js +39 -0
  535. package/src/shade/renderer/geometry/meshlet_geometry_to_transfer.d.ts +40 -0
  536. package/src/shade/renderer/geometry/meshlet_geometry_to_transfer.d.ts.map +1 -0
  537. package/src/shade/renderer/geometry/meshlet_geometry_to_transfer.js +58 -0
  538. package/src/shade/renderer/geometry/normals/build_tangent_from_normal.d.ts +5 -3
  539. package/src/shade/renderer/geometry/normals/build_tangent_from_normal.d.ts.map +1 -1
  540. package/src/shade/renderer/geometry/normals/build_tangent_from_normal.js +15 -45
  541. package/src/shade/renderer/geometry/normals/normal_frame_basis.d.ts +17 -0
  542. package/src/shade/renderer/geometry/normals/normal_frame_basis.d.ts.map +1 -0
  543. package/src/shade/renderer/geometry/normals/normal_frame_basis.js +40 -0
  544. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +8 -0
  545. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts.map +1 -1
  546. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +74 -2
  547. package/src/shade/renderer/geometry/sdf/shader_sdf_visualize.js +1 -1
  548. package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.d.ts +20 -3
  549. package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.d.ts.map +1 -1
  550. package/src/shade/renderer/geometry/virtual/build/VGeoBuildOptions.js +21 -3
  551. package/src/shade/renderer/geometry/virtual/build/gltf/GltfGeometry.d.ts +13 -2
  552. package/src/shade/renderer/geometry/virtual/build/gltf/GltfGeometry.d.ts.map +1 -1
  553. package/src/shade/renderer/geometry/virtual/build/gltf/GltfGeometry.js +14 -1
  554. package/src/shade/renderer/geometry/virtual/build/gltf/gltf_find_mesh_primitive_seams.d.ts +15 -0
  555. package/src/shade/renderer/geometry/virtual/build/gltf/gltf_find_mesh_primitive_seams.d.ts.map +1 -0
  556. package/src/shade/renderer/geometry/virtual/build/gltf/gltf_find_mesh_primitive_seams.js +455 -0
  557. package/src/shade/renderer/geometry/virtual/build/level/VGEO_MAX_STEP_GROUP_CLUSTERS.d.ts +15 -0
  558. package/src/shade/renderer/geometry/virtual/build/level/VGEO_MAX_STEP_GROUP_CLUSTERS.d.ts.map +1 -0
  559. package/src/shade/renderer/geometry/virtual/build/level/VGEO_MAX_STEP_GROUP_CLUSTERS.js +14 -0
  560. package/src/shade/renderer/geometry/virtual/build/level/VGeoFrontier.d.ts +91 -66
  561. package/src/shade/renderer/geometry/virtual/build/level/VGeoFrontier.d.ts.map +1 -1
  562. package/src/shade/renderer/geometry/virtual/build/level/VGeoFrontier.js +141 -65
  563. package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.d.ts +26 -41
  564. package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.d.ts.map +1 -1
  565. package/src/shade/renderer/geometry/virtual/build/level/VGeoLevelOptions.js +28 -41
  566. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_cluster.d.ts +20 -2
  567. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_cluster.d.ts.map +1 -1
  568. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_cluster.js +144 -22
  569. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_cluster_graph.d.ts +7 -7
  570. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_cluster_graph.d.ts.map +1 -1
  571. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_cluster_graph.js +146 -39
  572. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts +14 -7
  573. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.d.ts.map +1 -1
  574. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_group_step.js +532 -236
  575. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_leaf_frontier.d.ts +4 -6
  576. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_leaf_frontier.d.ts.map +1 -1
  577. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_leaf_frontier.js +210 -35
  578. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_levels.d.ts +7 -3
  579. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_levels.d.ts.map +1 -1
  580. package/src/shade/renderer/geometry/virtual/build/level/vgeo_build_levels.js +133 -187
  581. package/src/shade/renderer/geometry/virtual/build/level/vgeo_cluster_topology.d.ts +16 -0
  582. package/src/shade/renderer/geometry/virtual/build/level/vgeo_cluster_topology.d.ts.map +1 -0
  583. package/src/shade/renderer/geometry/virtual/build/level/vgeo_cluster_topology.js +94 -0
  584. package/src/shade/renderer/geometry/virtual/build/level/vgeo_compute_group_boundary.d.ts +15 -15
  585. package/src/shade/renderer/geometry/virtual/build/level/vgeo_compute_group_boundary.d.ts.map +1 -1
  586. package/src/shade/renderer/geometry/virtual/build/level/vgeo_compute_group_boundary.js +132 -99
  587. package/src/shade/renderer/geometry/virtual/build/level/vgeo_page_group_limit.d.ts +17 -0
  588. package/src/shade/renderer/geometry/virtual/build/level/vgeo_page_group_limit.d.ts.map +1 -0
  589. package/src/shade/renderer/geometry/virtual/build/level/vgeo_page_group_limit.js +44 -0
  590. package/src/shade/renderer/geometry/virtual/build/level/vgeo_partition_into_groups.d.ts +17 -12
  591. package/src/shade/renderer/geometry/virtual/build/level/vgeo_partition_into_groups.d.ts.map +1 -1
  592. package/src/shade/renderer/geometry/virtual/build/level/vgeo_partition_into_groups.js +344 -156
  593. package/src/shade/renderer/geometry/virtual/build/level/vgeo_run_round.d.ts +16 -16
  594. package/src/shade/renderer/geometry/virtual/build/level/vgeo_run_round.d.ts.map +1 -1
  595. package/src/shade/renderer/geometry/virtual/build/level/vgeo_run_round.js +160 -85
  596. package/src/shade/renderer/geometry/virtual/build/level/vgeo_step_group_page_size.d.ts +18 -0
  597. package/src/shade/renderer/geometry/virtual/build/level/vgeo_step_group_page_size.d.ts.map +1 -0
  598. package/src/shade/renderer/geometry/virtual/build/level/vgeo_step_group_page_size.js +21 -0
  599. package/src/shade/renderer/geometry/virtual/build/level/vgeo_try_repack.d.ts +4 -18
  600. package/src/shade/renderer/geometry/virtual/build/level/vgeo_try_repack.d.ts.map +1 -1
  601. package/src/shade/renderer/geometry/virtual/build/level/vgeo_try_repack.js +19 -37
  602. package/src/shade/renderer/geometry/virtual/build/mesh/VirtualGeometryMesh.d.ts +16 -0
  603. package/src/shade/renderer/geometry/virtual/build/mesh/VirtualGeometryMesh.d.ts.map +1 -1
  604. package/src/shade/renderer/geometry/virtual/build/mesh/VirtualGeometryMesh.js +26 -0
  605. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_attribute_vector_write.d.ts +21 -37
  606. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_attribute_vector_write.d.ts.map +1 -1
  607. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_attribute_vector_write.js +163 -87
  608. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_normalize_source.d.ts.map +1 -1
  609. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_normalize_source.js +291 -1
  610. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_resolve_attribute_weights.d.ts +6 -23
  611. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_resolve_attribute_weights.d.ts.map +1 -1
  612. package/src/shade/renderer/geometry/virtual/build/mesh/vgeo_resolve_attribute_weights.js +216 -30
  613. package/src/shade/renderer/geometry/virtual/build/page/vgeo_assemble_pages.d.ts +4 -4
  614. package/src/shade/renderer/geometry/virtual/build/page/vgeo_assemble_pages.d.ts.map +1 -1
  615. package/src/shade/renderer/geometry/virtual/build/page/vgeo_assemble_pages.js +218 -117
  616. package/src/shade/renderer/geometry/virtual/build/page/vgeo_group_page_size.d.ts +19 -0
  617. package/src/shade/renderer/geometry/virtual/build/page/vgeo_group_page_size.d.ts.map +1 -0
  618. package/src/shade/renderer/geometry/virtual/build/page/vgeo_group_page_size.js +50 -0
  619. package/src/shade/renderer/geometry/virtual/build/vgeo_build.d.ts.map +1 -1
  620. package/src/shade/renderer/geometry/virtual/build/vgeo_build.js +9 -0
  621. package/src/shade/renderer/geometry/virtual/format/attribute/VGEO_ATTRIBUTES.d.ts +10 -13
  622. package/src/shade/renderer/geometry/virtual/format/attribute/VGEO_ATTRIBUTES.d.ts.map +1 -1
  623. package/src/shade/renderer/geometry/virtual/format/attribute/VGEO_ATTRIBUTES.js +16 -17
  624. package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_attributes_read.d.ts +3 -3
  625. package/src/shade/renderer/geometry/virtual/format/attribute/vgeo_attributes_read.js +3 -3
  626. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_asset_id_preimage.d.ts +4 -4
  627. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_asset_id_preimage.d.ts.map +1 -1
  628. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_asset_id_preimage.js +13 -35
  629. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_asset_id_slices.d.ts +15 -0
  630. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_asset_id_slices.d.ts.map +1 -0
  631. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_asset_id_slices.js +120 -0
  632. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_asset_id.d.ts +9 -0
  633. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_asset_id.d.ts.map +1 -1
  634. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_asset_id.js +21 -13
  635. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum.d.ts +6 -0
  636. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum.d.ts.map +1 -1
  637. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum.js +32 -41
  638. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum_bytes.d.ts +16 -0
  639. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum_bytes.d.ts.map +1 -0
  640. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_frame_checksum_bytes.js +33 -0
  641. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum.d.ts +4 -1
  642. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum.d.ts.map +1 -1
  643. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum.js +19 -25
  644. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum_bytes.d.ts +12 -0
  645. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum_bytes.d.ts.map +1 -0
  646. package/src/shade/renderer/geometry/virtual/format/checksum/vgeo_compute_header_checksum_bytes.js +23 -0
  647. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_OFFSET.d.ts +6 -12
  648. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_OFFSET.d.ts.map +1 -1
  649. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_OFFSET.js +12 -14
  650. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_OFFSET_V7.d.ts +32 -0
  651. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_OFFSET_V7.d.ts.map +1 -0
  652. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_OFFSET_V7.js +41 -0
  653. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_RECORD_SIZE.d.ts +2 -1
  654. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_RECORD_SIZE.d.ts.map +1 -1
  655. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_RECORD_SIZE.js +3 -2
  656. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_RECORD_SIZE_V7.d.ts +8 -0
  657. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_RECORD_SIZE_V7.d.ts.map +1 -0
  658. package/src/shade/renderer/geometry/virtual/format/cluster/VGEO_CLUSTER_RECORD_SIZE_V7.js +7 -0
  659. package/src/shade/renderer/geometry/virtual/format/cluster/vgeo_pack_normal_cone.d.ts +25 -0
  660. package/src/shade/renderer/geometry/virtual/format/cluster/vgeo_pack_normal_cone.d.ts.map +1 -0
  661. package/src/shade/renderer/geometry/virtual/format/cluster/vgeo_pack_normal_cone.js +80 -0
  662. package/src/shade/renderer/geometry/virtual/format/dag/VirtualGeometryCluster.d.ts +18 -4
  663. package/src/shade/renderer/geometry/virtual/format/dag/VirtualGeometryCluster.d.ts.map +1 -1
  664. package/src/shade/renderer/geometry/virtual/format/dag/VirtualGeometryCluster.js +20 -4
  665. package/src/shade/renderer/geometry/virtual/format/frame/vgeo_check_frame_header.d.ts +16 -0
  666. package/src/shade/renderer/geometry/virtual/format/frame/vgeo_check_frame_header.d.ts.map +1 -0
  667. package/src/shade/renderer/geometry/virtual/format/frame/vgeo_check_frame_header.js +74 -0
  668. package/src/shade/renderer/geometry/virtual/format/header/VGEO_FORMAT_VERSION.d.ts +9 -0
  669. package/src/shade/renderer/geometry/virtual/format/header/VGEO_FORMAT_VERSION.d.ts.map +1 -1
  670. package/src/shade/renderer/geometry/virtual/format/header/VGEO_FORMAT_VERSION.js +10 -1
  671. package/src/shade/renderer/geometry/virtual/format/header/VGEO_HEADER_OFFSET.d.ts +1 -0
  672. package/src/shade/renderer/geometry/virtual/format/header/VGEO_HEADER_OFFSET.js +9 -0
  673. package/src/shade/renderer/geometry/virtual/format/header/VGEO_MIN_READER_VERSION.d.ts +6 -2
  674. package/src/shade/renderer/geometry/virtual/format/header/VGEO_MIN_READER_VERSION.d.ts.map +1 -1
  675. package/src/shade/renderer/geometry/virtual/format/header/VGEO_MIN_READER_VERSION.js +7 -3
  676. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerHeader.d.ts +6 -2
  677. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerHeader.d.ts.map +1 -1
  678. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerHeader.js +6 -2
  679. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts +22 -18
  680. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.d.ts.map +1 -1
  681. package/src/shade/renderer/geometry/virtual/format/read/VGeoContainerReader.js +137 -80
  682. package/src/shade/renderer/geometry/virtual/format/read/VGeoFetchError.d.ts +29 -0
  683. package/src/shade/renderer/geometry/virtual/format/read/VGeoFetchError.d.ts.map +1 -0
  684. package/src/shade/renderer/geometry/virtual/format/read/VGeoFetchError.js +36 -0
  685. package/src/shade/renderer/geometry/virtual/format/read/VGeoPage.d.ts +60 -103
  686. package/src/shade/renderer/geometry/virtual/format/read/VGeoPage.d.ts.map +1 -1
  687. package/src/shade/renderer/geometry/virtual/format/read/VGeoPage.js +168 -137
  688. package/src/shade/renderer/geometry/virtual/format/read/VGeoPageFetcherCore.d.ts +42 -38
  689. package/src/shade/renderer/geometry/virtual/format/read/VGeoPageFetcherCore.d.ts.map +1 -1
  690. package/src/shade/renderer/geometry/virtual/format/read/VGeoPageFetcherCore.js +218 -111
  691. package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts +9 -18
  692. package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.d.ts.map +1 -1
  693. package/src/shade/renderer/geometry/virtual/format/read/VGeoReadOptions.js +10 -19
  694. package/src/shade/renderer/geometry/virtual/format/read/vgeo_check_fixed_header.d.ts +17 -0
  695. package/src/shade/renderer/geometry/virtual/format/read/vgeo_check_fixed_header.d.ts.map +1 -0
  696. package/src/shade/renderer/geometry/virtual/format/read/vgeo_check_fixed_header.js +89 -0
  697. package/src/shade/renderer/geometry/virtual/format/read/vgeo_fetch_byte_source.d.ts +5 -8
  698. package/src/shade/renderer/geometry/virtual/format/read/vgeo_fetch_byte_source.d.ts.map +1 -1
  699. package/src/shade/renderer/geometry/virtual/format/read/vgeo_fetch_byte_source.js +118 -35
  700. package/src/shade/renderer/geometry/virtual/format/read/vgeo_is_retryable_http_status.d.ts +14 -0
  701. package/src/shade/renderer/geometry/virtual/format/read/vgeo_is_retryable_http_status.d.ts.map +1 -0
  702. package/src/shade/renderer/geometry/virtual/format/read/vgeo_is_retryable_http_status.js +20 -0
  703. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_from_transfer.d.ts +12 -0
  704. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_from_transfer.d.ts.map +1 -0
  705. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_from_transfer.js +44 -0
  706. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_to_transfer.d.ts +22 -0
  707. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_to_transfer.d.ts.map +1 -0
  708. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_to_transfer.js +46 -0
  709. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_worker_serve.d.ts +12 -8
  710. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_worker_serve.d.ts.map +1 -1
  711. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_worker_serve.js +183 -32
  712. package/src/shade/renderer/geometry/virtual/format/read/vgeo_read_header.d.ts +13 -43
  713. package/src/shade/renderer/geometry/virtual/format/read/vgeo_read_header.d.ts.map +1 -1
  714. package/src/shade/renderer/geometry/virtual/format/read/vgeo_read_header.js +20 -117
  715. package/src/shade/renderer/geometry/virtual/format/read/vgeo_read_page.d.ts +10 -22
  716. package/src/shade/renderer/geometry/virtual/format/read/vgeo_read_page.d.ts.map +1 -1
  717. package/src/shade/renderer/geometry/virtual/format/read/vgeo_read_page.js +290 -317
  718. package/src/shade/renderer/geometry/virtual/format/read/vgeo_resident_head_size.d.ts +17 -0
  719. package/src/shade/renderer/geometry/virtual/format/read/vgeo_resident_head_size.d.ts.map +1 -0
  720. package/src/shade/renderer/geometry/virtual/format/read/vgeo_resident_head_size.js +37 -0
  721. package/src/shade/renderer/geometry/virtual/format/upgrade/VGeoPageUpgraderTo8.d.ts +37 -0
  722. package/src/shade/renderer/geometry/virtual/format/upgrade/VGeoPageUpgraderTo8.d.ts.map +1 -0
  723. package/src/shade/renderer/geometry/virtual/format/upgrade/VGeoPageUpgraderTo8.js +376 -0
  724. package/src/shade/renderer/geometry/virtual/format/upgrade/vgeo_page_upgrade.d.ts +19 -0
  725. package/src/shade/renderer/geometry/virtual/format/upgrade/vgeo_page_upgrade.d.ts.map +1 -0
  726. package/src/shade/renderer/geometry/virtual/format/upgrade/vgeo_page_upgrade.js +111 -0
  727. package/src/shade/renderer/geometry/virtual/format/vgeo_validate_container.d.ts.map +1 -1
  728. package/src/shade/renderer/geometry/virtual/format/vgeo_validate_container.js +232 -36
  729. package/src/shade/renderer/geometry/virtual/format/vgeo_write_container.d.ts.map +1 -1
  730. package/src/shade/renderer/geometry/virtual/format/vgeo_write_container.js +29 -16
  731. package/src/shade/renderer/geometry/virtual/proxy/VGeoProxies.d.ts +91 -0
  732. package/src/shade/renderer/geometry/virtual/proxy/VGeoProxies.d.ts.map +1 -0
  733. package/src/shade/renderer/geometry/virtual/proxy/VGeoProxies.js +374 -0
  734. package/src/shade/renderer/geometry/virtual/proxy/vgeo_to_proxy_mesh.d.ts.map +1 -1
  735. package/src/shade/renderer/geometry/virtual/proxy/vgeo_to_proxy_mesh.js +22 -14
  736. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryPool.d.ts +7 -87
  737. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryPool.d.ts.map +1 -1
  738. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryPool.js +90 -182
  739. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts +48 -140
  740. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.d.ts.map +1 -1
  741. package/src/shade/renderer/geometry/virtual/runtime/GPUVirtualGeometryRuntime.js +135 -218
  742. package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.d.ts.map +1 -1
  743. package/src/shade/renderer/geometry/virtual/runtime/VGeoFeedbackLoop.js +3 -1
  744. package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.d.ts +58 -25
  745. package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.d.ts.map +1 -1
  746. package/src/shade/renderer/geometry/virtual/runtime/VGeoPageFetcher.js +617 -127
  747. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.d.ts +32 -90
  748. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.d.ts.map +1 -1
  749. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidency.js +1273 -345
  750. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidencyOptions.d.ts +25 -21
  751. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidencyOptions.d.ts.map +1 -1
  752. package/src/shade/renderer/geometry/virtual/runtime/VGeoResidencyOptions.js +28 -21
  753. package/src/shade/renderer/geometry/virtual/runtime/VGeoRuntimeTables.d.ts +80 -126
  754. package/src/shade/renderer/geometry/virtual/runtime/VGeoRuntimeTables.d.ts.map +1 -1
  755. package/src/shade/renderer/geometry/virtual/runtime/VGeoRuntimeTables.js +439 -328
  756. package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts +51 -108
  757. package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.d.ts.map +1 -1
  758. package/src/shade/renderer/geometry/virtual/runtime/VGeoViewCut.js +90 -211
  759. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts +26 -8
  760. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.d.ts.map +1 -1
  761. package/src/shade/renderer/geometry/virtual/runtime/VirtualGeometry.js +134 -14
  762. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAGS.d.ts +38 -0
  763. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAGS.d.ts.map +1 -0
  764. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAGS.js +33 -0
  765. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_PARAMS_STRUCT.d.ts +2 -2
  766. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_PARAMS_STRUCT.d.ts.map +1 -1
  767. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_PARAMS_STRUCT.js +8 -40
  768. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.d.ts +3 -9
  769. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.d.ts.map +1 -1
  770. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_access.js +43 -56
  771. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_arena.d.ts +3 -7
  772. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_arena.d.ts.map +1 -1
  773. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_arena.js +31 -35
  774. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_claim.d.ts +1 -6
  775. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_claim.d.ts.map +1 -1
  776. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_claim.js +1 -6
  777. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_descent.d.ts +5 -121
  778. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_descent.d.ts.map +1 -1
  779. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_descent.js +54 -226
  780. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.d.ts +7 -17
  781. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.d.ts.map +1 -1
  782. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance.js +79 -61
  783. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance_record.d.ts +8 -2
  784. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance_record.d.ts.map +1 -1
  785. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_instance_record.js +29 -17
  786. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_queue.d.ts +4 -4
  787. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_queue.js +4 -4
  788. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_rule.d.ts +4 -28
  789. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_rule.d.ts.map +1 -1
  790. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_rule.js +31 -173
  791. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_want.d.ts +2 -6
  792. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_want.d.ts.map +1 -1
  793. package/src/shade/renderer/geometry/virtual/runtime/cut/chunk_vgeo_cut_want.js +4 -27
  794. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.d.ts.map +1 -1
  795. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_collect.js +81 -87
  796. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_seed.d.ts.map +1 -1
  797. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_seed.js +29 -60
  798. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_traverse.d.ts.map +1 -1
  799. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_traverse.js +145 -61
  800. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_cut_descent.d.ts +21 -18
  801. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_cut_descent.d.ts.map +1 -1
  802. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_cut_descent.js +47 -62
  803. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_if_enabled.d.ts +13 -17
  804. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_if_enabled.d.ts.map +1 -1
  805. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_if_enabled.js +30 -18
  806. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts +28 -31
  807. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.d.ts.map +1 -1
  808. package/src/shade/renderer/geometry/virtual/runtime/graph_vgeo_expand_instances_to_meshlets.js +132 -98
  809. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CLUSTER_ROW_OFFSET.d.ts +1 -0
  810. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CLUSTER_ROW_OFFSET.js +8 -28
  811. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CLUSTER_ROW_WORDS.d.ts +2 -10
  812. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CLUSTER_ROW_WORDS.d.ts.map +1 -1
  813. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_CLUSTER_ROW_WORDS.js +3 -11
  814. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.d.ts +69 -11
  815. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.d.ts.map +1 -1
  816. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_OFFSET.js +49 -46
  817. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_WORDS.d.ts +1 -1
  818. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_INSTANCE_WORDS.js +2 -2
  819. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_OFFSET.d.ts +40 -12
  820. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_OFFSET.d.ts.map +1 -1
  821. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_OFFSET.js +17 -57
  822. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_WORDS.d.ts +1 -1
  823. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_WORDS.d.ts.map +1 -1
  824. package/src/shade/renderer/geometry/virtual/runtime/layout/VGEO_PAGE_ROW_WORDS.js +2 -2
  825. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_meshlet_batch.d.ts +7 -13
  826. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_meshlet_batch.d.ts.map +1 -1
  827. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_meshlet_batch.js +44 -41
  828. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_page_size_for_slot_words.d.ts +12 -0
  829. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_page_size_for_slot_words.d.ts.map +1 -0
  830. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_page_size_for_slot_words.js +19 -0
  831. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_write_page_block.d.ts.map +1 -1
  832. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_write_page_block.js +5 -0
  833. package/src/shade/renderer/global_illumination/brick4/gpu/bake/brick4_bake_basic.js +1 -1
  834. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts +20 -30
  835. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  836. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +68 -172
  837. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts +1 -1
  838. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +1 -1
  839. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts +9 -0
  840. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.d.ts.map +1 -1
  841. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUBrickClipmap.js +13 -1
  842. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts +117 -0
  843. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.d.ts.map +1 -0
  844. package/src/shade/renderer/global_illumination/probe_clipmap/brick/GPUSceneBrickClipmap.js +405 -0
  845. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts +35 -6
  846. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.d.ts.map +1 -1
  847. package/src/shade/renderer/global_illumination/probe_clipmap/brick/chunk_brick_clipmap_trace.js +169 -11
  848. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts +2 -7
  849. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.d.ts.map +1 -1
  850. package/src/shade/renderer/global_illumination/probe_clipmap/material/GPUBrickMaterial.js +13 -6
  851. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts +5 -4
  852. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.d.ts.map +1 -1
  853. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_light.js +26 -13
  854. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.d.ts.map +1 -1
  855. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_light.js +4 -2
  856. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts +2 -1
  857. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.d.ts.map +1 -1
  858. package/src/shade/renderer/global_illumination/screen_probe/SCREEN_PROBE.js +4 -2
  859. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.d.ts.map +1 -1
  860. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_brick.js +4 -2
  861. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_gather.js +11 -11
  862. package/src/shade/renderer/global_illumination/screen_probe/shader_screen_probe_importance.js +7 -7
  863. package/src/shade/renderer/gpu_primitive/indirect/STRUCT_INDEXED_DRAW_COMMAND.d.ts +6 -0
  864. package/src/shade/renderer/gpu_primitive/indirect/STRUCT_INDEXED_DRAW_COMMAND.d.ts.map +1 -0
  865. package/src/shade/renderer/gpu_primitive/indirect/STRUCT_INDEXED_DRAW_COMMAND.js +15 -0
  866. package/src/shade/renderer/grass/surface/GPUGrassSurfaces.js +1 -1
  867. package/src/shade/renderer/light/cluster/chunk_light_list_sample.d.ts +33 -0
  868. package/src/shade/renderer/light/cluster/chunk_light_list_sample.d.ts.map +1 -0
  869. package/src/shade/renderer/light/cluster/chunk_light_list_sample.js +52 -0
  870. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts +18 -6
  871. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.d.ts.map +1 -1
  872. package/src/shade/renderer/light/world_cluster/WORLD_LIGHT_CLUSTER.js +42 -7
  873. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts +14 -5
  874. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.d.ts.map +1 -1
  875. package/src/shade/renderer/light/world_cluster/graph_build_world_light_clusters.js +78 -25
  876. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.d.ts +11 -0
  877. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.d.ts.map +1 -1
  878. package/src/shade/renderer/light/world_cluster/shader_world_cluster_assign_lights.js +119 -72
  879. package/src/shade/renderer/lightmap/GPULightMap.js +1 -1
  880. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  881. package/src/shade/renderer/path_tracer/accumulating/AccumulatingPathTracer.js +1 -1
  882. package/src/shade/renderer/path_tracer/graph_path_trace_scene.js +1 -1
  883. package/src/shade/renderer/postprocess/nss/NSS.d.ts +1 -1
  884. package/src/shade/renderer/rasterize/bucket/graph_meshlets_rasterize_by_bucket.d.ts.map +1 -1
  885. package/src/shade/renderer/rasterize/bucket/graph_meshlets_rasterize_by_bucket.js +2 -0
  886. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts +4 -2
  887. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.d.ts.map +1 -1
  888. package/src/shade/renderer/rasterize/bucket/prepare_meshlet_draw_commands_by_material.js +25 -8
  889. package/src/shade/renderer/rasterize/draw/MESHLET_DRAW_INDEX.d.ts +40 -0
  890. package/src/shade/renderer/rasterize/draw/MESHLET_DRAW_INDEX.d.ts.map +1 -0
  891. package/src/shade/renderer/rasterize/draw/MESHLET_DRAW_INDEX.js +69 -0
  892. package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.d.ts +28 -0
  893. package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.d.ts.map +1 -0
  894. package/src/shade/renderer/rasterize/draw/chunk_meshlet_draw_vertex.js +129 -0
  895. package/src/shade/renderer/rasterize/draw/shader_meshlet_draw_indices.d.ts +91 -0
  896. package/src/shade/renderer/rasterize/draw/shader_meshlet_draw_indices.d.ts.map +1 -0
  897. package/src/shade/renderer/rasterize/draw/shader_meshlet_draw_indices.js +288 -0
  898. package/src/shade/renderer/rasterize/expand/GPUCollectionLimits.d.ts +10 -0
  899. package/src/shade/renderer/rasterize/expand/GPUCollectionLimits.d.ts.map +1 -1
  900. package/src/shade/renderer/rasterize/expand/GPUCollectionLimits.js +24 -3
  901. package/src/shade/renderer/rasterize/expand/RasterizationCollectionType.d.ts +2 -0
  902. package/src/shade/renderer/rasterize/expand/RasterizationCollectionType.js +10 -0
  903. package/src/shade/renderer/rasterize/expand/graph_meshlets_rasterize.d.ts +14 -1
  904. package/src/shade/renderer/rasterize/expand/graph_meshlets_rasterize.d.ts.map +1 -1
  905. package/src/shade/renderer/rasterize/expand/graph_meshlets_rasterize.js +99 -1
  906. package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.d.ts.map +1 -1
  907. package/src/shade/renderer/rasterize/fast/graph_rasterize_scene_fast.js +1 -0
  908. package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.d.ts +1 -2
  909. package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.d.ts.map +1 -1
  910. package/src/shade/renderer/rasterize/forward/chunk_forward_shade_standard_fragment.js +9 -14
  911. package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.d.ts +0 -6
  912. package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.d.ts.map +1 -1
  913. package/src/shade/renderer/rasterize/native/avboit/avboit_draw_fragment_body.js +3 -10
  914. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_pass_descriptor.d.ts.map +1 -1
  915. package/src/shade/renderer/rasterize/native/depth/shadow_rasterization_pass_descriptor.js +82 -99
  916. package/src/shade/renderer/rasterize/native/graph_rasterize_meshes_alpha_tested.d.ts.map +1 -1
  917. package/src/shade/renderer/rasterize/native/graph_rasterize_meshes_alpha_tested.js +10 -16
  918. package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.d.ts +0 -6
  919. package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.d.ts.map +1 -1
  920. package/src/shade/renderer/rasterize/native/oit/oit_resolve_fragment_body.js +1 -8
  921. package/src/shade/renderer/rasterize/native/viz/shader_vertex.d.ts +5 -0
  922. package/src/shade/renderer/rasterize/native/viz/shader_vertex.d.ts.map +1 -1
  923. package/src/shade/renderer/rasterize/native/viz/shader_vertex.js +16 -26
  924. package/src/shade/renderer/rasterize/native/viz/shader_vertex_corner.d.ts +8 -0
  925. package/src/shade/renderer/rasterize/native/viz/shader_vertex_corner.d.ts.map +1 -0
  926. package/src/shade/renderer/rasterize/native/viz/shader_vertex_corner.js +43 -0
  927. package/src/shade/renderer/rasterize/native/viz/viz_rasterization_opaque_pass_descriptor.d.ts.map +1 -1
  928. package/src/shade/renderer/rasterize/native/viz/viz_rasterization_opaque_pass_descriptor.js +32 -21
  929. package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.d.ts +2 -2
  930. package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.d.ts.map +1 -1
  931. package/src/shade/renderer/rasterize/standard/graph_rasterize_partial_opaque.js +10 -2
  932. package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.d.ts +2 -2
  933. package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.d.ts.map +1 -1
  934. package/src/shade/renderer/rasterize/standard/graph_rasterize_remaining_opaque.js +8 -2
  935. package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.d.ts +0 -1
  936. package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.d.ts.map +1 -1
  937. package/src/shade/renderer/rasterize/standard/graph_rasterize_scene.js +4 -4
  938. package/src/shade/renderer/restir/di/graph_restir_di.js +1 -1
  939. package/src/shade/renderer/scene/ACOUSTIC_MATERIAL_STRUCT.d.ts +21 -0
  940. package/src/shade/renderer/scene/ACOUSTIC_MATERIAL_STRUCT.d.ts.map +1 -0
  941. package/src/shade/renderer/scene/ACOUSTIC_MATERIAL_STRUCT.js +40 -0
  942. package/src/shade/renderer/scene/GPUSceneContext.d.ts +13 -5
  943. package/src/shade/renderer/scene/GPUSceneContext.d.ts.map +1 -1
  944. package/src/shade/renderer/scene/GPUSceneContext.js +39 -12
  945. package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.d.ts.map +1 -1
  946. package/src/shade/renderer/scene/SCENE_DATABASE_SPEC.js +4 -0
  947. package/src/shade/renderer/scene/bvh/StaticSceneBVH.js +3 -3
  948. package/src/shade/renderer/scene/optimization/geometry/geometry_deduplicate.d.ts.map +1 -1
  949. package/src/shade/renderer/scene/optimization/geometry/geometry_deduplicate.js +3 -11
  950. package/src/shade/renderer/scene/optimization/geometry/internal/GLOBAL_RESIDUAL_THRESHOLD_FRACTION.d.ts +12 -0
  951. package/src/shade/renderer/scene/optimization/geometry/internal/GLOBAL_RESIDUAL_THRESHOLD_FRACTION.d.ts.map +1 -0
  952. package/src/shade/renderer/scene/optimization/geometry/internal/GLOBAL_RESIDUAL_THRESHOLD_FRACTION.js +11 -0
  953. package/src/shade/renderer/scene/optimization/geometry/internal/RELATIVE_PAIR_EPSILON.d.ts +10 -0
  954. package/src/shade/renderer/scene/optimization/geometry/internal/RELATIVE_PAIR_EPSILON.d.ts.map +1 -0
  955. package/src/shade/renderer/scene/optimization/geometry/internal/RELATIVE_PAIR_EPSILON.js +9 -0
  956. package/src/shade/renderer/scene/optimization/geometry/internal/match_refit_validate.d.ts +2 -11
  957. package/src/shade/renderer/scene/optimization/geometry/internal/match_refit_validate.d.ts.map +1 -1
  958. package/src/shade/renderer/scene/optimization/geometry/internal/match_refit_validate.js +2 -11
  959. package/src/shade/renderer/scene/optimization/geometry/internal/match_solve_transform.d.ts +3 -2
  960. package/src/shade/renderer/scene/optimization/geometry/internal/match_solve_transform.d.ts.map +1 -1
  961. package/src/shade/renderer/scene/optimization/geometry/internal/match_solve_transform.js +46 -14
  962. package/src/shade/renderer/scene/rows/GPUSceneRows.d.ts.map +1 -1
  963. package/src/shade/renderer/scene/rows/GPUSceneRows.js +8 -9
  964. package/src/shade/renderer/shader/chunk/geometry/aabb3/chunk_aabb3_project_perspective.js +9 -9
  965. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_singular_values.d.ts +4 -3
  966. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_singular_values.d.ts.map +1 -1
  967. package/src/shade/renderer/shader/chunk/geometry/mat3/chunk_mat3_singular_values.js +4 -3
  968. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_meshlet_frame_decode.d.ts +15 -0
  969. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_meshlet_frame_decode.d.ts.map +1 -0
  970. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_meshlet_frame_decode.js +41 -0
  971. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_meshlet_frame_encode.d.ts +12 -0
  972. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_meshlet_frame_encode.d.ts.map +1 -0
  973. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_meshlet_frame_encode.js +37 -0
  974. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_meshlet_section_sizes.d.ts +12 -0
  975. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_meshlet_section_sizes.d.ts.map +1 -0
  976. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_meshlet_section_sizes.js +37 -0
  977. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_attribute_u32.js +1 -1
  978. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_attribute_vec2f.js +2 -2
  979. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_attribute_vec3f.js +3 -3
  980. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_position.d.ts +14 -0
  981. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_position.d.ts.map +1 -0
  982. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_position.js +81 -0
  983. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_triangle_positions.d.ts.map +1 -1
  984. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_triangle_positions.js +8 -12
  985. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_uv0.d.ts +14 -0
  986. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_uv0.d.ts.map +1 -0
  987. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_uv0.js +52 -0
  988. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex.d.ts +8 -0
  989. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex.d.ts.map +1 -1
  990. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex.js +41 -46
  991. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_position.d.ts.map +1 -1
  992. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_position.js +4 -3
  993. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_uv_position.d.ts.map +1 -1
  994. package/src/shade/renderer/shader/chunk/geometry/meshlet/chunk_read_meshlet_vertex_uv_position.js +24 -42
  995. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve.d.ts +23 -0
  996. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve.d.ts.map +1 -0
  997. package/src/shade/renderer/shader/chunk/subgroup/chunk_subgroup_reserve.js +44 -0
  998. package/src/shade/renderer/shader/chunk/subgroup/chunk_workgroup_sum_vec4.d.ts +24 -0
  999. package/src/shade/renderer/shader/chunk/subgroup/chunk_workgroup_sum_vec4.d.ts.map +1 -0
  1000. package/src/shade/renderer/shader/chunk/subgroup/chunk_workgroup_sum_vec4.js +56 -0
  1001. package/src/shade/renderer/shader/compiler/CodeChunk.d.ts +1 -1
  1002. package/src/shade/renderer/shader/compiler/ShaderSwitch.d.ts +1 -1
  1003. package/src/shade/renderer/shader/compiler/ShaderSwitchSet.d.ts +1 -1
  1004. package/src/shade/renderer/shader/pass/RenderPassDescriptor.d.ts +11 -2
  1005. package/src/shade/renderer/shader/pass/RenderPassDescriptor.d.ts.map +1 -1
  1006. package/src/shade/renderer/shader/pass/RenderPassDescriptor.js +12 -2
  1007. package/src/shade/renderer/shader/resource/ShaderResourceDescriptor.d.ts +1 -1
  1008. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
  1009. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +15 -9
  1010. package/src/shade/renderer/shadow/ray/RTXShadows.js +1 -1
  1011. package/src/shade/renderer/shadow/ray/staged/trace/graph_trace_rays.js +1 -1
  1012. package/src/shade/renderer/shadow/sdf/cascade/CascadedSceneSDF.js +1 -1
  1013. package/src/shade/renderer/shadow/sdf/graph_draw_sdf_shadows.js +1 -1
  1014. package/src/shade/renderer/view/GPUViewContext.d.ts.map +1 -1
  1015. package/src/shade/renderer/view/GPUViewContext.js +4 -1
  1016. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.d.ts.map +1 -1
  1017. package/src/shade/renderer/volumetrics/irradiance_clipmap/GPUIrradianceClipmap.js +1 -0
  1018. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts +3 -1
  1019. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.d.ts.map +1 -1
  1020. package/src/shade/renderer/volumetrics/irradiance_clipmap/IRRADIANCE_CLIPMAP.js +3 -1
  1021. package/src/shade/renderer/volumetrics/irradiance_clipmap/shader_irradiance_clipmap_build.d.ts +1 -1
  1022. package/src/shade/renderer/volumetrics/irradiance_clipmap/shader_irradiance_clipmap_build.d.ts.map +1 -1
  1023. package/src/shade/renderer/volumetrics/irradiance_clipmap/shader_irradiance_clipmap_build.js +23 -7
  1024. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts +3 -1
  1025. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.d.ts.map +1 -1
  1026. package/src/shade/renderer/volumetrics/shader_volumetrics_build_lighting.js +32 -9
  1027. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  1028. package/src/shade/renderer/water/query/GPUWaterQueries.js +741 -741
  1029. package/src/shade/renderer/water/query/shader_water_surface_query.d.ts.map +1 -1
  1030. package/src/shade/renderer/water/query/shader_water_surface_query.js +3 -2
  1031. package/src/shade/renderer/water/surface/lod/shader_water_lod.d.ts.map +1 -1
  1032. package/src/shade/renderer/water/surface/lod/shader_water_lod.js +5 -4
  1033. package/src/shade/renderer/water/surface/particles/GPUWaterParticles.js +1 -1
  1034. package/src/shade/renderer/water/surface/particles/shader_water_particles.d.ts.map +1 -1
  1035. package/src/shade/renderer/water/surface/particles/shader_water_particles.js +2 -1
  1036. package/src/shade/renderer/wind/GPUSceneWind.d.ts +1 -1
  1037. package/src/engine/sound/simulation/core/AcousticOccluderIndex.d.ts +0 -85
  1038. package/src/engine/sound/simulation/core/AcousticOccluderIndex.d.ts.map +0 -1
  1039. package/src/engine/sound/simulation/core/AcousticOccluderIndex.js +0 -312
  1040. package/src/engine/sound/simulation/core/AcousticSourceState.d.ts +0 -55
  1041. package/src/engine/sound/simulation/core/AcousticSourceState.d.ts.map +0 -1
  1042. package/src/engine/sound/simulation/core/AcousticSourceState.js +0 -109
  1043. package/src/engine/sound/simulation/core/OccluderBody.d.ts +0 -57
  1044. package/src/engine/sound/simulation/core/OccluderBody.d.ts.map +0 -1
  1045. package/src/engine/sound/simulation/core/OccluderBody.js +0 -74
  1046. package/src/engine/sound/simulation/core/RayHit.d.ts.map +0 -1
  1047. package/src/engine/sound/simulation/core/acoustic_occlusion_solve.d.ts +0 -31
  1048. package/src/engine/sound/simulation/core/acoustic_occlusion_solve.d.ts.map +0 -1
  1049. package/src/engine/sound/simulation/core/acoustic_occlusion_solve.js +0 -134
  1050. package/src/engine/sound/simulation/ecs/AcousticProbeFieldSystem.d.ts +0 -41
  1051. package/src/engine/sound/simulation/ecs/AcousticProbeFieldSystem.d.ts.map +0 -1
  1052. package/src/engine/sound/simulation/ecs/AcousticProbeFieldSystem.js +0 -90
  1053. package/src/engine/sound/simulation/ecs/AcousticSimulationSystem.d.ts +0 -54
  1054. package/src/engine/sound/simulation/ecs/AcousticSimulationSystem.d.ts.map +0 -1
  1055. package/src/engine/sound/simulation/ecs/AcousticSimulationSystem.js +0 -94
  1056. package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts +0 -249
  1057. package/src/engine/sound/simulation/probe/AcousticProbeField.d.ts.map +0 -1
  1058. package/src/engine/sound/simulation/probe/AcousticProbeField.js +0 -565
  1059. package/src/engine/sound/simulation/probe/AcousticProbeFieldSerializationAdapter.d.ts.map +0 -1
  1060. package/src/engine/sound/simulation/probe/AcousticProbeFieldSerializationAdapter.js +0 -60
  1061. package/src/engine/sound/simulation/probe/ProbeFieldPathingSolution.d.ts +0 -48
  1062. package/src/engine/sound/simulation/probe/ProbeFieldPathingSolution.d.ts.map +0 -1
  1063. package/src/engine/sound/simulation/probe/ProbeFieldPathingSolution.js +0 -64
  1064. package/src/engine/sound/simulation/probe/ProbeVisibilityRecheck.d.ts +0 -51
  1065. package/src/engine/sound/simulation/probe/ProbeVisibilityRecheck.d.ts.map +0 -1
  1066. package/src/engine/sound/simulation/probe/ProbeVisibilityRecheck.js +0 -132
  1067. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts +0 -33
  1068. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.d.ts.map +0 -1
  1069. package/src/engine/sound/simulation/probe/acoustic_probe_transfer.js +0 -103
  1070. package/src/engine/sound/simulation/probe/acoustic_trace_energy.d.ts.map +0 -1
  1071. package/src/engine/sound/simulation/probe/bakeProbeField.d.ts +0 -64
  1072. package/src/engine/sound/simulation/probe/bakeProbeField.d.ts.map +0 -1
  1073. package/src/engine/sound/simulation/probe/bakeProbeField.js +0 -214
  1074. package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts +0 -17
  1075. package/src/engine/sound/simulation/probe/bakeProbeReflectors.d.ts.map +0 -1
  1076. package/src/engine/sound/simulation/probe/bakeProbeReflectors.js +0 -106
  1077. package/src/engine/sound/simulation/probe/bakeReverbBands.d.ts +0 -32
  1078. package/src/engine/sound/simulation/probe/bakeReverbBands.d.ts.map +0 -1
  1079. package/src/engine/sound/simulation/probe/bakeReverbBands.js +0 -110
  1080. package/src/engine/sound/simulation/probe/bakeVisibility.d.ts +0 -48
  1081. package/src/engine/sound/simulation/probe/bakeVisibility.d.ts.map +0 -1
  1082. package/src/engine/sound/simulation/probe/bakeVisibility.js +0 -148
  1083. package/src/engine/sound/simulation/probe/echogram_band_rt60.d.ts.map +0 -1
  1084. package/src/engine/sound/simulation/probe/probe_delaunay_edges.d.ts +0 -23
  1085. package/src/engine/sound/simulation/probe/probe_delaunay_edges.d.ts.map +0 -1
  1086. package/src/engine/sound/simulation/probe/probe_delaunay_edges.js +0 -215
  1087. package/src/engine/sound/simulation/probe/probe_densify_portals.d.ts +0 -35
  1088. package/src/engine/sound/simulation/probe/probe_densify_portals.d.ts.map +0 -1
  1089. package/src/engine/sound/simulation/probe/probe_densify_portals.js +0 -140
  1090. package/src/engine/sound/simulation/probe/probe_detect_portals.d.ts +0 -32
  1091. package/src/engine/sound/simulation/probe/probe_detect_portals.d.ts.map +0 -1
  1092. package/src/engine/sound/simulation/probe/probe_detect_portals.js +0 -196
  1093. package/src/engine/sound/simulation/probe/probe_edge_key.d.ts +0 -31
  1094. package/src/engine/sound/simulation/probe/probe_edge_key.d.ts.map +0 -1
  1095. package/src/engine/sound/simulation/probe/probe_edge_key.js +0 -38
  1096. package/src/engine/sound/simulation/probe/probe_edge_visible.d.ts +0 -31
  1097. package/src/engine/sound/simulation/probe/probe_edge_visible.d.ts.map +0 -1
  1098. package/src/engine/sound/simulation/probe/probe_edge_visible.js +0 -59
  1099. package/src/engine/sound/simulation/probe/probe_place_sdf_cover.d.ts +0 -27
  1100. package/src/engine/sound/simulation/probe/probe_place_sdf_cover.d.ts.map +0 -1
  1101. package/src/engine/sound/simulation/probe/probe_place_sdf_cover.js +0 -81
  1102. package/src/engine/sound/simulation/probe/probe_refine_connectivity.d.ts +0 -26
  1103. package/src/engine/sound/simulation/probe/probe_refine_connectivity.d.ts.map +0 -1
  1104. package/src/engine/sound/simulation/probe/probe_refine_connectivity.js +0 -164
  1105. package/src/engine/sound/simulation/probe/probe_sdf_grid.d.ts +0 -153
  1106. package/src/engine/sound/simulation/probe/probe_sdf_grid.d.ts.map +0 -1
  1107. package/src/engine/sound/simulation/probe/probe_sdf_grid.js +0 -221
  1108. package/src/engine/sound/simulation/probe/probe_visibility_augment.d.ts +0 -32
  1109. package/src/engine/sound/simulation/probe/probe_visibility_augment.d.ts.map +0 -1
  1110. package/src/engine/sound/simulation/probe/probe_visibility_augment.js +0 -158
  1111. package/src/engine/sound/simulation/probe/probe_visibility_bridge_components.d.ts +0 -31
  1112. package/src/engine/sound/simulation/probe/probe_visibility_bridge_components.d.ts.map +0 -1
  1113. package/src/engine/sound/simulation/probe/probe_visibility_bridge_components.js +0 -167
  1114. package/src/engine/sound/simulation/render/FoaProbeReverbRenderer.d.ts +0 -119
  1115. package/src/engine/sound/simulation/render/FoaProbeReverbRenderer.d.ts.map +0 -1
  1116. package/src/engine/sound/simulation/render/FoaProbeReverbRenderer.js +0 -498
  1117. package/src/engine/sound/simulation/render/ProbeReverbRenderer.d.ts +0 -110
  1118. package/src/engine/sound/simulation/render/ProbeReverbRenderer.d.ts.map +0 -1
  1119. package/src/engine/sound/simulation/render/ProbeReverbRenderer.js +0 -304
  1120. package/src/engine/sound/simulation/render/foaReverbImpulseResponse.d.ts +0 -38
  1121. package/src/engine/sound/simulation/render/foaReverbImpulseResponse.d.ts.map +0 -1
  1122. package/src/engine/sound/simulation/render/foaReverbImpulseResponse.js +0 -105
  1123. package/src/engine/sound/simulation/render/reverbImpulseResponse.d.ts.map +0 -1
  1124. package/src/engine/sound/simulation/render/reverb_band_tails.d.ts.map +0 -1
  1125. package/src/shade/renderer/geometry/virtual/build/submesh/vgeo_narrow_indices.d.ts +0 -11
  1126. package/src/shade/renderer/geometry/virtual/build/submesh/vgeo_narrow_indices.d.ts.map +0 -1
  1127. package/src/shade/renderer/geometry/virtual/build/submesh/vgeo_narrow_indices.js +0 -26
  1128. package/src/shade/renderer/geometry/virtual/format/payload/VGEO_ENCODING_FLAGS_MASK.d.ts +0 -7
  1129. package/src/shade/renderer/geometry/virtual/format/payload/VGEO_ENCODING_FLAGS_MASK.d.ts.map +0 -1
  1130. package/src/shade/renderer/geometry/virtual/format/payload/VGEO_ENCODING_FLAGS_MASK.js +0 -6
  1131. package/src/shade/renderer/geometry/virtual/format/payload/VGeoEncodedPayload.d.ts +0 -18
  1132. package/src/shade/renderer/geometry/virtual/format/payload/VGeoEncodedPayload.d.ts.map +0 -1
  1133. package/src/shade/renderer/geometry/virtual/format/payload/VGeoEncodedPayload.js +0 -18
  1134. package/src/shade/renderer/geometry/virtual/format/payload/vgeo_encode_cluster_payload.d.ts +0 -41
  1135. package/src/shade/renderer/geometry/virtual/format/payload/vgeo_encode_cluster_payload.d.ts.map +0 -1
  1136. package/src/shade/renderer/geometry/virtual/format/payload/vgeo_encode_cluster_payload.js +0 -208
  1137. package/src/shade/renderer/geometry/virtual/format/payload/vgeo_payload_attribute_offset.d.ts +0 -19
  1138. package/src/shade/renderer/geometry/virtual/format/payload/vgeo_payload_attribute_offset.d.ts.map +0 -1
  1139. package/src/shade/renderer/geometry/virtual/format/payload/vgeo_payload_attribute_offset.js +0 -39
  1140. package/src/shade/renderer/geometry/virtual/format/payload/vgeo_payload_size.d.ts +0 -14
  1141. package/src/shade/renderer/geometry/virtual/format/payload/vgeo_payload_size.d.ts.map +0 -1
  1142. package/src/shade/renderer/geometry/virtual/format/payload/vgeo_payload_size.js +0 -20
  1143. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_transfer.d.ts +0 -15
  1144. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_transfer.d.ts.map +0 -1
  1145. package/src/shade/renderer/geometry/virtual/format/read/vgeo_page_transfer.js +0 -84
  1146. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAG_COARSEN.d.ts +0 -20
  1147. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAG_COARSEN.d.ts.map +0 -1
  1148. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAG_COARSEN.js +0 -19
  1149. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAG_CULL.d.ts +0 -16
  1150. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAG_CULL.d.ts.map +0 -1
  1151. package/src/shade/renderer/geometry/virtual/runtime/cut/VGEO_CUT_FLAG_CULL.js +0 -15
  1152. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_reseed.d.ts +0 -3
  1153. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_reseed.d.ts.map +0 -1
  1154. package/src/shade/renderer/geometry/virtual/runtime/cut/shader_vgeo_cut_reseed.js +0 -131
  1155. package/src/shade/renderer/geometry/virtual/runtime/vgeo_frontier_words.d.ts +0 -23
  1156. package/src/shade/renderer/geometry/virtual/runtime/vgeo_frontier_words.d.ts.map +0 -1
  1157. package/src/shade/renderer/geometry/virtual/runtime/vgeo_frontier_words.js +0 -28
  1158. package/src/shade/renderer/geometry/virtual/runtime/vgeo_meshlet_metadata_write.d.ts +0 -17
  1159. package/src/shade/renderer/geometry/virtual/runtime/vgeo_meshlet_metadata_write.d.ts.map +0 -1
  1160. package/src/shade/renderer/geometry/virtual/runtime/vgeo_meshlet_metadata_write.js +0 -29
  1161. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts +0 -60
  1162. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.d.ts.map +0 -1
  1163. package/src/shade/renderer/geometry/virtual/sdf/VGeoSDFProxies.js +0 -197
  1164. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts +0 -18
  1165. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.d.ts.map +0 -1
  1166. package/src/shade/renderer/global_illumination/screen_probe/chunk_screen_probe_workgroup_sum.js +0 -50
  1167. package/src/shade/renderer/rasterize/native/chunk_rasterize_triangle.d.ts +0 -3
  1168. package/src/shade/renderer/rasterize/native/chunk_rasterize_triangle.d.ts.map +0 -1
  1169. package/src/shade/renderer/rasterize/native/chunk_rasterize_triangle.js +0 -73
  1170. /package/src/engine/sound/simulation/{probe → oracle}/echogram_band_rt60.d.ts +0 -0
  1171. /package/src/engine/sound/simulation/{probe → oracle}/echogram_band_rt60.js +0 -0
@@ -1,1175 +1,1192 @@
1
- import { assert } from "../../../../core/assert.js";
2
- import { float_to_uint8 } from "../../../../core/binary/float_to_uint8.js";
3
- import LineBuilder from "../../../../core/codegen/LineBuilder.js";
4
- import { rgb_to_hex } from "../../../../core/color/hex/rgb_to_hex.js";
5
- import { okhsv_to_linear_srgb } from "../../../../core/color/oklab/okhsv_to_linear_srgb.js";
6
- import { convert_channel_linear_to_sRGB } from "../../../../core/color/sRGB/linear_to_sRGB.js";
7
- import { Signal } from "../../../../core/events/signal/Signal.js";
8
- import { noop } from "../../../../core/function/noop.js";
9
- import { graphviz_escape_html_label } from "../../../../core/graph/format/graphviz/graphviz_escape_html_label.js";
10
- import { graphviz_escape_quoted } from "../../../../core/graph/format/graphviz/graphviz_escape_quoted.js";
11
- import { lerp } from "../../../../core/math/lerp.js";
12
- import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
13
- import { FrameGraphScope } from "./FrameGraphScope.js";
14
- import { FrameGraphState, frame_graph_state_name } from "./FrameGraphState.js";
15
- import { FramePassBuilder } from "./FramePassBuilder.js";
16
- import { FramePassNode } from "./FramePassNode.js";
17
- import { FramePassResources } from "./FramePassResources.js";
18
- import { ResourceEntry } from "./ResourceEntry.js";
19
- import { ResourceNode } from "./ResourceNode.js";
20
-
21
- /**
22
- * @typedef {import("./IFrameGraphContext.js").IFrameGraphContext} IFrameGraphContext
23
- * @typedef {import("./resource/ResourceDescriptor.js").ResourceDescriptor} ResourceDescriptor
24
- */
25
-
26
- /**
27
- * A high-level rendering architecture system that manages render passes and their resource dependencies.
28
- * This class schedules frame execution by building a directed graph of resources (textures, buffers) and the passes that read or write to them.
29
- *
30
- * By deferring execution until after the graph is compiled, it automatically handles complex tasks such as:
31
- * - Culling unreferenced resources and passes (dead code elimination for rendering).
32
- * - Automatic resource lifetime management (allocating transient resources just-in-time and destroying them immediately after their last use).
33
- * - Visualizing the rendering pipeline via GraphViz DOT exports.
34
- *
35
- * The graph is **one-shot**: it is recorded into, then compiled, then executed, and it never goes
36
- * back. {@link compile} derives reference counts and resource lifetimes from what was recorded, so
37
- * recording into a compiled graph corrupts them, and compiling twice accumulates resource reference
38
- * counts instead of resetting them, which disables culling entirely. Build a new graph per frame.
39
- *
40
- * @see FrameGraphState
41
- *
42
- * @source Based on the Frostbite's GDC paper "FrameGraph: Extensible Rendering Architecture in Frostbite" by Yuriy O'Donnell
43
- * @example
44
- * const graph = new FrameGraph("My Graph");
45
- *
46
- * const pass_data = {};
47
- * const pass = graph.add("GBuffer Pass", pass_data, (data, resources, context) => {
48
- *
49
- * context.beginRenderPass({
50
- * depth_attachment: resources.get(data.depth),
51
- * color_attachments:[
52
- * resources.get(data.normal),
53
- * resources.get(data.albedo),
54
- * ]
55
- * });
56
- *
57
- * for (const renderable in renderables){
58
- * drawMesh(context, renderable.mesh, renderable.material);
59
- * }
60
- *
61
- * context.endRenderPass();
62
- *
63
- * });
64
- *
65
- * pass_data.depth = pass.create("depth", {...});
66
- * pass_data.albedo = pass.create("albedo", {...});
67
- * pass_data.normal = pass.create("normal", {...});
68
- *
69
- * graph.compile();
70
- * graph.execute(context);
71
- *
72
- */
73
- export class FrameGraph {
74
- /**
75
- * Human-readable name, used for debugging and UI primarily.
76
- * There is no uniqueness guarantee
77
- * @type {string}
78
- */
79
- name = "";
80
-
81
- /**
82
- * Every pass that survived culling has run, successfully.
83
- *
84
- * **Success-only.** A pass that throws takes the failure out of {@link execute} without sending
85
- * this — the graph hands its transients back and re-raises, and a listener waiting on this one
86
- * is left waiting. Anything that must settle on both paths belongs in the caller's own
87
- * `finally`, not here. Deliberate rather than incidental: this says "the frame's work is
88
- * recorded", which a failed frame has not done.
89
- *
90
- * Read-only, and swallowing, on the same terms as {@link onPassBegin}.
91
- *
92
- * @type {Signal<IFrameGraphContext,this>}
93
- */
94
- onExecuted = new Signal();
95
-
96
- /**
97
- * A pass is about to run, and everything encoded until {@link onPassEnd} belongs to it.
98
- *
99
- * This exists because **a GPU pass label is not a key back to the pass that opened it.** One
100
- * frame graph pass routinely opens several GPU passes under labels of their own choosing —
101
- * `graph_build_hzb` records one node and `hzb.build` opens a compute pass per mip — so a
102
- * profiler holding a pile of timestamped labels has no way to work out afterwards which node
103
- * produced them. Bracketing execution is what supplies the answer, and it cannot be recovered
104
- * any other way.
105
- *
106
- * Fires only for passes that survive culling, in execution order, and never nests: {@link
107
- * execute} runs one pass at a time.
108
- *
109
- * **A listener is a read-only observer.** The graph is handed over for symmetry with the signal
110
- * convention, not as an invitation: recording or compiling from a listener corrupts the counts
111
- * and lifetimes `execute()` is in the middle of using. The one-shot state assertions guard
112
- * against that, but they cannot stop a listener — `Signal` catches whatever a handler throws
113
- * and logs it — so a misbehaving listener produces two console lines and the frame carries on.
114
- * By the same token an `expect()` inside a listener can never fail a test; assert after the
115
- * dispatch, as `FrameGraph.pass_signals.spec.js` does.
116
- *
117
- * @type {Signal<FramePassNode,this>}
118
- */
119
- onPassBegin = new Signal();
120
-
121
- /**
122
- * The pass most recently announced by {@link onPassBegin} has finished encoding.
123
- *
124
- * Sent even when the pass threw, before the failure is re-raised, so a listener that opened
125
- * something on begin is not left holding it open by an exception. A listener must therefore
126
- * treat this as "that pass is over" rather than "that pass succeeded".
127
- *
128
- * Read-only, and swallowing, on the same terms as {@link onPassBegin}.
129
- *
130
- * @type {Signal<FramePassNode,this>}
131
- */
132
- onPassEnd = new Signal();
133
-
134
- /**
135
- *
136
- * @type {FramePassNode[]}
137
- * @private
138
- */
139
- __pass_nodes = [];
140
-
141
- /**
142
- *
143
- * @type {ResourceNode[]}
144
- * @private
145
- */
146
- __resource_nodes = [];
147
-
148
- /**
149
- *
150
- * @type {ResourceEntry[]}
151
- * @private
152
- */
153
- __resource_registry = [];
154
-
155
- /**
156
- * The passes {@link execute} will run, in recording order, as decided by {@link compile}.
157
- *
158
- * Computed once and then iterated, rather than re-derived at execution time. It is also the set
159
- * the lifetime loop has to cover: a pass that runs without ever becoming a resource's
160
- * {@link ResourceEntry.last} user reads a transient the graph has already handed back to the
161
- * pool, and the pool re-issues within the frame. Deriving "does this pass run" in two places is
162
- * exactly what let the two answers differ — `ref_count === 0` in the lifetime loop against
163
- * {@link FramePassNode.can_execute} in `execute()`, which disagree for every read-only
164
- * {@link FramePassBuilder.make_side_effect} pass.
165
- *
166
- * @type {FramePassNode[]}
167
- */
168
- #surviving_passes = [];
169
-
170
- /**
171
- * Position in the one-shot lifecycle.
172
- * @type {FrameGraphState}
173
- */
174
- #state = FrameGraphState.Recording;
175
-
176
- /**
177
- * Innermost open recording scope, or null. The enclosing scopes are its
178
- * {@link FrameGraphScope.parent} chain, so this one field is the whole stack.
179
- * @type {FrameGraphScope|null}
180
- */
181
- #scope = null;
182
-
183
- /**
184
- * Scopes opened so far, which is what gives each one an ID unique within this graph.
185
- * @type {number}
186
- */
187
- #scope_count = 0;
188
-
189
- /**
190
- *
191
- * @param {string} name
192
- */
193
- constructor(name = "") {
194
- assert.isString(name, 'name');
195
-
196
-
197
- this.name = name;
198
- }
199
-
200
- /**
201
- * Position in the one-shot lifecycle. Recording is only legal in
202
- * {@link FrameGraphState.Recording}, and {@link execute} is only legal in
203
- * {@link FrameGraphState.Compiled}.
204
- * @returns {FrameGraphState}
205
- */
206
- get state() {
207
- return this.#state;
208
- }
209
-
210
- /**
211
- * Innermost open recording scope, or null when recording outside of one.
212
- * @returns {FrameGraphScope|null}
213
- */
214
- get scope() {
215
- return this.#scope;
216
- }
217
-
218
- /**
219
- * Open a recording scope. Every pass and resource node created until the matching
220
- * {@link pop_scope} is stamped with it, nested scopes included.
221
- *
222
- * This is how the graph attributes work to whoever recorded it. Node names come from the
223
- * helpers that happened to build them and say nothing about the caller, so without a scope a
224
- * DOT export cannot group a frame by the thing each group belongs to, and a diagnostic cannot
225
- * ask whether everything one caller recorded was culled.
226
- *
227
- * @param {string} name
228
- * @returns {FrameGraphScope} the scope opened, for later queries against node stamps
229
- */
230
- push_scope(name) {
231
- assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': scopes can only be opened while recording, graph is ${frame_graph_state_name(this.#state)}`);
232
- assert.isString(name, 'name');
233
-
234
- const scope = new FrameGraphScope();
235
-
236
- scope.name = name;
237
- scope.id = this.#scope_count++;
238
- scope.parent = this.#scope;
239
-
240
- this.#scope = scope;
241
-
242
- return scope;
243
- }
244
-
245
- /**
246
- * Close the innermost open recording scope, returning to the one that encloses it.
247
- */
248
- pop_scope() {
249
- assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': scopes can only be closed while recording, graph is ${frame_graph_state_name(this.#state)}`);
250
- assert.notNull(this.#scope, `FrameGraph '${this.name}': pop_scope() without a scope open`);
251
-
252
- this.#scope = this.#scope.parent;
253
- }
254
-
255
- /**
256
- *
257
- * @param {number} id Resource Node ID
258
- * @returns {ResourceEntry}
259
- */
260
- getResourceEntry(id) {
261
- const node = this.getResourceNode(id);
262
-
263
- assert.defined(node, 'node');
264
-
265
- const registry = this.__resource_registry;
266
-
267
- const entry = registry[node.resource_id];
268
-
269
- assert.defined(entry, 'entry');
270
-
271
- return entry;
272
- }
273
-
274
- /**
275
- *
276
- * @param {number} id
277
- * @returns {ResourceNode}
278
- */
279
- getResourceNode(id) {
280
- assert.isNonNegativeInteger(id, 'id');
281
-
282
- const resource = this.__resource_nodes[id];
283
-
284
- if (resource === undefined) {
285
- throw new Error(`Resource Node ${id} not found`);
286
- }
287
-
288
- assert.equal(resource.id, id, 'resource.id does not match');
289
-
290
- return resource;
291
- }
292
-
293
- /**
294
- * @template T
295
- * @param {number} id resource ID
296
- * @returns {T}
297
- */
298
- getDescriptor(id) {
299
- return this.getResourceEntry(id).resource_descriptor;
300
- }
301
-
302
- /**
303
- * @template T
304
- * @param {string} name
305
- * @param {T} descriptor
306
- * @returns {number}
307
- */
308
- create_resource(name, descriptor) {
309
- assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': resources can only be created while recording, graph is ${frame_graph_state_name(this.#state)}`);
310
- assert.isString(name, 'name');
311
- assert.defined(descriptor, 'descriptor');
312
- assert.notNull(descriptor, 'descriptor');
313
- assert.isObject(descriptor, 'descriptor');
314
-
315
- const resource = this._createResourceEntry(descriptor);
316
-
317
- return this._createResourceNode(name, resource.resource_id).id;
318
- }
319
-
320
- /**
321
- * @template T
322
- * @param {T} descriptor
323
- * @return {ResourceEntry}
324
- * @private
325
- */
326
- _createResourceEntry(descriptor) {
327
- assert.defined(descriptor, 'descriptor');
328
- assert.notNull(descriptor, 'descriptor');
329
-
330
- const entry = new ResourceEntry();
331
-
332
- entry.resource_id = this.__resource_registry.length;
333
- entry.resource_descriptor = descriptor;
334
-
335
- this.__resource_registry.push(entry);
336
-
337
- return entry;
338
- }
339
-
340
- /**
341
- *
342
- * @param {string} name
343
- * @param {number} resource_id
344
- * @return {ResourceNode}
345
- * @private
346
- */
347
- _createResourceNode(name, resource_id) {
348
- assert.isString(name, 'name');
349
- assert.isNonNegativeInteger(resource_id, 'resource_id');
350
-
351
- const n = new ResourceNode();
352
-
353
- const id = this.__resource_nodes.length;
354
-
355
- n.id = id;
356
- n.name = name;
357
- n.resource_id = resource_id;
358
- n.scope = this.#scope;
359
-
360
- this.__resource_nodes[id] = n;
361
-
362
- return n;
363
- }
364
-
365
- /**
366
- *
367
- * @param {number} node_id
368
- * @returns {number} ID of the cloned resource node
369
- */
370
- clone_resource(node_id) {
371
- assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': resources can only be cloned while recording, graph is ${frame_graph_state_name(this.#state)}`);
372
-
373
- const node = this.getResourceNode(node_id);
374
-
375
- const entry = this.__resource_registry[node.resource_id];
376
-
377
- entry.resource_version++;
378
-
379
- const clone_node = new ResourceNode();
380
- clone_node.id = this.__resource_nodes.length;
381
- clone_node.name = node.name;
382
- clone_node.resource_id = node.resource_id;
383
- clone_node.version = entry.resource_version;
384
- clone_node.scope = this.#scope;
385
-
386
- this.__resource_nodes.push(clone_node);
387
-
388
- return clone_node.id;
389
- }
390
-
391
- /**
392
- * @template T
393
- * @param {string} name
394
- * @param {ResourceDescriptor<T>} description
395
- * @param {T} resource
396
- * @returns {number}
397
- */
398
- import_resource(name, description, resource) {
399
- assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': resources can only be imported while recording, graph is ${frame_graph_state_name(this.#state)}`);
400
-
401
- const record = this._createResourceEntry(description);
402
-
403
- record.resource = resource;
404
-
405
- record.imported = true;
406
-
407
- return this._createResourceNode(name, record.resource_id).id;
408
- }
409
-
410
- /**
411
- * @returns {boolean}
412
- * @param id
413
- */
414
- is_valid_resource(id) {
415
- const node = this.getResourceNode(id);
416
- const record = this.getResourceEntry(id);
417
-
418
- return node.version === record.resource_version;
419
- }
420
-
421
- /**
422
- * Add a new pass to the graph.
423
- * @template T
424
- * @param {string} name
425
- * @param {T} data
426
- * @param {(data: T, resources: FramePassResources, context: IFrameGraphContext) => void} execute
427
- * @returns {FramePassBuilder}
428
- */
429
- add(name, data, execute) {
430
- assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': passes can only be added while recording, graph is ${frame_graph_state_name(this.#state)}`);
431
- assert.isString(name, 'name');
432
-
433
- assert.defined(data, 'data');
434
- assert.notNull(data, 'data');
435
- assert.isObject(data, 'data');
436
-
437
- assert.isFunction(execute, 'execute');
438
-
439
- const pass_nodes = this.__pass_nodes;
440
-
441
- const builder = new FramePassBuilder();
442
- const node = new FramePassNode();
443
-
444
- node.id = pass_nodes.length;
445
- node.name = name;
446
- node.execute = execute;
447
- node.scope = this.#scope;
448
-
449
- pass_nodes.push(node);
450
-
451
- builder.init(this, node);
452
-
453
- node.data = data;
454
-
455
- return builder;
456
- }
457
-
458
- /**
459
- * Check the recorded graph for the two ways a read can silently return the wrong contents.
460
- *
461
- * {@link execute} runs passes in **insertion order** and never sorts, so a pass that reads a
462
- * resource written by a pass recorded after it reads whatever that resource happened to hold.
463
- * And a {@link ResourceEntry} owns exactly one concrete resource — a superseded
464
- * {@link ResourceNode} is not a snapshot of the old contents, it is the same resource holding
465
- * the new contents — so reading an out-of-date node is reading the wrong thing.
466
- *
467
- * One shape is deliberately **not** a problem: reading a transient that no pass writes is
468
- * fine, because a resource can be created by a pass that only reserves it, and the reader is
469
- * then the pass about to fill it.
470
- *
471
- * Accumulating into a shared target is **not** an exemption. {@link FramePassBuilder.write}
472
- * records a read of the handle it replaces, so a pass re-attaching a target it goes on to write
473
- * is a reader of that target, and it has to re-attach the handle its predecessor produced
474
- * rather than the one it was originally handed. Several passes rasterizing into one render
475
- * target do exactly this, and each of them threads the handle forward.
476
- *
477
- * Describes what was recorded rather than what survives culling, so it runs before culling is
478
- * computed — {@link compile} calls it.
479
- *
480
- * @param {function(string):*} [problem_consumer] invoked once per problem found
481
- * @returns {boolean} whether the graph is free of problems
482
- */
483
- validate(problem_consumer = noop) {
484
-
485
- const pass_nodes = this.__pass_nodes;
486
- const pass_node_count = pass_nodes.length;
487
-
488
- const resource_nodes = this.__resource_nodes;
489
-
490
- let valid = true;
491
-
492
- /**
493
- * Highest resource node version of a given resource entry written so far, by entry ID.
494
- * @type {Int32Array}
495
- */
496
- const current_version = new Int32Array(this.__resource_registry.length);
497
-
498
- /**
499
- * Index of the pass that wrote {@link current_version}, by resource entry ID, or -1.
500
- * @type {Int32Array}
501
- */
502
- const current_version_writer = new Int32Array(this.__resource_registry.length).fill(-1);
503
-
504
- for (let i = 0; i < pass_node_count; i++) {
505
- const pass = pass_nodes[i];
506
-
507
- for (const id of pass.resource_reads) {
508
- const node = resource_nodes[id];
509
-
510
- const producer = node.producer;
511
-
512
- if (producer !== null && producer.id > i) {
513
- problem_consumer(`Pass ${i} '${pass.name}' reads '${node.name}', which is written by pass ${producer.id} '${producer.name}'. Passes execute in the order they were added, so the read happens before the write.`);
514
-
515
- valid = false;
516
- }
517
-
518
- const version = current_version[node.resource_id];
519
-
520
- if (node.version < version) {
521
- const writer_index = current_version_writer[node.resource_id];
522
-
523
- problem_consumer(`Pass ${i} '${pass.name}' reads version ${node.version} of '${node.name}', which pass ${writer_index} '${pass_nodes[writer_index].name}' has already superseded with version ${version}. Both versions name one resource, so the read returns the newer contents.`);
524
-
525
- valid = false;
526
- }
527
- }
528
-
529
- for (const id of pass.resource_writes) {
530
- const node = resource_nodes[id];
531
-
532
- if (node.version > current_version[node.resource_id]) {
533
- current_version[node.resource_id] = node.version;
534
- current_version_writer[node.resource_id] = i;
535
- }
536
- }
537
- }
538
-
539
- return valid;
540
- }
541
-
542
- /**
543
- * Report physical resources this graph holds under more than one {@link ResourceEntry}.
544
- *
545
- * Everything {@link validate} reasons about — versions, supersession, `producer` ordering — is
546
- * scoped to a single entry, and {@link import_resource} has no identity check, so importing one
547
- * `GPUTexture` twice gives it two independent version chains that the checker treats as
548
- * unrelated resources. Every read/write hazard between them is invisible, and
549
- * {@link is_valid_resource} answers about the wrong chain.
550
- *
551
- * **Detection only, and not wired into {@link compile}.** The live `Shading` graph imports the
552
- * camera buffer seven times and the hierarchical-Z buffer three, and none of those produces an
553
- * incorrect frame today: the duplicate sites happen to be ordered safely, and their passes write
554
- * imported resources, so they are side-effect passes that never cull. Failing `compile()` on
555
- * them would break the renderer over a hazard that is structural rather than live, and
556
- * collapsing them into one entry changes which handle every one of those callers gets back.
557
- * Both are decisions of their own; this reports the shape so that either can be taken with the
558
- * numbers in hand.
559
- *
560
- * Only entries that hold a resource are considered, so a transient is reported only if the
561
- * backend handed the same object out twice while both were live — which is itself the bug
562
- * {@link RenderResourceManager} guards against.
563
- *
564
- * @param {function(string):*} [problem_consumer] invoked once per aliased resource
565
- * @returns {number} how many physical resources are held under more than one entry
566
- */
567
- report_resource_aliasing(problem_consumer = noop) {
568
- const registry = this.__resource_registry;
569
- const entry_count = registry.length;
570
-
571
- /**
572
- * Entry IDs by the physical resource they hold.
573
- * @type {Map<*,number[]>}
574
- */
575
- const by_resource = new Map();
576
-
577
- for (let i = 0; i < entry_count; i++) {
578
- const entry = registry[i];
579
-
580
- if (entry.resource === null) {
581
- continue;
582
- }
583
-
584
- const existing = by_resource.get(entry.resource);
585
-
586
- if (existing === undefined) {
587
- by_resource.set(entry.resource, [i]);
588
- } else {
589
- existing.push(i);
590
- }
591
- }
592
-
593
- let aliased = 0;
594
-
595
- for (const entry_ids of by_resource.values()) {
596
- if (entry_ids.length < 2) {
597
- continue;
598
- }
599
-
600
- aliased++;
601
-
602
- const names = entry_ids.map(id => {
603
- const node = this.__resource_nodes.find(n => n.resource_id === id);
604
-
605
- return `${id} '${node === undefined ? "?" : node.name}'`;
606
- });
607
-
608
- problem_consumer(`One resource is held under ${entry_ids.length} entries — ${names.join(", ")}. Versions and supersession are scoped to a single entry, so no hazard between them can be seen.`);
609
- }
610
-
611
- return aliased;
612
- }
613
-
614
- compile() {
615
- assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': compile() is one-shot, a second compile accumulates resource reference counts instead of resetting them and culling stops working, graph is ${frame_graph_state_name(this.#state)}`);
616
-
617
- assert.equal(this.#scope, null, `FrameGraph '${this.name}': recording finished with scope '${this.#scope}' still open, every push_scope() needs its pop_scope()`);
618
-
619
- /*
620
- `validate()` is called *inside* the assert on purpose, and must stay there.
621
-
622
- @rollup/plugin-strip deletes a matched call together with its arguments, so under the strip
623
- the consuming project applies (README, "Shipping a build") the whole gate — the walk, the
624
- two Int32Arrays, and `console.error` — disappears. That is the intent: this is a
625
- development check over what was recorded, run five or more times a frame, and a shipped
626
- game should not pay for it.
627
-
628
- Hoisting it to `const valid = this.validate(...)` would leave the walk running in every
629
- shipped build while stripping only the assert that reads the result. Do not "clean this up".
630
- */
631
- assert.ok(this.validate(console.error), `FrameGraph '${this.name}': the recorded graph is invalid, the problems are logged above`);
632
-
633
- this.#state = FrameGraphState.Compiled;
634
-
635
- const pass_nodes = this.__pass_nodes;
636
-
637
- // wire resources of passes
638
- const pass_node_count = pass_nodes.length;
639
- const resource_nodes = this.__resource_nodes;
640
-
641
- for (let i = 0; i < pass_node_count; i++) {
642
- const pass = pass_nodes[i];
643
-
644
- // mask pass as having number of references equal to number of resources it writes to
645
- pass.ref_count = pass.resource_writes.length;
646
-
647
- for (const id of pass.resource_reads) {
648
- const read_node = resource_nodes[id];
649
-
650
- read_node.ref_count++;
651
- }
652
- }
653
-
654
- // perform culling
655
- /**
656
- *
657
- * @type {ResourceNode[]}
658
- */
659
- const unreferenced_resources = [];
660
-
661
- for (const node of resource_nodes) {
662
- if (node.ref_count === 0) {
663
- unreferenced_resources.push(node);
664
- }
665
- }
666
-
667
- while (unreferenced_resources.length > 0) {
668
- const unreferenced_resource = unreferenced_resources.pop();
669
-
670
- const producer = unreferenced_resource.producer;
671
-
672
- if (producer === null || producer.has_side_effects) {
673
- continue;
674
- }
675
-
676
- assert.greaterThanOrEqual(producer.ref_count, 1, 'must have at least one reference'); // Why?
677
-
678
- // disconnect unreferenced resource from producer
679
- producer.ref_count--;
680
-
681
- if (producer.ref_count === 0) {
682
-
683
- // producer is no longer referenced
684
-
685
- for (const id of producer.resource_reads) {
686
- const node = resource_nodes[id];
687
-
688
- // disconnect producer from all its reads (upstream)
689
- node.ref_count--;
690
-
691
- if (node.ref_count === 0) {
692
- // resource is no longer referenced
693
- unreferenced_resources.push(node);
694
- }
695
- }
696
- }
697
- }
698
-
699
- // decide which passes run, once. `execute()` iterates this set instead of asking again.
700
- const surviving_passes = this.#surviving_passes;
701
-
702
- surviving_passes.length = 0;
703
-
704
- for (let i = 0; i < pass_node_count; i++) {
705
- const pass = pass_nodes[i];
706
-
707
- if (!pass.can_execute()) {
708
- // culled
709
- continue;
710
- }
711
-
712
- surviving_passes.push(pass);
713
- }
714
-
715
- // calculate lifetimes, over exactly the passes that will run
716
- const surviving_pass_count = surviving_passes.length;
717
-
718
- for (let i = 0; i < surviving_pass_count; i++) {
719
- const pass = surviving_passes[i];
720
-
721
- const allocates = pass.resource_allocates;
722
-
723
- allocates.length = 0;
724
-
725
- for (const id of pass.resource_creates) {
726
- const entry = this.getResourceEntry(id);
727
-
728
- entry.producer = pass;
729
- entry.last = pass;
730
-
731
- allocates.push(id);
732
- }
733
-
734
- for (const id of pass.resource_writes) {
735
- const entry = this.getResourceEntry(id);
736
-
737
- this.#claim_unparented_transient(entry, pass, id);
738
-
739
- entry.last = pass;
740
- }
741
-
742
- for (const id of pass.resource_reads) {
743
- const entry = this.getResourceEntry(id);
744
-
745
- this.#claim_unparented_transient(entry, pass, id);
746
-
747
- entry.last = pass;
748
- }
749
- }
750
- }
751
-
752
- /**
753
- * Make `pass` the allocator of a transient no pass created.
754
- *
755
- * {@link create_resource} is public, so a caller can reserve a handle before it knows which
756
- * pass will fill it — which is what the extension surface does, handing the graph out through
757
- * `FrameContext.graph`. Such an entry appears in no pass's {@link FramePassNode.resource_creates},
758
- * so nothing allocated it: the pass was handed `null` and the release scan then tried to give
759
- * `null` back to the pool. Allocating it at its first surviving user gives it the same lifetime
760
- * any other transient has, and matches what {@link validate} already blesses — reading a
761
- * transient no pass writes is legal, because the reader may be the pass about to fill it.
762
- *
763
- * @param {ResourceEntry} entry
764
- * @param {FramePassNode} pass
765
- * @param {number} id resource node ID
766
- */
767
- #claim_unparented_transient(entry, pass, id) {
768
- if (entry.producer !== null || entry.isImported()) {
769
- return;
770
- }
771
-
772
- entry.producer = pass;
773
-
774
- pass.resource_allocates.push(id);
775
- }
776
-
777
- /**
778
- *
779
- * @param {IFrameGraphContext} context
780
- */
781
- execute(context) {
782
- assert.equal(this.#state, FrameGraphState.Compiled, `FrameGraph '${this.name}': execute() requires a compiled graph, an uncompiled one has every reference count at 0 and culls itself silently, graph is ${frame_graph_state_name(this.#state)}`);
783
- assert.defined(context, 'context');
784
- assert.notNull(context, 'context');
785
- assert.isObject(context, 'context');
786
-
787
- this.#state = FrameGraphState.Executed;
788
-
789
- // Whatever `compile()` computed lifetimes over, and nothing else. Re-deriving the survivor
790
- // set here is what let the two disagree.
791
- const pass_nodes = this.#surviving_passes;
792
- const pass_node_count = pass_nodes.length;
793
-
794
- try {
795
- for (let i = 0; i < pass_node_count; i++) {
796
- const node = pass_nodes[i];
797
-
798
- const node_allocated_resources = node.resource_allocates;
799
-
800
- for (const id of node_allocated_resources) {
801
-
802
- // allocate resource
803
- this.getResourceEntry(id).create(context.resource_manager);
804
- }
805
-
806
- const resources = new FramePassResources();
807
- resources.init(this, node);
808
-
809
- /*
810
- Guarded rather than dispatched unconditionally: `send2` on a signal with no handlers
811
- still bumps `generation` and walks a Map iterator, and this pair runs twice per pass
812
- over a couple of hundred passes a frame. Nothing observes the graph in a normal frame,
813
- so the common case should cost a size comparison and nothing else.
814
- */
815
- const announce_passes = this.onPassBegin.hasHandlers() || this.onPassEnd.hasHandlers();
816
-
817
- if (announce_passes) {
818
- this.onPassBegin.send2(node, this);
819
- }
820
-
821
- // execute pass
822
- try {
823
- node.execute(node.data, resources, context);
824
- } catch (e) {
825
- // decorate
826
- const error = new Error(`RenderPass '${node.name}' failed to execute`);
827
-
828
- error.cause = e;
829
-
830
- throw error;
831
- } finally {
832
- // `finally` so a pass that throws still closes its bracket — a listener that opened
833
- // a scope on begin would otherwise attribute the rest of the frame to the pass that
834
- // died.
835
- if (announce_passes) {
836
- this.onPassEnd.send2(node, this);
837
- }
838
- }
839
-
840
-
841
- const resource_entries = this.__resource_registry;
842
- const resource_entry_count = resource_entries.length;
843
-
844
- for (let entry_index = 0; entry_index < resource_entry_count; entry_index++) {
845
- const entry = resource_entries[entry_index];
846
-
847
- if (entry.last === node && entry.isTransient()) {
848
- // this was the last user of the resource and the resource is transient (no external usage)
849
- entry.destroy(context.resource_manager);
850
- }
851
-
852
- }
853
-
854
- }
855
- } catch (e) {
856
- /*
857
- Nothing further will run, so every transient still checked out is checked out forever —
858
- in the Shading graph, tens of MB of render targets, leaked again on every failing frame
859
- of a render loop that catches and carries on.
860
-
861
- Deliberately here and not in a `finally` around the pass body: that `finally` belongs to
862
- the onPassBegin/onPassEnd bracket, and putting a release scan inside it would run the
863
- sweep on the success path too, once per pass.
864
- */
865
- this.#release_live_transients(context.resource_manager);
866
-
867
- throw e;
868
- }
869
-
870
- this.onExecuted.send2(context, this);
871
- }
872
-
873
- /**
874
- * Hand back every transient still holding a resource.
875
- *
876
- * Only reachable when a pass throws — {@link execute} releases as it goes, so on the success
877
- * path there is nothing left to find.
878
- *
879
- * The `resource !== null` filter is only a safe way to ask "is this still checked out" because
880
- * {@link ResourceEntry.destroy} clears the field. The pool re-issues immediately and within the
881
- * frame, so an entry naming a resource it has already returned would be pooled a second time,
882
- * and `TransientResourcePool.release` would take it, because that resource *is* bound — to
883
- * whoever owns it now.
884
- *
885
- * @param {RenderResourceManager} resources
886
- */
887
- #release_live_transients(resources) {
888
- const entries = this.__resource_registry;
889
- const entry_count = entries.length;
890
-
891
- for (let i = 0; i < entry_count; i++) {
892
- const entry = entries[i];
893
-
894
- if (entry.isTransient() && entry.resource !== null) {
895
- entry.destroy(resources);
896
- }
897
- }
898
- }
899
-
900
- /**
901
- * Should only call after {@link compile}
902
- *
903
- * One entry in `resources` per resource **node**, that is per version, keyed by node ID. A pass
904
- * records the node it read or wrote and not the underlying resource, so this is the id space
905
- * `passes[].reads` and `passes[].writes` point into; a registry-keyed export would leave those
906
- * references dangling on every version past the first.
907
- *
908
- * Can be visualized with this tool: https://skaarj1989.github.io/FrameGraph/
909
- *
910
- * @see https://github.com/skaarj1989/FrameGraph/blob/viewer/JsonWriter.hpp
911
- * @return {{passes: [], resources: []}}
912
- */
913
- exportToJson() {
914
-
915
- const resources = this.__resource_nodes.map(node => {
916
- const entry = this.__resource_registry[node.resource_id];
917
-
918
- const j = {
919
- id: node.id,
920
- name: node.name,
921
- transient: entry.isTransient(),
922
- };
923
-
924
- if (node.version > 0) {
925
- j.version = node.version;
926
- }
927
-
928
- const description = entry.resource_descriptor?.toString();
929
-
930
- if (description) {
931
- j.description = description;
932
- }
933
-
934
- if (node.producer !== null) {
935
- j.createdBy = node.producer.id;
936
- }
937
-
938
- const readers = [];
939
- const writers = [];
940
-
941
- for (const pass of this.__pass_nodes) {
942
- if (pass.reads(node.id)) {
943
- readers.push(pass.id);
944
- }
945
- if (pass.writes(node.id)) {
946
- writers.push(pass.id);
947
- }
948
- }
949
-
950
- if (readers.length > 0) {
951
- j.readers = readers;
952
- }
953
- if (writers.length > 0) {
954
- j.writers = writers;
955
- }
956
-
957
- return j;
958
- });
959
-
960
- return {
961
- passes: this.__pass_nodes.map(node => {
962
- return {
963
- id: node.id,
964
- name: node.name,
965
- culled: !node.can_execute(),
966
- reads: node.resource_reads,
967
- writes: node.resource_writes,
968
- }
969
- }),
970
- resources
971
- }
972
- }
973
-
974
- /**
975
- * Export the graph diagram in GraphViz DOT format.
976
- * Useful for debugging.
977
- * @see https://en.wikipedia.org/wiki/DOT_(graph_description_language)
978
- * @return {string}
979
- */
980
- exportToDot() {
981
- const out = new LineBuilder();
982
-
983
- out.add("digraph FrameGraph {");
984
- out.indent();
985
- out.add("graph [style=invis, rankdir=\"TB\" ordering=out, splines=spline]");
986
- out.add("node [shape=record, fontname=\"helvetica\", fontsize=10, margin=\"0.2,0.03\"]");
987
-
988
-
989
- // -- Define pass nodes
990
-
991
- /**
992
- * @param {FramePassNode} node
993
- * @returns {string}
994
- */
995
- const pass_declaration = (node) => `P${node.id} [label=<{ {<B>${graphviz_escape_html_label(node.name)}</B>} | {${(node.has_side_effects ? "&#x2605; " : "")} Refs: ${node.ref_count}<BR/> Index: ${node.id}} }> style=\"rounded,filled\", fillcolor=${(node.ref_count > 0 || node.has_side_effects) ? "orange" : "lightgray"}]`;
996
-
997
- out.add("");
998
- out.add("# Pass Nodes");
999
- for (const node of this.__pass_nodes) {
1000
- if (node.scope === null) {
1001
- out.add(pass_declaration(node));
1002
- }
1003
- }
1004
-
1005
- // -- Define resource nodes
1006
-
1007
- /**
1008
- *
1009
- * @param {string} type
1010
- * @returns {number}
1011
- */
1012
- function type_to_color(type) {
1013
-
1014
- const hash_32 = computeStringHash(type);
1015
-
1016
- const hash_16 = (hash_32 & 0xffff) ^ (hash_32 >>> 16);
1017
-
1018
- return hash_16 / 0xffff;
1019
- }
1020
-
1021
- /**
1022
- *
1023
- * @param {ResourceEntry} entry
1024
- * @return {string}
1025
- */
1026
- function entry_to_background_color(entry) {
1027
-
1028
- let color_hue = type_to_color(entry.resource_descriptor?.type ?? "");
1029
-
1030
- // remap hue away from red
1031
- color_hue = lerp(0.10, 0.90, color_hue);
1032
-
1033
- const saturation = entry.isImported() ? 0.2 : 0.07;
1034
-
1035
- const color_rgb = [];
1036
- okhsv_to_linear_srgb(color_rgb, color_hue, saturation, 1)
1037
-
1038
- /*
1039
- GraphViz reads `#rrggbb` as sRGB, so a linear-light value quantized straight to bytes
1040
- arrives at roughly three times the chroma the okhsv parameters asked for — which turns
1041
- the deliberately quiet imported-vs-transient saturation split into a loud one.
1042
- */
1043
- const hex = rgb_to_hex(...color_rgb.map(c => float_to_uint8(convert_channel_linear_to_sRGB(c))));
1044
-
1045
- return `#${hex}`;
1046
- }
1047
-
1048
- /**
1049
- * @param {ResourceNode} node
1050
- * @returns {string}
1051
- */
1052
- const resource_declaration = (node) => {
1053
- const entry = this.__resource_registry[node.resource_id];
1054
-
1055
- const type = graphviz_escape_html_label(entry.resource_descriptor?.type ?? "");
1056
-
1057
- const block_title = `${entry.isImported() ? "↪ " : ""}${graphviz_escape_html_label(node.name)}`;
1058
-
1059
- // a plain quoted attribute, not a record label: `{`, `}` and `|` are ordinary here
1060
- const block_tooltip = graphviz_escape_quoted(entry.toString());
1061
-
1062
- return `R${entry.resource_id}_${node.version} [label=<{ {<B>${block_title}</B>${node.version > 0 ? ` <FONT>v${(node.version + 1)}</FONT>` : ""}<BR/>${type}} | {Index: ${entry.resource_id}<BR/> Refs : ${node.ref_count} } }> style=filled, fillcolor="${entry_to_background_color(entry)}" tooltip="${block_tooltip}"]`;
1063
- };
1064
-
1065
- out.add("");
1066
- out.add("# Resource Nodes");
1067
- for (const node of this.__resource_nodes) {
1068
- if (node.scope === null) {
1069
- out.add(resource_declaration(node));
1070
- }
1071
- }
1072
-
1073
- // -- Define scoped nodes, inside the cluster of the scope that recorded them
1074
-
1075
- /**
1076
- * Scopes that stamped at least one node, and the scopes enclosing those.
1077
- * @type {Set<FrameGraphScope>}
1078
- */
1079
- const scopes = new Set();
1080
-
1081
- for (const node of [...this.__pass_nodes, ...this.__resource_nodes]) {
1082
- for (let scope = node.scope; scope !== null && !scopes.has(scope); scope = scope.parent) {
1083
- scopes.add(scope);
1084
- }
1085
- }
1086
-
1087
- /**
1088
- * @param {FrameGraphScope} scope
1089
- */
1090
- const emit_scope = (scope) => {
1091
- out.add(`subgraph cluster_${scope.id} {`);
1092
- out.indent();
1093
-
1094
- // the root graph is drawn invisible, so a cluster has to ask for its own frame
1095
- out.add(`label="${graphviz_escape_quoted(scope.name)}"`);
1096
- out.add("style=\"rounded,dashed\", color=\"gray55\", fontname=\"helvetica\", fontsize=10, labeljust=\"l\"");
1097
-
1098
- for (const node of this.__pass_nodes) {
1099
- if (node.scope === scope) {
1100
- out.add(pass_declaration(node));
1101
- }
1102
- }
1103
-
1104
- for (const node of this.__resource_nodes) {
1105
- if (node.scope === scope) {
1106
- out.add(resource_declaration(node));
1107
- }
1108
- }
1109
-
1110
- for (const child of scopes) {
1111
- if (child.parent === scope) {
1112
- emit_scope(child);
1113
- }
1114
- }
1115
-
1116
- out.dedent();
1117
- out.add("}");
1118
- };
1119
-
1120
- if (scopes.size > 0) {
1121
- out.add("");
1122
- out.add("# Scopes");
1123
-
1124
- for (const scope of scopes) {
1125
- if (scope.parent === null) {
1126
- emit_scope(scope);
1127
- }
1128
- }
1129
- }
1130
-
1131
- // -- Each pass node points to the resource that it writes
1132
-
1133
- out.add("");
1134
- out.add("# Resource Writes");
1135
- for (const node of this.__pass_nodes) {
1136
- out.add(`P${node.id} -> {`);
1137
- out.indent();
1138
- for (const id of node.resource_writes) {
1139
- const written = this.__resource_nodes[id];
1140
- out.add(`R${written.resource_id}_${written.version} `);
1141
- }
1142
- out.dedent();
1143
- out.add("} [color=orangered]");
1144
- }
1145
-
1146
- // -- Each resource node points to the pass where it's consumed
1147
-
1148
- out.add("");
1149
- out.add("# Resource Reads");
1150
-
1151
- for (const node of this.__resource_nodes) {
1152
- out.add(`R${node.resource_id}_${node.version} -> {`);
1153
- out.indent();
1154
- // find all readers of this resource node
1155
- for (const pass of this.__pass_nodes) {
1156
- for (const id of pass.resource_reads)
1157
- if (id === node.id) {
1158
- out.add(`P${pass.id} `);
1159
- }
1160
- }
1161
- out.dedent();
1162
- out.add("} [color=olivedrab3]");
1163
- }
1164
- out.dedent();
1165
- out.add("}");
1166
- return out.build();
1167
- }
1168
- }
1169
-
1170
- /**
1171
- * Type check shortcut.
1172
- * @readonly
1173
- * @type {boolean}
1174
- */
1
+ import { assert } from "../../../../core/assert.js";
2
+ import { float_to_uint8 } from "../../../../core/binary/float_to_uint8.js";
3
+ import LineBuilder from "../../../../core/codegen/LineBuilder.js";
4
+ import { rgb_to_hex } from "../../../../core/color/hex/rgb_to_hex.js";
5
+ import { okhsv_to_linear_srgb } from "../../../../core/color/oklab/okhsv_to_linear_srgb.js";
6
+ import { convert_channel_linear_to_sRGB } from "../../../../core/color/sRGB/linear_to_sRGB.js";
7
+ import { Signal } from "../../../../core/events/signal/Signal.js";
8
+ import { noop } from "../../../../core/function/noop.js";
9
+ import { graphviz_escape_html_label } from "../../../../core/graph/format/graphviz/graphviz_escape_html_label.js";
10
+ import { graphviz_escape_quoted } from "../../../../core/graph/format/graphviz/graphviz_escape_quoted.js";
11
+ import { lerp } from "../../../../core/math/lerp.js";
12
+ import { computeStringHash } from "../../../../core/primitives/strings/computeStringHash.js";
13
+ import { FrameGraphScope } from "./FrameGraphScope.js";
14
+ import { FrameGraphState, frame_graph_state_name } from "./FrameGraphState.js";
15
+ import { FramePassBuilder } from "./FramePassBuilder.js";
16
+ import { FramePassNode } from "./FramePassNode.js";
17
+ import { FramePassResources } from "./FramePassResources.js";
18
+ import { ResourceEntry } from "./ResourceEntry.js";
19
+ import { ResourceNode } from "./ResourceNode.js";
20
+
21
+ /**
22
+ * @typedef {import("./IFrameGraphContext.js").IFrameGraphContext} IFrameGraphContext
23
+ * @typedef {import("./resource/ResourceDescriptor.js").ResourceDescriptor} ResourceDescriptor
24
+ */
25
+
26
+ /**
27
+ * A high-level rendering architecture system that manages render passes and their resource dependencies.
28
+ * This class schedules frame execution by building a directed graph of resources (textures, buffers) and the passes that read or write to them.
29
+ *
30
+ * By deferring execution until after the graph is compiled, it automatically handles complex tasks such as:
31
+ * - Culling unreferenced resources and passes (dead code elimination for rendering).
32
+ * - Automatic resource lifetime management (allocating transient resources just-in-time and destroying them immediately after their last use).
33
+ * - Visualizing the rendering pipeline via GraphViz DOT exports.
34
+ *
35
+ * The graph is **one-shot**: it is recorded into, then compiled, then executed, and it never goes
36
+ * back. {@link compile} derives reference counts and resource lifetimes from what was recorded, so
37
+ * recording into a compiled graph corrupts them, and compiling twice accumulates resource reference
38
+ * counts instead of resetting them, which disables culling entirely. Build a new graph per frame.
39
+ *
40
+ * @see FrameGraphState
41
+ *
42
+ * @source Based on the Frostbite's GDC paper "FrameGraph: Extensible Rendering Architecture in Frostbite" by Yuriy O'Donnell
43
+ * @example
44
+ * const graph = new FrameGraph("My Graph");
45
+ *
46
+ * const pass_data = {};
47
+ * const pass = graph.add("GBuffer Pass", pass_data, (data, resources, context) => {
48
+ *
49
+ * context.beginRenderPass({
50
+ * depth_attachment: resources.get(data.depth),
51
+ * color_attachments:[
52
+ * resources.get(data.normal),
53
+ * resources.get(data.albedo),
54
+ * ]
55
+ * });
56
+ *
57
+ * for (const renderable in renderables){
58
+ * drawMesh(context, renderable.mesh, renderable.material);
59
+ * }
60
+ *
61
+ * context.endRenderPass();
62
+ *
63
+ * });
64
+ *
65
+ * pass_data.depth = pass.create("depth", {...});
66
+ * pass_data.albedo = pass.create("albedo", {...});
67
+ * pass_data.normal = pass.create("normal", {...});
68
+ *
69
+ * graph.compile();
70
+ * graph.execute(context);
71
+ *
72
+ */
73
+ export class FrameGraph {
74
+ /**
75
+ * Human-readable name, used for debugging and UI primarily.
76
+ * There is no uniqueness guarantee
77
+ * @type {string}
78
+ */
79
+ name = "";
80
+
81
+ /**
82
+ * Every pass that survived culling has run, successfully.
83
+ *
84
+ * **Success-only.** A pass that throws takes the failure out of {@link execute} without sending
85
+ * this — the graph hands its transients back and re-raises, and a listener waiting on this one
86
+ * is left waiting. Anything that must settle on both paths belongs in the caller's own
87
+ * `finally`, not here. Deliberate rather than incidental: this says "the frame's work is
88
+ * recorded", which a failed frame has not done.
89
+ *
90
+ * Read-only, and swallowing, on the same terms as {@link onPassBegin}.
91
+ *
92
+ * @type {Signal<IFrameGraphContext,this>}
93
+ */
94
+ onExecuted = new Signal();
95
+
96
+ /**
97
+ * A pass is about to run, and everything encoded until {@link onPassEnd} belongs to it.
98
+ *
99
+ * This exists because **a GPU pass label is not a key back to the pass that opened it.** One
100
+ * frame graph pass routinely opens several GPU passes under labels of their own choosing —
101
+ * `graph_build_hzb` records one node and `hzb.build` opens a compute pass per mip — so a
102
+ * profiler holding a pile of timestamped labels has no way to work out afterwards which node
103
+ * produced them. Bracketing execution is what supplies the answer, and it cannot be recovered
104
+ * any other way.
105
+ *
106
+ * Fires only for passes that survive culling, in execution order, and never nests: {@link
107
+ * execute} runs one pass at a time.
108
+ *
109
+ * **A listener is a read-only observer.** The graph is handed over for symmetry with the signal
110
+ * convention, not as an invitation: recording or compiling from a listener corrupts the counts
111
+ * and lifetimes `execute()` is in the middle of using. The one-shot state assertions guard
112
+ * against that, but they cannot stop a listener — `Signal` catches whatever a handler throws
113
+ * and logs it — so a misbehaving listener produces two console lines and the frame carries on.
114
+ * By the same token an `expect()` inside a listener can never fail a test; assert after the
115
+ * dispatch, as `FrameGraph.pass_signals.spec.js` does.
116
+ *
117
+ * @type {Signal<FramePassNode,this>}
118
+ */
119
+ onPassBegin = new Signal();
120
+
121
+ /**
122
+ * The pass most recently announced by {@link onPassBegin} has finished encoding.
123
+ *
124
+ * Sent even when the pass threw, before the failure is re-raised, so a listener that opened
125
+ * something on begin is not left holding it open by an exception. A listener must therefore
126
+ * treat this as "that pass is over" rather than "that pass succeeded".
127
+ *
128
+ * Read-only, and swallowing, on the same terms as {@link onPassBegin}.
129
+ *
130
+ * @type {Signal<FramePassNode,this>}
131
+ */
132
+ onPassEnd = new Signal();
133
+
134
+ /**
135
+ *
136
+ * @type {FramePassNode[]}
137
+ * @private
138
+ */
139
+ __pass_nodes = [];
140
+
141
+ /**
142
+ *
143
+ * @type {ResourceNode[]}
144
+ * @private
145
+ */
146
+ __resource_nodes = [];
147
+
148
+ /**
149
+ *
150
+ * @type {ResourceEntry[]}
151
+ * @private
152
+ */
153
+ __resource_registry = [];
154
+
155
+ /**
156
+ * The passes {@link execute} will run, in recording order, as decided by {@link compile}.
157
+ *
158
+ * Computed once and then iterated, rather than re-derived at execution time. It is also the set
159
+ * the lifetime loop has to cover: a pass that runs without ever becoming a resource's
160
+ * {@link ResourceEntry.last} user reads a transient the graph has already handed back to the
161
+ * pool, and the pool re-issues within the frame. Deriving "does this pass run" in two places is
162
+ * exactly what let the two answers differ — `ref_count === 0` in the lifetime loop against
163
+ * {@link FramePassNode.can_execute} in `execute()`, which disagree for every read-only
164
+ * {@link FramePassBuilder.make_side_effect} pass.
165
+ *
166
+ * @type {FramePassNode[]}
167
+ */
168
+ #surviving_passes = [];
169
+
170
+ /**
171
+ * Position in the one-shot lifecycle.
172
+ * @type {FrameGraphState}
173
+ */
174
+ #state = FrameGraphState.Recording;
175
+
176
+ /**
177
+ * Innermost open recording scope, or null. The enclosing scopes are its
178
+ * {@link FrameGraphScope.parent} chain, so this one field is the whole stack.
179
+ * @type {FrameGraphScope|null}
180
+ */
181
+ #scope = null;
182
+
183
+ /**
184
+ * Scopes opened so far, which is what gives each one an ID unique within this graph.
185
+ * @type {number}
186
+ */
187
+ #scope_count = 0;
188
+
189
+ /**
190
+ *
191
+ * @param {string} name
192
+ */
193
+ constructor(name = "") {
194
+ assert.isString(name, 'name');
195
+
196
+
197
+ this.name = name;
198
+ }
199
+
200
+ /**
201
+ * Position in the one-shot lifecycle. Recording is only legal in
202
+ * {@link FrameGraphState.Recording}, and {@link execute} is only legal in
203
+ * {@link FrameGraphState.Compiled}.
204
+ * @returns {FrameGraphState}
205
+ */
206
+ get state() {
207
+ return this.#state;
208
+ }
209
+
210
+ /**
211
+ * Passes added so far, culled or not: zero for a graph nothing has recorded into.
212
+ * @returns {number}
213
+ */
214
+ get pass_count() {
215
+ return this.__pass_nodes.length;
216
+ }
217
+
218
+ /**
219
+ * Whether nothing has been recorded into it: no pass, no resource, no scope. Such a graph can be handed to the next
220
+ * frame instead of a new one.
221
+ * @returns {boolean}
222
+ */
223
+ get untouched() {
224
+ return this.#state === FrameGraphState.Recording && this.__pass_nodes.length === 0 && this.__resource_registry.length === 0 && this.#scope_count === 0;
225
+ }
226
+
227
+ /**
228
+ * Innermost open recording scope, or null when recording outside of one.
229
+ * @returns {FrameGraphScope|null}
230
+ */
231
+ get scope() {
232
+ return this.#scope;
233
+ }
234
+
235
+ /**
236
+ * Open a recording scope. Every pass and resource node created until the matching
237
+ * {@link pop_scope} is stamped with it, nested scopes included.
238
+ *
239
+ * This is how the graph attributes work to whoever recorded it. Node names come from the
240
+ * helpers that happened to build them and say nothing about the caller, so without a scope a
241
+ * DOT export cannot group a frame by the thing each group belongs to, and a diagnostic cannot
242
+ * ask whether everything one caller recorded was culled.
243
+ *
244
+ * @param {string} name
245
+ * @returns {FrameGraphScope} the scope opened, for later queries against node stamps
246
+ */
247
+ push_scope(name) {
248
+ assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': scopes can only be opened while recording, graph is ${frame_graph_state_name(this.#state)}`);
249
+ assert.isString(name, 'name');
250
+
251
+ const scope = new FrameGraphScope();
252
+
253
+ scope.name = name;
254
+ scope.id = this.#scope_count++;
255
+ scope.parent = this.#scope;
256
+
257
+ this.#scope = scope;
258
+
259
+ return scope;
260
+ }
261
+
262
+ /**
263
+ * Close the innermost open recording scope, returning to the one that encloses it.
264
+ */
265
+ pop_scope() {
266
+ assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': scopes can only be closed while recording, graph is ${frame_graph_state_name(this.#state)}`);
267
+ assert.notNull(this.#scope, `FrameGraph '${this.name}': pop_scope() without a scope open`);
268
+
269
+ this.#scope = this.#scope.parent;
270
+ }
271
+
272
+ /**
273
+ *
274
+ * @param {number} id Resource Node ID
275
+ * @returns {ResourceEntry}
276
+ */
277
+ getResourceEntry(id) {
278
+ const node = this.getResourceNode(id);
279
+
280
+ assert.defined(node, 'node');
281
+
282
+ const registry = this.__resource_registry;
283
+
284
+ const entry = registry[node.resource_id];
285
+
286
+ assert.defined(entry, 'entry');
287
+
288
+ return entry;
289
+ }
290
+
291
+ /**
292
+ *
293
+ * @param {number} id
294
+ * @returns {ResourceNode}
295
+ */
296
+ getResourceNode(id) {
297
+ assert.isNonNegativeInteger(id, 'id');
298
+
299
+ const resource = this.__resource_nodes[id];
300
+
301
+ if (resource === undefined) {
302
+ throw new Error(`Resource Node ${id} not found`);
303
+ }
304
+
305
+ assert.equal(resource.id, id, 'resource.id does not match');
306
+
307
+ return resource;
308
+ }
309
+
310
+ /**
311
+ * @template T
312
+ * @param {number} id resource ID
313
+ * @returns {T}
314
+ */
315
+ getDescriptor(id) {
316
+ return this.getResourceEntry(id).resource_descriptor;
317
+ }
318
+
319
+ /**
320
+ * @template T
321
+ * @param {string} name
322
+ * @param {T} descriptor
323
+ * @returns {number}
324
+ */
325
+ create_resource(name, descriptor) {
326
+ assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': resources can only be created while recording, graph is ${frame_graph_state_name(this.#state)}`);
327
+ assert.isString(name, 'name');
328
+ assert.defined(descriptor, 'descriptor');
329
+ assert.notNull(descriptor, 'descriptor');
330
+ assert.isObject(descriptor, 'descriptor');
331
+
332
+ const resource = this._createResourceEntry(descriptor);
333
+
334
+ return this._createResourceNode(name, resource.resource_id).id;
335
+ }
336
+
337
+ /**
338
+ * @template T
339
+ * @param {T} descriptor
340
+ * @return {ResourceEntry}
341
+ * @private
342
+ */
343
+ _createResourceEntry(descriptor) {
344
+ assert.defined(descriptor, 'descriptor');
345
+ assert.notNull(descriptor, 'descriptor');
346
+
347
+ const entry = new ResourceEntry();
348
+
349
+ entry.resource_id = this.__resource_registry.length;
350
+ entry.resource_descriptor = descriptor;
351
+
352
+ this.__resource_registry.push(entry);
353
+
354
+ return entry;
355
+ }
356
+
357
+ /**
358
+ *
359
+ * @param {string} name
360
+ * @param {number} resource_id
361
+ * @return {ResourceNode}
362
+ * @private
363
+ */
364
+ _createResourceNode(name, resource_id) {
365
+ assert.isString(name, 'name');
366
+ assert.isNonNegativeInteger(resource_id, 'resource_id');
367
+
368
+ const n = new ResourceNode();
369
+
370
+ const id = this.__resource_nodes.length;
371
+
372
+ n.id = id;
373
+ n.name = name;
374
+ n.resource_id = resource_id;
375
+ n.scope = this.#scope;
376
+
377
+ this.__resource_nodes[id] = n;
378
+
379
+ return n;
380
+ }
381
+
382
+ /**
383
+ *
384
+ * @param {number} node_id
385
+ * @returns {number} ID of the cloned resource node
386
+ */
387
+ clone_resource(node_id) {
388
+ assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': resources can only be cloned while recording, graph is ${frame_graph_state_name(this.#state)}`);
389
+
390
+ const node = this.getResourceNode(node_id);
391
+
392
+ const entry = this.__resource_registry[node.resource_id];
393
+
394
+ entry.resource_version++;
395
+
396
+ const clone_node = new ResourceNode();
397
+ clone_node.id = this.__resource_nodes.length;
398
+ clone_node.name = node.name;
399
+ clone_node.resource_id = node.resource_id;
400
+ clone_node.version = entry.resource_version;
401
+ clone_node.scope = this.#scope;
402
+
403
+ this.__resource_nodes.push(clone_node);
404
+
405
+ return clone_node.id;
406
+ }
407
+
408
+ /**
409
+ * @template T
410
+ * @param {string} name
411
+ * @param {ResourceDescriptor<T>} description
412
+ * @param {T} resource
413
+ * @returns {number}
414
+ */
415
+ import_resource(name, description, resource) {
416
+ assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': resources can only be imported while recording, graph is ${frame_graph_state_name(this.#state)}`);
417
+
418
+ const record = this._createResourceEntry(description);
419
+
420
+ record.resource = resource;
421
+
422
+ record.imported = true;
423
+
424
+ return this._createResourceNode(name, record.resource_id).id;
425
+ }
426
+
427
+ /**
428
+ * @returns {boolean}
429
+ * @param id
430
+ */
431
+ is_valid_resource(id) {
432
+ const node = this.getResourceNode(id);
433
+ const record = this.getResourceEntry(id);
434
+
435
+ return node.version === record.resource_version;
436
+ }
437
+
438
+ /**
439
+ * Add a new pass to the graph.
440
+ * @template T
441
+ * @param {string} name
442
+ * @param {T} data
443
+ * @param {(data: T, resources: FramePassResources, context: IFrameGraphContext) => void} execute
444
+ * @returns {FramePassBuilder}
445
+ */
446
+ add(name, data, execute) {
447
+ assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': passes can only be added while recording, graph is ${frame_graph_state_name(this.#state)}`);
448
+ assert.isString(name, 'name');
449
+
450
+ assert.defined(data, 'data');
451
+ assert.notNull(data, 'data');
452
+ assert.isObject(data, 'data');
453
+
454
+ assert.isFunction(execute, 'execute');
455
+
456
+ const pass_nodes = this.__pass_nodes;
457
+
458
+ const builder = new FramePassBuilder();
459
+ const node = new FramePassNode();
460
+
461
+ node.id = pass_nodes.length;
462
+ node.name = name;
463
+ node.execute = execute;
464
+ node.scope = this.#scope;
465
+
466
+ pass_nodes.push(node);
467
+
468
+ builder.init(this, node);
469
+
470
+ node.data = data;
471
+
472
+ return builder;
473
+ }
474
+
475
+ /**
476
+ * Check the recorded graph for the two ways a read can silently return the wrong contents.
477
+ *
478
+ * {@link execute} runs passes in **insertion order** and never sorts, so a pass that reads a
479
+ * resource written by a pass recorded after it reads whatever that resource happened to hold.
480
+ * And a {@link ResourceEntry} owns exactly one concrete resource — a superseded
481
+ * {@link ResourceNode} is not a snapshot of the old contents, it is the same resource holding
482
+ * the new contents — so reading an out-of-date node is reading the wrong thing.
483
+ *
484
+ * One shape is deliberately **not** a problem: reading a transient that no pass writes is
485
+ * fine, because a resource can be created by a pass that only reserves it, and the reader is
486
+ * then the pass about to fill it.
487
+ *
488
+ * Accumulating into a shared target is **not** an exemption. {@link FramePassBuilder.write}
489
+ * records a read of the handle it replaces, so a pass re-attaching a target it goes on to write
490
+ * is a reader of that target, and it has to re-attach the handle its predecessor produced
491
+ * rather than the one it was originally handed. Several passes rasterizing into one render
492
+ * target do exactly this, and each of them threads the handle forward.
493
+ *
494
+ * Describes what was recorded rather than what survives culling, so it runs before culling is
495
+ * computed — {@link compile} calls it.
496
+ *
497
+ * @param {function(string):*} [problem_consumer] invoked once per problem found
498
+ * @returns {boolean} whether the graph is free of problems
499
+ */
500
+ validate(problem_consumer = noop) {
501
+
502
+ const pass_nodes = this.__pass_nodes;
503
+ const pass_node_count = pass_nodes.length;
504
+
505
+ const resource_nodes = this.__resource_nodes;
506
+
507
+ let valid = true;
508
+
509
+ /**
510
+ * Highest resource node version of a given resource entry written so far, by entry ID.
511
+ * @type {Int32Array}
512
+ */
513
+ const current_version = new Int32Array(this.__resource_registry.length);
514
+
515
+ /**
516
+ * Index of the pass that wrote {@link current_version}, by resource entry ID, or -1.
517
+ * @type {Int32Array}
518
+ */
519
+ const current_version_writer = new Int32Array(this.__resource_registry.length).fill(-1);
520
+
521
+ for (let i = 0; i < pass_node_count; i++) {
522
+ const pass = pass_nodes[i];
523
+
524
+ for (const id of pass.resource_reads) {
525
+ const node = resource_nodes[id];
526
+
527
+ const producer = node.producer;
528
+
529
+ if (producer !== null && producer.id > i) {
530
+ problem_consumer(`Pass ${i} '${pass.name}' reads '${node.name}', which is written by pass ${producer.id} '${producer.name}'. Passes execute in the order they were added, so the read happens before the write.`);
531
+
532
+ valid = false;
533
+ }
534
+
535
+ const version = current_version[node.resource_id];
536
+
537
+ if (node.version < version) {
538
+ const writer_index = current_version_writer[node.resource_id];
539
+
540
+ problem_consumer(`Pass ${i} '${pass.name}' reads version ${node.version} of '${node.name}', which pass ${writer_index} '${pass_nodes[writer_index].name}' has already superseded with version ${version}. Both versions name one resource, so the read returns the newer contents.`);
541
+
542
+ valid = false;
543
+ }
544
+ }
545
+
546
+ for (const id of pass.resource_writes) {
547
+ const node = resource_nodes[id];
548
+
549
+ if (node.version > current_version[node.resource_id]) {
550
+ current_version[node.resource_id] = node.version;
551
+ current_version_writer[node.resource_id] = i;
552
+ }
553
+ }
554
+ }
555
+
556
+ return valid;
557
+ }
558
+
559
+ /**
560
+ * Report physical resources this graph holds under more than one {@link ResourceEntry}.
561
+ *
562
+ * Everything {@link validate} reasons about — versions, supersession, `producer` ordering — is
563
+ * scoped to a single entry, and {@link import_resource} has no identity check, so importing one
564
+ * `GPUTexture` twice gives it two independent version chains that the checker treats as
565
+ * unrelated resources. Every read/write hazard between them is invisible, and
566
+ * {@link is_valid_resource} answers about the wrong chain.
567
+ *
568
+ * **Detection only, and not wired into {@link compile}.** The live `Shading` graph imports the
569
+ * camera buffer seven times and the hierarchical-Z buffer three, and none of those produces an
570
+ * incorrect frame today: the duplicate sites happen to be ordered safely, and their passes write
571
+ * imported resources, so they are side-effect passes that never cull. Failing `compile()` on
572
+ * them would break the renderer over a hazard that is structural rather than live, and
573
+ * collapsing them into one entry changes which handle every one of those callers gets back.
574
+ * Both are decisions of their own; this reports the shape so that either can be taken with the
575
+ * numbers in hand.
576
+ *
577
+ * Only entries that hold a resource are considered, so a transient is reported only if the
578
+ * backend handed the same object out twice while both were live — which is itself the bug
579
+ * {@link RenderResourceManager} guards against.
580
+ *
581
+ * @param {function(string):*} [problem_consumer] invoked once per aliased resource
582
+ * @returns {number} how many physical resources are held under more than one entry
583
+ */
584
+ report_resource_aliasing(problem_consumer = noop) {
585
+ const registry = this.__resource_registry;
586
+ const entry_count = registry.length;
587
+
588
+ /**
589
+ * Entry IDs by the physical resource they hold.
590
+ * @type {Map<*,number[]>}
591
+ */
592
+ const by_resource = new Map();
593
+
594
+ for (let i = 0; i < entry_count; i++) {
595
+ const entry = registry[i];
596
+
597
+ if (entry.resource === null) {
598
+ continue;
599
+ }
600
+
601
+ const existing = by_resource.get(entry.resource);
602
+
603
+ if (existing === undefined) {
604
+ by_resource.set(entry.resource, [i]);
605
+ } else {
606
+ existing.push(i);
607
+ }
608
+ }
609
+
610
+ let aliased = 0;
611
+
612
+ for (const entry_ids of by_resource.values()) {
613
+ if (entry_ids.length < 2) {
614
+ continue;
615
+ }
616
+
617
+ aliased++;
618
+
619
+ const names = entry_ids.map(id => {
620
+ const node = this.__resource_nodes.find(n => n.resource_id === id);
621
+
622
+ return `${id} '${node === undefined ? "?" : node.name}'`;
623
+ });
624
+
625
+ problem_consumer(`One resource is held under ${entry_ids.length} entries — ${names.join(", ")}. Versions and supersession are scoped to a single entry, so no hazard between them can be seen.`);
626
+ }
627
+
628
+ return aliased;
629
+ }
630
+
631
+ compile() {
632
+ assert.equal(this.#state, FrameGraphState.Recording, `FrameGraph '${this.name}': compile() is one-shot, a second compile accumulates resource reference counts instead of resetting them and culling stops working, graph is ${frame_graph_state_name(this.#state)}`);
633
+
634
+ assert.equal(this.#scope, null, `FrameGraph '${this.name}': recording finished with scope '${this.#scope}' still open, every push_scope() needs its pop_scope()`);
635
+
636
+ /*
637
+ `validate()` is called *inside* the assert on purpose, and must stay there.
638
+
639
+ @rollup/plugin-strip deletes a matched call together with its arguments, so under the strip
640
+ the consuming project applies (README, "Shipping a build") the whole gate — the walk, the
641
+ two Int32Arrays, and `console.error` — disappears. That is the intent: this is a
642
+ development check over what was recorded, run five or more times a frame, and a shipped
643
+ game should not pay for it.
644
+
645
+ Hoisting it to `const valid = this.validate(...)` would leave the walk running in every
646
+ shipped build while stripping only the assert that reads the result. Do not "clean this up".
647
+ */
648
+ assert.ok(this.validate(console.error), `FrameGraph '${this.name}': the recorded graph is invalid, the problems are logged above`);
649
+
650
+ this.#state = FrameGraphState.Compiled;
651
+
652
+ const pass_nodes = this.__pass_nodes;
653
+
654
+ // wire resources of passes
655
+ const pass_node_count = pass_nodes.length;
656
+ const resource_nodes = this.__resource_nodes;
657
+
658
+ for (let i = 0; i < pass_node_count; i++) {
659
+ const pass = pass_nodes[i];
660
+
661
+ // mask pass as having number of references equal to number of resources it writes to
662
+ pass.ref_count = pass.resource_writes.length;
663
+
664
+ for (const id of pass.resource_reads) {
665
+ const read_node = resource_nodes[id];
666
+
667
+ read_node.ref_count++;
668
+ }
669
+ }
670
+
671
+ // perform culling
672
+ /**
673
+ *
674
+ * @type {ResourceNode[]}
675
+ */
676
+ const unreferenced_resources = [];
677
+
678
+ for (const node of resource_nodes) {
679
+ if (node.ref_count === 0) {
680
+ unreferenced_resources.push(node);
681
+ }
682
+ }
683
+
684
+ while (unreferenced_resources.length > 0) {
685
+ const unreferenced_resource = unreferenced_resources.pop();
686
+
687
+ const producer = unreferenced_resource.producer;
688
+
689
+ if (producer === null || producer.has_side_effects) {
690
+ continue;
691
+ }
692
+
693
+ assert.greaterThanOrEqual(producer.ref_count, 1, 'must have at least one reference'); // Why?
694
+
695
+ // disconnect unreferenced resource from producer
696
+ producer.ref_count--;
697
+
698
+ if (producer.ref_count === 0) {
699
+
700
+ // producer is no longer referenced
701
+
702
+ for (const id of producer.resource_reads) {
703
+ const node = resource_nodes[id];
704
+
705
+ // disconnect producer from all its reads (upstream)
706
+ node.ref_count--;
707
+
708
+ if (node.ref_count === 0) {
709
+ // resource is no longer referenced
710
+ unreferenced_resources.push(node);
711
+ }
712
+ }
713
+ }
714
+ }
715
+
716
+ // decide which passes run, once. `execute()` iterates this set instead of asking again.
717
+ const surviving_passes = this.#surviving_passes;
718
+
719
+ surviving_passes.length = 0;
720
+
721
+ for (let i = 0; i < pass_node_count; i++) {
722
+ const pass = pass_nodes[i];
723
+
724
+ if (!pass.can_execute()) {
725
+ // culled
726
+ continue;
727
+ }
728
+
729
+ surviving_passes.push(pass);
730
+ }
731
+
732
+ // calculate lifetimes, over exactly the passes that will run
733
+ const surviving_pass_count = surviving_passes.length;
734
+
735
+ for (let i = 0; i < surviving_pass_count; i++) {
736
+ const pass = surviving_passes[i];
737
+
738
+ const allocates = pass.resource_allocates;
739
+
740
+ allocates.length = 0;
741
+
742
+ for (const id of pass.resource_creates) {
743
+ const entry = this.getResourceEntry(id);
744
+
745
+ entry.producer = pass;
746
+ entry.last = pass;
747
+
748
+ allocates.push(id);
749
+ }
750
+
751
+ for (const id of pass.resource_writes) {
752
+ const entry = this.getResourceEntry(id);
753
+
754
+ this.#claim_unparented_transient(entry, pass, id);
755
+
756
+ entry.last = pass;
757
+ }
758
+
759
+ for (const id of pass.resource_reads) {
760
+ const entry = this.getResourceEntry(id);
761
+
762
+ this.#claim_unparented_transient(entry, pass, id);
763
+
764
+ entry.last = pass;
765
+ }
766
+ }
767
+ }
768
+
769
+ /**
770
+ * Make `pass` the allocator of a transient no pass created.
771
+ *
772
+ * {@link create_resource} is public, so a caller can reserve a handle before it knows which
773
+ * pass will fill it — which is what the extension surface does, handing the graph out through
774
+ * `FrameContext.graph`. Such an entry appears in no pass's {@link FramePassNode.resource_creates},
775
+ * so nothing allocated it: the pass was handed `null` and the release scan then tried to give
776
+ * `null` back to the pool. Allocating it at its first surviving user gives it the same lifetime
777
+ * any other transient has, and matches what {@link validate} already blesses — reading a
778
+ * transient no pass writes is legal, because the reader may be the pass about to fill it.
779
+ *
780
+ * @param {ResourceEntry} entry
781
+ * @param {FramePassNode} pass
782
+ * @param {number} id resource node ID
783
+ */
784
+ #claim_unparented_transient(entry, pass, id) {
785
+ if (entry.producer !== null || entry.isImported()) {
786
+ return;
787
+ }
788
+
789
+ entry.producer = pass;
790
+
791
+ pass.resource_allocates.push(id);
792
+ }
793
+
794
+ /**
795
+ *
796
+ * @param {IFrameGraphContext} context
797
+ */
798
+ execute(context) {
799
+ assert.equal(this.#state, FrameGraphState.Compiled, `FrameGraph '${this.name}': execute() requires a compiled graph, an uncompiled one has every reference count at 0 and culls itself silently, graph is ${frame_graph_state_name(this.#state)}`);
800
+ assert.defined(context, 'context');
801
+ assert.notNull(context, 'context');
802
+ assert.isObject(context, 'context');
803
+
804
+ this.#state = FrameGraphState.Executed;
805
+
806
+ // Whatever `compile()` computed lifetimes over, and nothing else. Re-deriving the survivor
807
+ // set here is what let the two disagree.
808
+ const pass_nodes = this.#surviving_passes;
809
+ const pass_node_count = pass_nodes.length;
810
+
811
+ try {
812
+ for (let i = 0; i < pass_node_count; i++) {
813
+ const node = pass_nodes[i];
814
+
815
+ const node_allocated_resources = node.resource_allocates;
816
+
817
+ for (const id of node_allocated_resources) {
818
+
819
+ // allocate resource
820
+ this.getResourceEntry(id).create(context.resource_manager);
821
+ }
822
+
823
+ const resources = new FramePassResources();
824
+ resources.init(this, node);
825
+
826
+ /*
827
+ Guarded rather than dispatched unconditionally: `send2` on a signal with no handlers
828
+ still bumps `generation` and walks a Map iterator, and this pair runs twice per pass
829
+ over a couple of hundred passes a frame. Nothing observes the graph in a normal frame,
830
+ so the common case should cost a size comparison and nothing else.
831
+ */
832
+ const announce_passes = this.onPassBegin.hasHandlers() || this.onPassEnd.hasHandlers();
833
+
834
+ if (announce_passes) {
835
+ this.onPassBegin.send2(node, this);
836
+ }
837
+
838
+ // execute pass
839
+ try {
840
+ node.execute(node.data, resources, context);
841
+ } catch (e) {
842
+ // decorate
843
+ const error = new Error(`RenderPass '${node.name}' failed to execute`);
844
+
845
+ error.cause = e;
846
+
847
+ throw error;
848
+ } finally {
849
+ // `finally` so a pass that throws still closes its bracket — a listener that opened
850
+ // a scope on begin would otherwise attribute the rest of the frame to the pass that
851
+ // died.
852
+ if (announce_passes) {
853
+ this.onPassEnd.send2(node, this);
854
+ }
855
+ }
856
+
857
+
858
+ const resource_entries = this.__resource_registry;
859
+ const resource_entry_count = resource_entries.length;
860
+
861
+ for (let entry_index = 0; entry_index < resource_entry_count; entry_index++) {
862
+ const entry = resource_entries[entry_index];
863
+
864
+ if (entry.last === node && entry.isTransient()) {
865
+ // this was the last user of the resource and the resource is transient (no external usage)
866
+ entry.destroy(context.resource_manager);
867
+ }
868
+
869
+ }
870
+
871
+ }
872
+ } catch (e) {
873
+ /*
874
+ Nothing further will run, so every transient still checked out is checked out forever —
875
+ in the Shading graph, tens of MB of render targets, leaked again on every failing frame
876
+ of a render loop that catches and carries on.
877
+
878
+ Deliberately here and not in a `finally` around the pass body: that `finally` belongs to
879
+ the onPassBegin/onPassEnd bracket, and putting a release scan inside it would run the
880
+ sweep on the success path too, once per pass.
881
+ */
882
+ this.#release_live_transients(context.resource_manager);
883
+
884
+ throw e;
885
+ }
886
+
887
+ this.onExecuted.send2(context, this);
888
+ }
889
+
890
+ /**
891
+ * Hand back every transient still holding a resource.
892
+ *
893
+ * Only reachable when a pass throws — {@link execute} releases as it goes, so on the success
894
+ * path there is nothing left to find.
895
+ *
896
+ * The `resource !== null` filter is only a safe way to ask "is this still checked out" because
897
+ * {@link ResourceEntry.destroy} clears the field. The pool re-issues immediately and within the
898
+ * frame, so an entry naming a resource it has already returned would be pooled a second time,
899
+ * and `TransientResourcePool.release` would take it, because that resource *is* bound — to
900
+ * whoever owns it now.
901
+ *
902
+ * @param {RenderResourceManager} resources
903
+ */
904
+ #release_live_transients(resources) {
905
+ const entries = this.__resource_registry;
906
+ const entry_count = entries.length;
907
+
908
+ for (let i = 0; i < entry_count; i++) {
909
+ const entry = entries[i];
910
+
911
+ if (entry.isTransient() && entry.resource !== null) {
912
+ entry.destroy(resources);
913
+ }
914
+ }
915
+ }
916
+
917
+ /**
918
+ * Should only call after {@link compile}
919
+ *
920
+ * One entry in `resources` per resource **node**, that is per version, keyed by node ID. A pass
921
+ * records the node it read or wrote and not the underlying resource, so this is the id space
922
+ * `passes[].reads` and `passes[].writes` point into; a registry-keyed export would leave those
923
+ * references dangling on every version past the first.
924
+ *
925
+ * Can be visualized with this tool: https://skaarj1989.github.io/FrameGraph/
926
+ *
927
+ * @see https://github.com/skaarj1989/FrameGraph/blob/viewer/JsonWriter.hpp
928
+ * @return {{passes: [], resources: []}}
929
+ */
930
+ exportToJson() {
931
+
932
+ const resources = this.__resource_nodes.map(node => {
933
+ const entry = this.__resource_registry[node.resource_id];
934
+
935
+ const j = {
936
+ id: node.id,
937
+ name: node.name,
938
+ transient: entry.isTransient(),
939
+ };
940
+
941
+ if (node.version > 0) {
942
+ j.version = node.version;
943
+ }
944
+
945
+ const description = entry.resource_descriptor?.toString();
946
+
947
+ if (description) {
948
+ j.description = description;
949
+ }
950
+
951
+ if (node.producer !== null) {
952
+ j.createdBy = node.producer.id;
953
+ }
954
+
955
+ const readers = [];
956
+ const writers = [];
957
+
958
+ for (const pass of this.__pass_nodes) {
959
+ if (pass.reads(node.id)) {
960
+ readers.push(pass.id);
961
+ }
962
+ if (pass.writes(node.id)) {
963
+ writers.push(pass.id);
964
+ }
965
+ }
966
+
967
+ if (readers.length > 0) {
968
+ j.readers = readers;
969
+ }
970
+ if (writers.length > 0) {
971
+ j.writers = writers;
972
+ }
973
+
974
+ return j;
975
+ });
976
+
977
+ return {
978
+ passes: this.__pass_nodes.map(node => {
979
+ return {
980
+ id: node.id,
981
+ name: node.name,
982
+ culled: !node.can_execute(),
983
+ reads: node.resource_reads,
984
+ writes: node.resource_writes,
985
+ }
986
+ }),
987
+ resources
988
+ }
989
+ }
990
+
991
+ /**
992
+ * Export the graph diagram in GraphViz DOT format.
993
+ * Useful for debugging.
994
+ * @see https://en.wikipedia.org/wiki/DOT_(graph_description_language)
995
+ * @return {string}
996
+ */
997
+ exportToDot() {
998
+ const out = new LineBuilder();
999
+
1000
+ out.add("digraph FrameGraph {");
1001
+ out.indent();
1002
+ out.add("graph [style=invis, rankdir=\"TB\" ordering=out, splines=spline]");
1003
+ out.add("node [shape=record, fontname=\"helvetica\", fontsize=10, margin=\"0.2,0.03\"]");
1004
+
1005
+
1006
+ // -- Define pass nodes
1007
+
1008
+ /**
1009
+ * @param {FramePassNode} node
1010
+ * @returns {string}
1011
+ */
1012
+ const pass_declaration = (node) => `P${node.id} [label=<{ {<B>${graphviz_escape_html_label(node.name)}</B>} | {${(node.has_side_effects ? "&#x2605; " : "")} Refs: ${node.ref_count}<BR/> Index: ${node.id}} }> style=\"rounded,filled\", fillcolor=${(node.ref_count > 0 || node.has_side_effects) ? "orange" : "lightgray"}]`;
1013
+
1014
+ out.add("");
1015
+ out.add("# Pass Nodes");
1016
+ for (const node of this.__pass_nodes) {
1017
+ if (node.scope === null) {
1018
+ out.add(pass_declaration(node));
1019
+ }
1020
+ }
1021
+
1022
+ // -- Define resource nodes
1023
+
1024
+ /**
1025
+ *
1026
+ * @param {string} type
1027
+ * @returns {number}
1028
+ */
1029
+ function type_to_color(type) {
1030
+
1031
+ const hash_32 = computeStringHash(type);
1032
+
1033
+ const hash_16 = (hash_32 & 0xffff) ^ (hash_32 >>> 16);
1034
+
1035
+ return hash_16 / 0xffff;
1036
+ }
1037
+
1038
+ /**
1039
+ *
1040
+ * @param {ResourceEntry} entry
1041
+ * @return {string}
1042
+ */
1043
+ function entry_to_background_color(entry) {
1044
+
1045
+ let color_hue = type_to_color(entry.resource_descriptor?.type ?? "");
1046
+
1047
+ // remap hue away from red
1048
+ color_hue = lerp(0.10, 0.90, color_hue);
1049
+
1050
+ const saturation = entry.isImported() ? 0.2 : 0.07;
1051
+
1052
+ const color_rgb = [];
1053
+ okhsv_to_linear_srgb(color_rgb, color_hue, saturation, 1)
1054
+
1055
+ /*
1056
+ GraphViz reads `#rrggbb` as sRGB, so a linear-light value quantized straight to bytes
1057
+ arrives at roughly three times the chroma the okhsv parameters asked for — which turns
1058
+ the deliberately quiet imported-vs-transient saturation split into a loud one.
1059
+ */
1060
+ const hex = rgb_to_hex(...color_rgb.map(c => float_to_uint8(convert_channel_linear_to_sRGB(c))));
1061
+
1062
+ return `#${hex}`;
1063
+ }
1064
+
1065
+ /**
1066
+ * @param {ResourceNode} node
1067
+ * @returns {string}
1068
+ */
1069
+ const resource_declaration = (node) => {
1070
+ const entry = this.__resource_registry[node.resource_id];
1071
+
1072
+ const type = graphviz_escape_html_label(entry.resource_descriptor?.type ?? "");
1073
+
1074
+ const block_title = `${entry.isImported() ? "↪ " : ""}${graphviz_escape_html_label(node.name)}`;
1075
+
1076
+ // a plain quoted attribute, not a record label: `{`, `}` and `|` are ordinary here
1077
+ const block_tooltip = graphviz_escape_quoted(entry.toString());
1078
+
1079
+ return `R${entry.resource_id}_${node.version} [label=<{ {<B>${block_title}</B>${node.version > 0 ? ` <FONT>v${(node.version + 1)}</FONT>` : ""}<BR/>${type}} | {Index: ${entry.resource_id}<BR/> Refs : ${node.ref_count} } }> style=filled, fillcolor="${entry_to_background_color(entry)}" tooltip="${block_tooltip}"]`;
1080
+ };
1081
+
1082
+ out.add("");
1083
+ out.add("# Resource Nodes");
1084
+ for (const node of this.__resource_nodes) {
1085
+ if (node.scope === null) {
1086
+ out.add(resource_declaration(node));
1087
+ }
1088
+ }
1089
+
1090
+ // -- Define scoped nodes, inside the cluster of the scope that recorded them
1091
+
1092
+ /**
1093
+ * Scopes that stamped at least one node, and the scopes enclosing those.
1094
+ * @type {Set<FrameGraphScope>}
1095
+ */
1096
+ const scopes = new Set();
1097
+
1098
+ for (const node of [...this.__pass_nodes, ...this.__resource_nodes]) {
1099
+ for (let scope = node.scope; scope !== null && !scopes.has(scope); scope = scope.parent) {
1100
+ scopes.add(scope);
1101
+ }
1102
+ }
1103
+
1104
+ /**
1105
+ * @param {FrameGraphScope} scope
1106
+ */
1107
+ const emit_scope = (scope) => {
1108
+ out.add(`subgraph cluster_${scope.id} {`);
1109
+ out.indent();
1110
+
1111
+ // the root graph is drawn invisible, so a cluster has to ask for its own frame
1112
+ out.add(`label="${graphviz_escape_quoted(scope.name)}"`);
1113
+ out.add("style=\"rounded,dashed\", color=\"gray55\", fontname=\"helvetica\", fontsize=10, labeljust=\"l\"");
1114
+
1115
+ for (const node of this.__pass_nodes) {
1116
+ if (node.scope === scope) {
1117
+ out.add(pass_declaration(node));
1118
+ }
1119
+ }
1120
+
1121
+ for (const node of this.__resource_nodes) {
1122
+ if (node.scope === scope) {
1123
+ out.add(resource_declaration(node));
1124
+ }
1125
+ }
1126
+
1127
+ for (const child of scopes) {
1128
+ if (child.parent === scope) {
1129
+ emit_scope(child);
1130
+ }
1131
+ }
1132
+
1133
+ out.dedent();
1134
+ out.add("}");
1135
+ };
1136
+
1137
+ if (scopes.size > 0) {
1138
+ out.add("");
1139
+ out.add("# Scopes");
1140
+
1141
+ for (const scope of scopes) {
1142
+ if (scope.parent === null) {
1143
+ emit_scope(scope);
1144
+ }
1145
+ }
1146
+ }
1147
+
1148
+ // -- Each pass node points to the resource that it writes
1149
+
1150
+ out.add("");
1151
+ out.add("# Resource Writes");
1152
+ for (const node of this.__pass_nodes) {
1153
+ out.add(`P${node.id} -> {`);
1154
+ out.indent();
1155
+ for (const id of node.resource_writes) {
1156
+ const written = this.__resource_nodes[id];
1157
+ out.add(`R${written.resource_id}_${written.version} `);
1158
+ }
1159
+ out.dedent();
1160
+ out.add("} [color=orangered]");
1161
+ }
1162
+
1163
+ // -- Each resource node points to the pass where it's consumed
1164
+
1165
+ out.add("");
1166
+ out.add("# Resource Reads");
1167
+
1168
+ for (const node of this.__resource_nodes) {
1169
+ out.add(`R${node.resource_id}_${node.version} -> {`);
1170
+ out.indent();
1171
+ // find all readers of this resource node
1172
+ for (const pass of this.__pass_nodes) {
1173
+ for (const id of pass.resource_reads)
1174
+ if (id === node.id) {
1175
+ out.add(`P${pass.id} `);
1176
+ }
1177
+ }
1178
+ out.dedent();
1179
+ out.add("} [color=olivedrab3]");
1180
+ }
1181
+ out.dedent();
1182
+ out.add("}");
1183
+ return out.build();
1184
+ }
1185
+ }
1186
+
1187
+ /**
1188
+ * Type check shortcut.
1189
+ * @readonly
1190
+ * @type {boolean}
1191
+ */
1175
1192
  FrameGraph.prototype.isFrameGraph = true;