@woosh/meep-engine 3.60.4 → 3.60.5

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 (379) hide show
  1. package/CHANGELOG.md +2602 -0
  2. package/CONTRIBUTING.md +7 -0
  3. package/MIGRATION_2_TO_3.md +136 -0
  4. package/SECURITY.md +4 -0
  5. package/editor/EditorCameraNavigation.d.ts +2 -1
  6. package/editor/EditorCameraNavigation.d.ts.map +1 -1
  7. package/editor/EditorCameraNavigation.js +51 -57
  8. package/package.json +6 -2
  9. package/src/engine/EngineHarness.d.ts +3 -9
  10. package/src/engine/EngineHarness.d.ts.map +1 -1
  11. package/src/engine/EngineHarness.js +6 -8
  12. package/src/engine/graphics/camera/makeOrbitalCameraController.d.ts +9 -6
  13. package/src/engine/graphics/camera/makeOrbitalCameraController.d.ts.map +1 -1
  14. package/src/engine/graphics/camera/makeOrbitalCameraController.js +44 -71
  15. package/src/engine/graphics/camera/orbital/MomentumAxis.d.ts +64 -0
  16. package/src/engine/graphics/camera/orbital/MomentumAxis.d.ts.map +1 -0
  17. package/src/engine/graphics/camera/orbital/MomentumAxis.js +187 -0
  18. package/src/engine/graphics/camera/orbital/OrbitalCameraRig.d.ts +86 -0
  19. package/src/engine/graphics/camera/orbital/OrbitalCameraRig.d.ts.map +1 -0
  20. package/src/engine/graphics/camera/orbital/OrbitalCameraRig.js +319 -0
  21. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.d.ts +34 -10
  22. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.d.ts.map +1 -1
  23. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraController.js +116 -30
  24. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.d.ts +1 -7
  25. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.d.ts.map +1 -1
  26. package/src/engine/graphics/ecs/camera/topdown/TopDownCameraControllerSystem.js +1 -37
  27. package/src/engine/graphics/ecs/water/Water.d.ts +8 -0
  28. package/src/engine/graphics/ecs/water/Water.d.ts.map +1 -1
  29. package/src/engine/graphics/ecs/water/Water.js +8 -0
  30. package/src/engine/graphics3/WaterSystem.d.ts.map +1 -1
  31. package/src/engine/graphics3/WaterSystem.js +731 -734
  32. package/src/engine/graphics3/decal/DecalTileShader.d.ts +61 -0
  33. package/src/engine/graphics3/decal/DecalTileShader.d.ts.map +1 -0
  34. package/src/engine/graphics3/decal/DecalTileShader.js +138 -0
  35. package/src/engine/graphics3/decal/GPUDecalRenderer.d.ts +10 -4
  36. package/src/engine/graphics3/decal/GPUDecalRenderer.d.ts.map +1 -1
  37. package/src/engine/graphics3/decal/GPUDecalRenderer.js +149 -44
  38. package/src/engine/graphics3/decal/chunk_decal_tile_vertex.d.ts +25 -0
  39. package/src/engine/graphics3/decal/chunk_decal_tile_vertex.d.ts.map +1 -0
  40. package/src/engine/graphics3/decal/chunk_decal_tile_vertex.js +55 -0
  41. package/src/engine/graphics3/decal/graph_gather_decal_tiles.d.ts +22 -0
  42. package/src/engine/graphics3/decal/graph_gather_decal_tiles.d.ts.map +1 -0
  43. package/src/engine/graphics3/decal/graph_gather_decal_tiles.js +70 -0
  44. package/src/engine/graphics3/decal/shader_decal_composite.d.ts +7 -5
  45. package/src/engine/graphics3/decal/shader_decal_composite.d.ts.map +1 -1
  46. package/src/engine/graphics3/decal/shader_decal_composite.js +48 -44
  47. package/src/engine/graphics3/decal/shader_decal_tile_copy.d.ts +12 -0
  48. package/src/engine/graphics3/decal/shader_decal_tile_copy.d.ts.map +1 -0
  49. package/src/engine/graphics3/decal/shader_decal_tile_copy.js +78 -0
  50. package/src/engine/graphics3/decal/shader_gather_decal_tiles.d.ts +11 -0
  51. package/src/engine/graphics3/decal/shader_gather_decal_tiles.d.ts.map +1 -0
  52. package/src/engine/graphics3/decal/shader_gather_decal_tiles.js +80 -0
  53. package/src/engine/input/devices/mouse/MouseEventButtons.d.ts +13 -0
  54. package/src/engine/input/devices/mouse/MouseEventButtons.d.ts.map +1 -0
  55. package/src/engine/input/devices/mouse/MouseEventButtons.js +23 -0
  56. package/src/engine/input/ecs/controllers/KeyboardCameraController.d.ts +4 -0
  57. package/src/engine/input/ecs/controllers/KeyboardCameraController.d.ts.map +1 -1
  58. package/src/engine/input/ecs/controllers/KeyboardCameraController.js +9 -45
  59. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  60. package/src/shade/playground/water_refraction/README.md +5 -6
  61. package/src/shade/playground/water_refraction/index.html +1 -1
  62. package/src/shade/renderer/Renderer.d.ts.map +1 -1
  63. package/src/shade/renderer/Renderer.js +7 -5
  64. package/src/shade/renderer/camera/orbital/OrbitalCameraController.d.ts +40 -80
  65. package/src/shade/renderer/camera/orbital/OrbitalCameraController.d.ts.map +1 -1
  66. package/src/shade/renderer/camera/orbital/OrbitalCameraController.js +197 -147
  67. package/src/shade/renderer/fluid/GPUFluidCascade.d.ts +3 -3
  68. package/src/shade/renderer/fluid/GPUFluidCascadeStack.d.ts +1 -1
  69. package/src/shade/renderer/fluid/forcing/GPUFluidForcing.d.ts +6 -6
  70. package/src/shade/renderer/fluid/pressure/GPUFluidPressureSolve.d.ts +1 -1
  71. package/src/shade/renderer/fluid/query/GPUFluidQueries.d.ts +1 -1
  72. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.d.ts +2 -2
  73. package/src/shade/renderer/geometry/sdf/GPUGeometrySDFManager.js +2 -2
  74. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts +2 -1
  75. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.d.ts.map +1 -1
  76. package/src/shade/renderer/geometry/sdf/cards/GPUMeshCardSets.js +18 -1
  77. package/src/shade/renderer/geometry/virtual/proxy/vgeo_to_proxy_mesh.d.ts +31 -0
  78. package/src/shade/renderer/geometry/virtual/proxy/vgeo_to_proxy_mesh.d.ts.map +1 -0
  79. package/src/shade/renderer/geometry/virtual/proxy/vgeo_to_proxy_mesh.js +343 -0
  80. package/src/shade/renderer/geometry/virtual/runtime/vgeo_meshlet_metadata_write.d.ts +17 -0
  81. package/src/shade/renderer/geometry/virtual/runtime/vgeo_meshlet_metadata_write.d.ts.map +1 -0
  82. package/src/shade/renderer/geometry/virtual/runtime/vgeo_meshlet_metadata_write.js +29 -0
  83. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_meshlet_batch.d.ts.map +1 -1
  84. package/src/shade/renderer/geometry/virtual/runtime/vgeo_runtime_meshlet_batch.js +7 -13
  85. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.d.ts.map +1 -1
  86. package/src/shade/renderer/global_illumination/probe_clipmap/GPUProbeClipmapGI.js +1 -8
  87. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts +5 -5
  88. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.d.ts.map +1 -1
  89. package/src/shade/renderer/global_illumination/probe_clipmap/ProbeClipmapSceneHolds.js +10 -10
  90. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts +1 -4
  91. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.d.ts.map +1 -1
  92. package/src/shade/renderer/global_illumination/probe_clipmap/probe/GPUProbeClipmap.js +1 -10
  93. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_surface.d.ts +5 -15
  94. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_surface.d.ts.map +1 -1
  95. package/src/shade/renderer/global_illumination/probe_clipmap/probe/chunk_probe_clipmap_hit_surface.js +6 -34
  96. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.d.ts.map +1 -1
  97. package/src/shade/renderer/global_illumination/probe_clipmap/probe/shader_probe_clipmap_shade.js +1 -7
  98. package/src/shade/renderer/hiz/HZBFootprint.d.ts +14 -0
  99. package/src/shade/renderer/hiz/HZBFootprint.d.ts.map +1 -0
  100. package/src/shade/renderer/hiz/HZBFootprint.js +16 -0
  101. package/src/shade/renderer/hiz/HZB_FOOTPRINT_X.d.ts +10 -0
  102. package/src/shade/renderer/hiz/HZB_FOOTPRINT_X.d.ts.map +1 -0
  103. package/src/shade/renderer/hiz/HZB_FOOTPRINT_X.js +11 -0
  104. package/src/shade/renderer/hiz/HZB_FOOTPRINT_Y.d.ts +10 -0
  105. package/src/shade/renderer/hiz/HZB_FOOTPRINT_Y.d.ts.map +1 -0
  106. package/src/shade/renderer/hiz/HZB_FOOTPRINT_Y.js +11 -0
  107. package/src/shade/renderer/hiz/HierarchicalZBuffer.d.ts +0 -7
  108. package/src/shade/renderer/hiz/HierarchicalZBuffer.d.ts.map +1 -1
  109. package/src/shade/renderer/hiz/HierarchicalZBuffer.js +405 -350
  110. package/src/shade/renderer/hiz/chunk_hzb_footprint_x.d.ts +12 -0
  111. package/src/shade/renderer/hiz/chunk_hzb_footprint_x.d.ts.map +1 -0
  112. package/src/shade/renderer/hiz/chunk_hzb_footprint_x.js +27 -0
  113. package/src/shade/renderer/hiz/chunk_hzb_footprint_y.d.ts +12 -0
  114. package/src/shade/renderer/hiz/chunk_hzb_footprint_y.d.ts.map +1 -0
  115. package/src/shade/renderer/hiz/chunk_hzb_footprint_y.js +27 -0
  116. package/src/shade/renderer/hiz/hzb_footprint_texels.d.ts +14 -0
  117. package/src/shade/renderer/hiz/hzb_footprint_texels.d.ts.map +1 -0
  118. package/src/shade/renderer/hiz/hzb_footprint_texels.js +34 -0
  119. package/src/shade/renderer/hiz/shader_hzb_reduce_any.d.ts +0 -5
  120. package/src/shade/renderer/hiz/shader_hzb_reduce_any.d.ts.map +1 -1
  121. package/src/shade/renderer/hiz/shader_hzb_reduce_any.js +37 -57
  122. package/src/shade/renderer/hiz/shader_hzb_reduce_mip0.d.ts +11 -0
  123. package/src/shade/renderer/hiz/shader_hzb_reduce_mip0.d.ts.map +1 -0
  124. package/src/shade/renderer/hiz/{shader_hzb_reduce_mip0_clip.js → shader_hzb_reduce_mip0.js} +120 -111
  125. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  126. package/src/shade/renderer/material/GPUMaterialManager.d.ts +7 -0
  127. package/src/shade/renderer/material/GPUMaterialManager.d.ts.map +1 -1
  128. package/src/shade/renderer/material/GPUMaterialManager.js +11 -0
  129. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts +12 -12
  130. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.d.ts.map +1 -1
  131. package/src/shade/renderer/material/resident/GPUResidentMaterialContext.js +17 -118
  132. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.d.ts.map +1 -1
  133. package/src/shade/renderer/shadow/map/GPUSceneShadowmapContext.js +7 -2
  134. package/src/shade/renderer/water/GPUWaterRenderer.d.ts +0 -6
  135. package/src/shade/renderer/water/GPUWaterRenderer.d.ts.map +1 -1
  136. package/src/shade/renderer/water/GPUWaterRenderer.js +12 -17
  137. package/src/shade/renderer/water/medium/graph_water_meshlets.d.ts +35 -0
  138. package/src/shade/renderer/water/medium/graph_water_meshlets.d.ts.map +1 -0
  139. package/src/shade/renderer/water/medium/graph_water_meshlets.js +89 -0
  140. package/src/shade/renderer/water/query/GPUWaterQueries.d.ts +1 -1
  141. package/src/shade/renderer/water/shader_water.d.ts.map +1 -1
  142. package/src/shade/renderer/water/shader_water.js +22 -13
  143. package/src/shade/renderer/water/shader_water_avboit.d.ts.map +1 -1
  144. package/src/shade/renderer/water/shader_water_avboit.js +7 -7
  145. package/src/shade/renderer/water/surface/graph_water_tessellation.d.ts +1 -1
  146. package/src/shade/renderer/water/surface/graph_water_tessellation.js +1 -1
  147. package/src/shade/wgsl/emulator/WGSLJavaScriptCompiler.js +9 -1
  148. package/editor/REWORK_PLAN_2026_08.md +0 -692
  149. package/src/CODEC_LAYOUT_VERIFICATION.md +0 -419
  150. package/src/CORRECTNESS_HUNT_2026_07_24.md +0 -142
  151. package/src/DUPLICATION_AUDIT_2026_08_07/00_core_reuse_surface.md +0 -738
  152. package/src/DUPLICATION_AUDIT_2026_08_07/A_core_math_geom.md +0 -79
  153. package/src/DUPLICATION_AUDIT_2026_08_07/B_core_data.md +0 -93
  154. package/src/DUPLICATION_AUDIT_2026_08_07/C_gfx_render.md +0 -80
  155. package/src/DUPLICATION_AUDIT_2026_08_07/D_gfx_features.md +0 -164
  156. package/src/DUPLICATION_AUDIT_2026_08_07/E_physics.md +0 -69
  157. package/src/DUPLICATION_AUDIT_2026_08_07/F_sound.md +0 -110
  158. package/src/DUPLICATION_AUDIT_2026_08_07/G_net_save.md +0 -129
  159. package/src/DUPLICATION_AUDIT_2026_08_07/H_engine_misc.md +0 -72
  160. package/src/DUPLICATION_AUDIT_2026_08_07/I_generation_view.md +0 -74
  161. package/src/DUPLICATION_AUDIT_2026_08_07/K_crosscutting.md +0 -169
  162. package/src/DUPLICATION_AUDIT_2026_08_07.md +0 -254
  163. package/src/DUPLICATION_AUDIT_REMEDIATION.md +0 -250
  164. package/src/DUPLICATION_REVIEW_2026_10_24.md +0 -1072
  165. package/src/REVIEW_2026_08_06/adv-core.md +0 -511
  166. package/src/REVIEW_2026_08_06/adv-gfx.md +0 -480
  167. package/src/REVIEW_2026_08_06/adv-view.md +0 -446
  168. package/src/REVIEW_2026_08_06/api-core.md +0 -296
  169. package/src/REVIEW_2026_08_06/api-engine.md +0 -195
  170. package/src/REVIEW_2026_08_06/bvh-phys-sound-net.md +0 -507
  171. package/src/REVIEW_2026_08_06/core-binary.md +0 -348
  172. package/src/REVIEW_2026_08_06/core-collection.md +0 -376
  173. package/src/REVIEW_2026_08_06/core-math.md +0 -221
  174. package/src/REVIEW_2026_08_06/core-process.md +0 -266
  175. package/src/REVIEW_2026_08_06/core-science.md +0 -223
  176. package/src/REVIEW_2026_08_06/engine-ai-nav.md +0 -279
  177. package/src/REVIEW_2026_08_06/engine-animation.md +0 -167
  178. package/src/REVIEW_2026_08_06/engine-asset.md +0 -166
  179. package/src/REVIEW_2026_08_06/engine-ecs.md +0 -920
  180. package/src/REVIEW_2026_08_06/engine-input.md +0 -197
  181. package/src/REVIEW_2026_08_06/engine-misc.md +0 -248
  182. package/src/REVIEW_2026_08_06/engine-terrain.md +0 -52
  183. package/src/REVIEW_2026_08_06/generation.md +0 -176
  184. package/src/REVIEW_2026_08_06/geom-2d.md +0 -434
  185. package/src/REVIEW_2026_08_06/geom-3d.md +0 -117
  186. package/src/REVIEW_2026_08_06/gfx-gi.md +0 -143
  187. package/src/REVIEW_2026_08_06/gfx-render.md +0 -740
  188. package/src/REVIEW_2026_08_06/gfx-texture.md +0 -690
  189. package/src/REVIEW_2026_08_06/prior-criticals.md +0 -49
  190. package/src/REVIEW_2026_08_06/prior-highs.md +0 -138
  191. package/src/REVIEW_2026_08_06/test-gaps.md +0 -364
  192. package/src/REVIEW_2026_08_06/view.md +0 -667
  193. package/src/REVIEW_2026_08_06.md +0 -610
  194. package/src/core/binary/lz4/LZ4_HIGH_COMPRESSION_PLAN_2026_09_14.md +0 -542
  195. package/src/core/bvh2/bvh3/NOTES.md +0 -2
  196. package/src/core/bvh8/NOTES.md +0 -63
  197. package/src/core/cache/wtinylfu/benchmark/CacheWTinylfu.bench.md +0 -243
  198. package/src/core/color/COLOR_FIX_PLAN_2026_08_28.md +0 -417
  199. package/src/core/color/COLOR_REVIEW_2026_08_28.md +0 -779
  200. package/src/core/geom/2d/polygon/TRIANGULATION_DESIGN.md +0 -433
  201. package/src/core/geom/3d/atlas/ATLAS_PORT_PLAN.md +0 -486
  202. package/src/core/geom/3d/atlas/BFF_PLAN.md +0 -174
  203. package/src/core/geom/3d/atlas/REVIEW_02.md +0 -392
  204. package/src/core/geom/3d/gjk/GJK_REVIEW_NOTES.md +0 -146
  205. package/src/core/geom/3d/gjk/NOTES.md +0 -8
  206. package/src/core/geom/3d/topology/TOPO_MESH_RETIREMENT_PLAN.md +0 -135
  207. package/src/core/geom/GEOMETRY_REVIEW_002_API_ISSUES.md +0 -381
  208. package/src/core/geom/GEOMETRY_REVIEW_002_NAMING.md +0 -684
  209. package/src/core/geom/MANIFOLD_COMPARISON_2026_08_01.md +0 -554
  210. package/src/core/model/reactive/evaluation/PREDICATE_APPLICABILITY_PROPOSAL.md +0 -446
  211. package/src/engine/REVIEW_2026_07_03.md +0 -211
  212. package/src/engine/asset/loaders/image/IMAGE_CODEC_REVIEW_2026_08_28.md +0 -815
  213. package/src/engine/control/first-person/DESIGN.md +0 -658
  214. package/src/engine/control/first-person/DESIGN_COLLISION.md +0 -382
  215. package/src/engine/control/first-person/DESIGN_EXTENSIONS.md +0 -563
  216. package/src/engine/control/first-person/TODO.md +0 -160
  217. package/src/engine/ecs/ASYNC_SYSTEMS_PROPOSAL.md +0 -531
  218. package/src/engine/ecs/HIERARCHY_REVIEW.md +0 -717
  219. package/src/engine/ecs/async/WORKER_SYSTEM_PLAN.md +0 -262
  220. package/src/engine/ecs/ik/PLAN.md +0 -179
  221. package/src/engine/ecs/storage/binary/SERIALIZATION_COVERAGE.md +0 -272
  222. package/src/engine/ecs/storage/binary/object-v2/DESIGN.md +0 -199
  223. package/src/engine/ecs/transform/TRANSFORM64_MIGRATION_PLAN_2026_09_04.md +0 -521
  224. package/src/engine/graphics/CONTEXT_LOSS_RECOVERY_PLAN.md +0 -463
  225. package/src/engine/graphics/ecs/camera/pp/NOTES.md +0 -48
  226. package/src/engine/graphics/render/frame_graph/CORRECTNESS_FIXES_2026_09_04.md +0 -659
  227. package/src/engine/graphics/render/frame_graph/FRAME_GRAPH_RECOMMENDATIONS.md +0 -235
  228. package/src/engine/graphics/sh3/path_tracer/REVIEW_001_ACTION_PLAN.md +0 -490
  229. package/src/engine/graphics/texture/sampler/compare/FLIP_IMPLEMENTATION_PLAN.md +0 -466
  230. package/src/engine/input/GAMEPAD_API_PROPOSAL.md +0 -717
  231. package/src/engine/input/ecs/ism/ISM_DESIGN.md +0 -1523
  232. package/src/engine/input/ecs/ism/ISM_IMPLEMENTATION_PLAN.md +0 -627
  233. package/src/engine/navigation/mesh/OVERLAPPING_SURFACES_2026_08_25.md +0 -661
  234. package/src/engine/navigation/mesh/PATHFINDING_PLAN.md +0 -229
  235. package/src/engine/network/CONGESTION_CONTROL.md +0 -87
  236. package/src/engine/network/MESSAGE_TRANSPORT.md +0 -364
  237. package/src/engine/network/SMOOTHNESS_DESIGN.md +0 -400
  238. package/src/engine/physics/cloth/MEASUREMENTS.md +0 -5304
  239. package/src/engine/physics/cloth/PLAN.md +0 -3056
  240. package/src/engine/physics/fluid/GPU_FLUID_CASCADES_PROPOSAL_2026_10_16.md +0 -1382
  241. package/src/engine/physics/fluid/REVIEW_02_PLAN.md +0 -243
  242. package/src/engine/physics/fluid/solver/NOTES.md +0 -46
  243. package/src/engine/sound/SOUND_EMITTER_RETIREMENT_PLAN.md +0 -536
  244. package/src/engine/sound/simulation/IMPLEMENTATION_PLAN.md +0 -432
  245. package/src/engine/sound/simulation/PROBE_PLACEMENT.md +0 -250
  246. package/src/engine/sound/simulation/PROBE_TRANSFER_RESEARCH.md +0 -322
  247. package/src/engine/sound/simulation/REFLECTION_IR_PLAN.md +0 -261
  248. package/src/engine/sound/simulation/VISIBILITY_GRAPH_PLAN.md +0 -121
  249. package/src/engine/sound/sopra/IMPLEMENTATION_PLAN.md +0 -999
  250. package/src/format/image/avif/DECISIONS.md +0 -545
  251. package/src/format/image/jpeg/NOTES.md +0 -3
  252. package/src/format/scene/gltf/MESHOPT_COMPRESSION_PLAN.md +0 -814
  253. package/src/generation/COORDINATES.md +0 -54
  254. package/src/generation/REVIEW_01_ACTION_PLAN.md +0 -628
  255. package/src/generation/foliage/ANNUAL_SHOOTS_BRIEF_2026_10_25.md +0 -220
  256. package/src/generation/foliage/CROWN_FILLING_BRIEF_2026_10_26.md +0 -172
  257. package/src/generation/foliage/CROWN_FULLNESS_BRIEF_2026_10_26.md +0 -86
  258. package/src/generation/foliage/FOLIAGE_DESIGN.md +0 -547
  259. package/src/generation/foliage/FOLIAGE_PLAN.md +0 -198
  260. package/src/generation/foliage/LEAF_ARCHITECTURE_BRIEF_2026_10_26.md +0 -158
  261. package/src/generation/foliage/LOD_REWORK_BRIEF_2026_10_27.md +0 -521
  262. package/src/generation/foliage/REAL_TIME_TREES_BRIEF_2026_10_27.md +0 -86
  263. package/src/generation/foliage/SELF_ORGANIZING_FRAMEWORK_BRIEF_2026_10_26.md +0 -347
  264. package/src/generation/foliage/SHOOT_SYSTEMS_ALL_SPECIES_BRIEF_2026_10_26.md +0 -248
  265. package/src/generation/foliage/SPEEDTREE_COMPARISON_2026_10_24.md +0 -694
  266. package/src/generation/foliage/TWO_FRONT_ENDS_BRIEF_2026_10_28.md +0 -552
  267. package/src/shade/RENDERER_CONTRACT.md +0 -697
  268. package/src/shade/SHADER_F16_PROPOSAL_2026_10_24.md +0 -263
  269. package/src/shade/device/IMMEDIATE_DATA_PLAN_2026_08_28.md +0 -569
  270. package/src/shade/device/PASS_ENCODER_PROPOSAL_2026_08_31.md +0 -755
  271. package/src/shade/device/mock/EXTENSION_PROPOSAL_2026_08_22.md +0 -458
  272. package/src/shade/device/mock/IMPLEMENTATION_PLAN.md +0 -255
  273. package/src/shade/device/mock/REVIEW_2026_08_22.md +0 -527
  274. package/src/shade/device/timing/GPU_PROFILER_PROPOSAL_2026_08_28.md +0 -894
  275. package/src/shade/device/timing/profile/SGPT_FORMAT.md +0 -345
  276. package/src/shade/renderer/NOTES.md +0 -78
  277. package/src/shade/renderer/PLAN.md +0 -8
  278. package/src/shade/renderer/animation/ADDITIVE_BLENDING_PLAN.md +0 -145
  279. package/src/shade/renderer/animation/SKINNING_FRAME_PLAN.md +0 -357
  280. package/src/shade/renderer/atmosphere/NOTES.md +0 -6
  281. package/src/shade/renderer/camera/orbital/MomentumAxis.d.ts +0 -76
  282. package/src/shade/renderer/camera/orbital/MomentumAxis.d.ts.map +0 -1
  283. package/src/shade/renderer/camera/orbital/MomentumAxis.js +0 -164
  284. package/src/shade/renderer/camera/orbital/OrbitalCameraConfig.d.ts +0 -45
  285. package/src/shade/renderer/camera/orbital/OrbitalCameraConfig.d.ts.map +0 -1
  286. package/src/shade/renderer/camera/orbital/OrbitalCameraConfig.js +0 -66
  287. package/src/shade/renderer/camera/orbital/OrbitalCameraInput.d.ts +0 -98
  288. package/src/shade/renderer/camera/orbital/OrbitalCameraInput.d.ts.map +0 -1
  289. package/src/shade/renderer/camera/orbital/OrbitalCameraInput.js +0 -184
  290. package/src/shade/renderer/camera/orbital/OrbitalCameraRig.d.ts +0 -175
  291. package/src/shade/renderer/camera/orbital/OrbitalCameraRig.d.ts.map +0 -1
  292. package/src/shade/renderer/camera/orbital/OrbitalCameraRig.js +0 -411
  293. package/src/shade/renderer/camera/orbital/README.md +0 -81
  294. package/src/shade/renderer/camera/orbital/index.d.ts +0 -6
  295. package/src/shade/renderer/camera/orbital/index.d.ts.map +0 -1
  296. package/src/shade/renderer/camera/orbital/index.js +0 -9
  297. package/src/shade/renderer/extension/RENDER_EXTENSION_DESIGN.md +0 -964
  298. package/src/shade/renderer/fluid/GPU_FLUID_OCCUPANCY_AND_SOTA_REVIEW_2026_10_26.md +0 -361
  299. package/src/shade/renderer/geometry/bvh/BLAS_REFIT_BATCH_PLAN.md +0 -619
  300. package/src/shade/renderer/geometry/meshlet/COMPACTION_PLAN_2026_09_16.md +0 -674
  301. package/src/shade/renderer/geometry/sdf/NOTES.md +0 -6
  302. package/src/shade/renderer/geometry/virtual/ATTRIBUTE_PLAN_2026_09_18.md +0 -540
  303. package/src/shade/renderer/geometry/virtual/MICRON_COMPARISON_2026_08_20.md +0 -305
  304. package/src/shade/renderer/geometry/virtual/VGEO_FORMAT.md +0 -913
  305. package/src/shade/renderer/geometry/virtual/VIRTUAL_GEOMETRY_DESIGN.md +0 -787
  306. package/src/shade/renderer/geometry/virtual/VIRTUAL_GEOMETRY_PLAN.md +0 -481
  307. package/src/shade/renderer/geometry/virtual/VK_LOD_CLUSTERS_COMPARISON_2026_08_20.md +0 -301
  308. package/src/shade/renderer/geometry/virtual/WEDGE_PLAN_2026_09_18.md +0 -448
  309. package/src/shade/renderer/geometry/virtual/runtime/CULL_PLAN_2026_09_16.md +0 -385
  310. package/src/shade/renderer/geometry/virtual/runtime/CUT_PLAN_2026_09_14.md +0 -656
  311. package/src/shade/renderer/geometry/virtual/runtime/REVIEW_LEDGER.md +0 -308
  312. package/src/shade/renderer/geometry/virtual/runtime/RUNTIME_PLAN.md +0 -657
  313. package/src/shade/renderer/geometry/virtual/runtime/RUNTIME_PLAN_2026_09_14.md +0 -551
  314. package/src/shade/renderer/geometry/virtual/runtime/SHADOW_PLAN_2026_09_28.md +0 -529
  315. package/src/shade/renderer/global_illumination/lpv/NOTES.md +0 -3
  316. package/src/shade/renderer/global_illumination/probe_clipmap/PROBE_CLIPMAP_PROPOSAL_2026_10_27.md +0 -4306
  317. package/src/shade/renderer/global_illumination/probe_clipmap/PROBE_RAYS_VARIABLE_AND_SORTED_SCOPE_2026_10_30.md +0 -410
  318. package/src/shade/renderer/global_illumination/sharc/NOTES.md +0 -8
  319. package/src/shade/renderer/gpu_primitive/bvh/GPU_BVH_BUILD_PLAN.md +0 -1369
  320. package/src/shade/renderer/gpu_primitive/bvh/PHASE1_HANDOVER.md +0 -202
  321. package/src/shade/renderer/gpu_primitive/indirect/NOTES.md +0 -94
  322. package/src/shade/renderer/hiz/NOTES.md +0 -3
  323. package/src/shade/renderer/hiz/shader_hzb_reduce_mip0_clip.d.ts +0 -8
  324. package/src/shade/renderer/hiz/shader_hzb_reduce_mip0_clip.d.ts.map +0 -1
  325. package/src/shade/renderer/light/cluster/NOTES.md +0 -11
  326. package/src/shade/renderer/light/cluster/PROPOSAL_ALGORITHM_2026_10_16.md +0 -524
  327. package/src/shade/renderer/light/cluster/PROPOSAL_HIERARCHICAL_2026_10_16.md +0 -1101
  328. package/src/shade/renderer/material/resident/shader_resident_texture_means.d.ts +0 -24
  329. package/src/shade/renderer/material/resident/shader_resident_texture_means.d.ts.map +0 -1
  330. package/src/shade/renderer/material/resident/shader_resident_texture_means.js +0 -120
  331. package/src/shade/renderer/particles/DESIGN.md +0 -1011
  332. package/src/shade/renderer/particles/EMITTER_GLOBAL_STATE_PLAN_2026_10_29.md +0 -280
  333. package/src/shade/renderer/particles/ORIENTATION_PLAN_2026_10_15.md +0 -453
  334. package/src/shade/renderer/path_tracer/PATH_TRACED_MEDIA_PLAN_2026_10_02.md +0 -520
  335. package/src/shade/renderer/postprocess/bloom/NOTES.md +0 -6
  336. package/src/shade/renderer/postprocess/fsr/NOTES.md +0 -4
  337. package/src/shade/renderer/postprocess/gtao/NOTES.md +0 -6
  338. package/src/shade/renderer/postprocess/nss/NOTES.md +0 -332
  339. package/src/shade/renderer/postprocess/perspective/NOTES.md +0 -3
  340. package/src/shade/renderer/postprocess/sscs/NOTES.md +0 -5
  341. package/src/shade/renderer/postprocess/ssr/NOTES.md +0 -14
  342. package/src/shade/renderer/postprocess/ssr/REPROJECTION_PROPOSAL.md +0 -286
  343. package/src/shade/renderer/postprocess/ssr/prefilter/NOTES.md +0 -39
  344. package/src/shade/renderer/postprocess/taa/NOTES.md +0 -11
  345. package/src/shade/renderer/postprocess/upscale-dither/NOTES.md +0 -78
  346. package/src/shade/renderer/postprocess/vrs/NOTES.md +0 -4
  347. package/src/shade/renderer/rasterize/native/avboit/AVBOIT_LEDGER.md +0 -1218
  348. package/src/shade/renderer/rasterize/native/avboit/AVBOIT_PLAN_2026_09_03.md +0 -600
  349. package/src/shade/renderer/restir/reservoir/NOTES.md +0 -6
  350. package/src/shade/renderer/shader/chunk/atmosphere/NOTES.md +0 -6
  351. package/src/shade/renderer/shader/chunk/brdf/FRESNEL_BRIEF_2026_10_16.md +0 -391
  352. package/src/shade/renderer/shader/chunk/color/tonemap/ACES_TONE_MAPPING_BRIEF_2026_10_17.md +0 -153
  353. package/src/shade/renderer/shader/chunk/color/tonemap/HDR_TONE_MAPPING_FORMS_BRIEF_2026_10_16.md +0 -322
  354. package/src/shade/renderer/shader/chunk/color/tonemap/SDR_TONE_MAPPING_BRIEF_2026_10_16.md +0 -247
  355. package/src/shade/renderer/shader/chunk/fsr/NOTES.md +0 -3
  356. package/src/shade/renderer/shader/chunk/fsr/spd/NOTES.md +0 -4
  357. package/src/shade/renderer/shader/chunk/geometry/ray/NOTES.md +0 -4
  358. package/src/shade/renderer/shader/chunk/material/MULTISCATTER.md +0 -159
  359. package/src/shade/renderer/shader/chunk/mboit/NOTES.md +0 -38
  360. package/src/shade/renderer/shader/chunk/spherical_harmonics/l1i/NOTES.md +0 -3
  361. package/src/shade/renderer/shader/chunk/spherical_harmonics/sampling/NOTES.md +0 -8
  362. package/src/shade/renderer/shader/compiler/SHADER_SWITCH_PROPOSAL_2026_10_16.md +0 -927
  363. package/src/shade/renderer/shadow/contact/FINDINGS.md +0 -413
  364. package/src/shade/renderer/shadow/map/csm/NOTES.md +0 -5
  365. package/src/shade/renderer/shadow/ray/NOTES.md +0 -31
  366. package/src/shade/renderer/shadow/sdf/NOTES.md +0 -9
  367. package/src/shade/renderer/shadow/sdf/brixelizer/NOTES.md +0 -5
  368. package/src/shade/renderer/shadow/sdf/cascade/NOTES.md +0 -9
  369. package/src/shade/renderer/shadow/vsm/NOTES.md +0 -12
  370. package/src/shade/renderer/shadow/vsm/PLAN.md +0 -442
  371. package/src/shade/renderer/shadow/vsm/REVIEW_LEDGER.md +0 -43
  372. package/src/shade/renderer/texture/COMPRESSED_TEXTURE_PLAN_2026_09_01.md +0 -2444
  373. package/src/shade/renderer/texture/mipmaps/NOTES.md +0 -3
  374. package/src/shade/renderer/volumetrics/NOTES.md +0 -1329
  375. package/src/shade/renderer/volumetrics/VOLUMETRIC_NOISE_PLAN_2026_10_15.md +0 -336
  376. package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts +0 -23
  377. package/src/shade/renderer/water/medium/GPUWaterBodies.d.ts.map +0 -1
  378. package/src/shade/renderer/water/medium/GPUWaterBodies.js +0 -75
  379. package/src/shade/wgsl/NOTES.md +0 -4
@@ -1,527 +0,0 @@
1
- # `shade/device/mock` — review, 2026-08-22
2
-
3
- A review of `SoftwareGPUDevice` and the objects around it, against the WebGPU specification and
4
- against what the Shade renderer actually asks a device to do.
5
-
6
- > **Status: acted on.** Every finding below except the two named as out of scope has since been
7
- > fixed. This document describes the device *as it was on 2026-08-22*, and is kept as the record of
8
- > why the work was done and what the evidence for each finding was — not as a description of the
9
- > current code. What actually landed is in
10
- > [`IMPLEMENTATION_PLAN.md`](./IMPLEMENTATION_PLAN.md) §5.
11
- >
12
- > Still open: **E1/E2** (inherited limitations) are only partly addressed — `bytes_per_texel` no
13
- > longer throws for depth, packed or compressed formats, but `writeTexture` is still single-layer
14
- > (E2). **F1** and **F2** were both closed on 2026-08-22, by deletion rather than by fixing:
15
- > `probe_instance_animation.js` was removed with the `webgpu` dependency (it was one of five
16
- > hand-run Dawn probes), and `GPUDatabase.spec.js`'s skipped `full-fat` test went with it — F2's
17
- > own finding is why it could not be re-pointed at this device instead.
18
-
19
- The companion document is [`EXTENSION_PROPOSAL_2026_08_22.md`](./EXTENSION_PROPOSAL_2026_08_22.md),
20
- which turns the findings here into ranked work items.
21
-
22
- ---
23
-
24
- ## 1. Method
25
-
26
- Read every file in this folder, then established each behavioural claim below by running it. The
27
- probes were temporary spec files placed in this folder (vitest's `include` is `app/src/**/*.spec.js`,
28
- so a scratch file elsewhere is not collected) and deleted afterwards. Limit values were checked
29
- against a real Dawn device obtained through the `webgpu` package, which is already a dependency and
30
- is what `GPUDatabase.spec.js` and the `probe_*.js` tools use.
31
-
32
- Every "verified" tag below means the behaviour was observed, not inferred from reading.
33
-
34
- Baseline: `npx vitest run app/src/mir-engine/meep/src/shade/device/mock/` — 26 tests, all passing.
35
-
36
- ---
37
-
38
- ## 2. What this mock is, and what it is good at
39
-
40
- `SoftwareGPUDevice` is a CPU-memory stand-in for `GPUDevice` that lets renderer code be constructed
41
- and driven under node. It is not an emulator: nothing here compiles or executes WGSL — that is
42
- `wgsl/emulator/ComputeShaderEmulator.js` — and nothing rasterizes.
43
-
44
- Three things in it are genuinely good and should be preserved by any extension:
45
-
46
- 1. **The error model is right.** `pushErrorScope` / `popErrorScope` / `generate_error` /
47
- `uncapturederror` reproduce WebGPU's scope stack faithfully, down to details that are easy to get
48
- wrong: innermost-matching-scope wins, a scope keeps only its first error, a pop with no scope open
49
- rejects with an `OperationError`, an unclaimed error reaches the console. `SoftwareGPUError` is
50
- deliberately not an `Error` subclass, because `GPUError` is not one either. The reasoning is
51
- written down in the source next to the code that depends on it.
52
-
53
- 2. **A rejected descriptor does not throw.** `createBuffer` reports through the error scope and
54
- returns an invalid buffer that still reads back its requested `size`, `usage` and `label`, and the
55
- invalidity propagates the way WebGPU propagates it — a command naming an invalid buffer poisons
56
- the *encoder*, and the error surfaces from `finish()`, not from the encoding call. Then a
57
- submission holding one invalid command buffer executes *none* of its command buffers. That chain
58
- is subtle and it is implemented correctly.
59
-
60
- 3. **Where it declines to emulate, it says so loudly.** `SoftwareGPUComputePassEncoder`'s header
61
- states in plain words that dispatches change no bytes and that asserting on shader output is
62
- meaningless. `dispatchWorkgroupsIndirect` records `[-1, -1, -1]` rather than inventing a
63
- workgroup count. This is the right instinct and the extensions should keep it.
64
-
65
- The findings below are about the surface *around* that core, which is much thinner than the core
66
- suggests.
67
-
68
- ### 2.1 Inventory
69
-
70
- | File | Fidelity | Note |
71
- |---|---|---|
72
- | `SoftwareGPUDevice` | **Validating** (buffers only) | error scopes complete; `destroy`/`adapterInfo` throw |
73
- | `SoftwareGPUError`, `SoftwareGPUUncapturedErrorEvent` | **Complete** | — |
74
- | `SoftwareGPUBuffer` | **Executing** | no mapping; no destroyed-state enforcement |
75
- | `SoftwareGPUQueue` | **Executing** | no validation at all |
76
- | `SoftwareGPUCommandEncoder` | **Executing** (2 of 8 commands) | no render pass, no texture copies |
77
- | `SoftwareGPUCommandBuffer` | **Executing** | — |
78
- | `SoftwareGPUTexture` | **Storing** | lazy per-mip CPU storage, layer 0 only |
79
- | `SoftwareGPUComputePassEncoder` | **Recording** | by design |
80
- | `SoftwareGPUPipeline`, `SoftwareGPUShaderModule`, `SoftwareGPUBindGroup(Layout)`, `SoftwareGPUTextureView` | **Opaque handle** | by design |
81
- | `GPUQuerySet`, `GPURenderPassEncoder`, `GPURenderBundle*`, `GPUAdapter`, `GPUCanvasContext` | **Absent** | — |
82
-
83
- The ladder — *opaque handle → recording → storing → executing → validating* — is the useful axis for
84
- the rest of this document. The mock's problem is not that objects sit low on it. It is that **which**
85
- rung a given object sits on is unpredictable, and nothing tells a caller which one they got.
86
-
87
- ---
88
-
89
- ## 3. Findings
90
-
91
- Grouped by failure mode, because the failure mode determines how much a finding costs you.
92
-
93
- ### Class A — silent divergence
94
-
95
- *The mock accepts what a real device rejects. The test goes green and the GPU breaks. This is the
96
- expensive class: a mock that is merely incomplete wastes an afternoon, a mock that is wrong ships a
97
- bug.*
98
-
99
- #### A1. `queue.writeBuffer` performs no validation whatsoever — verified
100
-
101
- The spec requires `bufferOffset % 4 === 0`, the written size to be a multiple of 4, the destination
102
- range to lie inside the buffer, and the destination usage to include `COPY_DST`. None of these are
103
- checked.
104
-
105
- Observed, on an 8-byte buffer:
106
-
107
- - `writeBuffer(buffer, 0, new Uint8Array(16))` — **wrote 8 bytes, reported nothing.** No throw, no
108
- error scope entry. The default-size computation at `SoftwareGPUQueue.js:84` is
109
- `Math.min(buffer.size - offset, source.byteLength - dataOffset)`, which silently clamps. A real
110
- device raises a validation error; the caller here is told the write succeeded.
111
- - `writeBuffer(buffer, 1, new Uint8Array([9,9,9]))` — **wrote 3 bytes at byte offset 1.** Both the
112
- offset and the size are unaligned; both are validation errors in WebGPU.
113
- - With an explicit oversized `size`, the clamp does not apply and `array_buffer_copy` throws a bare
114
- `RangeError: Invalid typed array length` from two frames down — an opaque crash where the spec has
115
- a named, catchable error.
116
-
117
- `writeBuffer` is the single most-used queue entry point in the renderer. Silent truncation here is
118
- the highest-consequence finding in this document.
119
-
120
- #### A2. A destroyed buffer remains fully usable — verified
121
-
122
- ```
123
- c = device.createBuffer({size: 16, usage: COPY_DST}); c.destroy();
124
- queue.writeBuffer(c, 0, new Uint8Array([1,2,3,4]));
125
- // error scope: null c.data: [1, 2, 3, 4]
126
- ```
127
-
128
- `destroy()` sets a flag and nothing reads it. `#data` is retained, `writeBuffer` writes into it,
129
- `copyBufferToBuffer` copies out of it, `getMappedRange` hands it out. Use-after-destroy is one of the
130
- easier lifetime bugs to introduce in a pooled allocator and this mock is blind to all of it.
131
-
132
- `SoftwareGPUTexture.destroy()` at least clears `#mip_data`, but `get_mip_data` will happily
133
- re-allocate afterwards, so the same hole exists one indirection away.
134
-
135
- #### A3. `getMappedRange()` succeeds on an unmapped buffer — verified
136
-
137
- The guard at `SoftwareGPUBuffer.js:144` tests `#data === null`, which is only true for a buffer the
138
- device *refused*. A valid, unmapped, never-mapped buffer returns its whole storage. The spec requires
139
- an `OperationError` unless `mapState` is `"mapped"`.
140
-
141
- Consequence: renderer code that forgets to map, or that reads a range after `unmap()`, works here and
142
- fails in a browser. `GPUBufferStagingAllocator` asserts `mapState === "mapped"` precisely because
143
- that discipline matters, and the mock removes the only mechanism that would catch a violation.
144
-
145
- #### A4. `createBuffer` validates one rule out of five — verified
146
-
147
- Only `size > maxBufferSize` is checked. Accepted without complaint:
148
-
149
- - `usage: 0` (spec: validation error),
150
- - `MAP_READ | MAP_WRITE` together, and `MAP_READ` combined with anything other than `COPY_DST`
151
- (spec: validation error),
152
- - `mappedAtCreation: true` with a size that is not a multiple of 4 (spec: validation error).
153
-
154
- #### A5. `createTexture` validates nothing at all — verified
155
-
156
- ```
157
- device.createTexture({size: [1<<20, 1<<20], format: 'rgba8unorm', usage: TEXTURE_BINDING});
158
- // error scope: null
159
- ```
160
-
161
- `maxTextureDimension1D/2D/3D`, `maxTextureArrayLayers`, `mipLevelCount` versus size, `sampleCount`,
162
- `usage: 0`, format/usage compatibility — none are examined. This is a straight inconsistency with
163
- `createBuffer`, which is the same kind of entry point and does check its headline limit.
164
-
165
- It also leaves seven sites unexercised. The renderer clamps its own allocations against a texture
166
- dimension limit in `Renderer.js:1381`, `:1440`, `GPUProbeAtlas.js:112`, `:213`,
167
- `VirtualShadowMap.js:77` and `GPUSceneShadowmapContext.js:270` (all `maxTextureDimension2D`), and in
168
- `GPUGeometrySDFManager.js:71` (`maxTextureDimension3D`). The mock cannot tell you whether any of
169
- those clamps is correct, because it never objects to the unclamped value.
170
-
171
- #### A6. `copyBufferToBuffer` validates nothing — verified
172
-
173
- An 8-byte source and an 8-byte destination with `size = 64`:
174
-
175
- ```
176
- encoder.copyBufferToBuffer(a, 0, b, 0, 64);
177
- finish() -> error scope: null (encoder was not invalidated)
178
- submit() -> RangeError: Invalid typed array length: 16
179
- ```
180
-
181
- The spec requires `COPY_SRC` / `COPY_DST` usage, 4-byte alignment on both offsets and the size,
182
- in-bounds ranges, and `source !== destination`. The encoder checks only `isValid`. Note the shape of
183
- the failure: the error appears at *submit* time, as a `RangeError` from inside `array_buffer_copy`,
184
- with a message that names neither buffer.
185
-
186
- `ShadeGPUCommandContext.copyBufferToBuffer` does assert bounds — but `assert.*` is compiled out of
187
- production builds, so the assertion is a development aid, not the contract, and it is the mock's job
188
- to be the contract.
189
-
190
- #### A7. `clearBuffer` accepts an unaligned range — verified
191
-
192
- `clearBuffer(buffer, 1, 3)` is executed. The spec requires both offset and size to be multiples of 4.
193
-
194
- #### A8. The command encoder is never locked while a pass is open — verified
195
-
196
- ```
197
- const p1 = enc.beginComputePass(); const p2 = enc.beginComputePass(); // both succeed
198
- ```
199
-
200
- WebGPU puts the encoder into a *locked* state for the lifetime of a pass; any encoder method called
201
- before `end()` is a validation error that invalidates the encoder. Here you can interleave two passes,
202
- or issue `copyBufferToBuffer` in the middle of one, and the mock will not object. Pass-scoping bugs
203
- are a real category and this makes them invisible.
204
-
205
- Related: a pass's recorded work never reaches the command buffer. `beginComputePass` pushes onto
206
- `encoder.compute_passes` and the pass is inspected from there; `finish()` does not fold it into
207
- `#commands`. That is coherent with "the pass executes nothing", but it does mean `end()` is
208
- unobservable and pass ordering relative to copies is not represented anywhere.
209
-
210
- #### A9. `device.limits` is one shared, mutable object — verified
211
-
212
- ```
213
- device.limits.maxBufferSize = 4;
214
- new SoftwareGPUDevice().limits.maxBufferSize // -> 4
215
- ```
216
-
217
- `DEFAULT_LIMITS` is a module-level object returned by reference from every device. `GPUSupportedLimits`
218
- is declared entirely `readonly`, and a real Dawn device silently ignores the assignment (verified).
219
- Here one test can poison every subsequent device in the same worker.
220
-
221
- This also blocks something worth having: the clamp sites listed in A5 are only reachable today by
222
- actually requesting an 8192-pixel texture. A device whose limits could be *lowered* per instance
223
- would make them cheap to test — see the proposal, P3.
224
-
225
- #### A10. `device.features` is empty; a real core device is not — verified
226
-
227
- Dawn's default device reports `core-features-and-limits`. The spec makes that feature always present
228
- and always enabled on a core adapter. The mock's `NO_FEATURES` is defensible for optional features —
229
- the header argues the case well — but the always-on one is a factual difference, and code written as
230
- `device.features.has('core-features-and-limits')` would take the compatibility-mode branch here.
231
-
232
- #### A11. Four limits are wrong and one is missing — verified
233
-
234
- Against Dawn's default (spec-default) device, `DEFAULT_LIMITS` matches on every field it declares
235
- except:
236
-
237
- | Limit | Mock | Dawn default |
238
- |---|---|---|
239
- | `maxStorageBuffersInVertexStage` | 0 (`// unset`) | 8 |
240
- | `maxStorageBuffersInFragmentStage` | 0 (`// unset`) | 8 |
241
- | `maxStorageTexturesInVertexStage` | 0 (`// unset`) | 4 |
242
- | `maxStorageTexturesInFragmentStage` | 0 (`// unset`) | 4 |
243
- | `maxImmediateSize` | *absent* | 0 |
244
-
245
- The four zeroes are not a conservative choice — they are the *compatibility-mode* values, and they
246
- say "this device supports no storage bindings in the vertex or fragment stage", which is a stronger
247
- and less true claim than the spec default. Dawn's values are exactly
248
- `maxStorageBuffersPerShaderStage` and `maxStorageTexturesPerShaderStage`, which is what the spec
249
- derives them from for a core device.
250
-
251
- ### Class B — loud divergence
252
-
253
- *The mock throws where a real device reports, or refuses what a real device allows. Nothing ships
254
- broken, but tests cannot be written at all — and the current suite is already paying for it.*
255
-
256
- #### B1. `mapAsync` throws `Not Implemented`, and it is costing us today — verified
257
-
258
- This is the most consequential gap in the folder, and it is not hypothetical:
259
-
260
- ```
261
- $ npx vitest run .../GPUMeshSkinningContext.spec.js --reporter=verbose | grep -c "Not Implemented"
262
- 104
263
- ```
264
-
265
- **104 rejected `mapAsync` calls inside one passing spec file.** The origin is
266
- `GPUBufferStagingAllocator.release()`, which re-maps a released buffer to return it to the pool. The
267
- `mapAsync` rejection is routed to `console.error` there, so the buffer is dropped instead of pooled,
268
- the test still passes, and nobody notices.
269
-
270
- The measurable effect:
271
-
272
- ```
273
- 5 identical 64-byte staging requests -> 5 buffers created
274
- ```
275
-
276
- Under a real device the pool serves the second through fifth from the first. **The staging pool does
277
- not pool under the mock** — which means `ShadeGPUCommandContext.writeBuffer` and `writeValueBuffer`,
278
- the renderer's primary upload path, run a different allocation strategy in tests than in production,
279
- and any test that reasons about allocation counts is reasoning about the wrong system.
280
-
281
- `mapAsync` is also the gate on every GPU→CPU readback: `inspect_gpu_buffer`,
282
- `inspect_gpu_buffer_typed`, `graph_read_buffer`, `download_texture_data`,
283
- `Uint32BufferSamplingStats`, `GPUTimer`, `GPUTimerArray`. All are unreachable under the mock.
284
-
285
- #### B2. `getMappedRange` refuses sub-ranges the spec allows — verified
286
-
287
- ```
288
- getMappedRange(0, 32) on a 64-byte buffer -> Error('Size not supported')
289
- getMappedRange(offset !== 0) -> Error('Offset not supported')
290
- ```
291
-
292
- Six production call sites pass a sub-range: `ShadeGPUCommandContext.js:630` and `:660`
293
- (`getMappedRange(0, size)` on a pooled buffer that is `>=` size), `inspect_gpu_buffer.js:43`, `:85`,
294
- `:95`, `GPUTimerArray.js:169`, `graph_read_buffer.js:95`. The staging path only avoids this today
295
- *because* B1 stops the pool from ever handing back an oversized buffer — one bug is masking the other,
296
- and fixing B1 alone would expose B2 immediately.
297
-
298
- The spec's own constraints (`offset % 8 === 0`, `size % 4 === 0`, range inside the mapped range, no
299
- overlap with a range already handed out) are cheap and are the useful part.
300
-
301
- #### B3. `destroy()` is not idempotent — verified
302
-
303
- `SoftwareGPUBuffer.destroy()` throws `Already destroyed` on a second call; so does
304
- `SoftwareGPUTexture.destroy()`. The spec says destroy may be called multiple times. The source
305
- already carries `// TODO should this fail silently instead?` — the answer is yes, and it matters:
306
- defensive double-destroy in pool teardown is normal, correct code that this mock punishes.
307
-
308
- #### B4. `device.destroy()` and `device.adapterInfo` throw `Not Implemented`
309
-
310
- `destroy()` in particular is not exotic — it is how a renderer shuts down. Spec behaviour is well
311
- defined and small: idempotent, resolves `lost` with reason `"destroyed"`, and subsequent work
312
- becomes a validation error rather than an exception.
313
-
314
- #### B5. Re-submitting a command buffer throws — verified
315
-
316
- `submit([cb])` twice gives `Error: execute() called twice` from `SoftwareGPUCommandBuffer`. The spec
317
- makes a second submission a validation error. Throwing is inconsistent with this folder's own
318
- governing argument, stated at `SoftwareGPUDevice.js:246`: *"Throwing instead would mean renderer code
319
- that runs on a GPU takes a different path here, which is the one thing a software device must not
320
- do."*
321
-
322
- #### B6. Encode-after-`finish` throws — deliberate, and worth naming as such
323
-
324
- `#assert_encoding()` and the second `finish()` both throw. WebGPU makes these validation errors on an
325
- invalidated encoder. This is a *chosen* deviation — `SoftwareGPUDevice.spec.js:443` pins it — and the
326
- argument for it (a caller bug should be loud) is reasonable.
327
-
328
- It is listed here not as a defect but because the folder currently has **two contradictory policies**
329
- (A6/B5 argue "never throw, always report"; B6 argues "throw on caller bugs") and neither is written
330
- down as a policy. Whichever way it lands, it should be one sentence in one place, and the exceptions
331
- should be exceptions on purpose.
332
-
333
- #### B7. `copyExternalImageToTexture` throws for `flipY` and for non-`ImageData` sources
334
-
335
- Honest and well-documented, but it is a third policy: an unimplemented *feature* throws a plain
336
- `Error`. Same note as B6.
337
-
338
- ### Class C — absent surface
339
-
340
- *A `TypeError: x is not a function` on contact. Cheap to diagnose, but each one is a hard stop for a
341
- category of test.*
342
-
343
- | # | Missing | Consequence |
344
- |---|---|---|
345
- | C1 | `device.createQuerySet` | `GPUTimer`, `GPUTimerArray` cannot be constructed |
346
- | C2 | `encoder.beginRenderPass` | **any** render-pass test; `ShadeGPUCommandContext.beginRenderPass`/`constructRenderPass` are dead under the mock |
347
- | C3 | `encoder.copyTextureToTexture` / `copyBufferToTexture` / `copyTextureToBuffer` | texture upload/readback/blit paths; `download_texture_data` |
348
- | C4 | `encoder.resolveQuerySet` | timing readback |
349
- | C5 | a render pass encoder class | see C2 |
350
- | C6 | `queue.onSubmittedWorkDone` | any code that waits on the queue |
351
- | C7 | `device.lost` | shutdown / context-loss handling |
352
- | C8 | `createCommandEncoder(descriptor)` — descriptor dropped | encoder has no `label` at all; `ShadeGPUCommandContext.create` passes one (`ShadeGPUCommandContext.js:198`) and it vanishes. `SoftwareGPUCommandEncoder`, `SoftwareGPUQueue` and `SoftwareGPUCommandBuffer` all skip `SoftwareGPUObjectBase`, and the compute pass encoder rolled its own `label` field instead — four objects, three answers |
353
- | C9 | `setBindGroup` dynamic offsets | the 5-argument overload is dropped on the floor; dynamic-offset bugs are invisible |
354
- | C10 | `GPUAdapter` / `navigator.gpu` stand-in | device-acquisition code cannot be driven |
355
-
356
- C2/C5 are worth a second look because of how small the real requirement is. Counting calls made
357
- directly on a pass across all of `shade/`: `draw` (17), `setViewport` (4), `drawIndirect` (3),
358
- `setVertexBuffer` (1, in a `prototype*.js` file), plus `setPipeline` / `setBindGroup` / `end` /
359
- debug markers. No index buffers, no bundles, no occlusion queries. And most full-screen work does not
360
- touch a pass directly at all — `ImageShader.draw()` funnels through `constructRenderPass` →
361
- `setViewport` → `draw(3)` → `end` (`renderer/shader/ImageShader.js:178-208`), with roughly two dozen
362
- further call sites behind it. A recording render pass encoder is about the size of the compute one
363
- that already exists, and it unblocks every full-screen pass in the renderer.
364
-
365
- ### Class D — environment coupling
366
-
367
- #### D1. Texture views and samplers are not recognised by the `instanceof` stubs — verified
368
-
369
- ```
370
- tex.createView() instanceof GPUTextureView -> false
371
- device.createSampler() instanceof GPUSampler -> false
372
- device.createBuffer() instanceof GPUBuffer -> true
373
- ```
374
-
375
- `vitest.setup.mjs` gives `GPUBuffer` a `Symbol.hasInstance` that recognises `SoftwareGPUBuffer`, with
376
- a good comment explaining why. `GPUTextureView` and `GPUSampler` got empty stand-ins instead.
377
-
378
- The consequence is in production code:
379
- `BindGroupDescriptor.compute_binding_resource_hash` branches on exactly those two `instanceof` tests.
380
- Under the mock both are false, control falls to `resource.buffer !== undefined` (also false), and the
381
- function **returns 0 for every texture-view and sampler binding**. Two bind groups differing only in
382
- their bound textures hash identically. The correctness of the cache is saved by
383
- `compute_binding_resource_equality`, which falls back to identity — so this is not a live bug, but it
384
- does mean the texture-view and sampler branches of the renderer's bind-group hashing are *dead code
385
- in node*, and `BindGroupManager.spec.js` (109 lines) binds only buffers, so nothing covers them.
386
-
387
- The same two tests also gate `encoder_prepare_shader_binding.js:55`/`:66` and
388
- `ShaderResourceGroupDescriptor.js:132`, which take an `else { throw }` branch for an unrecognised
389
- resource.
390
-
391
- `SoftwareGPUSampler` is not even a class — `createSampler` returns
392
- `{...descriptor, isSoftwareGPUSampler: true}`, an object literal, so `a.constructor` is `Object`.
393
-
394
- ### Class E — inherited limitations
395
-
396
- #### E1. `bytes_per_texel` throws for most non-colour formats — verified
397
-
398
- `SoftwareGPUTexture.bytes_per_texel` delegates to `parse_gpu_texture_format`, whose regular
399
- expression handles only `<channels><bits><type>`:
400
-
401
- | Format | Result |
402
- |---|---|
403
- | `rgba8unorm`, `bgra8unorm`, `rgba8unorm-srgb`, `r32float`, `rg16uint` | correct |
404
- | `depth32float` | correct (special case) |
405
- | `depth24plus`, `stencil8`, `bc7-rgba-unorm` | `Error: Failed to parse` |
406
- | `rgb10a2unorm`, `rg11b10ufloat` | `Error: Unsupported format` |
407
-
408
- So a texture in any depth format other than `depth32float`, any packed format, or any block-compressed
409
- format cannot have data written to it or read from it through this mock. Given that Shade's shadow
410
- maps, Hi-Z chain and G-buffer all use depth and packed formats, this bounds texture testing quite
411
- sharply. The fix belongs upstream of this folder, but the requirement originates here.
412
-
413
- #### E2. `writeTexture` is single-layer, single-aspect, 2D only
414
-
415
- `assert.equal(depth, 1, 'only single-layer writes are emulated')`. `rowsPerImage` is ignored, `aspect`
416
- is ignored, and although `get_mip_data` allocates `width × height × depthOrArrayLayers × bpt`, the
417
- row addressing in `writeTexture` only ever reaches layer 0 — the rest of the allocation is
418
- unreachable. Cube maps, texture arrays and 3D textures (the LPG volume, the SDF atlas, the probe
419
- atlas) are all out of reach.
420
-
421
- Also note this validation is expressed with `assert.*`, which is stripped in production builds. That
422
- is harmless while this folder is test-only, but it means the guard is a development aid rather than
423
- a contract; a mock's refusals should hold under any build.
424
-
425
- ### Class F — stale documentation
426
-
427
- #### F1. `probe_instance_animation.js` states a limitation that no longer exists
428
-
429
- Its header explains that it cannot be a spec because *"`SoftwareGPUDevice` has neither
430
- `pushErrorScope` nor `createShaderModule`"*. Both exist now, and `GPUMeshSkinningContext.spec.js:73`
431
- constructs a full `GraphicsContext` over the mock. The *other* reason given there — that registration
432
- is only observable through GPU output — still stands, so the file should stay a probe; but the stated
433
- wall is gone and the comment misleads the next reader about what the mock can do.
434
-
435
- #### F2. `GPUDatabase.spec.js` carries a skipped functional test
436
-
437
- `test.skip("full-fat", ...)` is written against a real Dawn device and exercises the whole
438
- write → upload → read-back loop. It cannot be re-pointed at the software device: `GPUDatabase.update`
439
- uploads through a **compute dispatch** (`gpu_table_element_upload_shader.dispatch`,
440
- `GPUDatabase.js:570`), and a dispatch changes no bytes here. No amount of extension to this mock
441
- short of shader execution will run it.
442
-
443
- It is listed because a skipped functional test should be fixed or deleted, and because the reason it
444
- is skipped needs checking: the stated obstacle elsewhere in the tree is that a Dawn device "does not
445
- survive vitest's worker pool", but a Dawn device created inside a vitest run in this repo today does
446
- a full `writeBuffer → mapAsync → getMappedRange` round trip successfully (verified). Whatever is
447
- actually blocking that test, it is worth re-establishing rather than assuming.
448
-
449
- ---
450
-
451
- ## 4. Summary
452
-
453
- | Class | Count | Cost of leaving it |
454
- |---|---|---|
455
- | A — silent divergence | 11 | green tests over broken GPU behaviour |
456
- | B — loud divergence | 7 | tests cannot be written; 104 suppressed errors in one existing spec |
457
- | C — absent surface | 10 | whole categories blocked (render passes, timing, texture copies) |
458
- | D — environment coupling | 1 | two production hashing branches dead in node |
459
- | E — inherited | 2 | depth/packed/compressed textures out of reach |
460
- | F — stale docs | 2 | — |
461
-
462
- The one-line version: **the error-reporting machinery is excellent and the validation it exists to
463
- report is almost entirely absent.** The scaffolding for saying "the device refused this, here is why,
464
- in the scope you were watching" is built, tested and correct — and `createBuffer`'s single
465
- `maxBufferSize` check is the only thing that ever uses it. Every extension in the companion document
466
- is, in one way or another, a way of giving that machinery something to report.
467
-
468
- ---
469
-
470
- ## 5. Adversarial review of this document
471
-
472
- Challenges raised against the draft, and what they changed.
473
-
474
- **"A2, A3 and A6 are the same finding — the mock does not validate."** Partly fair, and they are now
475
- grouped under one heading with one shared framing. They are kept separate because the remedies are
476
- independent and land in different files, and because A2 (lifetime) is a different *kind* of state
477
- than A6 (arguments). The class heading now carries the shared argument so the individual entries do
478
- not repeat it.
479
-
480
- **"You claim `writeBuffer` truncation is the highest-consequence finding, but you have not shown a
481
- real renderer bug it would hide."** Correct, and the claim is now scoped to what was measured: the
482
- behaviour is verified, the consequence is argued from call-site count (`writeBuffer` is the most-used
483
- queue entry point), not from a caught bug. No claim of a discovered defect is made anywhere in this
484
- document.
485
-
486
- **"B1's `104` is a grep count of stack-trace lines, not of distinct failures."** A fair objection, and
487
- it was checked rather than argued: the same run yields 104 `Error: Not Implemented` lines, 104
488
- `at SoftwareGPUBuffer.mapAsync` frames and 104 `at GPUBufferStagingAllocator.release` frames. Each
489
- stack contributes exactly one of each, so the count is 104 distinct rejections. The claim stands as
490
- written. Independently of the count, the argument rests on the second measurement —
491
- `5 identical staging requests → 5 buffers created` — which is a direct behavioural observation and
492
- does not depend on error counting at all.
493
-
494
- **"A9's 'poisons every device in the worker' — do the current tests actually share a worker?"** Not
495
- asserted either way now. The verified fact is that the object is shared and mutable and that a real
496
- device ignores the write; whether any current test collides is unknown and the text no longer implies
497
- one does.
498
-
499
- **"A11 says Dawn's numbers are 'the spec defaults'. Dawn reports its *supported* limits, which may
500
- exceed spec defaults."** Right, and the text was corrected. The evidence is that
501
- `adapter.requestDevice()` with no `requiredLimits` yields the default device, and that its four
502
- values coincide exactly with `maxStorageBuffersPerShaderStage` / `maxStorageTexturesPerShaderStage`,
503
- which is how the spec derives them for a core device. The document now says that, rather than
504
- "Dawn is the spec".
505
-
506
- **"D1 is a bug in `vitest.setup.mjs`, not in this folder."** True; it is retained because the fix
507
- requires a change in this folder as well (`SoftwareGPUSampler` must become a class to be recognised)
508
- and because a reader of the mock has no other place to learn that view bindings hash to zero. The
509
- class is now explicitly named "environment coupling" rather than filed as a mock defect.
510
-
511
- **"E1/E2 are other people's code."** Yes — the class is named "inherited" and the review says the fix
512
- belongs upstream. They are in scope because they bound what this mock can be extended to do, which
513
- is the question the companion document has to answer.
514
-
515
- **"B6 is listed as a finding but you conclude it is fine."** Reworded. It is not a defect claim; it
516
- is a claim that three different policies for unimplemented/illegal input coexist without one being
517
- written down. That claim stands on its own.
518
-
519
- **"The render-pass call counts in C2 look like a raw `.draw(` grep."** They were, and they were
520
- wrong — 44 counted `ImageShader.draw({...})` helper calls alongside genuine `pass.draw()` calls.
521
- Recounted against pass-bound receivers only: 17 / 4 / 3 / 1. The correction weakens the raw numbers
522
- and strengthens the point, because `ImageShader.draw` turns out to funnel *into* the same tiny pass
523
- surface, so the helper call sites are additional beneficiaries rather than additional API.
524
-
525
- **"The fidelity ladder in §2.1 is invented vocabulary."** It is, and it is only used as a reading
526
- aid. The table's rungs are each defined by the concrete behaviour of the object, so a reader who
527
- rejects the vocabulary loses nothing.