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