@forgeax/engine-render 0.1.32 → 0.1.34

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 (624) hide show
  1. package/README.md +1374 -142
  2. package/dist/assembly/analytic-fog-registration.d.ts +3 -0
  3. package/dist/assembly/analytic-fog-registration.d.ts.map +1 -0
  4. package/dist/assembly/backend-contract.d.ts +2 -0
  5. package/dist/assembly/backend-contract.d.ts.map +1 -1
  6. package/dist/assembly/barrel-distortion-inspection.d.ts +3 -0
  7. package/dist/assembly/barrel-distortion-inspection.d.ts.map +1 -0
  8. package/dist/assembly/canvas-draw-guard.d.ts +3 -0
  9. package/dist/assembly/canvas-draw-guard.d.ts.map +1 -0
  10. package/dist/assembly/cloud-shadow-entry.d.ts +4 -0
  11. package/dist/assembly/cloud-shadow-entry.d.ts.map +1 -0
  12. package/dist/assembly/dynamic-geometry-host.d.ts +4 -1
  13. package/dist/assembly/dynamic-geometry-host.d.ts.map +1 -1
  14. package/dist/assembly/dynamic-geometry-runtime.d.ts +1 -1
  15. package/dist/assembly/dynamic-geometry-runtime.d.ts.map +1 -1
  16. package/dist/assembly/factory.d.ts +1 -1
  17. package/dist/assembly/factory.d.ts.map +1 -1
  18. package/dist/assembly/fxaa-registration.d.ts +4 -0
  19. package/dist/assembly/fxaa-registration.d.ts.map +1 -0
  20. package/dist/assembly/host-contract.d.ts +3 -3
  21. package/dist/assembly/host-contract.d.ts.map +1 -1
  22. package/dist/assembly/lod-observation.d.ts +4 -0
  23. package/dist/assembly/lod-observation.d.ts.map +1 -0
  24. package/dist/assembly/material/assembly.d.ts.map +1 -1
  25. package/dist/assembly/material/pipeline-helpers.d.ts +5 -0
  26. package/dist/assembly/material/pipeline-helpers.d.ts.map +1 -1
  27. package/dist/assembly/material-shader-policy.d.ts +16 -2
  28. package/dist/assembly/material-shader-policy.d.ts.map +1 -1
  29. package/dist/assembly/material-shader-prewarm.d.ts.map +1 -1
  30. package/dist/assembly/motion-blur-registration.d.ts +3 -0
  31. package/dist/assembly/motion-blur-registration.d.ts.map +1 -0
  32. package/dist/assembly/recovery/device-loss-fanout.d.ts.map +1 -1
  33. package/dist/assembly/recovery/renderer-recover.d.ts +2 -0
  34. package/dist/assembly/recovery/renderer-recover.d.ts.map +1 -1
  35. package/dist/assembly/render-feature-post-processes.d.ts +6 -0
  36. package/dist/assembly/render-feature-post-processes.d.ts.map +1 -0
  37. package/dist/assembly/renderer-facade.d.ts.map +1 -1
  38. package/dist/assembly/renderer-feature-inspection.d.ts +1 -1
  39. package/dist/assembly/renderer-feature-inspection.d.ts.map +1 -1
  40. package/dist/assembly/renderer-frame-transaction.d.ts +12 -0
  41. package/dist/assembly/renderer-frame-transaction.d.ts.map +1 -1
  42. package/dist/assembly/renderer-inspection.d.ts +11 -0
  43. package/dist/assembly/renderer-inspection.d.ts.map +1 -1
  44. package/dist/assembly/temporal-post-process-prewarm.d.ts +13 -0
  45. package/dist/assembly/temporal-post-process-prewarm.d.ts.map +1 -0
  46. package/dist/assembly/webgpu-pbr-ready.d.ts +1 -0
  47. package/dist/assembly/webgpu-pbr-ready.d.ts.map +1 -1
  48. package/dist/assembly/webgpu-ready-contract.d.ts +4 -3
  49. package/dist/assembly/webgpu-ready-contract.d.ts.map +1 -1
  50. package/dist/assembly/webgpu-ready-per-pass.d.ts +39 -0
  51. package/dist/assembly/webgpu-ready-per-pass.d.ts.map +1 -0
  52. package/dist/assembly/webgpu-ready.d.ts +2 -2
  53. package/dist/assembly/webgpu-ready.d.ts.map +1 -1
  54. package/dist/assembly/webgpu-renderer-bootstrap.d.ts.map +1 -1
  55. package/dist/assembly/webgpu-renderer-observation-owner.d.ts +35 -0
  56. package/dist/assembly/webgpu-renderer-observation-owner.d.ts.map +1 -0
  57. package/dist/assembly/webgpu-renderer.d.ts +1 -1
  58. package/dist/assembly/webgpu-renderer.d.ts.map +1 -1
  59. package/dist/authoring.mjs +1 -1
  60. package/dist/barrel-distortion.d.ts +47 -0
  61. package/dist/barrel-distortion.d.ts.map +1 -0
  62. package/dist/bloom-admission.d.ts +13 -0
  63. package/dist/bloom-admission.d.ts.map +1 -0
  64. package/dist/{chunk-PA5DRJNI.mjs → chunk-ELJFJ2BU.mjs} +2 -2
  65. package/dist/chunk-ELJFJ2BU.mjs.map +1 -0
  66. package/dist/{chunk-JCIRYQ4V.mjs → chunk-HEB564WF.mjs} +10 -4
  67. package/dist/chunk-HEB564WF.mjs.map +1 -0
  68. package/dist/{chunk-JRIPCMYC.mjs → chunk-MKDIT2EM.mjs} +1584 -375
  69. package/dist/chunk-MKDIT2EM.mjs.map +1 -0
  70. package/dist/{chunk-S665NJNF.mjs → chunk-OCDLEI6I.mjs} +3 -3
  71. package/dist/{chunk-S665NJNF.mjs.map → chunk-OCDLEI6I.mjs.map} +1 -1
  72. package/dist/chunk-ODZWR6JQ.mjs +4927 -0
  73. package/dist/chunk-ODZWR6JQ.mjs.map +1 -0
  74. package/dist/{chunk-DRR7D3KX.mjs → chunk-SHFUFJ5N.mjs} +192 -18
  75. package/dist/chunk-SHFUFJ5N.mjs.map +1 -0
  76. package/dist/{chunk-4NNZQCL3.mjs → chunk-UI5SFODX.mjs} +223 -277
  77. package/dist/chunk-UI5SFODX.mjs.map +1 -0
  78. package/dist/{chunk-GWCEMDVR.mjs → chunk-UINHLCZA.mjs} +787 -80
  79. package/dist/chunk-UINHLCZA.mjs.map +1 -0
  80. package/dist/{chunk-6TFBXLRJ.mjs → chunk-WEX45HKH.mjs} +222 -337
  81. package/dist/chunk-WEX45HKH.mjs.map +1 -0
  82. package/dist/cloud/density.d.ts +55 -0
  83. package/dist/cloud/density.d.ts.map +1 -0
  84. package/dist/cloud/extract.d.ts +25 -0
  85. package/dist/cloud/extract.d.ts.map +1 -0
  86. package/dist/cloud/feature.d.ts +57 -0
  87. package/dist/cloud/feature.d.ts.map +1 -0
  88. package/dist/cloud/frame-context.d.ts +8 -0
  89. package/dist/cloud/frame-context.d.ts.map +1 -0
  90. package/dist/cloud/inspection.d.ts +59 -0
  91. package/dist/cloud/inspection.d.ts.map +1 -0
  92. package/dist/cloud/optics.d.ts +56 -0
  93. package/dist/cloud/optics.d.ts.map +1 -0
  94. package/dist/cloud/parameters.d.ts +73 -0
  95. package/dist/cloud/parameters.d.ts.map +1 -0
  96. package/dist/cloud/resources.d.ts +60 -0
  97. package/dist/cloud/resources.d.ts.map +1 -0
  98. package/dist/cloud/shadow.d.ts +42 -0
  99. package/dist/cloud/shadow.d.ts.map +1 -0
  100. package/dist/cloud/temporal.d.ts +74 -0
  101. package/dist/cloud/temporal.d.ts.map +1 -0
  102. package/dist/components/atmosphere.d.ts +2 -0
  103. package/dist/components/atmosphere.d.ts.map +1 -1
  104. package/dist/components/barrel-distortion.d.ts +13 -0
  105. package/dist/components/barrel-distortion.d.ts.map +1 -0
  106. package/dist/components/camera.d.ts +20 -4
  107. package/dist/components/camera.d.ts.map +1 -1
  108. package/dist/components/cloud-layer.d.ts +29 -0
  109. package/dist/components/cloud-layer.d.ts.map +1 -0
  110. package/dist/components/index.d.ts +2 -0
  111. package/dist/components/index.d.ts.map +1 -1
  112. package/dist/components/instances.d.ts +20 -6
  113. package/dist/components/instances.d.ts.map +1 -1
  114. package/dist/components/mesh-filter.d.ts +6 -5
  115. package/dist/components/mesh-filter.d.ts.map +1 -1
  116. package/dist/components/motion-blur.d.ts +1 -0
  117. package/dist/components/motion-blur.d.ts.map +1 -1
  118. package/dist/construct-renderer.d.ts +1 -1
  119. package/dist/construct-renderer.d.ts.map +1 -1
  120. package/dist/construct-renderer.mjs +9751 -3528
  121. package/dist/construct-renderer.mjs.map +1 -1
  122. package/dist/device/gpu-residency.d.ts +6 -0
  123. package/dist/device/gpu-residency.d.ts.map +1 -1
  124. package/dist/dynamic-geometry.d.ts +5 -1
  125. package/dist/dynamic-geometry.d.ts.map +1 -1
  126. package/dist/environment/analytic-fog.d.ts +6 -0
  127. package/dist/environment/analytic-fog.d.ts.map +1 -0
  128. package/dist/errors/cloud.d.ts +59 -0
  129. package/dist/errors/cloud.d.ts.map +1 -0
  130. package/dist/errors/render.d.ts +23 -5
  131. package/dist/errors/render.d.ts.map +1 -1
  132. package/dist/examples/single-layer-medium-surface.d.ts +47 -0
  133. package/dist/examples/single-layer-medium-surface.d.ts.map +1 -0
  134. package/dist/extract/camera.d.ts.map +1 -1
  135. package/dist/extract/contracts.d.ts +12 -1
  136. package/dist/extract/contracts.d.ts.map +1 -1
  137. package/dist/extract/environment.d.ts +2 -0
  138. package/dist/extract/environment.d.ts.map +1 -1
  139. package/dist/features/barrel-distortion.d.ts +29 -0
  140. package/dist/features/barrel-distortion.d.ts.map +1 -0
  141. package/dist/features/error-reporting.d.ts +17 -0
  142. package/dist/features/error-reporting.d.ts.map +1 -0
  143. package/dist/features/host.d.ts +15 -0
  144. package/dist/features/host.d.ts.map +1 -1
  145. package/dist/features/motion-blur/motion-blur-feature.d.ts +20 -2
  146. package/dist/features/motion-blur/motion-blur-feature.d.ts.map +1 -1
  147. package/dist/features/motion-blur/motion-blur-params.d.ts +21 -0
  148. package/dist/features/motion-blur/motion-blur-params.d.ts.map +1 -1
  149. package/dist/features/motion-blur/motion-blur-runtime.d.ts +54 -0
  150. package/dist/features/motion-blur/motion-blur-runtime.d.ts.map +1 -0
  151. package/dist/features/plan.d.ts +15 -4
  152. package/dist/features/plan.d.ts.map +1 -1
  153. package/dist/features/prepared-gpu-work.d.ts +9 -5
  154. package/dist/features/prepared-gpu-work.d.ts.map +1 -1
  155. package/dist/features/render-graph-compute.d.ts.map +1 -1
  156. package/dist/features/render-graph-contribution.d.ts +5 -0
  157. package/dist/features/render-graph-contribution.d.ts.map +1 -1
  158. package/dist/features/render-graph-raster.d.ts +1 -0
  159. package/dist/features/render-graph-raster.d.ts.map +1 -1
  160. package/dist/features/targets.d.ts +2 -0
  161. package/dist/features/targets.d.ts.map +1 -1
  162. package/dist/features/types.d.ts +44 -0
  163. package/dist/features/types.d.ts.map +1 -1
  164. package/dist/fullscreen-post-process-pass.d.ts +15 -7
  165. package/dist/fullscreen-post-process-pass.d.ts.map +1 -1
  166. package/dist/gpu-dirty-ranges.d.ts +11 -0
  167. package/dist/gpu-dirty-ranges.d.ts.map +1 -0
  168. package/dist/gpu-driven/batch-topology.d.ts +17 -0
  169. package/dist/gpu-driven/batch-topology.d.ts.map +1 -1
  170. package/dist/gpu-driven/material-artifacts.d.ts +6 -0
  171. package/dist/gpu-driven/material-artifacts.d.ts.map +1 -1
  172. package/dist/gpu-driven/prepared-draw.d.ts +7 -0
  173. package/dist/gpu-driven/prepared-draw.d.ts.map +1 -1
  174. package/dist/gpu-driven/production-raster-material.d.ts +178 -0
  175. package/dist/gpu-driven/production-raster-material.d.ts.map +1 -0
  176. package/dist/gpu-driven/production-raster.d.ts +50 -4
  177. package/dist/gpu-driven/production-raster.d.ts.map +1 -1
  178. package/dist/gpu-driven/resource-allocation.d.ts +31 -0
  179. package/dist/gpu-driven/resource-allocation.d.ts.map +1 -0
  180. package/dist/gpu-driven/shadow-ownership.d.ts +14 -0
  181. package/dist/gpu-driven/shadow-ownership.d.ts.map +1 -0
  182. package/dist/gpu-driven/view-gpu.d.ts +35 -2
  183. package/dist/gpu-driven/view-gpu.d.ts.map +1 -1
  184. package/dist/gpu-scene.d.ts +11 -1
  185. package/dist/gpu-scene.d.ts.map +1 -1
  186. package/dist/hdrp-buffers.d.ts +2 -2
  187. package/dist/hdrp-buffers.d.ts.map +1 -1
  188. package/dist/ibl/skylight-bind-group.d.ts +10 -1
  189. package/dist/ibl/skylight-bind-group.d.ts.map +1 -1
  190. package/dist/index.d.ts +31 -8
  191. package/dist/index.d.ts.map +1 -1
  192. package/dist/index.mjs +258 -8
  193. package/dist/index.mjs.map +1 -1
  194. package/dist/inspection-types.d.ts +178 -3
  195. package/dist/inspection-types.d.ts.map +1 -1
  196. package/dist/instance-buffer-cache.d.ts +4 -4
  197. package/dist/instance-buffer-cache.d.ts.map +1 -1
  198. package/dist/instances.d.ts +49 -94
  199. package/dist/instances.d.ts.map +1 -1
  200. package/dist/internal.mjs +7 -7
  201. package/dist/pbr-pipeline.d.ts +19 -1
  202. package/dist/pbr-pipeline.d.ts.map +1 -1
  203. package/dist/pipeline/single-layer-medium-passes.d.ts +73 -0
  204. package/dist/pipeline/single-layer-medium-passes.d.ts.map +1 -0
  205. package/dist/pipeline/standard-forward-lane.d.ts.map +1 -1
  206. package/dist/pipeline/standard-output/graph.d.ts.map +1 -1
  207. package/dist/pipeline/standard-output/types.d.ts +4 -2
  208. package/dist/pipeline/standard-output/types.d.ts.map +1 -1
  209. package/dist/pipeline/standard-pipeline.d.ts.map +1 -1
  210. package/dist/pipeline/standard-post.d.ts +28 -19
  211. package/dist/pipeline/standard-post.d.ts.map +1 -1
  212. package/dist/pipeline-builder.d.ts +1 -1
  213. package/dist/pipeline-builder.d.ts.map +1 -1
  214. package/dist/pipeline-spec.d.ts +2 -2
  215. package/dist/plugin.d.ts.map +1 -1
  216. package/dist/prepare/prepared-graphics-resolver.d.ts +2 -0
  217. package/dist/prepare/prepared-graphics-resolver.d.ts.map +1 -1
  218. package/dist/record/barrel-distortion-frame.d.ts +15 -0
  219. package/dist/record/barrel-distortion-frame.d.ts.map +1 -0
  220. package/dist/record/dynamic-geometry-consumption.d.ts +10 -2
  221. package/dist/record/dynamic-geometry-consumption.d.ts.map +1 -1
  222. package/dist/record/fold-buckets.d.ts +95 -0
  223. package/dist/record/fold-buckets.d.ts.map +1 -0
  224. package/dist/record/fold-instance-buffer.d.ts +6 -0
  225. package/dist/record/fold-instance-buffer.d.ts.map +1 -0
  226. package/dist/record/frame-lighting.d.ts +1 -0
  227. package/dist/record/frame-lighting.d.ts.map +1 -1
  228. package/dist/record/frame-snapshot.d.ts +40 -3
  229. package/dist/record/frame-snapshot.d.ts.map +1 -1
  230. package/dist/record/frame-targets.d.ts.map +1 -1
  231. package/dist/record/frame.d.ts +14 -62
  232. package/dist/record/frame.d.ts.map +1 -1
  233. package/dist/record/gpu-draw-receipts.d.ts +11 -0
  234. package/dist/record/gpu-draw-receipts.d.ts.map +1 -0
  235. package/dist/record/gpu-timing.d.ts +8 -0
  236. package/dist/record/gpu-timing.d.ts.map +1 -1
  237. package/dist/record/main-pass-geometry.d.ts +21 -5
  238. package/dist/record/main-pass-geometry.d.ts.map +1 -1
  239. package/dist/record/main-pass-material.d.ts +7 -1
  240. package/dist/record/main-pass-material.d.ts.map +1 -1
  241. package/dist/record/main-pass-sprite-draws.d.ts.map +1 -1
  242. package/dist/record/main-pass.d.ts +13 -2
  243. package/dist/record/main-pass.d.ts.map +1 -1
  244. package/dist/record/mesh-ssbo.d.ts +6 -5
  245. package/dist/record/mesh-ssbo.d.ts.map +1 -1
  246. package/dist/record/motion-blur-receipt.d.ts +11 -0
  247. package/dist/record/motion-blur-receipt.d.ts.map +1 -0
  248. package/dist/record/probe-blend-buffer.d.ts +16 -0
  249. package/dist/record/probe-blend-buffer.d.ts.map +1 -0
  250. package/dist/record/recovery-pipeline.d.ts.map +1 -1
  251. package/dist/record/render-context.d.ts +34 -31
  252. package/dist/record/render-context.d.ts.map +1 -1
  253. package/dist/record/shadow-pass.d.ts +2 -0
  254. package/dist/record/shadow-pass.d.ts.map +1 -1
  255. package/dist/record/skybox-post-pass.d.ts +6 -4
  256. package/dist/record/skybox-post-pass.d.ts.map +1 -1
  257. package/dist/record/typed-frame-graph.d.ts +22 -2
  258. package/dist/record/typed-frame-graph.d.ts.map +1 -1
  259. package/dist/record/view-ubo.d.ts +11 -3
  260. package/dist/record/view-ubo.d.ts.map +1 -1
  261. package/dist/record/volume-params.d.ts +9 -0
  262. package/dist/record/volume-params.d.ts.map +1 -0
  263. package/dist/recovery/render-system-candidate.d.ts +10 -0
  264. package/dist/recovery/render-system-candidate.d.ts.map +1 -1
  265. package/dist/reflection/record-owner.d.ts.map +1 -1
  266. package/dist/render-contract.d.ts +66 -8
  267. package/dist/render-contract.d.ts.map +1 -1
  268. package/dist/render-graph-primitives.d.ts.map +1 -1
  269. package/dist/render-pipeline.d.ts +106 -3
  270. package/dist/render-pipeline.d.ts.map +1 -1
  271. package/dist/render-system-extract-tail.d.ts +3 -2
  272. package/dist/render-system-extract-tail.d.ts.map +1 -1
  273. package/dist/render-system-extract.d.ts +24 -10
  274. package/dist/render-system-extract.d.ts.map +1 -1
  275. package/dist/render-system-presentation.d.ts +23 -0
  276. package/dist/render-system-presentation.d.ts.map +1 -0
  277. package/dist/render-system-producer-roots.d.ts +10 -0
  278. package/dist/render-system-producer-roots.d.ts.map +1 -0
  279. package/dist/render-system-residency.d.ts +12 -0
  280. package/dist/render-system-residency.d.ts.map +1 -0
  281. package/dist/render-system.d.ts +26 -15
  282. package/dist/render-system.d.ts.map +1 -1
  283. package/dist/scene/probe-blend.d.ts +27 -0
  284. package/dist/scene/probe-blend.d.ts.map +1 -1
  285. package/dist/scene/render-scene.d.ts +14 -5
  286. package/dist/scene/render-scene.d.ts.map +1 -1
  287. package/dist/ssao-buffers.d.ts +9 -0
  288. package/dist/ssao-buffers.d.ts.map +1 -1
  289. package/dist/surface/dynamic-input.d.ts +133 -0
  290. package/dist/surface/dynamic-input.d.ts.map +1 -0
  291. package/dist/surface/gpu-driven.d.ts +41 -0
  292. package/dist/surface/gpu-driven.d.ts.map +1 -0
  293. package/dist/surface/submission-observation.d.ts +136 -0
  294. package/dist/surface/submission-observation.d.ts.map +1 -0
  295. package/dist/systems/skin-palette-allocator.d.ts.map +1 -1
  296. package/dist/temporal/frame-coordinator.d.ts.map +1 -1
  297. package/dist/temporal/frame.d.ts +7 -0
  298. package/dist/temporal/frame.d.ts.map +1 -1
  299. package/dist/temporal/gpu.d.ts +13 -1
  300. package/dist/temporal/gpu.d.ts.map +1 -1
  301. package/dist/temporal/index.mjs +5 -5
  302. package/dist/temporal/inspection.d.ts.map +1 -1
  303. package/dist/temporal/standard-scene-data.d.ts.map +1 -1
  304. package/dist/temporal/target-coverage-attachment.d.ts.map +1 -1
  305. package/dist/temporal/view.d.ts +6 -1
  306. package/dist/temporal/view.d.ts.map +1 -1
  307. package/dist/transmission/single-layer-medium.d.ts +89 -0
  308. package/dist/transmission/single-layer-medium.d.ts.map +1 -0
  309. package/dist/typed-render-graph-primitives.d.ts +24 -9
  310. package/dist/typed-render-graph-primitives.d.ts.map +1 -1
  311. package/dist/volume/component.d.ts +9 -5
  312. package/dist/volume/component.d.ts.map +1 -1
  313. package/dist/volume/extract.d.ts +1 -1
  314. package/dist/volume/extract.d.ts.map +1 -1
  315. package/dist/volume/inspection.d.ts +2 -0
  316. package/dist/volume/inspection.d.ts.map +1 -1
  317. package/dist/volume/passes.d.ts +4 -1
  318. package/dist/volume/passes.d.ts.map +1 -1
  319. package/dist/volume/resources.d.ts.map +1 -1
  320. package/dist/volume/temporal.d.ts +3 -1
  321. package/dist/volume/temporal.d.ts.map +1 -1
  322. package/package.json +22 -21
  323. package/src/__tests__/analytic-fog-graph.unit.test.ts +199 -0
  324. package/src/__tests__/analytic-fog-optics.unit.test.ts +38 -0
  325. package/src/__tests__/atmosphere-daylight.dawn.test.ts +72 -0
  326. package/src/__tests__/barrel-distortion-lkg.integration.test.ts +353 -0
  327. package/src/__tests__/barrel-distortion.dawn.test.ts +41 -0
  328. package/src/__tests__/barrel-distortion.unit.test.ts +364 -0
  329. package/src/__tests__/bloom-exact-zero.unit.test.ts +112 -18
  330. package/src/__tests__/bloom-lifecycle.integration.test.ts +17 -4
  331. package/src/__tests__/construct-renderer-identity.unit.test.ts +49 -0
  332. package/src/__tests__/detached-recovery-graph.unit.test.ts +277 -0
  333. package/src/__tests__/device-loss-fanout.unit.test.ts +36 -1
  334. package/src/__tests__/docs-gate-green.unit.test.ts +112 -1
  335. package/src/__tests__/dynamic-resolution-plugin.integration.test.ts +20 -0
  336. package/src/__tests__/environment-fog-lanes.integration.test.ts +14 -0
  337. package/src/__tests__/environment-selection.unit.test.ts +12 -0
  338. package/src/__tests__/factory-contract.integration.test.ts +626 -113
  339. package/src/__tests__/feature-depth-input.dawn.test.ts +129 -2
  340. package/src/__tests__/frame-camera-selection.unit.test.ts +39 -1
  341. package/src/__tests__/frame-plan-contract.unit.test.ts +2 -0
  342. package/src/__tests__/fullscreen-feature-plan.unit.test.ts +14 -3
  343. package/src/__tests__/gpu-dirty-ranges.unit.test.ts +22 -0
  344. package/src/__tests__/gpu-driven-baseline.characterization.test.ts +16 -3
  345. package/src/__tests__/gpu-driven-batch-topology-pbr.unit.test.ts +12 -0
  346. package/src/__tests__/gpu-driven-indirect-raster-evidence.ts +2 -1
  347. package/src/__tests__/gpu-driven-material-artifacts.unit.test.ts +143 -0
  348. package/src/__tests__/gpu-driven-pbr.dawn.test.ts +2 -2
  349. package/src/__tests__/gpu-driven-production.integration.test.ts +482 -3
  350. package/src/__tests__/gpu-driven-shadow-views.dawn.test.ts +7 -6
  351. package/src/__tests__/gpu-driven-shadow-views.integration.test.ts +1 -1
  352. package/src/__tests__/gpu-driven-view-gpu-evidence.ts +103 -4
  353. package/src/__tests__/gpu-driven-view-graph.integration.test.ts +18 -2
  354. package/src/__tests__/gpu-driven-view.browser.test.ts +5 -8
  355. package/src/__tests__/gpu-driven-view.dawn.test.ts +6 -2
  356. package/src/__tests__/gpu-driven-view.unit.test.ts +1 -1
  357. package/src/__tests__/gpu-pass-timing-lifecycle.integration.test.ts +1 -0
  358. package/src/__tests__/gpu-pass-timing.browser.test.ts +6 -4
  359. package/src/__tests__/gpu-pass-timing.rhi-null.unit.test.ts +1 -0
  360. package/src/__tests__/gpu-resource-store-stride.unit.test.ts +12 -0
  361. package/src/__tests__/gpu-scene.unit.test.ts +210 -9
  362. package/src/__tests__/instance-allocation-failure.unit.test.ts +57 -0
  363. package/src/__tests__/instances-culling.integration.test.ts +10 -36
  364. package/src/__tests__/instances-store.unit.test.ts +105 -238
  365. package/src/__tests__/instances-world-ownership.integration.test.ts +62 -0
  366. package/src/__tests__/main-pass-material-medium-selection.unit.test.ts +146 -0
  367. package/src/__tests__/material-shader-prewarm.unit.test.ts +59 -0
  368. package/src/__tests__/material-snapshot-mutation.integration.test.ts +39 -1
  369. package/src/__tests__/mesh-submission-lifetime.unit.test.ts +31 -0
  370. package/src/__tests__/morph-culling-reentry.dawn.test.ts +5 -5
  371. package/src/__tests__/morph-visual-evidence.integration.test.ts +8 -7
  372. package/src/__tests__/motion-blur-compute.dawn.test.ts +589 -0
  373. package/src/__tests__/motion-blur.pixel.integration.test.ts +2 -2
  374. package/src/__tests__/nineslice-handle-surface.unit.test.ts +4 -4
  375. package/src/__tests__/pbr-view-layout.unit.test.ts +9 -0
  376. package/src/__tests__/physical-clearcoat.integration.test.ts +58 -0
  377. package/src/__tests__/prepared-gpu-driven-pbr.integration.test.ts +21 -0
  378. package/src/__tests__/prepared-graphics-capability.unit.test.ts +66 -2
  379. package/src/__tests__/prepared-graphics-lifecycle.unit.test.ts +86 -0
  380. package/src/__tests__/probe-bindings.unit.test.ts +582 -1
  381. package/src/__tests__/probe-scene-dirty.integration.test.ts +28 -1
  382. package/src/__tests__/public-surface.test-d.ts +8 -0
  383. package/src/__tests__/receipt-observation-retirement.unit.test.ts +65 -0
  384. package/src/__tests__/recovery-candidate-prepare.contract.test.ts +69 -0
  385. package/src/__tests__/render-error-code-owner.test-d.ts +9 -0
  386. package/src/__tests__/render-feature-diagnostics.unit.test.ts +15 -2
  387. package/src/__tests__/render-feature-error-reporting.unit.test.ts +44 -0
  388. package/src/__tests__/render-feature-prepared-diagnostics.unit.test.ts +10 -1
  389. package/src/__tests__/render-feature-retry.unit.test.ts +12 -1
  390. package/src/__tests__/render-feature-stage-fault-recovery.unit.test.ts +23 -0
  391. package/src/__tests__/render-scene-mixed-updates.integration.test.ts +145 -19
  392. package/src/__tests__/render-scene-projection.unit.test.ts +36 -11
  393. package/src/__tests__/render-scene-temporal-retry.unit.test.ts +37 -6
  394. package/src/__tests__/render-target-probe-soak.perf.test.ts +2 -2
  395. package/src/__tests__/render-temporal-environment-consumer.browser.test.ts +3 -3
  396. package/src/__tests__/render-temporal-environment-consumer.dawn.test.ts +5 -2
  397. package/src/__tests__/renderer-factory-material-contract.unit.test.ts +41 -7
  398. package/src/__tests__/renderer-frame-generation-fence.integration.test.ts +16 -0
  399. package/src/__tests__/renderer-frame-transaction.integration.test.ts +33 -11
  400. package/src/__tests__/resource-allocation.unit.test.ts +123 -0
  401. package/src/__tests__/shader-manifest-fixture.ts +4 -4
  402. package/src/__tests__/single-layer-medium-passes.unit.test.ts +275 -0
  403. package/src/__tests__/skin-motion-regression.unit.test.ts +70 -1
  404. package/src/__tests__/skin-palette-recycling.dawn.test.ts +97 -0
  405. package/src/__tests__/skinned-shadow-caster.test.ts +17 -0
  406. package/src/__tests__/ssr-carrier-public-contract.unit.test.ts +21 -0
  407. package/src/__tests__/ssr-gpu-dispatch.browser.test.ts +4 -4
  408. package/src/__tests__/ssr-gpu-dispatch.dawn.test.ts +2 -2
  409. package/src/__tests__/ssr-gpu-dispatch.ts +1 -1
  410. package/src/__tests__/ssr-receiver-coverage.dawn.test.ts +6 -2
  411. package/src/__tests__/standard-lighting-write.unit.test.ts +2 -1
  412. package/src/__tests__/standard-output-chain-contract.unit.test.ts +28 -0
  413. package/src/__tests__/standard-pbr-artifact-assembly.unit.test.ts +46 -1
  414. package/src/__tests__/standard-pipeline.dawn.test.ts +1 -1
  415. package/src/__tests__/standard-pipeline.integration.test.ts +200 -9
  416. package/src/__tests__/surface-dynamic-buffer-lifecycle.unit.test.ts +506 -0
  417. package/src/__tests__/surface-submission-observation.unit.test.ts +812 -0
  418. package/src/__tests__/temporal-history-lifecycle.unit.test.ts +32 -0
  419. package/src/__tests__/temporal-performance.integration.test.ts +3 -3
  420. package/src/__tests__/temporal-reset-matrix.unit.test.ts +10 -0
  421. package/src/__tests__/temporal-view.unit.test.ts +2 -1
  422. package/src/__tests__/typed-pipeline-topology.unit.test.ts +20 -4
  423. package/src/__tests__/visibility-instances.integration.test.ts +7 -19
  424. package/src/__tests__/visibility-producer-matrix.integration.test.ts +9 -20
  425. package/src/__tests__/volume-optics-oracle.unit.test.ts +7 -3
  426. package/src/__tests__/volumetric-fog-budget-recovery.integration.test.ts +189 -15
  427. package/src/__tests__/volumetric-fog-errors.unit.test.ts +4 -3
  428. package/src/__tests__/volumetric-fog-multiple.unit.test.ts +55 -0
  429. package/src/__tests__/volumetric-fog-spot-frame-optics.integration.test.ts +1 -1
  430. package/src/__tests__/volumetric-fog-stage-readback.dawn.test.ts +558 -68
  431. package/src/__tests__/volumetric-fog-temporal.unit.test.ts +27 -0
  432. package/src/__tests__/volumetric-fog-topology.unit.test.ts +23 -5
  433. package/src/assembly/analytic-fog-registration.ts +14 -0
  434. package/src/assembly/backend-contract.ts +30 -0
  435. package/src/assembly/barrel-distortion-inspection.ts +22 -0
  436. package/src/assembly/canvas-draw-guard.ts +11 -0
  437. package/src/assembly/cloud-shadow-entry.ts +22 -0
  438. package/src/assembly/dynamic-geometry-host.ts +65 -37
  439. package/src/assembly/dynamic-geometry-runtime.ts +7 -1
  440. package/src/assembly/factory.ts +2 -30
  441. package/src/assembly/fxaa-registration.ts +17 -0
  442. package/src/assembly/host-contract.ts +3 -3
  443. package/src/assembly/lod-observation.ts +12 -0
  444. package/src/assembly/material/assembly.ts +25 -13
  445. package/src/assembly/material/pipeline-helpers.ts +53 -12
  446. package/src/assembly/material-shader-policy.ts +55 -0
  447. package/src/assembly/material-shader-prewarm.ts +21 -10
  448. package/src/assembly/motion-blur-registration.ts +17 -0
  449. package/src/assembly/recovery/device-loss-fanout.ts +13 -0
  450. package/src/assembly/recovery/renderer-recover.ts +41 -18
  451. package/src/assembly/render-feature-post-processes.ts +54 -0
  452. package/src/assembly/renderer-facade.ts +6 -1
  453. package/src/assembly/renderer-feature-inspection.ts +8 -2
  454. package/src/assembly/renderer-frame-transaction.ts +23 -0
  455. package/src/assembly/renderer-inspection.ts +28 -0
  456. package/src/assembly/skin-palette-owner.ts +1 -1
  457. package/src/assembly/temporal-post-process-prewarm.ts +40 -0
  458. package/src/assembly/webgpu-pbr-ready.ts +9 -1
  459. package/src/assembly/webgpu-ready-contract.ts +8 -3
  460. package/src/assembly/webgpu-ready-per-pass.ts +104 -0
  461. package/src/assembly/webgpu-ready.ts +296 -306
  462. package/src/assembly/webgpu-renderer-bootstrap.ts +0 -12
  463. package/src/assembly/webgpu-renderer-observation-owner.ts +222 -0
  464. package/src/assembly/webgpu-renderer.ts +228 -281
  465. package/src/assembly/webgpu-vertex-layouts.ts +1 -1
  466. package/src/barrel-distortion.ts +247 -0
  467. package/src/bloom-admission.ts +21 -0
  468. package/src/cloud/__tests__/cloud-density-parity.dawn.test.ts +173 -0
  469. package/src/cloud/__tests__/cloud-layer-framebuffer-y.dawn.test.ts +265 -0
  470. package/src/cloud/__tests__/cloud-layer.browser.test.ts +432 -0
  471. package/src/cloud/__tests__/cloud-layer.unit.test.ts +634 -0
  472. package/src/cloud/density.ts +600 -0
  473. package/src/cloud/extract.ts +110 -0
  474. package/src/cloud/feature.ts +1810 -0
  475. package/src/cloud/frame-context.ts +42 -0
  476. package/src/cloud/inspection.ts +130 -0
  477. package/src/cloud/optics.ts +285 -0
  478. package/src/cloud/parameters.ts +255 -0
  479. package/src/cloud/resources.ts +122 -0
  480. package/src/cloud/shadow.ts +167 -0
  481. package/src/cloud/temporal.ts +226 -0
  482. package/src/components/__tests__/motion-blur.unit.test.ts +1 -0
  483. package/src/components/atmosphere.ts +4 -0
  484. package/src/components/barrel-distortion.ts +46 -0
  485. package/src/components/camera.ts +66 -10
  486. package/src/components/cloud-layer.ts +47 -0
  487. package/src/components/index.ts +2 -0
  488. package/src/components/instances.ts +18 -45
  489. package/src/components/mesh-filter.ts +11 -9
  490. package/src/components/motion-blur.ts +1 -0
  491. package/src/components/sprite-instances.ts +1 -1
  492. package/src/construct-renderer.ts +1 -1
  493. package/src/device/gpu-residency.ts +56 -12
  494. package/src/dynamic-geometry.ts +12 -1
  495. package/src/environment/analytic-fog.ts +44 -0
  496. package/src/environment/background.ts +2 -2
  497. package/src/errors/cloud.ts +103 -0
  498. package/src/errors/render.ts +58 -8
  499. package/src/examples/single-layer-medium-surface.ts +59 -0
  500. package/src/extract/camera.ts +35 -8
  501. package/src/extract/contracts.ts +12 -0
  502. package/src/extract/environment.ts +4 -0
  503. package/src/features/barrel-distortion.ts +172 -0
  504. package/src/features/error-reporting.ts +98 -0
  505. package/src/features/host.ts +138 -24
  506. package/src/features/motion-blur/__tests__/motion-blur-feature.unit.test.ts +111 -1
  507. package/src/features/motion-blur/__tests__/motion-blur-params.unit.test.ts +58 -3
  508. package/src/features/motion-blur/motion-blur-feature.ts +1519 -15
  509. package/src/features/motion-blur/motion-blur-params.ts +70 -2
  510. package/src/features/motion-blur/motion-blur-runtime.ts +176 -0
  511. package/src/features/plan.ts +33 -8
  512. package/src/features/prepared-gpu-work.ts +86 -35
  513. package/src/features/render-graph-compute.ts +13 -5
  514. package/src/features/render-graph-contribution.ts +11 -0
  515. package/src/features/render-graph-raster.ts +45 -3
  516. package/src/features/targets.ts +66 -0
  517. package/src/features/types.ts +47 -0
  518. package/src/fullscreen-post-process-pass.ts +41 -9
  519. package/src/gpu-dirty-ranges.ts +48 -0
  520. package/src/gpu-driven/batch-topology.ts +53 -0
  521. package/src/gpu-driven/material-artifacts.ts +35 -32
  522. package/src/gpu-driven/prepared-draw.ts +27 -14
  523. package/src/gpu-driven/production-raster-material.ts +1894 -0
  524. package/src/gpu-driven/production-raster.ts +904 -787
  525. package/src/gpu-driven/resource-allocation.ts +142 -0
  526. package/src/gpu-driven/shadow-ownership.ts +71 -0
  527. package/src/gpu-driven/view-gpu.ts +181 -10
  528. package/src/gpu-scene.ts +259 -101
  529. package/src/hdrp-buffers.ts +4 -3
  530. package/src/ibl/skylight-bind-group.ts +49 -7
  531. package/src/index.ts +228 -9
  532. package/src/inspection-types.ts +222 -2
  533. package/src/instance-buffer-cache.ts +4 -4
  534. package/src/instances.ts +151 -492
  535. package/src/pbr-pipeline.ts +219 -13
  536. package/src/pipeline/single-layer-medium-passes.ts +267 -0
  537. package/src/pipeline/standard-forward-lane.ts +313 -57
  538. package/src/pipeline/standard-output/graph.ts +8 -2
  539. package/src/pipeline/standard-output/types.ts +12 -1
  540. package/src/pipeline/standard-pipeline.ts +291 -18
  541. package/src/pipeline/standard-post.ts +397 -102
  542. package/src/pipeline-builder.ts +1 -1
  543. package/src/pipeline-spec.ts +5 -5
  544. package/src/plugin.ts +4 -0
  545. package/src/points-lines/__tests__/points-lines.bench.ts +17 -8
  546. package/src/points-lines/__tests__/view-ubo.unit.test.ts +2 -1
  547. package/src/prepare/prepared-graphics-resolver.ts +2 -0
  548. package/src/record/__tests__/main-pass-geometry.unit.test.ts +30 -0
  549. package/src/record/__tests__/sprite-material-abi.unit.test.ts +1 -1
  550. package/src/record/__tests__/temporal-payload.unit.test.ts +3 -2
  551. package/src/record/__tests__/transparent-group2-selection.unit.test.ts +11 -0
  552. package/src/record/__tests__/typed-frame-graph-plan.unit.test.ts +1 -0
  553. package/src/record/__tests__/view-ubo-layout.unit.test.ts +4 -3
  554. package/src/record/barrel-distortion-frame.ts +110 -0
  555. package/src/record/dynamic-geometry-consumption.ts +39 -9
  556. package/src/record/fold-buckets.ts +852 -0
  557. package/src/record/fold-instance-buffer.ts +51 -0
  558. package/src/record/frame-lighting.ts +36 -2
  559. package/src/record/frame-snapshot.ts +44 -4
  560. package/src/record/frame-targets.ts +10 -6
  561. package/src/record/frame.ts +373 -1099
  562. package/src/record/gpu-draw-receipts.ts +38 -0
  563. package/src/record/gpu-timing.ts +48 -5
  564. package/src/record/main-pass-geometry.ts +281 -83
  565. package/src/record/main-pass-material.ts +66 -4
  566. package/src/record/main-pass-sprite-draws.ts +13 -66
  567. package/src/record/main-pass.ts +156 -20
  568. package/src/record/mesh-ssbo.ts +43 -6
  569. package/src/record/motion-blur-receipt.ts +91 -0
  570. package/src/record/probe-blend-buffer.ts +180 -0
  571. package/src/record/recovery-pipeline.ts +35 -3
  572. package/src/record/render-context.ts +51 -31
  573. package/src/record/shadow-pass.ts +36 -2
  574. package/src/record/skybox-post-pass.ts +150 -200
  575. package/src/record/typed-frame-graph.ts +824 -44
  576. package/src/record/view-ubo.ts +26 -3
  577. package/src/record/volume-params.ts +225 -0
  578. package/src/recovery/render-system-candidate.ts +257 -52
  579. package/src/reflection/record-owner.ts +7 -3
  580. package/src/render-contract.ts +71 -8
  581. package/src/render-graph-primitives.ts +7 -1
  582. package/src/render-pipeline.ts +136 -1
  583. package/src/render-system-extract-tail.ts +72 -60
  584. package/src/render-system-extract.ts +117 -87
  585. package/src/render-system-presentation.ts +56 -0
  586. package/src/render-system-producer-roots.ts +96 -0
  587. package/src/render-system-residency.ts +159 -0
  588. package/src/render-system.ts +601 -482
  589. package/src/scene/probe-blend.ts +96 -4
  590. package/src/scene/render-scene.ts +431 -281
  591. package/src/ssao-buffers.ts +95 -2
  592. package/src/surface/__tests__/dynamic-input.unit.test.ts +374 -0
  593. package/src/surface/__tests__/gpu-driven.unit.test.ts +87 -0
  594. package/src/surface/dynamic-input.ts +658 -0
  595. package/src/surface/gpu-driven.ts +147 -0
  596. package/src/surface/submission-observation.ts +517 -0
  597. package/src/systems/skin-palette-allocator.ts +4 -1
  598. package/src/temporal/__tests__/temporal-frame-transaction.unit.test.ts +36 -0
  599. package/src/temporal/frame-coordinator.ts +8 -1
  600. package/src/temporal/frame.ts +20 -0
  601. package/src/temporal/gpu.ts +101 -17
  602. package/src/temporal/inspection.ts +7 -1
  603. package/src/temporal/standard-scene-data.ts +5 -0
  604. package/src/temporal/target-coverage-attachment.ts +4 -0
  605. package/src/temporal/view.ts +13 -2
  606. package/src/transmission/__tests__/single-layer-medium.unit.test.ts +149 -0
  607. package/src/transmission/__tests__/standard-transmission.dawn.test.ts +12 -11
  608. package/src/transmission/single-layer-medium.ts +322 -0
  609. package/src/typed-render-graph-primitives.ts +191 -50
  610. package/src/volume/component.ts +10 -10
  611. package/src/volume/extract.ts +11 -5
  612. package/src/volume/inspection.ts +3 -0
  613. package/src/volume/passes.ts +95 -8
  614. package/src/volume/resources.ts +2 -1
  615. package/src/volume/temporal.ts +11 -0
  616. package/dist/chunk-4NNZQCL3.mjs.map +0 -1
  617. package/dist/chunk-6TFBXLRJ.mjs.map +0 -1
  618. package/dist/chunk-DRR7D3KX.mjs.map +0 -1
  619. package/dist/chunk-GWCEMDVR.mjs.map +0 -1
  620. package/dist/chunk-JCIRYQ4V.mjs.map +0 -1
  621. package/dist/chunk-JRIPCMYC.mjs.map +0 -1
  622. package/dist/chunk-LULCA3OF.mjs +0 -1713
  623. package/dist/chunk-LULCA3OF.mjs.map +0 -1
  624. package/dist/chunk-PA5DRJNI.mjs.map +0 -1
@@ -3,15 +3,27 @@ import { World } from '@forgeax/engine-ecs';
3
3
  import { deriveVertexLayoutProjection } from '@forgeax/engine-geometry';
4
4
  import { vec3 } from '@forgeax/engine-math';
5
5
  import { RenderGraphBuilder } from '@forgeax/engine-render-graph';
6
- import { type BindGroup, RhiError, type RhiRenderPassEncoder } from '@forgeax/engine-rhi';
7
- import { type RhiNullDevice, rhi } from '@forgeax/engine-rhi-null';
6
+ import {
7
+ type BindGroup,
8
+ type Buffer,
9
+ type Result,
10
+ RhiError,
11
+ type RhiRenderPassEncoder,
12
+ } from '@forgeax/engine-rhi';
13
+ import {
14
+ RhiNullCommandEncoder,
15
+ RhiNullDevice,
16
+ type RhiNullDevice as RhiNullDeviceType,
17
+ RhiNullQueue,
18
+ rhi,
19
+ } from '@forgeax/engine-rhi-null';
8
20
  import { propagateTransforms, Transform } from '@forgeax/engine-scene';
9
21
  import {
10
22
  createStandardPbrArtifactReceipt,
11
23
  DEFAULT_STANDARD_PBR_PARAM_SCHEMA,
12
24
  DEFAULT_UNLIT_PARAM_SCHEMA,
13
25
  } from '@forgeax/engine-shader';
14
- import { ok } from '@forgeax/engine-types';
26
+ import { deriveMaterialDynamicInputLayout, ok } from '@forgeax/engine-types';
15
27
  import { describe, expect, it, vi } from 'vitest';
16
28
  import { createRenderer as constructRenderer } from '../assembly/factory';
17
29
  import { Camera, MeshFilter, MeshRenderer, PointLight } from '../components';
@@ -23,6 +35,7 @@ import {
23
35
  adaptStandardPbrFrameResources,
24
36
  GpuDrivenProduction,
25
37
  projectStandardPbrScene,
38
+ resolveGpuDrivenMeshGroup,
26
39
  } from '../gpu-driven/production-raster';
27
40
  import { GPU_DRIVEN_VIEW_WGSL } from '../gpu-driven/view-gpu';
28
41
  import { GpuBuffer } from '../gpu-resource';
@@ -30,11 +43,13 @@ import { GpuScene } from '../gpu-scene';
30
43
  import {
31
44
  GPU_BUFFER_USAGE_COPY_DST,
32
45
  GPU_BUFFER_USAGE_INDEX,
46
+ GPU_BUFFER_USAGE_STORAGE,
33
47
  GPU_BUFFER_USAGE_UNIFORM,
34
48
  GPU_BUFFER_USAGE_VERTEX,
35
49
  } from '../gpu-usage';
36
50
  import { buildDispatchPlan } from '../record/frame';
37
51
  import { makeZeroCameraFallbackSnapshot, worldEntityKey } from '../record/frame-snapshot';
52
+ import { emitGpuDrivenDrawReceipts } from '../record/gpu-draw-receipts';
38
53
  import {
39
54
  encodeDirectionalShadowPass,
40
55
  encodePointShadowPass,
@@ -51,6 +66,7 @@ import type {
51
66
  } from '../render-system-extract';
52
67
  import { shadowCasterCpuReason } from '../render-system-extract';
53
68
  import { PersistentRenderScene, RenderScene } from '../scene/render-scene';
69
+ import { ReadonlyDynamicInputPage } from '../surface/dynamic-input';
54
70
  import {
55
71
  preparedPbrSnapshot as preparedPbrFixture,
56
72
  standardPbrInputs,
@@ -58,6 +74,105 @@ import {
58
74
 
59
75
  const STANDARD_PBR_RECEIPT = createStandardPbrArtifactReceipt();
60
76
 
77
+ describe('GPU-driven scene-index mesh address selection', () => {
78
+ it('keeps direct batches on their local group and rebuilds clustered group(2) around the same projection buffer', () => {
79
+ const directGroup = {} as BindGroup;
80
+ const clusteredGroup = {} as BindGroup;
81
+ const legacyClusterGroup = {} as BindGroup;
82
+ const projectionBuffer = {} as Buffer;
83
+ const clusterBindGroupForMesh = vi.fn(() => clusteredGroup);
84
+ const frameResources = { clusterBindGroup: legacyClusterGroup, clusterBindGroupForMesh };
85
+
86
+ expect(
87
+ resolveGpuDrivenMeshGroup({
88
+ clustered: false,
89
+ deformation: 'rigid',
90
+ meshBindGroup: directGroup,
91
+ meshProjectionBuffer: projectionBuffer,
92
+ meshProjectionBytes: 256,
93
+ frameResources,
94
+ }),
95
+ ).toBe(directGroup);
96
+ expect(clusterBindGroupForMesh).not.toHaveBeenCalled();
97
+
98
+ expect(
99
+ resolveGpuDrivenMeshGroup({
100
+ clustered: true,
101
+ deformation: 'rigid',
102
+ meshBindGroup: directGroup,
103
+ meshProjectionBuffer: projectionBuffer,
104
+ meshProjectionBytes: 512,
105
+ frameResources,
106
+ }),
107
+ ).toBe(clusteredGroup);
108
+ expect(clusterBindGroupForMesh).toHaveBeenCalledExactlyOnceWith(projectionBuffer, 512);
109
+ });
110
+
111
+ it('rebuilds clustered skin group(2) from the matching scene-index mesh and palette pages', () => {
112
+ const directSkinGroup = {} as BindGroup;
113
+ const clusteredSkinGroup = {} as BindGroup;
114
+ const projectionBuffer = {} as Buffer;
115
+ const paletteBuffer = {} as Buffer;
116
+ const clusterBindGroupForSkin = vi.fn(() => clusteredSkinGroup);
117
+
118
+ expect(
119
+ resolveGpuDrivenMeshGroup({
120
+ clustered: true,
121
+ deformation: 'skin',
122
+ meshBindGroup: directSkinGroup,
123
+ meshProjectionBuffer: projectionBuffer,
124
+ meshProjectionBytes: 768,
125
+ skinPaletteBinding: { buffer: paletteBuffer, bindingWindowBytes: 16_320 },
126
+ frameResources: { clusterBindGroupForSkin },
127
+ }),
128
+ ).toBe(clusteredSkinGroup);
129
+ expect(clusterBindGroupForSkin).toHaveBeenCalledExactlyOnceWith(
130
+ projectionBuffer,
131
+ 768,
132
+ paletteBuffer,
133
+ 16_320,
134
+ );
135
+ });
136
+ });
137
+
138
+ interface BufferWrite {
139
+ readonly buffer: Buffer;
140
+ readonly offset: number;
141
+ readonly bytes: Uint8Array;
142
+ }
143
+
144
+ class RecordingQueue extends RhiNullQueue {
145
+ readonly writes: BufferWrite[] = [];
146
+
147
+ override writeBuffer(
148
+ buffer: Buffer,
149
+ bufferOffset: number,
150
+ data: ArrayBufferView | ArrayBuffer,
151
+ dataOffset?: number,
152
+ size?: number,
153
+ ): Result<void, RhiError> {
154
+ const source =
155
+ data instanceof ArrayBuffer
156
+ ? new Uint8Array(data)
157
+ : new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
158
+ const start = dataOffset ?? 0;
159
+ const length = size ?? source.byteLength - start;
160
+ this.writes.push({
161
+ buffer,
162
+ offset: bufferOffset,
163
+ bytes: source.slice(start, start + length),
164
+ });
165
+ return super.writeBuffer(buffer, bufferOffset, data, dataOffset, size);
166
+ }
167
+ }
168
+
169
+ function recordingDevice(queue: RecordingQueue): RhiNullDeviceType {
170
+ return new RhiNullDevice(
171
+ queue,
172
+ (bookkeeper, device) => new RhiNullCommandEncoder(bookkeeper, device),
173
+ );
174
+ }
175
+
61
176
  const EMPTY_RESOURCE_CLASS = JSON.stringify({ textures: [], samplers: [], video: [] });
62
177
  const OUTPUT_TRANSFORM_WGSL =
63
178
  '@vertex fn vs_main(@builtin(vertex_index) i: u32) -> @builtin(position) vec4<f32> { ' +
@@ -453,6 +568,314 @@ describe('GPU-driven production projection', () => {
453
568
  availability.scene.dispose();
454
569
  });
455
570
 
571
+ it('validates and consumes a published Surface dynamic page through production prepare', async () => {
572
+ const queue = new RecordingQueue();
573
+ const device = recordingDevice(queue);
574
+ const shader = (await rhi.createShaderModule(device, { code: 'synthetic' })).unwrap();
575
+ const viewLayout = device
576
+ .createBindGroupLayout({
577
+ entries: [{ binding: 0, visibility: 0x1, buffer: { type: 'uniform' } }],
578
+ })
579
+ .unwrap();
580
+ const pbrInputs = standardPbrInputs(device, shader, viewLayout);
581
+ const baseArtifact = pbrInputs.standardPbrArtifact;
582
+ expect(baseArtifact).toBeDefined();
583
+ if (baseArtifact === undefined) return;
584
+ const dynamicSchema = {
585
+ name: 'surfaceEvents',
586
+ fields: [
587
+ { name: 'position', type: 'vec3<f32>' as const },
588
+ { name: 'strength', type: 'f32' as const },
589
+ ],
590
+ maxRecords: 4,
591
+ maxDomains: 2,
592
+ maxPageBytes: 64,
593
+ maxBindings: 1,
594
+ maxEventsPerSample: 2,
595
+ };
596
+ const layout = deriveMaterialDynamicInputLayout(dynamicSchema).unwrap();
597
+ const surfaceReceipt = {
598
+ ...STANDARD_PBR_RECEIPT,
599
+ surface: {
600
+ model: 'single-layer-medium' as const,
601
+ module: 'forgeax::single-layer-medium',
602
+ inputAbi: 'SingleLayerMediumSurfaceInput',
603
+ outputAbi: 'SingleLayerMediumSurfaceData',
604
+ passes: ['nearest-layer', 'color'] as const,
605
+ dynamicInput: {
606
+ layout,
607
+ group: 3,
608
+ binding: 3,
609
+ readOnly: true as const,
610
+ accessor: `read_${layout.name}`,
611
+ },
612
+ },
613
+ };
614
+ const artifact = {
615
+ ...baseArtifact,
616
+ receipt: surfaceReceipt,
617
+ };
618
+ const projection = new RenderScene();
619
+ const source = preparedPbrFixture(snapshot(1, 3));
620
+ const identity = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
621
+ const twoInstanceSurface = {
622
+ ...source,
623
+ instances: {
624
+ transforms: new Float32Array([...identity, ...identity]),
625
+ instanceCount: 2,
626
+ cacheKey: 1,
627
+ archVersion: 1,
628
+ revision: 1,
629
+ },
630
+ } satisfies RenderableSnapshot;
631
+ const delta = projection.apply([updateSnapshot(twoInstanceSurface)]);
632
+ const availability = GpuScene.create(device, 1).unwrap();
633
+ expect(availability.status).toBe('available');
634
+ if (availability.status !== 'available') return;
635
+ availability.scene.sync(delta).unwrap();
636
+ const topology = new BatchTopology();
637
+ topology.rebuild(projection.slotsSnapshot());
638
+ const page = ReadonlyDynamicInputPage.create({
639
+ sourceId: 'surface-producer',
640
+ pageId: 1,
641
+ schema: dynamicSchema,
642
+ }).unwrap();
643
+ page.writeRecord(0, { position: [1, 2, 3], strength: 0.75 }).unwrap();
644
+ page.writeRecord(1, { position: [4, 5, 6], strength: 0.25 }).unwrap();
645
+ const firstRange = page
646
+ .reserveRange({
647
+ domain: 'surface-a',
648
+ recordStart: 0,
649
+ recordCount: 1,
650
+ instanceIndex: 3,
651
+ member: {
652
+ worldIdentity: 'world-a',
653
+ entityKey: 1,
654
+ drawItemIndex: 0,
655
+ instanceOrdinal: 0,
656
+ },
657
+ })
658
+ .unwrap();
659
+ const secondRange = page
660
+ .reserveRange({
661
+ domain: 'surface-b',
662
+ recordStart: 1,
663
+ recordCount: 1,
664
+ instanceIndex: 7,
665
+ member: {
666
+ worldIdentity: 'world-a',
667
+ entityKey: 1,
668
+ drawItemIndex: 0,
669
+ instanceOrdinal: 1,
670
+ },
671
+ })
672
+ .unwrap();
673
+ const stableRanges = Object.freeze([firstRange, secondRange]);
674
+ const production = new GpuDrivenProduction(device, {
675
+ createShaderModule: () => ok(shader),
676
+ });
677
+ const probeBlendRecordBuffer = device
678
+ .createBuffer({ size: 4096, usage: GPU_BUFFER_USAGE_STORAGE })
679
+ .unwrap();
680
+ const prepared = production
681
+ .prepare({
682
+ ...pbrInputs,
683
+ standardPbrArtifact: artifact,
684
+ scene: {
685
+ scene: availability.scene,
686
+ plan: topology.plan(),
687
+ slots: projection.slotsSnapshot(),
688
+ worldIdentities: ['world-a'],
689
+ },
690
+ camera: makeZeroCameraFallbackSnapshot(),
691
+ meshBySlot: new Map([[0, mesh(device)]]),
692
+ viewBindGroupLayout: viewLayout,
693
+ meshResidencyEpoch: 1,
694
+ probeBlendRecordBuffer,
695
+ hdrp: false,
696
+ surfaceDynamicInput: {
697
+ page,
698
+ ranges: [secondRange, firstRange],
699
+ projectionRevision: 1,
700
+ frameTime: 1,
701
+ },
702
+ deviceGeneration: 1,
703
+ })
704
+ .unwrap();
705
+ expect(prepared?.surfaceSubmission).toMatchObject({
706
+ model: 'single-layer-medium',
707
+ lane: 'gpu-driven',
708
+ passes: [{ pass: 'nearest-layer' }, { pass: 'color' }],
709
+ });
710
+ expect(page.uploadedRevision).toBe(page.contentRevision);
711
+ const consumeSpy = vi.spyOn(page, 'consume');
712
+ expect(prepared?._consumeSurfaceDynamicInput?.(31)).toMatchObject({
713
+ ok: true,
714
+ });
715
+ expect(consumeSpy).toHaveBeenCalledTimes(2);
716
+ const frameBuffer = prepared?.standardPbrFrameResources.surfaceDynamicInput?.frame;
717
+ expect(frameBuffer).toBeDefined();
718
+ if (frameBuffer === undefined) return;
719
+ const frameWrites = queue.writes.filter(
720
+ (write) => write.buffer === frameBuffer && write.bytes.byteLength === 48,
721
+ );
722
+ const mappedFrameWrite = frameWrites.find((write) => {
723
+ if (write.buffer !== frameBuffer || write.bytes.byteLength !== 48) return false;
724
+ return (
725
+ new DataView(write.bytes.buffer, write.bytes.byteOffset, write.bytes.byteLength).getUint32(
726
+ 12,
727
+ true,
728
+ ) === 3
729
+ );
730
+ });
731
+ expect(mappedFrameWrite?.offset).toBe(0);
732
+ expect(
733
+ mappedFrameWrite === undefined
734
+ ? undefined
735
+ : new DataView(
736
+ mappedFrameWrite.bytes.buffer,
737
+ mappedFrameWrite.bytes.byteOffset,
738
+ mappedFrameWrite.bytes.byteLength,
739
+ ).getUint32(44, true),
740
+ ).toBe(1);
741
+ const secondMappedFrameWrite = frameWrites.find((write) => {
742
+ if (write.buffer !== frameBuffer || write.bytes.byteLength !== 48) return false;
743
+ return (
744
+ new DataView(write.bytes.buffer, write.bytes.byteOffset, write.bytes.byteLength).getUint32(
745
+ 12,
746
+ true,
747
+ ) === 7
748
+ );
749
+ });
750
+ expect(secondMappedFrameWrite?.offset).toBe(48);
751
+ const frameWriteCount = frameWrites.length;
752
+ expect(production.inspect()).toMatchObject({
753
+ surfaceFrameRangeBuilds: 1,
754
+ surfaceFrameMemberScans: 4,
755
+ surfaceFrameRowAllocations: 2,
756
+ surfaceFrameTimeWrites: 1,
757
+ });
758
+ const repeated = production
759
+ .prepare({
760
+ ...pbrInputs,
761
+ standardPbrArtifact: artifact,
762
+ scene: {
763
+ scene: availability.scene,
764
+ plan: topology.plan(),
765
+ slots: projection.slotsSnapshot(),
766
+ worldIdentities: ['world-a'],
767
+ },
768
+ camera: makeZeroCameraFallbackSnapshot(),
769
+ meshBySlot: new Map([[0, mesh(device)]]),
770
+ viewBindGroupLayout: viewLayout,
771
+ meshResidencyEpoch: 1,
772
+ probeBlendRecordBuffer,
773
+ hdrp: false,
774
+ surfaceDynamicInput: { page, ranges: stableRanges, projectionRevision: 1, frameTime: 1 },
775
+ deviceGeneration: 1,
776
+ })
777
+ .unwrap();
778
+ expect(repeated).toBeDefined();
779
+ expect(repeated?._consumeSurfaceDynamicInput?.(32)).toMatchObject({ ok: true });
780
+ expect(consumeSpy).toHaveBeenCalledTimes(2);
781
+ expect(
782
+ queue.writes.filter((write) => write.buffer === frameBuffer && write.bytes.byteLength === 48),
783
+ ).toHaveLength(frameWriteCount);
784
+ const stableInspection = production.inspect();
785
+ expect(stableInspection).toMatchObject({
786
+ surfaceFrameRangeBuilds: 1,
787
+ surfaceFrameMemberScans: 4,
788
+ surfaceFrameRowAllocations: 2,
789
+ surfaceFrameTimeWrites: 1,
790
+ });
791
+
792
+ const writesBeforeTimeAdvance = queue.writes.length;
793
+ production
794
+ .prepare({
795
+ ...pbrInputs,
796
+ standardPbrArtifact: artifact,
797
+ scene: {
798
+ scene: availability.scene,
799
+ plan: topology.plan(),
800
+ slots: projection.slotsSnapshot(),
801
+ worldIdentities: ['world-a'],
802
+ },
803
+ camera: makeZeroCameraFallbackSnapshot(),
804
+ meshBySlot: new Map([[0, mesh(device)]]),
805
+ viewBindGroupLayout: viewLayout,
806
+ meshResidencyEpoch: 1,
807
+ probeBlendRecordBuffer,
808
+ hdrp: false,
809
+ surfaceDynamicInput: { page, ranges: stableRanges, projectionRevision: 1, frameTime: 2 },
810
+ deviceGeneration: 1,
811
+ })
812
+ .unwrap();
813
+ const timeAdvanceWrites = queue.writes.slice(writesBeforeTimeAdvance);
814
+ const sharedFrameBuffer = prepared?.standardPbrFrameResources.surfaceDynamicInput?.sharedFrame;
815
+ expect(sharedFrameBuffer).toBeDefined();
816
+ expect(timeAdvanceWrites.filter((write) => write.buffer === sharedFrameBuffer)).toMatchObject([
817
+ { offset: 0, bytes: { byteLength: 16 } },
818
+ ]);
819
+ expect(timeAdvanceWrites.some((write) => write.buffer === frameBuffer)).toBe(false);
820
+ expect(production.inspect()).toMatchObject({
821
+ surfaceFrameRangeBuilds: stableInspection.surfaceFrameRangeBuilds,
822
+ surfaceFrameMemberScans: stableInspection.surfaceFrameMemberScans,
823
+ surfaceFrameRowAllocations: stableInspection.surfaceFrameRowAllocations,
824
+ surfaceFrameTimeWrites: stableInspection.surfaceFrameTimeWrites + 1,
825
+ });
826
+
827
+ const invalid = production.prepare({
828
+ ...pbrInputs,
829
+ standardPbrArtifact: artifact,
830
+ scene: {
831
+ scene: availability.scene,
832
+ plan: topology.plan(),
833
+ slots: projection.slotsSnapshot(),
834
+ worldIdentities: ['world-a'],
835
+ },
836
+ camera: makeZeroCameraFallbackSnapshot(),
837
+ meshBySlot: new Map([[0, mesh(device)]]),
838
+ viewBindGroupLayout: viewLayout,
839
+ meshResidencyEpoch: 1,
840
+ probeBlendRecordBuffer,
841
+ hdrp: false,
842
+ surfaceDynamicInput: {
843
+ page,
844
+ ranges: [{ ...firstRange, byteOffset: firstRange.byteOffset + 4 }, secondRange],
845
+ projectionRevision: 2,
846
+ frameTime: 1,
847
+ },
848
+ deviceGeneration: 1,
849
+ });
850
+ expect(invalid).toMatchObject({ ok: false, error: { code: 'rhi-descriptor-invalid' } });
851
+ const retried = production.prepare({
852
+ ...pbrInputs,
853
+ standardPbrArtifact: artifact,
854
+ scene: {
855
+ scene: availability.scene,
856
+ plan: topology.plan(),
857
+ slots: projection.slotsSnapshot(),
858
+ worldIdentities: ['world-a'],
859
+ },
860
+ camera: makeZeroCameraFallbackSnapshot(),
861
+ meshBySlot: new Map([[0, mesh(device)]]),
862
+ viewBindGroupLayout: viewLayout,
863
+ meshResidencyEpoch: 1,
864
+ probeBlendRecordBuffer,
865
+ hdrp: false,
866
+ surfaceDynamicInput: {
867
+ page,
868
+ ranges: stableRanges,
869
+ projectionRevision: 2,
870
+ frameTime: 2,
871
+ },
872
+ deviceGeneration: 1,
873
+ });
874
+ expect(retried.ok).toBe(true);
875
+ production.dispose();
876
+ availability.scene.dispose();
877
+ });
878
+
456
879
  it('keeps GPU batches World-homogeneous for same-submit counter attribution', async () => {
457
880
  const adapter = (await rhi.requestAdapter()).unwrap();
458
881
  const device = (await adapter.requestDevice()).unwrap() as RhiNullDevice;
@@ -531,6 +954,62 @@ describe('GPU-driven production projection', () => {
531
954
  cpuFallbackDrawItems: 0,
532
955
  validatedGpuOwnedRows: 0,
533
956
  });
957
+
958
+ // Composition-local world indices do not necessarily equal the retained
959
+ // stable world identity used by the GPU draw-key producer.
960
+ const worldKeys = [101, 202] as const;
961
+ const stableGpuOwned = new Set([
962
+ gpuDrivenDrawKey(
963
+ worldEntityKey(worldKeys[gpuLodRow.worldId] ?? -1, gpuLodRow.entityKey),
964
+ -1,
965
+ 0,
966
+ ),
967
+ ]);
968
+ production.recordCpuValidation(
969
+ [{ source: gpuLodRow }],
970
+ stableGpuOwned,
971
+ 'stable-world',
972
+ worldKeys,
973
+ );
974
+ expect(production.inspect()).toMatchObject({
975
+ cpuFallbackDrawItems: 0,
976
+ validatedGpuOwnedRows: 0,
977
+ });
978
+ production.dispose();
979
+ });
980
+
981
+ it('keeps unclaimed mixed draws on the CPU lane while GPU receipts stay concrete', async () => {
982
+ const adapter = (await rhi.requestAdapter()).unwrap();
983
+ const device = (await adapter.requestDevice()).unwrap() as RhiNullDevice;
984
+ const shader = (await rhi.createShaderModule(device, { code: 'synthetic' })).unwrap();
985
+ const production = new GpuDrivenProduction(device, {
986
+ createShaderModule: () => ok(shader),
987
+ });
988
+ const base = snapshot(8, 3);
989
+ const firstDraw = base.gpuDrivenDraws?.[0];
990
+ if (firstDraw === undefined) throw new Error('mixed ownership fixture has no first draw');
991
+ const mixed = {
992
+ ...base,
993
+ gpuDrivenDraws: [
994
+ firstDraw,
995
+ { ...firstDraw, drawItemIndex: 1, first: firstDraw.first + firstDraw.count },
996
+ ],
997
+ };
998
+ const claimed = new Set([
999
+ gpuDrivenDrawKey(worldEntityKey(mixed.worldId, mixed.entityKey), -1, 0),
1000
+ ]);
1001
+ const gpuReceipts: { readonly submeshIndex: number; readonly lane: string }[] = [];
1002
+ emitGpuDrivenDrawReceipts({ source: mixed }, claimed, (_entry, submeshIndex, receipt) =>
1003
+ gpuReceipts.push({ submeshIndex, lane: receipt.lane }),
1004
+ );
1005
+ expect(gpuReceipts).toEqual([{ submeshIndex: 0, lane: 'gpu' }]);
1006
+ expect(gpuReceipts.some((receipt) => receipt.submeshIndex === 1)).toBe(false);
1007
+
1008
+ production.recordCpuValidation([{ source: mixed }], claimed);
1009
+ expect(production.inspect()).toMatchObject({
1010
+ cpuFallbackDrawItems: 1,
1011
+ validatedGpuOwnedRows: 1,
1012
+ });
534
1013
  production.dispose();
535
1014
  });
536
1015
 
@@ -68,7 +68,7 @@ function topology(): RenderPipelineTopology {
68
68
  storageFormat: 'rgba8unorm',
69
69
  viewFormat: 'rgba8unorm',
70
70
  },
71
- camera: { tonemap: 'aces-filmic', antialias: 'fxaa', bloom: 'off' },
71
+ camera: { tonemap: 'aces-filmic', antialias: 'fxaa', bloom: 'off', bloomIntensity: 1 },
72
72
  shadow: {
73
73
  directional: { mapSize: 32, cascadeCount: 2 },
74
74
  spotMapSize: 32,
@@ -196,7 +196,7 @@ describe('GPU-driven shadow views Dawn structural evidence', () => {
196
196
  visibleReadback: device
197
197
  .createBuffer({
198
198
  label: `shadow-view-${index}-visible-readback`,
199
- size: 520,
199
+ size: 1040,
200
200
  usage: GPU_BUFFER_USAGE_MAP_READ | GPU_BUFFER_USAGE_COPY_DST,
201
201
  })
202
202
  .unwrap(),
@@ -219,7 +219,7 @@ describe('GPU-driven shadow views Dawn structural evidence', () => {
219
219
  const encoder = device.createCommandEncoder({ label: 'gpu-driven-shadow-views-dawn' }).unwrap();
220
220
  compiled.execute({ encoder }).unwrap();
221
221
  for (const readback of readbacks) {
222
- encoder.copyBufferToBuffer(readback.visible, 0, readback.visibleReadback, 0, 520);
222
+ encoder.copyBufferToBuffer(readback.visible, 0, readback.visibleReadback, 0, 1040);
223
223
  encoder.copyBufferToBuffer(readback.indirect, 0, readback.indirectReadback, 0, 40);
224
224
  encoder.copyBufferToBuffer(
225
225
  readback.overflow,
@@ -243,10 +243,11 @@ describe('GPU-driven shadow views Dawn structural evidence', () => {
243
243
  const overflowMap = (await readback.overflowReadback.mapAsync(GPU_MAP_MODE_READ)).unwrap();
244
244
  const overflow = new Uint32Array(overflowMap.getMappedRange().unwrap().slice(0));
245
245
  overflowMap.unmap();
246
- expect(Array.from(visible.slice(0, 2))).toEqual([0, 0]);
246
+ expect(Array.from(visible.slice(0, 4))).toEqual([0, 0, 1, 0]);
247
247
  // Each indirect batch binds its own projected Mesh table, so the
248
- // compact visible row is batch-local rather than a global primitive id.
249
- expect(Array.from(visible.slice(128, 130))).toEqual([0, 1]);
248
+ // compact visible row is batch-local. The retained RenderScene slot and
249
+ // generation remain global addresses for scene-index side tables.
250
+ expect(Array.from(visible.slice(256, 260))).toEqual([0, 1, 2, 0]);
250
251
  expect(Array.from(indirect)).toEqual([36, 1, 0, 0, 0, 36, 1, 0, 0, 0]);
251
252
  expect(Array.from(overflow)).toEqual([0]);
252
253
  device.destroyBuffer(readback.visibleReadback);
@@ -24,7 +24,7 @@ function topology(): RenderPipelineTopology {
24
24
  storageFormat: 'rgba8unorm',
25
25
  viewFormat: 'rgba8unorm',
26
26
  },
27
- camera: { tonemap: 'aces-filmic', antialias: 'fxaa', bloom: 'off' },
27
+ camera: { tonemap: 'aces-filmic', antialias: 'fxaa', bloom: 'off', bloomIntensity: 1 },
28
28
  shadow: {
29
29
  directional: { mapSize: 32, cascadeCount: 2 },
30
30
  spotMapSize: 32,