@forgeax/engine-render 0.1.27 → 0.1.29

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 (655) hide show
  1. package/README.md +842 -124
  2. package/dist/assembly/atmosphere-shader-prewarm.d.ts +6 -0
  3. package/dist/assembly/atmosphere-shader-prewarm.d.ts.map +1 -0
  4. package/dist/assembly/dynamic-geometry-host.d.ts +52 -0
  5. package/dist/assembly/dynamic-geometry-host.d.ts.map +1 -0
  6. package/dist/assembly/dynamic-geometry-runtime.d.ts +20 -0
  7. package/dist/assembly/dynamic-geometry-runtime.d.ts.map +1 -0
  8. package/dist/assembly/factory.d.ts +3 -1
  9. package/dist/assembly/factory.d.ts.map +1 -1
  10. package/dist/assembly/gpu-driven-owner.d.ts +10 -0
  11. package/dist/assembly/gpu-driven-owner.d.ts.map +1 -0
  12. package/dist/assembly/host-contract.d.ts +19 -0
  13. package/dist/assembly/host-contract.d.ts.map +1 -1
  14. package/dist/assembly/material/assembly.d.ts +7 -0
  15. package/dist/assembly/material/assembly.d.ts.map +1 -1
  16. package/dist/assembly/material-shader-policy.d.ts +3 -1
  17. package/dist/assembly/material-shader-policy.d.ts.map +1 -1
  18. package/dist/assembly/recovery/failure-location.d.ts +12 -0
  19. package/dist/assembly/recovery/failure-location.d.ts.map +1 -0
  20. package/dist/assembly/recovery/renderer-recover.d.ts +6 -4
  21. package/dist/assembly/recovery/renderer-recover.d.ts.map +1 -1
  22. package/dist/assembly/renderer-facade.d.ts.map +1 -1
  23. package/dist/assembly/renderer-feature-inspection.d.ts +5 -0
  24. package/dist/assembly/renderer-feature-inspection.d.ts.map +1 -0
  25. package/dist/assembly/renderer-frame-transaction.d.ts +19 -0
  26. package/dist/assembly/renderer-frame-transaction.d.ts.map +1 -1
  27. package/dist/assembly/renderer-helpers.d.ts +3 -0
  28. package/dist/assembly/renderer-helpers.d.ts.map +1 -1
  29. package/dist/assembly/renderer-inspection.d.ts +4 -0
  30. package/dist/assembly/renderer-inspection.d.ts.map +1 -1
  31. package/dist/assembly/shader-prewarm-policy.d.ts +6 -0
  32. package/dist/assembly/shader-prewarm-policy.d.ts.map +1 -1
  33. package/dist/assembly/skin-palette-owner.d.ts +8 -0
  34. package/dist/assembly/skin-palette-owner.d.ts.map +1 -0
  35. package/dist/assembly/ssr-shader-prewarm.d.ts +6 -0
  36. package/dist/assembly/ssr-shader-prewarm.d.ts.map +1 -0
  37. package/dist/assembly/webgpu-device-loss.d.ts +15 -0
  38. package/dist/assembly/webgpu-device-loss.d.ts.map +1 -0
  39. package/dist/assembly/webgpu-pbr-ready.d.ts +38 -0
  40. package/dist/assembly/webgpu-pbr-ready.d.ts.map +1 -0
  41. package/dist/assembly/webgpu-ready-mipmap.d.ts +11 -0
  42. package/dist/assembly/webgpu-ready-mipmap.d.ts.map +1 -0
  43. package/dist/assembly/webgpu-ready.d.ts +7 -3
  44. package/dist/assembly/webgpu-ready.d.ts.map +1 -1
  45. package/dist/assembly/webgpu-renderer-bootstrap.d.ts +10 -0
  46. package/dist/assembly/webgpu-renderer-bootstrap.d.ts.map +1 -0
  47. package/dist/assembly/webgpu-renderer-contract.d.ts +62 -0
  48. package/dist/assembly/webgpu-renderer-contract.d.ts.map +1 -0
  49. package/dist/assembly/webgpu-renderer-guards.d.ts +9 -0
  50. package/dist/assembly/webgpu-renderer-guards.d.ts.map +1 -0
  51. package/dist/assembly/webgpu-renderer-observation.d.ts +6 -0
  52. package/dist/assembly/webgpu-renderer-observation.d.ts.map +1 -0
  53. package/dist/assembly/webgpu-renderer-recovery-failure.d.ts +12 -0
  54. package/dist/assembly/webgpu-renderer-recovery-failure.d.ts.map +1 -0
  55. package/dist/assembly/webgpu-renderer.d.ts +7 -141
  56. package/dist/assembly/webgpu-renderer.d.ts.map +1 -1
  57. package/dist/assembly/webgpu-vertex-layouts.d.ts +28 -84
  58. package/dist/assembly/webgpu-vertex-layouts.d.ts.map +1 -1
  59. package/dist/authoring.mjs +3 -3
  60. package/dist/{chunk-ADHHVYLW.mjs → chunk-33XZFTQU.mjs} +245 -39
  61. package/dist/chunk-33XZFTQU.mjs.map +1 -0
  62. package/dist/{chunk-GF523LHF.mjs → chunk-BLXGONR2.mjs} +30 -12
  63. package/dist/chunk-BLXGONR2.mjs.map +1 -0
  64. package/dist/{chunk-KM2NOX2I.mjs → chunk-BQVQOQJH.mjs} +958 -254
  65. package/dist/chunk-BQVQOQJH.mjs.map +1 -0
  66. package/dist/{chunk-HKXTW355.mjs → chunk-BTWH7BP4.mjs} +386 -17
  67. package/dist/chunk-BTWH7BP4.mjs.map +1 -0
  68. package/dist/{chunk-TMIASV2N.mjs → chunk-FUODTTIA.mjs} +3934 -676
  69. package/dist/chunk-FUODTTIA.mjs.map +1 -0
  70. package/dist/{chunk-FJ6P52EE.mjs → chunk-ILQ5MEZF.mjs} +3 -17
  71. package/dist/chunk-ILQ5MEZF.mjs.map +1 -0
  72. package/dist/{chunk-E34VL5VI.mjs → chunk-JQTSEI3Z.mjs} +3 -3
  73. package/dist/{chunk-E34VL5VI.mjs.map → chunk-JQTSEI3Z.mjs.map} +1 -1
  74. package/dist/{chunk-GE3SDD72.mjs → chunk-NICXSHAT.mjs} +16 -38
  75. package/dist/chunk-NICXSHAT.mjs.map +1 -0
  76. package/dist/{chunk-ZZ4YQ474.mjs → chunk-NRNXBLIJ.mjs} +577 -7
  77. package/dist/chunk-NRNXBLIJ.mjs.map +1 -0
  78. package/dist/{chunk-JDWARUOI.mjs → chunk-PA5DRJNI.mjs} +17 -3
  79. package/dist/chunk-PA5DRJNI.mjs.map +1 -0
  80. package/dist/{chunk-XDP6XE5V.mjs → chunk-S4DNKQYQ.mjs} +1118 -446
  81. package/dist/chunk-S4DNKQYQ.mjs.map +1 -0
  82. package/dist/components/camera.d.ts +62 -2
  83. package/dist/components/camera.d.ts.map +1 -1
  84. package/dist/components/index.d.ts +1 -0
  85. package/dist/components/index.d.ts.map +1 -1
  86. package/dist/components/instances.d.ts +6 -20
  87. package/dist/components/instances.d.ts.map +1 -1
  88. package/dist/components/scene-instance.d.ts +2 -1
  89. package/dist/components/scene-instance.d.ts.map +1 -1
  90. package/dist/components/screen-space-reflection.d.ts +14 -0
  91. package/dist/components/screen-space-reflection.d.ts.map +1 -0
  92. package/dist/construct-renderer.mjs +13805 -7186
  93. package/dist/construct-renderer.mjs.map +1 -1
  94. package/dist/device/gpu-residency.d.ts +11 -17
  95. package/dist/device/gpu-residency.d.ts.map +1 -1
  96. package/dist/device/mesh-residency-lifetime.d.ts +21 -0
  97. package/dist/device/mesh-residency-lifetime.d.ts.map +1 -0
  98. package/dist/dynamic-geometry.d.ts +125 -0
  99. package/dist/dynamic-geometry.d.ts.map +1 -0
  100. package/dist/environment/background.d.ts +6 -0
  101. package/dist/environment/background.d.ts.map +1 -0
  102. package/dist/errors/gpu-driven.d.ts +6 -3
  103. package/dist/errors/gpu-driven.d.ts.map +1 -1
  104. package/dist/errors/render.d.ts +7 -4
  105. package/dist/errors/render.d.ts.map +1 -1
  106. package/dist/extract/camera.d.ts.map +1 -1
  107. package/dist/extract/gpu-driven.d.ts +33 -3
  108. package/dist/extract/gpu-driven.d.ts.map +1 -1
  109. package/dist/features/host.d.ts +23 -1
  110. package/dist/features/host.d.ts.map +1 -1
  111. package/dist/features/noise-texture.d.ts +17 -0
  112. package/dist/features/noise-texture.d.ts.map +1 -0
  113. package/dist/features/plan.d.ts +83 -2
  114. package/dist/features/plan.d.ts.map +1 -1
  115. package/dist/features/prepared-gpu-work.d.ts +37 -4
  116. package/dist/features/prepared-gpu-work.d.ts.map +1 -1
  117. package/dist/features/prepared-graphics-store.d.ts.map +1 -1
  118. package/dist/features/prepared-graphics.d.ts +5 -0
  119. package/dist/features/prepared-graphics.d.ts.map +1 -1
  120. package/dist/features/render-graph-compute.d.ts +5 -3
  121. package/dist/features/render-graph-compute.d.ts.map +1 -1
  122. package/dist/features/render-graph-contribution.d.ts +11 -3
  123. package/dist/features/render-graph-contribution.d.ts.map +1 -1
  124. package/dist/features/render-graph-raster.d.ts +19 -3
  125. package/dist/features/render-graph-raster.d.ts.map +1 -1
  126. package/dist/features/types.d.ts +11 -0
  127. package/dist/features/types.d.ts.map +1 -1
  128. package/dist/fullscreen-post-process-pass.d.ts +2 -0
  129. package/dist/fullscreen-post-process-pass.d.ts.map +1 -1
  130. package/dist/gpu-driven/batch-topology.d.ts +34 -1
  131. package/dist/gpu-driven/batch-topology.d.ts.map +1 -1
  132. package/dist/gpu-driven/pbr-program.d.ts +10 -0
  133. package/dist/gpu-driven/pbr-program.d.ts.map +1 -0
  134. package/dist/gpu-driven/prepared-draw.d.ts.map +1 -1
  135. package/dist/gpu-driven/production-raster.d.ts +144 -23
  136. package/dist/gpu-driven/production-raster.d.ts.map +1 -1
  137. package/dist/gpu-driven/shadow-views.d.ts +126 -0
  138. package/dist/gpu-driven/shadow-views.d.ts.map +1 -0
  139. package/dist/gpu-driven/view-gpu.d.ts +18 -2
  140. package/dist/gpu-driven/view-gpu.d.ts.map +1 -1
  141. package/dist/gpu-scene-schema.d.ts +2 -8
  142. package/dist/gpu-scene-schema.d.ts.map +1 -1
  143. package/dist/gpu-scene.d.ts +14 -0
  144. package/dist/gpu-scene.d.ts.map +1 -1
  145. package/dist/gpu-texture-usage.d.ts +1 -0
  146. package/dist/gpu-texture-usage.d.ts.map +1 -1
  147. package/dist/hdrp-buffers.d.ts +6 -0
  148. package/dist/hdrp-buffers.d.ts.map +1 -1
  149. package/dist/ibl/frame-resources.d.ts +8 -0
  150. package/dist/ibl/frame-resources.d.ts.map +1 -0
  151. package/dist/ibl/skylight-bind-group.d.ts.map +1 -1
  152. package/dist/index.d.ts +21 -8
  153. package/dist/index.d.ts.map +1 -1
  154. package/dist/index.mjs +8 -7
  155. package/dist/index.mjs.map +1 -1
  156. package/dist/inspection-types.d.ts +164 -0
  157. package/dist/inspection-types.d.ts.map +1 -1
  158. package/dist/instances-derived-bounds.d.ts +11 -0
  159. package/dist/instances-derived-bounds.d.ts.map +1 -1
  160. package/dist/instances.d.ts +89 -44
  161. package/dist/instances.d.ts.map +1 -1
  162. package/dist/internal.d.ts +3 -0
  163. package/dist/internal.d.ts.map +1 -1
  164. package/dist/internal.mjs +118 -10
  165. package/dist/internal.mjs.map +1 -1
  166. package/dist/lifecycle.d.ts +2 -1
  167. package/dist/lifecycle.d.ts.map +1 -1
  168. package/dist/material-row.d.ts +5 -0
  169. package/dist/material-row.d.ts.map +1 -0
  170. package/dist/materials.d.ts +15 -0
  171. package/dist/materials.d.ts.map +1 -1
  172. package/dist/pbr-pipeline.d.ts +21 -5
  173. package/dist/pbr-pipeline.d.ts.map +1 -1
  174. package/dist/pipeline/standard-forward-lane.d.ts.map +1 -1
  175. package/dist/pipeline/standard-output/auto-exposure/capability.d.ts +12 -0
  176. package/dist/pipeline/standard-output/auto-exposure/capability.d.ts.map +1 -0
  177. package/dist/pipeline/standard-output/auto-exposure/gpu.d.ts +70 -0
  178. package/dist/pipeline/standard-output/auto-exposure/gpu.d.ts.map +1 -0
  179. package/dist/pipeline/standard-output/auto-exposure/graph.d.ts +75 -0
  180. package/dist/pipeline/standard-output/auto-exposure/graph.d.ts.map +1 -0
  181. package/dist/pipeline/standard-output/auto-exposure/inspection.d.ts +111 -0
  182. package/dist/pipeline/standard-output/auto-exposure/inspection.d.ts.map +1 -0
  183. package/dist/pipeline/standard-output/auto-exposure/oracle.d.ts +16 -0
  184. package/dist/pipeline/standard-output/auto-exposure/oracle.d.ts.map +1 -0
  185. package/dist/pipeline/standard-output/auto-exposure/preset.d.ts +14 -0
  186. package/dist/pipeline/standard-output/auto-exposure/preset.d.ts.map +1 -0
  187. package/dist/pipeline/standard-output/auto-exposure/state.d.ts +46 -0
  188. package/dist/pipeline/standard-output/auto-exposure/state.d.ts.map +1 -0
  189. package/dist/pipeline/standard-output/color-transform.d.ts +27 -0
  190. package/dist/pipeline/standard-output/color-transform.d.ts.map +1 -0
  191. package/dist/pipeline/standard-output/graph.d.ts +15 -0
  192. package/dist/pipeline/standard-output/graph.d.ts.map +1 -0
  193. package/dist/pipeline/standard-output/lut-admission.d.ts +29 -0
  194. package/dist/pipeline/standard-output/lut-admission.d.ts.map +1 -0
  195. package/dist/pipeline/standard-output/lut-gpu.d.ts +48 -0
  196. package/dist/pipeline/standard-output/lut-gpu.d.ts.map +1 -0
  197. package/dist/pipeline/standard-output/lut-state.d.ts +68 -0
  198. package/dist/pipeline/standard-output/lut-state.d.ts.map +1 -0
  199. package/dist/pipeline/standard-output/resources.d.ts +10 -0
  200. package/dist/pipeline/standard-output/resources.d.ts.map +1 -0
  201. package/dist/pipeline/standard-output/types.d.ts +39 -0
  202. package/dist/pipeline/standard-output/types.d.ts.map +1 -0
  203. package/dist/pipeline/standard-pipeline.d.ts.map +1 -1
  204. package/dist/pipeline/standard-post.d.ts +2 -2
  205. package/dist/pipeline/standard-post.d.ts.map +1 -1
  206. package/dist/pipeline-builder.d.ts +2 -1
  207. package/dist/pipeline-builder.d.ts.map +1 -1
  208. package/dist/pipeline-spec-types.d.ts +4 -0
  209. package/dist/pipeline-spec-types.d.ts.map +1 -1
  210. package/dist/pipeline-spec.d.ts +1 -9
  211. package/dist/pipeline-spec.d.ts.map +1 -1
  212. package/dist/points-lines/standard-owner.d.ts +1 -1
  213. package/dist/points-lines/standard-owner.d.ts.map +1 -1
  214. package/dist/prepare/prepared-graphics-resolver.d.ts +6 -1
  215. package/dist/prepare/prepared-graphics-resolver.d.ts.map +1 -1
  216. package/dist/record/dynamic-geometry-consumption.d.ts +15 -0
  217. package/dist/record/dynamic-geometry-consumption.d.ts.map +1 -0
  218. package/dist/record/frame-lighting.d.ts +3 -3
  219. package/dist/record/frame-lighting.d.ts.map +1 -1
  220. package/dist/record/frame-snapshot.d.ts +106 -5
  221. package/dist/record/frame-snapshot.d.ts.map +1 -1
  222. package/dist/record/frame-targets.d.ts.map +1 -1
  223. package/dist/record/frame.d.ts +39 -4
  224. package/dist/record/frame.d.ts.map +1 -1
  225. package/dist/record/main-pass-geometry.d.ts +7 -8
  226. package/dist/record/main-pass-geometry.d.ts.map +1 -1
  227. package/dist/record/main-pass-material.d.ts +38 -1
  228. package/dist/record/main-pass-material.d.ts.map +1 -1
  229. package/dist/record/main-pass-sprite-draws.d.ts +2 -10
  230. package/dist/record/main-pass-sprite-draws.d.ts.map +1 -1
  231. package/dist/record/main-pass.d.ts +12 -2
  232. package/dist/record/main-pass.d.ts.map +1 -1
  233. package/dist/record/mesh-ssbo.d.ts +15 -6
  234. package/dist/record/mesh-ssbo.d.ts.map +1 -1
  235. package/dist/record/prepared-material-bindings.d.ts +19 -0
  236. package/dist/record/prepared-material-bindings.d.ts.map +1 -0
  237. package/dist/record/recovery-pipeline.d.ts +2 -9
  238. package/dist/record/recovery-pipeline.d.ts.map +1 -1
  239. package/dist/record/render-context.d.ts +76 -26
  240. package/dist/record/render-context.d.ts.map +1 -1
  241. package/dist/record/shadow-pass.d.ts +62 -7
  242. package/dist/record/shadow-pass.d.ts.map +1 -1
  243. package/dist/record/skybox-post-pass.d.ts +1 -1
  244. package/dist/record/skybox-post-pass.d.ts.map +1 -1
  245. package/dist/record/typed-frame-graph.d.ts +35 -7
  246. package/dist/record/typed-frame-graph.d.ts.map +1 -1
  247. package/dist/record/view-ubo.d.ts +1 -0
  248. package/dist/record/view-ubo.d.ts.map +1 -1
  249. package/dist/recovery/render-system-candidate.d.ts +10 -2
  250. package/dist/recovery/render-system-candidate.d.ts.map +1 -1
  251. package/dist/recovery/render-system-roots.d.ts +11 -0
  252. package/dist/recovery/render-system-roots.d.ts.map +1 -0
  253. package/dist/recovery/types.d.ts +76 -0
  254. package/dist/recovery/types.d.ts.map +1 -0
  255. package/dist/reflection/record-owner.d.ts +0 -2
  256. package/dist/reflection/record-owner.d.ts.map +1 -1
  257. package/dist/render-contract.d.ts +185 -30
  258. package/dist/render-contract.d.ts.map +1 -1
  259. package/dist/render-graph-primitives.d.ts +1 -0
  260. package/dist/render-graph-primitives.d.ts.map +1 -1
  261. package/dist/render-pipeline.d.ts +64 -5
  262. package/dist/render-pipeline.d.ts.map +1 -1
  263. package/dist/render-system-extract-tail.d.ts +7 -5
  264. package/dist/render-system-extract-tail.d.ts.map +1 -1
  265. package/dist/render-system-extract.d.ts +101 -41
  266. package/dist/render-system-extract.d.ts.map +1 -1
  267. package/dist/render-system-projections.d.ts +22 -0
  268. package/dist/render-system-projections.d.ts.map +1 -0
  269. package/dist/render-system.d.ts +34 -77
  270. package/dist/render-system.d.ts.map +1 -1
  271. package/dist/scene/render-scene-types.d.ts +14 -7
  272. package/dist/scene/render-scene-types.d.ts.map +1 -1
  273. package/dist/scene/render-scene.d.ts +29 -11
  274. package/dist/scene/render-scene.d.ts.map +1 -1
  275. package/dist/scene/shadow-visibility.d.ts +5 -0
  276. package/dist/scene/shadow-visibility.d.ts.map +1 -0
  277. package/dist/ssr/admission.d.ts +70 -1
  278. package/dist/ssr/admission.d.ts.map +1 -1
  279. package/dist/ssr/compose.d.ts +13 -0
  280. package/dist/ssr/compose.d.ts.map +1 -0
  281. package/dist/ssr/errors.d.ts +35 -0
  282. package/dist/ssr/errors.d.ts.map +1 -1
  283. package/dist/ssr/graph.d.ts +60 -0
  284. package/dist/ssr/graph.d.ts.map +1 -0
  285. package/dist/ssr/history.d.ts +97 -0
  286. package/dist/ssr/history.d.ts.map +1 -0
  287. package/dist/ssr/hiz.d.ts +37 -0
  288. package/dist/ssr/hiz.d.ts.map +1 -0
  289. package/dist/ssr/inspection.d.ts +42 -0
  290. package/dist/ssr/inspection.d.ts.map +1 -0
  291. package/dist/ssr/resources.d.ts +58 -0
  292. package/dist/ssr/resources.d.ts.map +1 -0
  293. package/dist/ssr/temporal.d.ts +38 -0
  294. package/dist/ssr/temporal.d.ts.map +1 -0
  295. package/dist/systems/skin-palette-allocator.d.ts +32 -10
  296. package/dist/systems/skin-palette-allocator.d.ts.map +1 -1
  297. package/dist/systems/skin-palette-types.d.ts +15 -0
  298. package/dist/systems/skin-palette-types.d.ts.map +1 -1
  299. package/dist/systems/transparent-dispatch.d.ts +9 -0
  300. package/dist/systems/transparent-dispatch.d.ts.map +1 -0
  301. package/dist/targets/material-source.d.ts +7 -0
  302. package/dist/targets/material-source.d.ts.map +1 -1
  303. package/dist/temporal/frame-coordinator.d.ts +7 -0
  304. package/dist/temporal/frame-coordinator.d.ts.map +1 -1
  305. package/dist/temporal/gpu.d.ts +8 -0
  306. package/dist/temporal/gpu.d.ts.map +1 -1
  307. package/dist/temporal/history.d.ts.map +1 -1
  308. package/dist/temporal/index.mjs +6 -6
  309. package/dist/temporal/inspection.d.ts.map +1 -1
  310. package/dist/temporal/standard-scene-data.d.ts +2 -1
  311. package/dist/temporal/standard-scene-data.d.ts.map +1 -1
  312. package/dist/temporal/temporal-view.d.ts +2 -0
  313. package/dist/temporal/temporal-view.d.ts.map +1 -1
  314. package/dist/typed-render-graph-primitives.d.ts +35 -1
  315. package/dist/typed-render-graph-primitives.d.ts.map +1 -1
  316. package/dist/typed-shadow-passes.d.ts +3 -1
  317. package/dist/typed-shadow-passes.d.ts.map +1 -1
  318. package/dist/volume/temporal.d.ts +6 -0
  319. package/dist/volume/temporal.d.ts.map +1 -1
  320. package/package.json +21 -20
  321. package/src/__tests__/auto-exposure-gpu-evidence.ts +291 -0
  322. package/src/__tests__/auto-exposure-inspection.unit.test.ts +80 -0
  323. package/src/__tests__/auto-exposure-transaction.integration.test.ts +99 -0
  324. package/src/__tests__/auto-exposure.browser.test.ts +33 -0
  325. package/src/__tests__/auto-exposure.dawn.test.ts +33 -0
  326. package/src/__tests__/detached-inspection.integration.test.ts +5 -0
  327. package/src/__tests__/device-scope-lifecycle.unit.test.ts +18 -0
  328. package/src/__tests__/device-scope-stale-matrix.unit.test.ts +18 -0
  329. package/src/__tests__/docs-gate-green.unit.test.ts +3 -3
  330. package/src/__tests__/dynamic-geometry-host.unit.test.ts +1123 -0
  331. package/src/__tests__/dynamic-geometry.unit.test.ts +233 -0
  332. package/src/__tests__/factory-contract.integration.test.ts +73 -22
  333. package/src/__tests__/fallback-row-stride-surface.unit.test.ts +19 -0
  334. package/src/__tests__/feature-depth-input.dawn.test.ts +121 -0
  335. package/src/__tests__/feature-noise.unit.test.ts +38 -0
  336. package/src/__tests__/fixtures/taa-resolve-pinned-baseline.wgsl +301 -0
  337. package/src/__tests__/frame-camera-selection.unit.test.ts +131 -0
  338. package/src/__tests__/frame-plan-contract.unit.test.ts +24 -0
  339. package/src/__tests__/frame-targets.unit.test.ts +24 -0
  340. package/src/__tests__/fullscreen-feature-plan.unit.test.ts +3 -0
  341. package/src/__tests__/gpu-driven-baseline.characterization.test.ts +79 -0
  342. package/src/__tests__/gpu-driven-batch-topology-pbr.unit.test.ts +287 -6
  343. package/src/__tests__/gpu-driven-indirect-raster-evidence.ts +122 -142
  344. package/src/__tests__/gpu-driven-indirect-raster.browser.test.ts +10 -1
  345. package/src/__tests__/gpu-driven-lod-cache.unit.test.ts +264 -0
  346. package/src/__tests__/gpu-driven-mesh-world-identity.unit.test.ts +349 -0
  347. package/src/__tests__/gpu-driven-pbr.dawn.test.ts +1417 -0
  348. package/src/__tests__/gpu-driven-pbr.integration.test.ts +21 -0
  349. package/src/__tests__/gpu-driven-production-fixture.ts +96 -0
  350. package/src/__tests__/gpu-driven-production.integration.test.ts +1075 -93
  351. package/src/__tests__/gpu-driven-scaling.unit.test.ts +1 -3
  352. package/src/__tests__/gpu-driven-shadow-views.browser.test.ts +63 -0
  353. package/src/__tests__/gpu-driven-shadow-views.dawn.test.ts +294 -0
  354. package/src/__tests__/gpu-driven-shadow-views.integration.test.ts +97 -0
  355. package/src/__tests__/gpu-driven-shadow-views.unit.test.ts +168 -0
  356. package/src/__tests__/gpu-driven-skin-contract.test-d.ts +11 -0
  357. package/src/__tests__/gpu-driven-view-gpu-evidence.ts +72 -20
  358. package/src/__tests__/gpu-driven-view-graph.integration.test.ts +30 -9
  359. package/src/__tests__/gpu-driven-view.unit.test.ts +159 -52
  360. package/src/__tests__/gpu-pass-timing.browser.test.ts +6 -1
  361. package/src/__tests__/gpu-resource-store-stride.unit.test.ts +42 -0
  362. package/src/__tests__/gpu-scene-render-graph-gpu.ts +19 -5
  363. package/src/__tests__/gpu-scene.dawn.test.ts +40 -13
  364. package/src/__tests__/gpu-scene.unit.test.ts +559 -33
  365. package/src/__tests__/instances-culling.integration.test.ts +36 -10
  366. package/src/__tests__/instances-derived-bounds.unit.test.ts +54 -0
  367. package/src/__tests__/instances-store.unit.test.ts +242 -39
  368. package/src/__tests__/ktx2-basis-gpu-consumer.dawn.test.ts +6 -0
  369. package/src/__tests__/lighting-scene-roundtrip.integration.test.ts +13 -16
  370. package/src/__tests__/lut-lkg-transaction.integration.test.ts +122 -0
  371. package/src/__tests__/material-contract-inventory.unit.test.ts +5 -6
  372. package/src/__tests__/material-dispatch-shader-id.unit.test.ts +51 -0
  373. package/src/__tests__/material-lane-selection.unit.test.ts +60 -0
  374. package/src/__tests__/material-numeric-upload.unit.test.ts +53 -0
  375. package/src/__tests__/material-texture-handles.unit.test.ts +18 -0
  376. package/src/__tests__/material-texture-source.unit.test.ts +87 -0
  377. package/src/__tests__/materials-authoring-validation.unit.test.ts +41 -0
  378. package/src/__tests__/materials-standard-contract.unit.test.ts +52 -2
  379. package/src/__tests__/mesh-buffer-usage-surface.unit.test.ts +4 -0
  380. package/src/__tests__/mesh-submission-lifetime.unit.test.ts +53 -0
  381. package/src/__tests__/normal-fallback.dawn.test.ts +122 -0
  382. package/src/__tests__/particle-material-input-layout.unit.test.ts +104 -0
  383. package/src/__tests__/physical-clearcoat.integration.test.ts +37 -3
  384. package/src/__tests__/pipeline-texture-specialization.unit.test.ts +138 -0
  385. package/src/__tests__/point-shadow-inspection.unit.test.ts +2 -0
  386. package/src/__tests__/prepared-gpu-driven-pbr-contract.test-d.ts +31 -0
  387. package/src/__tests__/prepared-gpu-driven-pbr-contract.unit.test.ts +39 -0
  388. package/src/__tests__/prepared-gpu-driven-pbr.integration.test.ts +35 -4
  389. package/src/__tests__/prepared-graphics-capability.unit.test.ts +21 -0
  390. package/src/__tests__/prepared-graphics-pipeline-warmup.unit.test.ts +6 -2
  391. package/src/__tests__/profiler-phase-catalog.test.ts +5 -0
  392. package/src/__tests__/public-surface.test-d.ts +3 -0
  393. package/src/__tests__/recovery-candidate-prepare.contract.test.ts +30 -12
  394. package/src/__tests__/reflection-fallback-async-publication.unit.test.ts +104 -0
  395. package/src/__tests__/reflection-probe-record-owner.characterization.unit.test.ts +2 -1
  396. package/src/__tests__/render-error-code-owner.test-d.ts +4 -0
  397. package/src/__tests__/render-error-detail-ssot.test-d.ts +22 -0
  398. package/src/__tests__/render-error-exhaustive.test-d.ts +15 -0
  399. package/src/__tests__/render-feature-gpu-work.integration.test.ts +285 -2
  400. package/src/__tests__/render-feature-plan.unit.test.ts +245 -0
  401. package/src/__tests__/render-feature-shadow-order.unit.test.ts +228 -0
  402. package/src/__tests__/render-feature-zero-work.unit.test.ts +35 -1
  403. package/src/__tests__/render-graph-fallback.integration.test.ts +2 -2
  404. package/src/__tests__/render-owner-cohesion.unit.test.ts +55 -0
  405. package/src/__tests__/render-scene-mixed-updates.integration.test.ts +426 -0
  406. package/src/__tests__/render-scene-projection.unit.test.ts +914 -23
  407. package/src/__tests__/render-scene-resource-updates.integration.test.ts +214 -0
  408. package/src/__tests__/render-scene-skin-lifecycle.integration.test.ts +173 -0
  409. package/src/__tests__/render-scene-temporal-retry.unit.test.ts +133 -0
  410. package/src/__tests__/render-target-material-source.test-d.ts +27 -3
  411. package/src/__tests__/renderer-factory-material-contract.unit.test.ts +61 -1
  412. package/src/__tests__/renderer-frame-transaction.integration.test.ts +923 -5
  413. package/src/__tests__/shader-manifest-fixture.ts +39 -0
  414. package/src/__tests__/skin-motion-regression.unit.test.ts +0 -33
  415. package/src/__tests__/skin-palette-persistent.integration.test.ts +28 -0
  416. package/src/__tests__/skin-palette-persistent.unit.test.ts +247 -0
  417. package/src/__tests__/skinned-shadow-caster.test.ts +118 -14
  418. package/src/__tests__/specular-environment-scale.dawn.test.ts +156 -0
  419. package/src/__tests__/ssr-admission-matrix.integration.test.ts +7 -1
  420. package/src/__tests__/ssr-confidence-compose.unit.test.ts +84 -0
  421. package/src/__tests__/ssr-coordinate-oracle.unit.test.ts +28 -0
  422. package/src/__tests__/ssr-format-probe-gating.integration.test.ts +82 -0
  423. package/src/__tests__/ssr-gpu-dispatch.browser.test.ts +91 -0
  424. package/src/__tests__/ssr-gpu-dispatch.dawn.test.ts +112 -0
  425. package/src/__tests__/ssr-gpu-dispatch.ts +946 -0
  426. package/src/__tests__/ssr-graph-topology.unit.test.ts +104 -0
  427. package/src/__tests__/ssr-history-filter.dawn.test.ts +198 -0
  428. package/src/__tests__/ssr-hit-color.dawn.test.ts +273 -0
  429. package/src/__tests__/ssr-hiz-odd-reduction.dawn.test.ts +569 -0
  430. package/src/__tests__/ssr-hiz-rescue.dawn.test.ts +279 -0
  431. package/src/__tests__/ssr-hiz.browser.test.ts +150 -0
  432. package/src/__tests__/ssr-hiz.dawn.test.ts +150 -0
  433. package/src/__tests__/ssr-hiz.unit.test.ts +56 -0
  434. package/src/__tests__/ssr-inspection.unit.test.ts +105 -0
  435. package/src/__tests__/ssr-memory-budget.unit.test.ts +45 -0
  436. package/src/__tests__/ssr-performance-sequence-aggregation.unit.test.ts +15 -0
  437. package/src/__tests__/ssr-public-surface.test-d.ts +37 -0
  438. package/src/__tests__/ssr-receiver-coverage.dawn.test.ts +387 -0
  439. package/src/__tests__/ssr-reflection-mip-reducer.dawn.test.ts +309 -0
  440. package/src/__tests__/ssr-reprojection-probe.ts +90 -0
  441. package/src/__tests__/ssr-roughness-mip.dawn.test.ts +163 -0
  442. package/src/__tests__/ssr-shader-prewarm.unit.test.ts +59 -0
  443. package/src/__tests__/ssr-spatial.integration.test.ts +141 -0
  444. package/src/__tests__/ssr-stable-lattice.dawn.test.ts +475 -0
  445. package/src/__tests__/ssr-temporal-history.unit.test.ts +202 -0
  446. package/src/__tests__/ssr-texel-crossing.dawn.test.ts +448 -0
  447. package/src/__tests__/ssr-zero-work.integration.test.ts +87 -0
  448. package/src/__tests__/standard-cluster-variant-resolution.unit.test.ts +44 -12
  449. package/src/__tests__/standard-clustered-pipeline.unit.test.ts +29 -0
  450. package/src/__tests__/standard-output-chain-contract.unit.test.ts +99 -0
  451. package/src/__tests__/standard-output-chain.integration.test.ts +73 -0
  452. package/src/__tests__/standard-output-gpu-evidence.ts +205 -0
  453. package/src/__tests__/standard-output.browser.test.ts +15 -0
  454. package/src/__tests__/standard-output.dawn.test.ts +15 -0
  455. package/src/__tests__/standard-pbr-artifact-assembly.unit.test.ts +38 -0
  456. package/src/__tests__/standard-pipeline.integration.test.ts +320 -3
  457. package/src/__tests__/standard-profile-oracle.unit.test.ts +22 -0
  458. package/src/__tests__/standard-surface-lighting.unit.test.ts +41 -0
  459. package/src/__tests__/standard-texture-specialization.dawn.test.ts +141 -0
  460. package/src/__tests__/surface-adjacent-regressions.integration.test.ts +6 -3
  461. package/src/__tests__/taa-coverage-edge.dawn.test.ts +193 -0
  462. package/src/__tests__/taa-history-clipping.dawn.test.ts +328 -0
  463. package/src/__tests__/taa-neighborhood-equivalence.dawn.test.ts +778 -0
  464. package/src/__tests__/taa-stability-feedback.browser.test.ts +23 -0
  465. package/src/__tests__/taa-stability-feedback.dawn.test.ts +68 -0
  466. package/src/__tests__/taa-stability-feedback.ts +341 -0
  467. package/src/__tests__/temporal-history-lifecycle.unit.test.ts +49 -7
  468. package/src/__tests__/temporal-reset-matrix.unit.test.ts +9 -0
  469. package/src/__tests__/temporal-transaction.integration.test.ts +28 -0
  470. package/src/__tests__/texture-usage-surface.unit.test.ts +4 -2
  471. package/src/__tests__/typed-pipeline-topology.unit.test.ts +109 -4
  472. package/src/__tests__/typed-scene-pass-material-cache.integration.test.ts +126 -0
  473. package/src/__tests__/vertex-layouts-ssot.unit.test.ts +47 -0
  474. package/src/__tests__/visibility-extract.perf.test.ts +20 -8
  475. package/src/__tests__/visibility-instances.integration.test.ts +19 -7
  476. package/src/__tests__/visibility-producer-matrix.integration.test.ts +20 -9
  477. package/src/assembly/atmosphere-shader-prewarm.ts +38 -0
  478. package/src/assembly/dynamic-geometry-host.ts +887 -0
  479. package/src/assembly/dynamic-geometry-runtime.ts +71 -0
  480. package/src/assembly/factory.ts +4 -0
  481. package/src/assembly/gpu-driven-owner.ts +29 -0
  482. package/src/assembly/host-contract.ts +36 -0
  483. package/src/assembly/material/assembly.ts +38 -0
  484. package/src/assembly/material-shader-policy.ts +71 -28
  485. package/src/assembly/recovery/failure-location.ts +62 -0
  486. package/src/assembly/recovery/renderer-recover.ts +19 -17
  487. package/src/assembly/renderer-facade.ts +29 -0
  488. package/src/assembly/renderer-feature-inspection.ts +13 -0
  489. package/src/assembly/renderer-frame-transaction.ts +63 -0
  490. package/src/assembly/renderer-helpers.ts +26 -0
  491. package/src/assembly/renderer-inspection.ts +6 -0
  492. package/src/assembly/shader-prewarm-policy.ts +32 -0
  493. package/src/assembly/skin-palette-owner.ts +21 -0
  494. package/src/assembly/ssr-shader-prewarm.ts +41 -0
  495. package/src/assembly/webgpu-device-loss.ts +75 -0
  496. package/src/assembly/webgpu-pbr-ready.ts +232 -0
  497. package/src/assembly/webgpu-ready-mipmap.ts +26 -0
  498. package/src/assembly/webgpu-ready.ts +142 -121
  499. package/src/assembly/webgpu-renderer-bootstrap.ts +85 -0
  500. package/src/assembly/webgpu-renderer-contract.ts +69 -0
  501. package/src/assembly/webgpu-renderer-guards.ts +32 -0
  502. package/src/assembly/webgpu-renderer-observation.ts +43 -0
  503. package/src/assembly/webgpu-renderer-recovery-failure.ts +62 -0
  504. package/src/assembly/webgpu-renderer.ts +675 -614
  505. package/src/assembly/webgpu-vertex-layouts.ts +233 -87
  506. package/src/components/__tests__/camera-exposure.contract.unit.test.ts +153 -0
  507. package/src/components/camera.ts +287 -7
  508. package/src/components/index.ts +1 -0
  509. package/src/components/instances.ts +45 -18
  510. package/src/components/scene-instance.ts +2 -1
  511. package/src/components/screen-space-reflection.ts +21 -0
  512. package/src/components/sprite-animation.ts +3 -3
  513. package/src/components/sprite-instances.ts +1 -1
  514. package/src/device/gpu-residency.ts +96 -93
  515. package/src/device/mesh-residency-lifetime.ts +73 -0
  516. package/src/dynamic-geometry.ts +736 -0
  517. package/src/environment/background.ts +263 -0
  518. package/src/errors/gpu-driven.ts +39 -5
  519. package/src/errors/render.ts +27 -3
  520. package/src/extract/camera.ts +26 -1
  521. package/src/extract/gpu-driven.ts +185 -10
  522. package/src/features/host.ts +237 -19
  523. package/src/features/noise-texture.ts +91 -0
  524. package/src/features/plan.ts +553 -24
  525. package/src/features/prepared-gpu-work.ts +631 -49
  526. package/src/features/prepared-graphics-store.ts +31 -0
  527. package/src/features/prepared-graphics.ts +5 -0
  528. package/src/features/render-graph-compute.ts +41 -8
  529. package/src/features/render-graph-contribution.ts +141 -3
  530. package/src/features/render-graph-raster.ts +143 -30
  531. package/src/features/types.ts +11 -0
  532. package/src/fullscreen-post-process-pass.ts +3 -0
  533. package/src/gpu-driven/batch-topology.ts +424 -102
  534. package/src/gpu-driven/pbr-program.ts +31 -0
  535. package/src/gpu-driven/prepared-draw.ts +29 -4
  536. package/src/gpu-driven/production-raster.ts +2267 -694
  537. package/src/gpu-driven/shadow-views.ts +539 -0
  538. package/src/gpu-driven/view-gpu.ts +188 -41
  539. package/src/gpu-scene-schema.ts +52 -11
  540. package/src/gpu-scene.ts +186 -99
  541. package/src/gpu-texture-usage.ts +1 -0
  542. package/src/hdrp-buffers.ts +72 -36
  543. package/src/ibl/frame-resources.ts +38 -0
  544. package/src/ibl/skylight-bind-group.ts +5 -4
  545. package/src/index.ts +125 -1
  546. package/src/inspection-types.ts +191 -0
  547. package/src/instances-derived-bounds.ts +258 -34
  548. package/src/instances.ts +459 -150
  549. package/src/internal.ts +22 -0
  550. package/src/lifecycle.ts +2 -0
  551. package/src/material-row.ts +145 -0
  552. package/src/materials.ts +44 -8
  553. package/src/pbr-pipeline.ts +159 -17
  554. package/src/pipeline/standard-forward-lane.ts +52 -24
  555. package/src/pipeline/standard-output/__tests__/lut-admission.unit.test.ts +103 -0
  556. package/src/pipeline/standard-output/auto-exposure/__tests__/capability.unit.test.ts +40 -0
  557. package/src/pipeline/standard-output/auto-exposure/__tests__/gpu.contract.unit.test.ts +125 -0
  558. package/src/pipeline/standard-output/auto-exposure/__tests__/graph.contract.unit.test.ts +94 -0
  559. package/src/pipeline/standard-output/auto-exposure/__tests__/oracle.test.ts +108 -0
  560. package/src/pipeline/standard-output/auto-exposure/__tests__/preset.test.ts +26 -0
  561. package/src/pipeline/standard-output/auto-exposure/capability.ts +38 -0
  562. package/src/pipeline/standard-output/auto-exposure/gpu.ts +567 -0
  563. package/src/pipeline/standard-output/auto-exposure/graph.ts +221 -0
  564. package/src/pipeline/standard-output/auto-exposure/inspection.ts +231 -0
  565. package/src/pipeline/standard-output/auto-exposure/oracle.ts +291 -0
  566. package/src/pipeline/standard-output/auto-exposure/preset.ts +28 -0
  567. package/src/pipeline/standard-output/auto-exposure/state.ts +156 -0
  568. package/src/pipeline/standard-output/color-transform.ts +124 -0
  569. package/src/pipeline/standard-output/graph.ts +139 -0
  570. package/src/pipeline/standard-output/lut-admission.ts +121 -0
  571. package/src/pipeline/standard-output/lut-gpu.ts +399 -0
  572. package/src/pipeline/standard-output/lut-state.ts +176 -0
  573. package/src/pipeline/standard-output/resources.ts +121 -0
  574. package/src/pipeline/standard-output/types.ts +58 -0
  575. package/src/pipeline/standard-pipeline.ts +192 -59
  576. package/src/pipeline/standard-post.ts +186 -27
  577. package/src/pipeline-builder.ts +16 -6
  578. package/src/pipeline-spec-types.ts +4 -0
  579. package/src/pipeline-spec.ts +37 -29
  580. package/src/points-lines/standard-owner.ts +6 -14
  581. package/src/prepare/prepared-graphics-resolver.ts +9 -2
  582. package/src/record/__tests__/material-slot-plan.unit.test.ts +48 -0
  583. package/src/record/__tests__/mesh-ssbo.unit.test.ts +40 -1
  584. package/src/record/__tests__/recovery-pipeline.unit.test.ts +2 -29
  585. package/src/record/__tests__/sprite-material-abi.unit.test.ts +36 -5
  586. package/src/record/__tests__/typed-frame-graph-plan.unit.test.ts +45 -0
  587. package/src/record/__tests__/view-ubo-layout.unit.test.ts +5 -0
  588. package/src/record/dynamic-geometry-consumption.ts +59 -0
  589. package/src/record/frame-lighting.ts +12 -11
  590. package/src/record/frame-snapshot.ts +133 -23
  591. package/src/record/frame-targets.ts +9 -0
  592. package/src/record/frame.ts +727 -133
  593. package/src/record/main-pass-geometry.ts +162 -98
  594. package/src/record/main-pass-material.ts +115 -26
  595. package/src/record/main-pass-sprite-draws.ts +18 -107
  596. package/src/record/main-pass.ts +78 -8
  597. package/src/record/material-uniforms.ts +1 -1
  598. package/src/record/mesh-ssbo.ts +59 -15
  599. package/src/record/prepared-material-bindings.ts +234 -0
  600. package/src/record/recovery-pipeline.ts +59 -136
  601. package/src/record/render-context.ts +92 -22
  602. package/src/record/shadow-pass.ts +1231 -209
  603. package/src/record/skybox-post-pass.ts +14 -3
  604. package/src/record/typed-frame-graph.ts +1006 -53
  605. package/src/record/view-ubo.ts +11 -0
  606. package/src/recovery/render-system-candidate.ts +90 -66
  607. package/src/recovery/render-system-roots.ts +113 -0
  608. package/src/recovery/types.ts +77 -0
  609. package/src/reflection/record-owner.ts +26 -54
  610. package/src/render-contract.ts +219 -25
  611. package/src/render-graph-primitives.ts +6 -2
  612. package/src/render-pipeline.ts +70 -1
  613. package/src/render-system-extract-tail.ts +409 -160
  614. package/src/render-system-extract.ts +376 -102
  615. package/src/render-system-projections.ts +241 -0
  616. package/src/render-system.ts +692 -791
  617. package/src/scene/render-scene-types.ts +13 -4
  618. package/src/scene/render-scene.ts +569 -355
  619. package/src/scene/shadow-visibility.ts +21 -0
  620. package/src/ssr/admission.ts +380 -14
  621. package/src/ssr/compose.ts +144 -0
  622. package/src/ssr/errors.ts +48 -0
  623. package/src/ssr/graph.ts +777 -0
  624. package/src/ssr/history.ts +436 -0
  625. package/src/ssr/hiz.ts +124 -0
  626. package/src/ssr/inspection.ts +124 -0
  627. package/src/ssr/resources.ts +202 -0
  628. package/src/ssr/temporal.ts +164 -0
  629. package/src/systems/skin-palette-allocator.ts +495 -148
  630. package/src/systems/skin-palette-types.ts +17 -0
  631. package/src/systems/transparent-dispatch.ts +90 -0
  632. package/src/targets/material-source.ts +34 -0
  633. package/src/temporal/coverage.ts +1 -1
  634. package/src/temporal/frame-coordinator.ts +23 -2
  635. package/src/temporal/gpu.ts +74 -12
  636. package/src/temporal/history.ts +3 -1
  637. package/src/temporal/inspection.ts +2 -1
  638. package/src/temporal/standard-scene-data.ts +3 -1
  639. package/src/temporal/temporal-view.ts +3 -0
  640. package/src/transmission/__tests__/standard-transmission.dawn.test.ts +204 -139
  641. package/src/typed-render-graph-primitives.ts +266 -74
  642. package/src/typed-shadow-passes.ts +122 -12
  643. package/src/volume/temporal.ts +10 -0
  644. package/dist/chunk-ADHHVYLW.mjs.map +0 -1
  645. package/dist/chunk-FJ6P52EE.mjs.map +0 -1
  646. package/dist/chunk-GE3SDD72.mjs.map +0 -1
  647. package/dist/chunk-GF523LHF.mjs.map +0 -1
  648. package/dist/chunk-HKXTW355.mjs.map +0 -1
  649. package/dist/chunk-JDWARUOI.mjs.map +0 -1
  650. package/dist/chunk-KM2NOX2I.mjs.map +0 -1
  651. package/dist/chunk-TMIASV2N.mjs.map +0 -1
  652. package/dist/chunk-XDP6XE5V.mjs.map +0 -1
  653. package/dist/chunk-ZZ4YQ474.mjs.map +0 -1
  654. package/src/__tests__/instances-world-ownership.integration.test.ts +0 -62
  655. package/src/scene/__tests__/changed-block-summary.candidate.test.ts +0 -36
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/errors/render.ts","../src/gpu-texture-usage.ts","../src/shadow-atlas.ts","../src/render-contract.ts"],"names":[],"mappings":";;;AAgDO,IAAM,0BAAA,GAAN,cAAyC,KAAA,CAAM;AAAA,EAC3C,IAAA,GAAO,+BAAA;AAAA,EACP,QAAA,GAAW,4DAAA;AAAA,EACX,IAAA,GAAO,6EAAA;AAAA,EACP,MAAA;AAAA,EAET,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AA,GAAoC;AAAA,EAC/C,wCAAA;AAAA,EACA,GAAG,gCAAA;AAAA,EACH,iDAAA;AAAA,EACA;AACF,CAAA;AAIO,IAAM,gCAAA,GAAmC;AAAA,EAC9C,iCAAA;AAAA,EACA,kCAAA;AAAA,EACA,uCAAA;AAAA,EACA,6CAAA;AAAA,EACA,iCAAA;AAAA,EACA,GAAG;AACL,CAAA;AASO,IAAM,2BAAA,GAA8B;AAAA,EACzC,+BAAA;AAAA,EACA,iCAAA;AAAA,EACA,oBAAA;AAAA,EACA,GAAG,gCAAA;AAAA,EACH,kBAAA;AAAA,EACA,qBAAA;AAAA,EACA,qBAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA,gBAAA;AAAA,EACA,oBAAA;AAAA,EACA,sBAAA;AAAA,EACA,GAAG;AACL,CAAA;AAIO,IAAM,oBAAA,GAAuB;AAAA,EAClC,SAAA;AAAA,EACA,mBAAA;AAAA,EACA,aAAA;AAAA,EACA,UAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA;AAAA,EACA,GAAG;AACL","file":"chunk-ZZ4YQ474.mjs","sourcesContent":["// @forgeax/engine-render -- render cluster error classes.\n//\n// feat-20260704-runtime-tier1-decomposition M2 / w8 (D-3): the monolithic\n// errors.ts RuntimeErrorCode / RuntimeError top-level aggregate unions are\n// decomposed into five per-cluster files (render / asset / skin / recover /\n// environment). Each cluster owns a closed *ErrorCode code union + a closed\n// *Error class union; error class names, .code literals, and .detail shapes\n// are preserved byte-for-byte (OOS-4: zero semantic change).\n//\n// The render cluster holds the shadow / HDRP cluster-forward + deferred /\n// g-buffer / point-shadow-atlas / video-upload / vertex-storage-buffer render\n// path errors. ShadowInvalidConfigError is consumed by the DirectionalLight /\n// SpotLight / PointLightShadow component validators (forward cross-directory\n// import, no cycle -- research Finding C2).\n\nimport type {\n RenderSurfaceFailureDetail,\n SurfaceFailureCode,\n SurfaceFailureKind,\n} from '@forgeax/engine-render-graph';\nimport type { DeviceResourceKind, DeviceScopeReceipt } from '../device/resource-types';\nimport type {\n PreparedKind,\n RenderFeatureCapabilityKey,\n RenderFeatureRecovery,\n RenderFeatureStage,\n} from '../features/vocabulary';\nimport type { SceneDataLane, SceneDataSchemaId } from '../temporal/scene-data';\nimport type { TransmissionCapabilityFact } from '../transmission/backdrop';\nimport type { RecoveryOutcome, RecoveryPhase } from './recover';\n\n// Public render errors keep one machine-readable order: closed `code`,\n// expected state, actionable `hint`, then typed `detail`. Consumers branch on\n// that shape and never use Error.message as a protocol.\n\nexport interface LifecycleConstructionFailureDetail {\n readonly owner: string;\n readonly generation: number;\n readonly operation: 'create' | 'dispose';\n readonly resourceKind: DeviceResourceKind;\n readonly cause: unknown;\n readonly cleanupFailures: readonly {\n readonly resourceKind: DeviceResourceKind;\n readonly cause: unknown;\n }[];\n readonly receipt: DeviceScopeReceipt;\n}\n\nexport class LifecycleConstructionError extends Error {\n readonly code = 'lifecycle-construction-failed' as const;\n readonly expected = 'all DeviceScope resources establish and terminate in order';\n readonly hint = 'inspect detail and cleanupFailures, then recover or rebuild the DeviceScope';\n readonly detail: LifecycleConstructionFailureDetail;\n\n constructor(detail: LifecycleConstructionFailureDetail) {\n super(`lifecycle-construction-failed: ${detail.resourceKind} lifecycle transaction failed`);\n this.name = 'LifecycleConstructionError';\n this.detail = detail;\n }\n}\n\nconst SURFACE_FAILURE_POLICY: Readonly<\n Record<SurfaceFailureCode, { readonly expected: string; readonly hint: string }>\n> = {\n 'surface-allocation-failed': {\n expected: 'the required surface resource can be allocated with its declared format and usage',\n hint: 'inspect the capability detail, release transient resources, and retry the candidate graph',\n },\n 'surface-attachment-failed': {\n expected: 'the float target is renderable as the declared attachment',\n hint: 'verify float color attachment support and retry without hiding the failure',\n },\n 'surface-sampled-read-failed': {\n expected: 'the float target can be sampled by the next post-processing stage',\n hint: 'verify sampled-read support for the declared format before rebuilding the graph',\n },\n 'surface-view-domain-failed': {\n expected: 'surface storage and display views preserve their declared color domains',\n hint: 'repair the explicit format/domain pair and retry the candidate graph',\n },\n 'surface-raw-endpoint-failed': {\n expected: 'the surface presentation endpoint has descriptor, acquisition, and validation proof',\n hint: 'run the concrete presentation probe; keep the last-known-good surface when proof is absent',\n },\n};\n\n/** Render-surface failure with an exhaustive code and actionable detail. */\nexport class RenderSurfaceError<\n Code extends SurfaceFailureCode = SurfaceFailureCode,\n> extends Error {\n readonly code: Code;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderSurfaceFailureDetail;\n\n constructor(code: Code, detail: RenderSurfaceFailureDetail) {\n const policy = SURFACE_FAILURE_POLICY[code];\n if (policy === undefined) {\n throw new Error(`unknown render surface failure code: ${code}`);\n }\n super(`[RenderSurfaceError ${code}] expected: ${policy.expected}; hint: ${policy.hint}`);\n this.name = 'RenderSurfaceError';\n this.code = code;\n this.expected = policy.expected;\n this.hint = policy.hint;\n this.detail = detail;\n }\n}\n\nexport type { RenderSurfaceFailureDetail, SurfaceFailureCode, SurfaceFailureKind };\n\nexport type RenderSurfaceExpectedError = {\n readonly [Code in SurfaceFailureCode]: RenderSurfaceError<Code>;\n}[SurfaceFailureCode];\n\n/** Construct the closed surface error from its failure-stage discriminant. */\nexport function createRenderSurfaceError(\n kind: SurfaceFailureKind,\n detail: RenderSurfaceFailureDetail,\n): RenderSurfaceExpectedError {\n return new RenderSurfaceError(`surface-${kind}-failed` as SurfaceFailureCode, detail);\n}\n\nexport type LightResourceFailureReason = 'asset' | 'format' | 'capability' | 'capacity';\n\nexport interface LightResourceUnavailableDetail {\n readonly entity: number;\n readonly feature: 'ies' | 'cookie' | 'probe';\n readonly generation: number;\n readonly sourceKey: string;\n readonly reason: LightResourceFailureReason;\n}\n\nexport class LightResourceUnavailableError extends Error {\n readonly code = 'light-resource-unavailable' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: LightResourceUnavailableDetail;\n\n constructor(\n detail: LightResourceUnavailableDetail,\n expected: string,\n actual: string,\n hint: string,\n ) {\n super(`light-resource-unavailable: ${detail.feature} ${actual}`);\n this.name = 'LightResourceUnavailableError';\n this.expected = expected;\n this.hint = hint;\n this.detail = detail;\n }\n}\n\nexport function createLightResourceUnavailable(input: {\n readonly entity: number;\n readonly feature: LightResourceUnavailableDetail['feature'];\n readonly generation: number;\n readonly sourceKey: string;\n readonly reason: LightResourceFailureReason;\n readonly expected: string;\n readonly actual: string;\n readonly hint: string;\n}): LightResourceUnavailableError {\n return new LightResourceUnavailableError(\n {\n entity: input.entity,\n feature: input.feature,\n generation: input.generation,\n sourceKey: input.sourceKey,\n reason: input.reason,\n },\n input.expected,\n input.actual,\n input.hint,\n );\n}\n\nexport interface TemporalFrameSubmitDetail {\n readonly reason: 'queue-submit-failed';\n}\n\nexport class TemporalFrameSubmitError extends Error {\n readonly code = 'temporal-frame-submit-rejected' as const;\n readonly expected = 'the staged frame is accepted by queue.submit before temporal facts advance';\n readonly hint = 'inspect the queue submission and retry the frame after the device is available';\n readonly detail: TemporalFrameSubmitDetail;\n\n constructor(reason: 'queue-submit-failed') {\n super(`temporal-frame-submit-rejected: ${reason}`);\n this.name = 'TemporalFrameSubmitError';\n this.detail = { reason };\n }\n}\n// ── ShadowInvalidConfigError ──────────────────────────────────────────────\n\n/**\n * Detail for `RuntimeErrorCode 'shadow-invalid-config'`.\n *\n * The four fields are the only recovery surface: AI users read the invalid\n * field, actual value, structured bound, and reason without parsing prose.\n */\nexport type ShadowInvalidConfigBound =\n | { readonly kind: 'range'; readonly min: number; readonly max: number }\n | { readonly kind: 'lower-bound'; readonly operator: '>' | '>='; readonly value: number }\n | { readonly kind: 'allowed-values'; readonly values: readonly number[] };\n\nexport interface ShadowInvalidConfigDetail {\n readonly field: string;\n readonly actual: number;\n readonly bound: ShadowInvalidConfigBound;\n readonly reason: string;\n}\n\n/**\n * Structured error for shadow component config validation failures.\n *\n * Emitted by Directional, Point, and Spot shadow validation. All three\n * component owners share this error class so `switch (err.code)` on\n * `RuntimeErrorCode` needs one branch (charter P4 — closed-union SSOT).\n * Four-field surface:\n * - `.code = 'shadow-invalid-config'` (closed RuntimeErrorCode)\n * - `.expected` — expected-state description (programmatic predicate form)\n * - `.hint` — actionable recovery guidance (imperative; AI users paste into\n * spawn calls).\n * - `.detail = { field, actual, bound, reason }` — structured values.\n */\nexport class ShadowInvalidConfigError extends Error {\n readonly code = 'shadow-invalid-config' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: ShadowInvalidConfigDetail;\n\n constructor(\n field: string,\n actual: number,\n minOrBound: number | ShadowInvalidConfigBound,\n maxOrComparator?: number | '>' | '>=',\n reason?: string,\n ) {\n const bound: ShadowInvalidConfigBound =\n typeof minOrBound === 'number'\n ? typeof maxOrComparator === 'number'\n ? { kind: 'range', min: minOrBound, max: maxOrComparator }\n : {\n kind: 'lower-bound',\n operator: maxOrComparator === '>' ? '>' : '>=',\n value: minOrBound,\n }\n : minOrBound;\n const resolvedReason = reason ?? shadowBoundReason(bound);\n const expected = shadowBoundExpected(field, bound);\n const hint = `set ${field} to ${resolvedReason}; got ${actual}`;\n super(`shadow component .${field} is invalid: ${resolvedReason}; got ${actual}`);\n this.name = 'ShadowInvalidConfigError';\n this.hint = hint;\n this.expected = expected;\n this.detail = { field, actual, bound, reason: resolvedReason };\n }\n}\n\nfunction shadowBoundExpected(field: string, bound: ShadowInvalidConfigBound): string {\n switch (bound.kind) {\n case 'range':\n return `${field} in [${bound.min}, ${bound.max}]`;\n case 'lower-bound':\n return `${field} ${bound.operator} ${bound.value}`;\n case 'allowed-values':\n return `${field} in {${bound.values.join(', ')}}`;\n }\n}\n\nfunction shadowBoundReason(bound: ShadowInvalidConfigBound): string {\n switch (bound.kind) {\n case 'range':\n return `a value in [${bound.min}, ${bound.max}]`;\n case 'lower-bound':\n return `a value ${bound.operator} ${bound.value}`;\n case 'allowed-values':\n return `one of [${bound.values.join(', ')}]`;\n }\n}\n\n// ── EquirectProjectionFailedError ────────────────────────────────────────────\n\n/**\n * Detail for `RuntimeErrorCode 'equirect-projection-failed'`.\n *\n * Emitted when the equirect-to-cubemap IBL projection fails for the equirect\n * handle referenced by a `Skylight` / `SkyboxBackground` component. The handle\n * id is carried so AI users can trace which equirect source failed projection.\n * Degradation: the record arm records `status:'failed'`, binds the white-cube\n * fallback, fires this error ONCE, and does NOT retry the projection.\n *\n * feat-20260630 D-5: structured error with detail carrying the handle id.\n */\nexport interface EquirectProjectionFailedDetail {\n readonly handle: number;\n}\n\n/**\n * Structured error for a failed equirect-to-cubemap IBL projection.\n *\n * Emitted by the record stage when the internal cubemap projection for an\n * equirect handle returns a failure (or records `status:'failed'`). Four-field\n * surface per AGENTS.md error model:\n * - `.code = 'equirect-projection-failed'` (closed RuntimeErrorCode)\n * - `.expected` — equirect-to-cubemap projection + IBL precompute succeeds\n * - `.hint` — declare `Skylight{equirect}` with a valid HDR equirect source;\n * check `device.caps.rgba16floatRenderable`. The projection is internal —\n * there is no user upload call to retry\n * - `.detail = { handle }` — the numeric equirect handle id for diagnostics\n */\nexport class EquirectProjectionFailedError extends Error {\n readonly code = 'equirect-projection-failed' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: EquirectProjectionFailedDetail;\n\n constructor(handle: number) {\n const expected = `equirect handle ${handle} projects to a GPU cubemap + IBL precompute`;\n const hint =\n `equirect handle ${handle} referenced by Skylight/SkyboxBackground failed projection; ` +\n `declare Skylight{equirect} with a valid HDR equirect source and check device.caps.rgba16floatRenderable. ` +\n `The projection is internal (no user upload call); the record arm does not retry`;\n super(`equirect handle ${handle} cubemap projection failed`);\n this.name = 'EquirectProjectionFailedError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { handle };\n }\n}\n\n// ── StandardLightBudgetExceededError ──────────────────────────────────────\n\n/** The finite local-light budget that a Standard frame agreed to admit. */\nexport interface StandardLightBudgetExceededDetail {\n readonly actual: number;\n readonly budget: number;\n}\n\n/**\n * Structured refusal for a Standard frame whose finite local-light set is\n * outside the selected profile budget. The frame is rejected as a whole; the\n * record owner must not slice the input or submit a partial membership set.\n */\nexport class StandardLightBudgetExceededError extends Error {\n readonly code = 'standard-light-budget-exceeded' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: StandardLightBudgetExceededDetail;\n\n constructor(actual: number, budget: number) {\n const expected = `light count <= ${budget}`;\n const hint =\n `${actual} finite local lights exceed Standard budget ${budget}; ` +\n 'reduce the local-light set or select a profile with a supported budget';\n super(`Standard light budget exceeded: ${actual} > ${budget}`);\n this.name = 'StandardLightBudgetExceededError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { actual, budget };\n }\n}\n\n// ── StandardClusterIndexOverflowError ──────────────────────────────────────\n\n/** Cluster membership entries that could not fit the single shared index list. */\nexport interface StandardClusterIndexOverflowDetail {\n readonly actual: number;\n readonly capacity: number;\n}\n\n/**\n * Structured refusal for a membership producer that exceeded the shared\n * Cluster index-list capacity. No truncated list is uploaded and no graph is\n * submitted for the rejected frame.\n */\nexport class StandardClusterIndexOverflowError extends Error {\n readonly code = 'standard-cluster-index-overflow' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: StandardClusterIndexOverflowDetail;\n\n constructor(actual: number, capacity: number) {\n const expected = `light index list entries <= ${capacity}`;\n const hint =\n `cluster binner overflow: writeCount ${actual} exceeds capacity ${capacity}; ` +\n 'reduce finite local lights or choose a supported cluster layout';\n super(`Standard cluster index list overflow: ${actual} > ${capacity}`);\n this.name = 'StandardClusterIndexOverflowError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { actual, capacity };\n }\n}\n\n// ── StandardClusterTransportUnavailableError ───────────────────────────────\n\nexport interface StandardClusterTransportUnavailableDetail {\n readonly requested: number;\n readonly admitted: 0;\n}\n\n/**\n * Structured capability refusal. Standard never turns an unproven transport\n * into a smaller direct-light lane; the caller receives the exact requested\n * local-light count and an admitted count of zero.\n */\nexport class StandardClusterTransportUnavailableError extends Error {\n readonly code = 'standard-cluster-transport-unavailable' as const;\n readonly expected = 'all requested local lights have a proven Cluster transport';\n readonly hint: string;\n readonly detail: StandardClusterTransportUnavailableDetail;\n\n constructor(\n requested: number,\n hint = 'enable a proven Cluster storage transport before drawing',\n ) {\n super(`Standard Cluster transport unavailable for ${requested} local lights`);\n this.name = 'StandardClusterTransportUnavailableError';\n this.hint = hint;\n this.detail = { requested, admitted: 0 };\n }\n}\n\n// ── StandardProfileInvalidError ───────────────────────────────────────────\n\nexport interface StandardProfileInvalidDetail {\n readonly field: string;\n readonly actual: unknown;\n}\n\n/** Structured validation failure for the single Standard profile surface. */\nexport class StandardProfileInvalidError extends Error {\n readonly code = 'standard-profile-invalid' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: StandardProfileInvalidDetail;\n\n constructor(message: string, detail?: StandardProfileInvalidDetail) {\n super(message);\n this.name = 'StandardProfileInvalidError';\n this.detail = detail ?? { field: 'profile', actual: message };\n if (this.detail.field === 'clusterGrid') {\n this.expected = 'clusterGrid.{x,y,z} each positive integer in [1, 64]';\n this.hint =\n 'set clusterGrid.x, clusterGrid.y, and clusterGrid.z to positive integers in [1, 64]';\n } else {\n this.expected = 'StandardProfile contains only supported fields and values';\n this.hint = 'repair the Standard profile fields and retry setProfile';\n }\n }\n}\n\n// ── PointShadowAtlasUninitializedError ─────────────────────────────────────\n\n/**\n * Structured error for `ShadowAtlas.faceView` called before `ensure()`\n * allocated the cube_array texture. Replaces the prior bare\n * `throw new Error()` (Round-2 F-4: P3 closed-union compliance).\n *\n * - `.code = 'point-shadow-atlas-uninitialized'`\n * - `.expected` — call `ensure()` before iterating face views\n * - `.hint` — gate `faceView` on `isAllocated()` or call `ensure()` once\n * in the per-frame extract step before recording the 6 x N caster passes\n * - `.detail = undefined` (no per-call data needed)\n */\nexport class PointShadowAtlasUninitializedError extends Error {\n readonly code = 'point-shadow-atlas-uninitialized' as const;\n readonly expected: string;\n readonly hint: string;\n\n constructor() {\n const expected = 'ShadowAtlas.ensure() invoked before faceView()';\n const hint =\n 'Gate faceView on isAllocated() or call ensure() once in the per-frame extract step before iterating face views';\n super('ShadowAtlas.faceView called before ensure(); the cube_array texture is not allocated');\n this.name = 'PointShadowAtlasUninitializedError';\n this.expected = expected;\n this.hint = hint;\n }\n}\n\n// ── PointShadowAtlasBoundsViolationError ───────────────────────────────────\n\n/**\n * Detail for `RuntimeErrorCode 'point-shadow-atlas-bounds-violation'`.\n *\n * Emitted by `ShadowAtlas.faceView` when `layer` falls outside `[0, layers)`\n * or `face` falls outside `[0, 6)`. Both axes are reported as\n * `{ axis, value, max }` so AI users discriminate without parsing the message.\n */\nexport interface PointShadowAtlasBoundsViolationDetail {\n readonly axis: 'layer' | 'face';\n readonly value: number;\n readonly max: number;\n}\n\n/**\n * Structured error for `ShadowAtlas.faceView(layer, face)` arguments outside\n * the allocated atlas range. Replaces the prior bare `throw new Error()`\n * (Round-2 F-4: P3 closed-union compliance).\n *\n * - `.code = 'point-shadow-atlas-bounds-violation'`\n * - `.expected` — `0 <= layer < layers && 0 <= face < 6`\n * - `.hint` — clamp `shadowAtlasLayer` or face index before calling\n * `faceView`; the layer cap is the renderer-owned ShadowAtlas capacity\n * - `.detail = { axis, value, max }` — discriminates layer vs face\n */\nexport class PointShadowAtlasBoundsViolationError extends Error {\n readonly code = 'point-shadow-atlas-bounds-violation' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: PointShadowAtlasBoundsViolationDetail;\n\n constructor(axis: 'layer' | 'face', value: number, max: number) {\n const expected = `0 <= ${axis} < ${max}`;\n const hint =\n axis === 'layer'\n ? `clamp PointLight.shadowAtlasLayer to [0, ${max}); the cap on layers equals PointLightShadow cardinality (4)`\n : `clamp face index to [0, ${max}); cube faces are indexed 0..5 in +X/-X/+Y/-Y/+Z/-Z order`;\n super(`ShadowAtlas.faceView ${axis} out of range: ${value} (must be in [0, ${max}))`);\n this.name = 'PointShadowAtlasBoundsViolationError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { axis, value, max };\n }\n}\n\n// ── VideoUploadUnsupportedError ─────────────────────────────────────────\n\n/**\n * Structured error for `RuntimeErrorCode 'video-upload-unsupported'`\n * (feat-20260623-world-space-video-asset M3 / w11 — AC-10).\n *\n * Fired by the per-frame record stage (`videoTextureView`) when a VideoPlayer\n * entity can reach neither video upload path this frame: the general\n * `copyExternalImageToTexture` path (no host HTMLVideoElement resolved via\n * `VideoElementProvider`) AND the high-perf `GPUExternalTexture` path\n * (capability absent). The engine surfaces this explicit failure rather than\n * silently rendering a stale/garbage texture (charter P3, plan-strategy D-6).\n * - `.code = 'video-upload-unsupported'`\n * - `.expected` — at least one upload path available (host element or\n * GPUExternalTexture capability)\n * - `.hint` — actionable recovery: use a static texture or switch backend\n * - `.detail` — undefined (no narrowed detail variant)\n */\nexport class VideoUploadUnsupportedError extends Error {\n readonly code = 'video-upload-unsupported' as const;\n readonly expected: string;\n readonly hint: string;\n\n constructor() {\n const expected =\n 'at least one video upload path available: a host HTMLVideoElement (general copyExternalImageToTexture path) or GPUExternalTexture capability (high-perf path)';\n const hint =\n 'this backend exposes no usable video upload path; render a static texture instead, or switch to a WebGPU backend that supports video texture upload';\n super('video upload unsupported — no general or high-perf path available');\n this.name = 'VideoUploadUnsupportedError';\n this.expected = expected;\n this.hint = hint;\n }\n}\n\n// ── VertexStorageBufferUnavailableError ─────────────────────────────────\n\n/**\n * Structured error for missing vertex-stage storage buffer capability.\n *\n * Emitted at createRenderer time (cap-gate).\n * - `.code = 'vertex-storage-buffer-unavailable'`\n * - `.expected` — device.caps supports vertex-stage storage buffer\n * - `.hint` — switch to a WebGPU adapter with vertex storage buffer support or use uniform-buffer fallback (OOS-uniform-palette)\n * - `.detail` — undefined (no narrowed detail variant)\n */\nexport class VertexStorageBufferUnavailableError extends Error {\n readonly code = 'vertex-storage-buffer-unavailable' as const;\n readonly expected: string;\n readonly hint: string;\n\n constructor() {\n const expected =\n 'device.caps supports vertex-stage storage buffer (maxStorageBuffersPerShaderStage >= 1)';\n const hint =\n 'this device does not support vertex-stage storage buffers; skinning requires vertex-stage storage buffer access (OOS-uniform-palette fallback not implemented)';\n super('vertex-stage storage buffer unavailable — skinning cannot operate');\n this.name = 'VertexStorageBufferUnavailableError';\n this.expected = expected;\n this.hint = hint;\n }\n}\n\n// ── VertexColorVariantConflictError ───────────────────────────────────────\n\nexport interface VertexColorVariantConflictDetail {\n readonly authored: true;\n readonly authoredValue: string;\n readonly projected: boolean;\n}\n\n/** The authored color axis disagrees with the canonical geometry projection. */\nexport class VertexColorVariantConflictError extends Error {\n readonly code = 'vertex-color-variant-conflict' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: VertexColorVariantConflictDetail;\n\n constructor(authoredValue: string, projected: boolean) {\n const expected = `VERTEX_COLOR_AVAILABLE=${projected ? 'true' : 'false'}`;\n const hint =\n 'derive the shader variant from the mesh VertexLayoutProjection; COLOR_0 presence is a geometry fact';\n super(`authored vertex-color variant ${authoredValue} disagrees with projected ${expected}`);\n this.name = 'VertexColorVariantConflictError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { authored: true, authoredValue, projected };\n }\n}\n\n// ── Skin palette/material validation errors ────────────────────────────────\n\n/** Detail for a palette buffer that exceeds the device storage limit. */\nexport interface SkinPaletteOverflowDetail {\n readonly requestedBytes: number;\n readonly limit: number;\n}\n\n/**\n * Structured render error for a skin palette allocation that exceeds the\n * device storage-buffer binding limit. The allocator that emits this error\n * lives in render, so the error belongs to the render union rather than the\n * renderer-independent skinning binding package.\n */\nexport class SkinPaletteOverflowError extends Error {\n readonly code = 'skin-palette-overflow' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: SkinPaletteOverflowDetail;\n\n constructor(requestedBytes: number, limit: number) {\n const expected = `skinned joint palette (${requestedBytes} B) fits within device.limits.maxStorageBufferBindingSize (${limit} B)`;\n const hint =\n 'palette buffer exceeds device maxStorageBufferBindingSize; reduce skinned entity count or split into multiple palette buffers (OOS-skin-palette-batch)';\n super(`skin palette buffer needs ${requestedBytes} B, exceeds device limit ${limit} B`);\n this.name = 'SkinPaletteOverflowError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { requestedBytes, limit };\n }\n}\n\n/** Detail for a skinned entity using a non-skin material shader. */\nexport interface SkinMaterialMismatchDetail {\n readonly entity: number;\n readonly actualShader: string | undefined;\n}\n\n/** Structured render error for a Skin/non-skin-material mismatch. */\nexport class SkinMaterialMismatchError extends Error {\n readonly code = 'skin-material-mismatch' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: SkinMaterialMismatchDetail;\n\n constructor(entity: number, actualShader: string | undefined) {\n const expected = \"Skin entity's first material program module === 'forgeax::pbr-skin'\";\n const hint = `entity ${entity} has Skin but the first material program module is ${actualShader ?? '<empty>'}; load the mesh via the gltf importer (cooker auto-routes 'forgeax::pbr-skin' for skinned primitives), or remove the Skin component to render the entity unskinned with Materials.standard / Materials.unlit`;\n super(\n `Skin / material mismatch on entity ${entity}: expected forgeax::pbr-skin, got ${actualShader ?? '<empty>'}`,\n );\n this.name = 'SkinMaterialMismatchError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { entity, actualShader };\n }\n}\n\n/** Detail for a pbr-skin material whose mesh lacks skin attributes. */\nexport interface MaterialSkinAttrMissingDetail {\n readonly entity: number;\n readonly missing: 'skinIndex' | 'skinWeight' | 'both';\n}\n\n/** Structured render error for a pbr-skin material/mesh attribute mismatch. */\nexport class MaterialSkinAttrMissingError extends Error {\n readonly code = 'material-skin-attr-missing' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: MaterialSkinAttrMissingDetail;\n\n constructor(entity: number, missing: 'skinIndex' | 'skinWeight' | 'both') {\n const expected = 'pbr-skin material requires mesh.attributes.skinIndex + skinWeight';\n const hint = `entity ${entity} uses forgeax::pbr-skin but its MeshAsset is missing ${missing}; switch the entity to a skinned glTF mesh authored with JOINTS_0 + WEIGHTS_0, or change the material to a non-skin shader via Materials.standard / Materials.unlit`;\n super(\n `material/skin attribute mismatch on entity ${entity}: pbr-skin material with mesh missing ${missing}`,\n );\n this.name = 'MaterialSkinAttrMissingError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { entity, missing };\n }\n}\n\nexport interface TransmissionCapabilityMissingDetail {\n readonly material: string;\n readonly capability: 'transmission';\n readonly stage: 'prepare' | 'record';\n readonly lane: 'standard-forward';\n readonly format: string;\n readonly missing: readonly TransmissionCapabilityFact[];\n}\n\nexport class TransmissionCapabilityMissingError extends Error {\n readonly code = 'transmission-capability-missing' as const;\n readonly expected = 'the renderer exposes the transmission capability for this material';\n readonly hint = 'disable transmission or provide the renderer capability before drawing';\n readonly detail: TransmissionCapabilityMissingDetail;\n\n constructor(\n material: string,\n stage: 'prepare' | 'record',\n evidence: {\n readonly lane: 'standard-forward';\n readonly format: string;\n readonly missing: readonly TransmissionCapabilityFact[];\n },\n ) {\n super(`transmission capability is missing for material '${material}'`);\n this.name = 'TransmissionCapabilityMissingError';\n this.detail = { material, capability: 'transmission', stage, ...evidence };\n }\n}\n\n// -- RenderFeature errors ---------------------------------------------------\n\nexport type RenderFeatureErrorCode =\n | 'render-feature-registration-conflict'\n | 'render-feature-stage-failed'\n | 'render-feature-capability-missing'\n | 'render-feature-pass-order-conflict'\n | 'render-feature-preparation-failed'\n | 'render-feature-prepared-state-mismatch'\n | 'render-feature-draw-recording-failed';\n\nexport interface RenderFeatureRegistrationConflictDetail {\n readonly featureIdentity: string;\n readonly order: number;\n readonly conflictingOrder: number;\n}\n\nexport interface RenderFeatureCleanupFailure {\n readonly featureIdentity: string;\n readonly order: number;\n readonly code: string;\n}\n\nexport interface RenderFeatureStageFailedDetail {\n readonly featureIdentity: string;\n readonly order: number;\n readonly stage: RenderFeatureStage;\n readonly recovery: RenderFeatureRecovery;\n readonly cleanupFailures?: readonly RenderFeatureCleanupFailure[];\n}\n\nexport interface RenderFeatureCapabilityMissingDetail {\n readonly featureIdentity: string;\n readonly order: number;\n readonly capability: RenderFeatureCapabilityKey;\n}\n\nexport interface RenderFeaturePassOrderConflictDetail {\n readonly featureIdentity: string;\n readonly order: number;\n readonly passIdentity: string;\n readonly dependencyIdentity: string;\n}\n\nexport interface RenderFeaturePreparationFailedDetail {\n readonly featureIdentity: string;\n readonly order: number;\n readonly stage: 'prepare';\n readonly operation: string;\n readonly resourceKind: PreparedKind;\n readonly resourceName: string;\n readonly reason: string;\n readonly recovery: RenderFeatureRecovery;\n}\n\nexport type RenderFeaturePreparedStateMismatchDetail =\n | {\n readonly featureIdentity: string;\n readonly order: number;\n readonly stage: 'contribute';\n readonly operation: string;\n readonly resourceKind: PreparedKind;\n readonly reason: 'missing-prepared-state';\n readonly missingResource: string;\n readonly recovery: RenderFeatureRecovery;\n }\n | {\n readonly featureIdentity: string;\n readonly order: number;\n readonly stage: 'contribute';\n readonly operation: string;\n readonly resourceKind: PreparedKind;\n readonly reason: 'foreign-feature';\n readonly expectedFeatureIdentity: string;\n readonly actualFeatureIdentity: string;\n readonly recovery: RenderFeatureRecovery;\n }\n | {\n readonly featureIdentity: string;\n readonly order: number;\n readonly stage: 'contribute';\n readonly operation: string;\n readonly resourceKind: PreparedKind;\n readonly reason: 'foreign-kind';\n readonly expectedKind: PreparedKind;\n readonly actualKind: PreparedKind;\n readonly recovery: RenderFeatureRecovery;\n }\n | {\n readonly featureIdentity: string;\n readonly order: number;\n readonly stage: 'contribute';\n readonly operation: string;\n readonly resourceKind: PreparedKind;\n readonly reason: 'generation-mismatch';\n readonly expectedGeneration: number;\n readonly actualGeneration: number;\n readonly recovery: RenderFeatureRecovery;\n }\n | {\n readonly featureIdentity: string;\n readonly order: number;\n readonly stage: 'contribute';\n readonly operation: string;\n readonly resourceKind: PreparedKind;\n readonly reason: 'layout-mismatch';\n readonly expectedLayout: string;\n readonly actualLayout: string;\n readonly recovery: RenderFeatureRecovery;\n }\n | {\n readonly featureIdentity: string;\n readonly order: number;\n readonly stage: 'contribute';\n readonly operation: string;\n readonly resourceKind: PreparedKind;\n readonly reason: 'format-mismatch';\n readonly expectedFormat: string;\n readonly actualFormat: string;\n readonly recovery: RenderFeatureRecovery;\n };\n\nexport interface RenderFeatureDrawRecordingFailedDetail {\n readonly featureIdentity: string;\n readonly order: number;\n readonly stage: 'record';\n readonly operation: string;\n readonly resourceKind: PreparedKind;\n readonly reason: string;\n readonly backendReason: string;\n readonly recovery: RenderFeatureRecovery;\n}\n\nexport type RenderFeatureErrorDetailByCode = {\n 'render-feature-registration-conflict': RenderFeatureRegistrationConflictDetail;\n 'render-feature-stage-failed': RenderFeatureStageFailedDetail;\n 'render-feature-capability-missing': RenderFeatureCapabilityMissingDetail;\n 'render-feature-pass-order-conflict': RenderFeaturePassOrderConflictDetail;\n 'render-feature-preparation-failed': RenderFeaturePreparationFailedDetail;\n 'render-feature-prepared-state-mismatch': RenderFeaturePreparedStateMismatchDetail;\n 'render-feature-draw-recording-failed': RenderFeatureDrawRecordingFailedDetail;\n};\n\n/** Machine-readable four-field diagnostic exposed by every feature error. */\nexport type RenderFeatureErrorDescriptor = {\n [Code in RenderFeatureErrorCode]: {\n readonly code: Code;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderFeatureErrorDetailByCode[Code];\n };\n}[RenderFeatureErrorCode];\n\nconst renderFeatureRecoveryHintByRecovery = {\n 'next-frame': (featureIdentity: string, stage: RenderFeatureStage) =>\n `correct '${featureIdentity}' ${stage} data and retry on the next frame`,\n 'renderer-recover': (featureIdentity: string, _stage: RenderFeatureStage) =>\n `wait for renderer recovery before retrying '${featureIdentity}'`,\n registration: (featureIdentity: string, _stage: RenderFeatureStage) =>\n `correct '${featureIdentity}' registration before retrying`,\n} satisfies Record<\n RenderFeatureRecovery,\n (featureIdentity: string, stage: RenderFeatureStage) => string\n>;\n\nexport class RenderFeatureRegistrationConflictError extends Error {\n readonly code = 'render-feature-registration-conflict' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderFeatureRegistrationConflictDetail;\n\n constructor(featureIdentity: string, order: number, conflictingOrder: number) {\n const expected = `feature identity '${featureIdentity}' is unique`;\n const hint = `rename '${featureIdentity}' or remove the duplicate feature before registration`;\n super(`render feature registration conflict for '${featureIdentity}'`);\n this.name = 'RenderFeatureRegistrationConflictError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { featureIdentity, order, conflictingOrder };\n }\n}\n\nexport class RenderFeatureStageFailedError extends Error {\n readonly code = 'render-feature-stage-failed' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderFeatureStageFailedDetail;\n\n constructor(\n featureIdentity: string,\n order: number,\n stage: RenderFeatureStage,\n recovery: RenderFeatureRecovery,\n ) {\n const expected = `feature '${featureIdentity}' completes its ${stage} stage without an error`;\n const hint = renderFeatureRecoveryHintByRecovery[recovery](featureIdentity, stage);\n super(`render feature '${featureIdentity}' failed during ${stage}`);\n this.name = 'RenderFeatureStageFailedError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { featureIdentity, order, stage, recovery };\n }\n}\n\nexport class RenderFeatureCapabilityMissingError extends Error {\n readonly code = 'render-feature-capability-missing' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderFeatureCapabilityMissingDetail;\n\n constructor(\n featureIdentity: string,\n order: number,\n capability: RenderFeatureCapabilityMissingDetail['capability'],\n ) {\n const expected = `device capability '${capability}' is available for feature '${featureIdentity}'`;\n const hint = `disable '${featureIdentity}' or use a device with '${capability}' capability`;\n super(`render feature '${featureIdentity}' requires missing capability '${capability}'`);\n this.name = 'RenderFeatureCapabilityMissingError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { featureIdentity, order, capability };\n }\n}\n\nexport class RenderFeaturePassOrderConflictError extends Error {\n readonly code = 'render-feature-pass-order-conflict' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderFeaturePassOrderConflictDetail;\n\n constructor(\n featureIdentity: string,\n order: number,\n passIdentity: string,\n dependencyIdentity: string,\n ) {\n const expected = `feature pass '${passIdentity}' follows dependency '${dependencyIdentity}'`;\n const hint = `reorder '${featureIdentity}' passes so '${passIdentity}' follows '${dependencyIdentity}'`;\n super(`render feature '${featureIdentity}' pass order conflict`);\n this.name = 'RenderFeaturePassOrderConflictError';\n this.expected = expected;\n this.hint = hint;\n this.detail = { featureIdentity, order, passIdentity, dependencyIdentity };\n }\n}\n\nexport class RenderFeaturePreparationFailedError extends Error {\n readonly code = 'render-feature-preparation-failed' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderFeaturePreparationFailedDetail;\n\n constructor(\n featureIdentity: string,\n order: number,\n operation: string,\n resourceKind: RenderFeaturePreparationFailedDetail['resourceKind'],\n resourceName: string,\n reason: string,\n recovery: RenderFeatureRecovery,\n ) {\n const expected = `${resourceKind} '${resourceName}' is prepared during ${operation}`;\n const hint = `repair '${resourceName}' and retry feature '${featureIdentity}' on ${recovery}`;\n super(`render feature '${featureIdentity}' preparation failed for '${resourceName}'`);\n this.name = 'RenderFeaturePreparationFailedError';\n this.expected = expected;\n this.hint = hint;\n this.detail = {\n featureIdentity,\n order,\n stage: 'prepare',\n operation,\n resourceKind,\n resourceName,\n reason,\n recovery,\n };\n }\n}\n\nexport class RenderFeaturePreparedStateMismatchError extends Error {\n readonly code = 'render-feature-prepared-state-mismatch' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderFeaturePreparedStateMismatchDetail;\n\n constructor(detail: RenderFeaturePreparedStateMismatchDetail) {\n const expected = `${detail.resourceKind} state is compatible for '${detail.operation}'`;\n const hint = `repair '${detail.reason}' for feature '${detail.featureIdentity}' and retry`;\n super(`render feature '${detail.featureIdentity}' prepared state mismatch`);\n this.name = 'RenderFeaturePreparedStateMismatchError';\n this.expected = expected;\n this.hint = hint;\n this.detail = detail;\n }\n}\n\nexport class RenderFeatureDrawRecordingFailedError extends Error {\n readonly code = 'render-feature-draw-recording-failed' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderFeatureDrawRecordingFailedDetail;\n\n constructor(\n featureIdentity: string,\n order: number,\n operation: string,\n resourceKind: RenderFeatureDrawRecordingFailedDetail['resourceKind'],\n reason: string,\n backendReason: string,\n recovery: RenderFeatureRecovery,\n ) {\n const expected = `${resourceKind} recording succeeds for '${operation}'`;\n const hint = `repair '${reason}' and retry feature '${featureIdentity}' after ${recovery}`;\n super(`render feature '${featureIdentity}' draw recording failed`);\n this.name = 'RenderFeatureDrawRecordingFailedError';\n this.expected = expected;\n this.hint = hint;\n this.detail = {\n featureIdentity,\n order,\n stage: 'record',\n operation,\n resourceKind,\n reason,\n backendReason,\n recovery,\n };\n }\n}\n\n// ── ObservationUnavailableError ───────────────────────────────────────────\n\nexport type ObservationUnavailableReason =\n | 'no-frame'\n | 'resource'\n | 'copy-src'\n | 'stale'\n | 'identity'\n | 'format'\n | 'readback-failed';\n\nexport interface ObservationUnavailableDetail {\n readonly reason: ObservationUnavailableReason;\n readonly recovery: 'draw-current-frame' | 'enable-copy-src' | 'retry-readback';\n}\n\n/** A producer-owned current-frame observation could not be made available. */\nexport class ObservationUnavailableError extends Error {\n readonly code = 'observation-unavailable' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: ObservationUnavailableDetail;\n\n constructor(reason: ObservationUnavailableReason, hint: string) {\n let recovery: ObservationUnavailableDetail['recovery'];\n if (reason === 'copy-src') recovery = 'enable-copy-src';\n else if (reason === 'resource' || reason === 'readback-failed') recovery = 'retry-readback';\n else recovery = 'draw-current-frame';\n super(`current-frame observation unavailable: ${reason}`);\n this.name = 'ObservationUnavailableError';\n this.expected = 'a fresh producer-owned rgba16float current-frame observation';\n this.hint = hint;\n this.detail = { reason, recovery };\n }\n}\n\nexport type SceneDataUnavailableReason =\n | 'capability-missing'\n | 'producer-missing'\n | 'coverage-incomplete'\n | 'renderer-recovering';\nexport interface SceneDataUnavailableDetail {\n readonly featureIdentity: string;\n readonly schema: SceneDataSchemaId;\n readonly lane: SceneDataLane;\n readonly reason: SceneDataUnavailableReason;\n readonly missingContributorIds: readonly string[];\n readonly omittedMissingContributorCount: number;\n readonly recovery: 'enable-capability' | 'next-frame' | 'renderer-recover';\n}\nexport class SceneDataUnavailableError extends Error {\n readonly code = 'scene-data-unavailable' as const;\n readonly expected = 'the requested semantic scene data is available for the active plan';\n readonly hint: string;\n readonly detail: SceneDataUnavailableDetail;\n constructor(detail: SceneDataUnavailableDetail) {\n const hint =\n detail.recovery === 'enable-capability'\n ? 'enable rgba16floatRenderable and retry the current frame'\n : detail.recovery === 'renderer-recover'\n ? 'wait for renderer recovery, then retry the frame'\n : 'restore the producer coverage and retry on the next frame';\n super(`scene data '${detail.schema}' unavailable for '${detail.featureIdentity}'`);\n this.name = 'SceneDataUnavailableError';\n this.hint = hint;\n this.detail = Object.freeze({\n ...detail,\n missingContributorIds: Object.freeze([...detail.missingContributorIds].slice(0, 32)),\n omittedMissingContributorCount: Math.max(\n detail.omittedMissingContributorCount,\n Math.max(0, detail.missingContributorIds.length - 32),\n ),\n });\n }\n}\n\nexport class TaaUnavailableError extends Error {\n readonly code = 'taa-unavailable' as const;\n readonly expected =\n 'Standard TAA has a renderable rgba16float target and a complete resolve path';\n readonly hint =\n 'enable rgba16float rendering or select none/fxaa explicitly; do not treat TAA as no-AA';\n readonly detail: {\n readonly reason: 'capability' | 'topology' | 'history';\n readonly observed?: string;\n };\n constructor(reason: 'capability' | 'topology' | 'history', observed?: string) {\n super(`taa-unavailable: ${reason}`);\n this.name = 'TaaUnavailableError';\n this.detail = observed === undefined ? { reason } : { reason, observed };\n }\n}\n\nexport interface FrameReceiptStaleDetail {\n readonly frameId: number;\n readonly receiptGeneration: number;\n readonly currentGeneration: number;\n}\n\n/** Receipt-bound observation failed closed at a generation fence. */\nexport class FrameReceiptStaleError extends Error {\n readonly code = 'frame-receipt-stale' as const;\n readonly expected = 'the observation receipt belongs to the active device generation';\n readonly hint = 'draw a new frame and call observe with its returned FrameReceipt';\n readonly detail: FrameReceiptStaleDetail;\n\n constructor(detail: FrameReceiptStaleDetail) {\n super('frame receipt belongs to a retired device generation');\n this.name = 'FrameReceiptStaleError';\n this.detail = detail;\n }\n}\n\nexport interface RendererContractFailureDetail {\n readonly operation: 'construct' | 'attach' | 'draw' | 'observe';\n readonly cause: string;\n}\n\n/** Structured boundary failure while adapting an owner contract. */\nexport class RendererContractFailureError extends Error {\n readonly code = 'renderer-contract-failed' as const;\n readonly expected = 'renderer owner contracts remain valid at the public boundary';\n readonly hint = 'repair the owner contract and retry the operation';\n readonly detail: RendererContractFailureDetail;\n\n constructor(operation: RendererContractFailureDetail['operation'], cause: string) {\n super(`renderer ${operation} contract failed: ${cause}`);\n this.name = 'RendererContractFailureError';\n this.detail = { operation, cause };\n }\n}\n\nexport interface EnvironmentSourceConflictDetail {\n readonly owners: readonly {\n readonly kind: 'image' | 'atmosphere';\n readonly entityKey: number;\n readonly sourceKey: string;\n }[];\n}\n\nexport class EnvironmentSourceConflictError extends Error {\n readonly code = 'environment-source-conflict' as const;\n readonly expected = 'exactly one environment source owns the frame';\n readonly hint = 'remove all but one image or atmosphere environment owner';\n readonly detail: EnvironmentSourceConflictDetail;\n\n constructor(owners: readonly EnvironmentSourceConflictDetail['owners'][number][]) {\n super('environment source owners conflict');\n this.name = 'EnvironmentSourceConflictError';\n this.detail = { owners: owners.map((owner) => Object.freeze({ ...owner })) };\n }\n}\n\nexport interface FogCardinalityDetail {\n readonly count: number;\n}\n\nexport class FogCardinalityError extends Error {\n readonly code = 'fog-cardinality' as const;\n readonly expected = 'zero or one Fog owner contributes to a frame';\n readonly hint = 'remove extra Fog owners so the resource owner has at most one';\n readonly detail: FogCardinalityDetail;\n\n constructor(count: number) {\n super(`Fog owner cardinality is ${count}`);\n this.name = 'FogCardinalityError';\n this.detail = { count };\n }\n}\n\nexport interface TaaCapsInsufficientDetail {\n readonly required: readonly string[];\n readonly available: readonly string[];\n}\n\nexport class TaaCapsInsufficientError extends Error {\n readonly code = 'taa-caps-insufficient' as const;\n readonly expected = 'the backend exposes the capabilities required by TAA';\n readonly hint = 'select a backend with the required TAA capabilities or disable TAA on Camera';\n readonly detail: TaaCapsInsufficientDetail;\n\n constructor(required: readonly string[], available: readonly string[]) {\n super('TAA capabilities are insufficient');\n this.name = 'TaaCapsInsufficientError';\n this.detail = { required: [...required], available: [...available] };\n }\n}\n\nexport interface EnvironmentGenerationFailedDetail {\n readonly sourceKey: string;\n readonly stage: 'prepare' | 'build' | 'execute' | 'finish' | 'submit';\n}\n\nexport class EnvironmentGenerationFailedError extends Error {\n readonly code = 'environment-generation-failed' as const;\n readonly expected = 'the selected environment generation completes its owner stage';\n readonly hint = 'inspect the stage and sourceKey, then retry after correcting the environment';\n readonly detail: EnvironmentGenerationFailedDetail;\n\n constructor(sourceKey: string, stage: EnvironmentGenerationFailedDetail['stage']) {\n super(`environment generation failed during ${stage}`);\n this.name = 'EnvironmentGenerationFailedError';\n this.detail = { sourceKey, stage };\n }\n}\n\nexport interface AtmosphereInvalidParameterDetail {\n readonly field: string;\n readonly value: number;\n}\n\nexport interface AtmosphereParameterRange {\n readonly min: number;\n readonly max: number;\n}\n\nexport class AtmosphereInvalidParameterError extends Error {\n readonly code = 'atmosphere-invalid-parameter' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: AtmosphereInvalidParameterDetail;\n\n constructor(field: string, value: number, range: AtmosphereParameterRange) {\n super(`Atmosphere.${field} is invalid`);\n this.name = 'AtmosphereInvalidParameterError';\n this.detail = { field, value };\n const rangeText = Number.isFinite(range.max)\n ? `[${range.min}, ${range.max}]`\n : `>= ${range.min}`;\n this.expected = `Atmosphere.${field} must be finite and ${rangeText}`;\n this.hint = `set Atmosphere.${field} to a finite value ${rangeText}`;\n }\n}\n\nexport interface OwnerStageFailedDetail {\n readonly owner: 'environment' | 'temporal' | 'fog' | 'renderer';\n readonly stage: 'extract' | 'prepare' | 'record' | 'finish' | 'submit';\n}\n\nexport class OwnerStageFailedError extends Error {\n readonly code = 'owner-stage-failed' as const;\n readonly expected = 'the owner completes its current frame stage';\n readonly hint = 'inspect the owner and stage, keep the last-known-good frame, and retry';\n readonly detail: OwnerStageFailedDetail;\n\n constructor(owner: OwnerStageFailedDetail['owner'], stage: OwnerStageFailedDetail['stage']) {\n super(`${owner} owner failed during ${stage}`);\n this.name = 'OwnerStageFailedError';\n this.detail = { owner, stage };\n }\n}\n\nexport interface RendererOperationCause {\n readonly code: string;\n readonly expected: string;\n readonly hint: string;\n readonly detail?: unknown;\n}\n\nexport interface RendererOperationDetailByCode {\n readonly 'world-lease-invalid': {\n readonly operation: 'attach' | 'draw';\n readonly cause: RendererOperationCause;\n };\n readonly 'frame-input-invalid': {\n readonly operation: 'draw' | 'set-profile';\n readonly cause: RendererOperationCause;\n };\n readonly 'scene-projection-failed': {\n readonly operation: 'draw';\n readonly cause: RendererOperationCause;\n };\n readonly 'asset-binding-failed': {\n readonly operation: 'draw';\n readonly cause: RendererOperationCause;\n };\n readonly 'feature-plan-failed': {\n readonly operation: 'draw';\n readonly cause: RendererOperationCause;\n };\n readonly 'graph-build-failed': {\n readonly operation: 'draw' | 'set-profile';\n readonly cause: RendererOperationCause;\n };\n readonly 'device-operation-failed': {\n readonly operation: 'draw' | 'complete-frame' | 'renderer-event';\n readonly frameId?: number;\n readonly deviceGeneration?: number;\n readonly cause: RendererOperationCause;\n };\n readonly 'surface-unavailable': {\n readonly operation: 'release-surface' | 'restore-surface';\n readonly cause: RendererOperationCause;\n };\n readonly 'renderer-state-invalid': {\n readonly operation: 'draw' | 'set-profile' | 'recover' | 'dispose';\n readonly state: string;\n readonly cause?: RendererOperationCause;\n };\n readonly 'recovery-failed': {\n readonly operation: 'recover';\n readonly phase: RecoveryPhase;\n readonly oldGeneration: number;\n readonly candidateGeneration: number;\n readonly attempt: number;\n readonly elapsedMs: number;\n readonly retryable: boolean;\n readonly guidance: 'retry' | 'repair-owner' | 'rebuild-renderer';\n readonly owner: string;\n readonly resourceKind: string;\n readonly lastOutcome: RecoveryOutcome;\n readonly rehydratedRoots: number;\n readonly staleLossEvents: number;\n readonly cleanupFailures: readonly RendererOperationCause[];\n readonly cause: RendererOperationCause;\n };\n readonly 'cleanup-failed': {\n readonly operation: 'dispose';\n readonly causes: readonly RendererOperationCause[];\n };\n}\n\nexport type RendererOperationErrorCode = keyof RendererOperationDetailByCode;\n\nconst RENDERER_OPERATION_ERROR_POLICY = {\n 'world-lease-invalid': {\n expected: 'every render World is represented by a live lease owned by this Renderer',\n hint: 'attach the World to this Renderer and use the returned lease',\n },\n 'frame-input-invalid': {\n expected: 'the frame input references attached leases and a valid immutable RenderProfile',\n hint: 'repair the frame input and retry draw or setProfile',\n },\n 'scene-projection-failed': {\n expected: 'the attached World projects into the renderer-owned RenderScene',\n hint: 'inspect the structured cause, repair the World publication, and retry draw',\n },\n 'asset-binding-failed': {\n expected: 'all frame assets resolve to valid renderer-owned bindings',\n hint: 'inspect the structured cause, rebuild or cold-cook the asset, and retry draw',\n },\n 'feature-plan-failed': {\n expected: 'every installed RenderFeature produces a valid declarative plan',\n hint: 'inspect the feature cause, repair its plan, and retry draw',\n },\n 'graph-build-failed': {\n expected: 'the Standard graph builds from the active profile and feature plans',\n hint: 'inspect the graph cause, repair the profile or plan, and retry',\n },\n 'device-operation-failed': {\n expected: 'the active device generation completes the renderer-owned operation',\n hint: 'inspect renderer state and the structured cause, then retry or recover',\n },\n 'surface-unavailable': {\n expected: 'the presentation surface accepts the requested lifecycle operation',\n hint: 'inspect renderer state, then restore the surface or create a new Renderer',\n },\n 'renderer-state-invalid': {\n expected: 'the Renderer is in a state that accepts the requested operation',\n hint: 'inspect renderer state and choose retry, restoreSurface, recover, or stop',\n },\n 'recovery-failed': {\n expected: 'one recovery attempt publishes a complete replacement device generation',\n hint: 'inspect the structured cause and retry recover after the host-selected delay',\n },\n 'cleanup-failed': {\n expected: 'Renderer disposal completes every registered cleanup in reverse ownership order',\n hint: 'inspect the ordered cleanup causes; the Renderer remains disposed and must not be reused',\n },\n} as const satisfies Readonly<\n Record<RendererOperationErrorCode, { readonly expected: string; readonly hint: string }>\n>;\n\n/** Public renderer-operation failure with a code-narrowed structured detail. */\nexport class RendererOperationError<Code extends RendererOperationErrorCode> extends Error {\n readonly code: Code;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RendererOperationDetailByCode[Code];\n\n constructor(code: Code, detail: RendererOperationDetailByCode[Code]) {\n const policy = RENDERER_OPERATION_ERROR_POLICY[code];\n super(`${code}: ${policy.expected}`);\n this.name = 'RendererOperationError';\n this.code = code;\n this.expected = policy.expected;\n this.hint = policy.hint;\n this.detail = detail;\n }\n}\n\nexport type RendererExpectedOperationError = {\n readonly [Code in RendererOperationErrorCode]: RendererOperationError<Code>;\n}[RendererOperationErrorCode];\n\n// -- Points/Lines admission errors -------------------------------------------\n\nexport interface PointsLinesInvalidStyleDetail {\n readonly entity: number;\n readonly component: 'Points' | 'Lines' | 'Points/Lines';\n readonly field: string;\n readonly value: number | string | undefined;\n readonly expected: string;\n}\n\nexport class PointsLinesInvalidStyleError extends Error {\n readonly code = 'points-lines-invalid-style' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: PointsLinesInvalidStyleDetail;\n\n constructor(detail: PointsLinesInvalidStyleDetail) {\n super(`invalid ${detail.component} style at ${detail.field}`);\n this.name = 'PointsLinesInvalidStyleError';\n this.expected = detail.expected;\n this.hint = `repair entity ${detail.entity} ${detail.component}.${detail.field} and retry admission`;\n this.detail = detail;\n }\n}\n\nexport interface PointsLinesTopologyMismatchDetail {\n readonly entity: number;\n readonly submesh: number;\n readonly expected: string;\n readonly actual: string;\n}\n\nexport class PointsLinesTopologyMismatchError extends Error {\n readonly code = 'points-lines-topology-mismatch' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: PointsLinesTopologyMismatchDetail;\n\n constructor(detail: PointsLinesTopologyMismatchDetail) {\n super(`Points/Lines topology mismatch at submesh ${detail.submesh}`);\n this.name = 'PointsLinesTopologyMismatchError';\n this.expected = `submesh ${detail.submesh} topology is ${detail.expected}`;\n this.hint = `rebuild entity ${detail.entity} with ${detail.expected} geometry before retrying Points/Lines admission`;\n this.detail = detail;\n }\n}\n\nexport interface PointsLinesStyleUnsupportedDetail {\n readonly lane: string;\n readonly field: string;\n readonly member: string;\n readonly supported: readonly string[];\n}\n\nexport class PointsLinesStyleUnsupportedError extends Error {\n readonly code = 'points-lines-style-unsupported' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: PointsLinesStyleUnsupportedDetail;\n\n constructor(detail: PointsLinesStyleUnsupportedDetail) {\n super(`unsupported Points/Lines ${detail.field} member ${detail.member}`);\n this.name = 'PointsLinesStyleUnsupportedError';\n this.expected = `${detail.field} is one of ${detail.supported.join(', ')}`;\n this.hint = `use a supported Points/Lines ${detail.field} member or wait for a later milestone`;\n this.detail = detail;\n }\n}\n\nexport interface PointsLinesMaterialUnsupportedDetail {\n readonly entity: number;\n readonly material: string;\n readonly pass: string;\n readonly module: string;\n readonly reason: string;\n}\n\nexport class PointsLinesMaterialUnsupportedError extends Error {\n readonly code = 'points-lines-material-unsupported' as const;\n readonly expected = 'one engine-owned unlit forward MaterialAsset pass';\n readonly hint: string;\n readonly detail: PointsLinesMaterialUnsupportedDetail;\n\n constructor(detail: PointsLinesMaterialUnsupportedDetail) {\n super(`Points/Lines material is unsupported on entity ${detail.entity}`);\n this.name = 'PointsLinesMaterialUnsupportedError';\n this.hint = `use Materials.unlit without a shadow-caster pass for entity ${detail.entity}`;\n this.detail = detail;\n }\n}\n\nexport interface PointsLinesBudgetExceededDetail {\n readonly lane: string;\n readonly requested: number;\n readonly limit: number;\n readonly unit: 'points' | 'segments' | 'vertices' | 'indices' | 'bytes' | 'draws';\n}\n\nexport class PointsLinesBudgetExceededError extends Error {\n readonly code = 'points-lines-budget-exceeded' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: PointsLinesBudgetExceededDetail;\n\n constructor(detail: PointsLinesBudgetExceededDetail) {\n super(`Points/Lines ${detail.unit} budget exceeded`);\n this.name = 'PointsLinesBudgetExceededError';\n this.expected = `${detail.unit} <= ${detail.limit}`;\n this.hint = `reduce Points/Lines ${detail.unit} or split the entity into bounded equivalent batches`;\n this.detail = detail;\n }\n}\n\nexport interface PointsLinesPrepareFailedDetail {\n readonly owner: string;\n readonly generation: number;\n readonly stage: 'prepare';\n readonly cause: string;\n readonly lastKnownGood: boolean;\n}\n\nexport class PointsLinesPrepareFailedError extends Error {\n readonly code = 'points-lines-prepare-failed' as const;\n readonly expected = 'the complete Points/Lines candidate validates before publication';\n readonly hint: string;\n readonly detail: PointsLinesPrepareFailedDetail;\n\n constructor(detail: PointsLinesPrepareFailedDetail) {\n super(`Points/Lines prepare failed at generation ${detail.generation}`);\n this.name = 'PointsLinesPrepareFailedError';\n this.hint = detail.lastKnownGood\n ? 'retain the last known good candidate, repair the producer, and retry prepare'\n : 'repair the producer and retry prepare; the failed first candidate produces zero draw';\n this.detail = detail;\n }\n}\n\n// -- RenderTarget errors ------------------------------------------------------\n\nexport interface RenderTargetDescriptorInvalidDetail {\n readonly field: string;\n readonly value: unknown;\n readonly expected: string;\n}\n\nexport class RenderTargetDescriptorInvalidError extends Error {\n readonly code = 'render-target-descriptor-invalid' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderTargetDescriptorInvalidDetail;\n\n constructor(detail: RenderTargetDescriptorInvalidDetail) {\n super(`render-target-descriptor-invalid: ${detail.field} does not satisfy ${detail.expected}`);\n this.name = 'RenderTargetDescriptorInvalidError';\n this.expected = detail.expected;\n this.hint = `set RenderTargetDescriptor.${detail.field} to the expected value, then retry create or resize`;\n this.detail = detail;\n }\n}\n\nexport interface RenderTargetCapabilityMissingDetail {\n readonly operation: 'create' | 'resize' | 'source' | 'readback';\n readonly requested: string;\n readonly capability: string;\n readonly actual: string;\n}\n\nexport class RenderTargetCapabilityMissingError extends Error {\n readonly code = 'render-target-capability-missing' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderTargetCapabilityMissingDetail;\n\n constructor(detail: RenderTargetCapabilityMissingDetail) {\n super(\n `render-target-capability-missing: ${detail.capability} does not admit ${detail.requested}`,\n );\n this.name = 'RenderTargetCapabilityMissingError';\n this.expected = `${detail.capability} admits ${detail.requested}`;\n this.hint = `choose an admitted target descriptor or use a backend providing ${detail.capability}`;\n this.detail = detail;\n }\n}\n\nexport type RenderTargetStateInvalidReason =\n | 'foreign-renderer'\n | 'destroyed'\n | 'uninitialized'\n | 'generation-mismatch'\n | 'readback-without-intent';\n\nexport interface RenderTargetStateInvalidDetail {\n readonly operation: 'inspect' | 'resize' | 'source' | 'readback' | 'destroy';\n readonly reason: RenderTargetStateInvalidReason;\n readonly state: 'uninitialized' | 'candidate' | 'active' | 'rebuilding' | 'destroyed';\n readonly generation: number;\n}\n\nexport class RenderTargetStateInvalidError extends Error {\n readonly code = 'render-target-state-invalid' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderTargetStateInvalidDetail;\n\n constructor(detail: RenderTargetStateInvalidDetail) {\n super(`render-target-state-invalid: ${detail.operation} cannot use ${detail.reason}`);\n this.name = 'RenderTargetStateInvalidError';\n this.expected = `target state permits ${detail.operation}`;\n this.hint =\n 'use the Renderer that created the target, then initialize, recover, or stop using the destroyed token';\n this.detail = detail;\n }\n}\n\nexport interface RenderTargetOperationFailedDetail {\n readonly operation: 'create' | 'resize' | 'source' | 'readback' | 'destroy' | 'recover';\n readonly stage: 'allocation' | 'compile' | 'write' | 'submit' | 'copy' | 'retire';\n readonly generation: number;\n readonly cause: unknown;\n readonly recovery: 'retry' | 'recover' | 'retain-last-known-good';\n}\n\nexport class RenderTargetOperationFailedError extends Error {\n readonly code = 'render-target-operation-failed' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderTargetOperationFailedDetail;\n\n constructor(detail: RenderTargetOperationFailedDetail) {\n super(`render-target-operation-failed: ${detail.operation} failed during ${detail.stage}`);\n this.name = 'RenderTargetOperationFailedError';\n this.expected = `${detail.operation} completes ${detail.stage}`;\n this.hint =\n 'inspect detail.cause, then retry, recover the Renderer, or retain the last-known-good generation';\n this.detail = detail;\n }\n}\n\nexport interface ReflectionProbeBudgetExceededDetail {\n readonly actual: number;\n readonly budget: number;\n}\n\nexport class ReflectionProbeBudgetExceededError extends Error {\n readonly code = 'reflection-probe-budget-exceeded' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: ReflectionProbeBudgetExceededDetail;\n\n constructor(actual: number, budget: number) {\n super(`reflection-probe-budget-exceeded: ${actual} > ${budget}`);\n this.name = 'ReflectionProbeBudgetExceededError';\n this.expected = `reflection probe work <= ${budget}`;\n this.hint = 'reduce probe updates for this frame or raise the RenderProfile probe budget';\n this.detail = { actual, budget };\n }\n}\n\nexport interface RenderIntentInvalidDetail {\n readonly component: 'CubeCamera' | 'ReflectionProbe';\n readonly field: 'updateIntent';\n readonly value: number;\n readonly allowed: readonly [0, 1, 2];\n}\n\nexport class RenderIntentInvalidError extends Error {\n readonly code = 'render-intent-invalid' as const;\n readonly expected: string;\n readonly hint: string;\n readonly detail: RenderIntentInvalidDetail;\n\n constructor(component: RenderIntentInvalidDetail['component'], value: number) {\n super(`render-intent-invalid: ${component}.updateIntent is not an admitted value`);\n this.name = 'RenderIntentInvalidError';\n this.expected = `${component}.updateIntent is one of 0, 1, or 2`;\n this.hint = `set ${component}.updateIntent to 0, 1, or 2`;\n this.detail = { component, field: 'updateIntent', value, allowed: [0, 1, 2] };\n }\n}\n\nexport interface VolumeOwnerConflictDetail {\n readonly ownerCount: number;\n}\n\nexport class VolumeOwnerConflictError extends Error {\n readonly code = 'volume-owner-conflict' as const;\n readonly expected = 'exactly one global VolumetricFog owner is authored';\n readonly hint = 'remove additional VolumetricFog owners and retry extraction';\n readonly detail: VolumeOwnerConflictDetail;\n\n constructor(ownerCount: number) {\n super(`volume-owner-conflict: received ${ownerCount} owners`);\n this.name = 'VolumeOwnerConflictError';\n this.detail = { ownerCount };\n }\n}\n\nexport interface VolumeDensityShapeMismatchDetail {\n readonly guid: string;\n readonly viewDimension: string;\n}\n\nexport class VolumeDensityShapeMismatchError extends Error {\n readonly code = 'volume-density-shape-mismatch' as const;\n readonly expected = 'density is a linear 3D TextureAsset';\n readonly hint = 'bind a verified linear texture with viewDimension 3d';\n readonly detail: VolumeDensityShapeMismatchDetail;\n\n constructor(guid: string, viewDimension: string) {\n super(`volume-density-shape-mismatch: ${viewDimension} density is not 3d`);\n this.name = 'VolumeDensityShapeMismatchError';\n this.detail = { guid, viewDimension };\n }\n}\n\nexport interface VolumeInvalidBoundsDetail {\n readonly min: readonly [number, number, number];\n readonly max: readonly [number, number, number];\n}\n\nexport class VolumeInvalidBoundsError extends Error {\n readonly code = 'volume-invalid-bounds' as const;\n readonly expected = 'bounds are finite and max is greater than min on every axis';\n readonly hint = 'set finite non-degenerate volume bounds';\n readonly detail: VolumeInvalidBoundsDetail;\n\n constructor(bounds: VolumeInvalidBoundsDetail) {\n super('volume-invalid-bounds: bounds must be finite and non-degenerate');\n this.name = 'VolumeInvalidBoundsError';\n this.detail = bounds;\n }\n}\n\nexport interface VolumeInvalidParametersDetail {\n readonly field: string;\n readonly value: unknown;\n}\n\nexport class VolumeInvalidParametersError extends Error {\n readonly code = 'volume-invalid-parameters' as const;\n readonly expected = 'volume parameters remain finite and inside their closed ranges';\n readonly hint = 'repair extinction, albedo, emission, anisotropy, or maxDistance';\n readonly detail: VolumeInvalidParametersDetail;\n\n constructor(input: { readonly maxDistance?: number; readonly anisotropy?: number }) {\n const field =\n input.maxDistance !== undefined && input.maxDistance <= 0 ? 'maxDistance' : 'parameters';\n const value = field === 'maxDistance' ? input.maxDistance : input.anisotropy;\n super(`volume-invalid-parameters: ${field} is outside the authored range`);\n this.name = 'VolumeInvalidParametersError';\n this.detail = { field, value };\n }\n}\n\nexport type VolumeError =\n | VolumeOwnerConflictError\n | VolumeDensityShapeMismatchError\n | VolumeInvalidBoundsError\n | VolumeInvalidParametersError;\n\nexport interface ProjectorBindingDetail {\n readonly guid: string;\n readonly status: 'pending' | 'invalid' | 'bind-failed';\n}\n\nexport class ProjectorBindingError extends Error {\n readonly code = 'projector-binding-failed' as const;\n readonly expected = 'authored projector is accepted and bound for both surface and volume';\n readonly hint =\n 'inspect the projector Meta/Pack receipt, repair the source, and retry with the same GUID';\n readonly detail: ProjectorBindingDetail;\n\n constructor(guid: string, status: ProjectorBindingDetail['status']) {\n super(`projector binding failed for ${guid}: ${status}`);\n this.name = 'ProjectorBindingError';\n this.detail = { guid, status };\n }\n}\n\n// -- RenderErrorCode / RenderError closed unions --------------------------------\n\n/**\n * Closed union of render-cluster error codes. AI users perform exhaustive\n * `switch (err.code)` without default; TS guards completeness.\n */\nexport type RenderErrorCode = RenderError['code'];\n\n/**\n * Closed union of the render-cluster structured error classes, each carrying a\n * `RenderErrorCode` discriminant on `.code`.\n */\nexport type RenderError =\n | LifecycleConstructionError\n | RendererExpectedOperationError\n | FrameReceiptStaleError\n | RendererContractFailureError\n | ObservationUnavailableError\n | SceneDataUnavailableError\n | TaaUnavailableError\n | ShadowInvalidConfigError\n | EquirectProjectionFailedError\n | StandardLightBudgetExceededError\n | StandardClusterIndexOverflowError\n | StandardClusterTransportUnavailableError\n | StandardProfileInvalidError\n | PointShadowAtlasUninitializedError\n | PointShadowAtlasBoundsViolationError\n | VideoUploadUnsupportedError\n | VertexStorageBufferUnavailableError\n | VertexColorVariantConflictError\n | SkinPaletteOverflowError\n | SkinMaterialMismatchError\n | MaterialSkinAttrMissingError\n | TransmissionCapabilityMissingError\n | RenderFeatureRegistrationConflictError\n | RenderFeatureStageFailedError\n | RenderFeatureCapabilityMissingError\n | RenderFeaturePassOrderConflictError\n | RenderFeaturePreparationFailedError\n | RenderFeaturePreparedStateMismatchError\n | RenderFeatureDrawRecordingFailedError\n | EnvironmentSourceConflictError\n | FogCardinalityError\n | TaaCapsInsufficientError\n | EnvironmentGenerationFailedError\n | AtmosphereInvalidParameterError\n | OwnerStageFailedError\n | PointsLinesInvalidStyleError\n | PointsLinesTopologyMismatchError\n | PointsLinesStyleUnsupportedError\n | PointsLinesMaterialUnsupportedError\n | PointsLinesBudgetExceededError\n | PointsLinesPrepareFailedError\n | LightResourceUnavailableError\n | RenderTargetDescriptorInvalidError\n | RenderTargetCapabilityMissingError\n | RenderTargetStateInvalidError\n | RenderTargetOperationFailedError\n | ReflectionProbeBudgetExceededError\n | RenderIntentInvalidError\n | ProjectorBindingError\n | VolumeError;\n","// @forgeax/engine-runtime - render package texture usage values.\n//\n// Keep the WebGPU bit values in one dependency-free owner because render\n// package descriptor and graph builders also run against null and WebGL2-\n// compatible RHI shims where the browser's GPUTextureUsage global is absent.\n\nexport const GPU_TEXTURE_USAGE_COPY_SRC = 0x01;\nexport const GPU_TEXTURE_USAGE_COPY_DST = 0x02;\nexport const GPU_TEXTURE_USAGE_TEXTURE_BINDING = 0x04;\nexport const GPU_TEXTURE_USAGE_RENDER_ATTACHMENT = 0x10;\nexport const GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING =\n GPU_TEXTURE_USAGE_RENDER_ATTACHMENT | GPU_TEXTURE_USAGE_TEXTURE_BINDING;\n","// @forgeax/engine-runtime - ShadowAtlas (cube_array depth atlas for point-light shadows).\n//\n// feat-20260612-point-light-shadows-urp-hdrp M3 / T-M3-1 (plan-strategy §D-1).\n//\n// Lazy-allocated `texture_depth_cube_array` (depth32float) + per-face 2D\n// TextureView cache. One layer per admitted shadow-casting PointLight; the\n// renderer owns the bounded atlas admission policy. Total texel footprint at\n// the 512x512 default = 4 layers x 6 faces x 512 x 512 x 4 B = 24 MiB.\n//\n// Why a separate module (vs inlining into createRenderer / pipelineState):\n// - zero-shadow scene path stays allocation-free (AC-09): we never call\n// `device.createTexture` on the cube_array unless `ensure(...)` is invoked\n// from the extract / record path on a frame that has at least one\n// PointLightShadow snapshot.\n// - face-view cache is keyed (layer, face) and built lazily during the\n// per-light shadow caster pass; the cache is invalidated together with the\n// atlas when `dispose()` runs (renderer teardown or layers re-allocation).\n// - the helper descriptors live in `@forgeax/engine-rhi`\n// (`cubeArrayDepthDescriptor` / `cubeArrayDepthFaceView` /\n// `comparisonSamplerDescriptor`) per T-M0-3; this file is the runtime-side\n// owner of the GPU resources they describe.\n//\n// Lifecycle:\n// 1. `new ShadowAtlas(device, { faceSize, layers })` — construct the\n// manager; no GPU work yet.\n// 2. `atlas.ensure()` — first call allocates the cube_array texture +\n// cube_array sampling view + comparison sampler (idempotent thereafter).\n// 3. `atlas.faceView(layer, face)` — lazy 2D depth view used as a render-\n// pass attachment for the corresponding cube face. Cached per (layer,\n// face).\n// 4. `atlas.dispose()` — releases the GPU resources and clears caches.\n// `ensure()` after `dispose()` re-allocates from scratch.\n\nimport {\n comparisonSamplerDescriptor,\n cubeArrayDepthDescriptor,\n cubeArrayDepthFaceView,\n type RhiDevice,\n type Sampler,\n type Texture,\n type TextureView,\n} from '@forgeax/engine-rhi';\n\nimport {\n PointShadowAtlasBoundsViolationError,\n PointShadowAtlasUninitializedError,\n} from './errors/render';\nimport { GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING } from './gpu-texture-usage';\n\n/**\n * Construction options for {@link ShadowAtlas}.\n */\nexport interface ShadowAtlasOptions {\n /** Per-face square size in pixels. Default 512 (PointLightShadow.mapSize default). */\n readonly faceSize?: number;\n /** Number of cube layers. Default is the renderer atlas admission capacity. */\n readonly layers?: number;\n}\n\n/** Default per-face square size in pixels. Mirrors PointLightShadow.mapSize default. */\nexport const SHADOW_ATLAS_DEFAULT_FACE_SIZE = 512;\n/** Default cube layer count. Renderer-owned point-shadow admission capacity. */\nexport const SHADOW_ATLAS_DEFAULT_LAYERS = 4;\n\n/**\n * Cube-array depth atlas for point-light shadows.\n *\n * Shape: `texture_depth_cube_array` (depth32float) with `layers` and per-\n * face size `faceSize x faceSize`. The cube_array sampling view feeds\n * `@group(0) @binding(5)` in URP shaders; the per-face 2D view feeds the\n * shadow-caster render pass attachment for one (layer, face) at a time\n * (WebGPU forbids cube views as render-pass attachments).\n *\n * Construction performs no GPU work. The first `ensure()` call allocates the\n * texture + view + sampler. `dispose()` releases everything; later `ensure()`\n * calls re-allocate.\n *\n * @example Lazy allocation in the extract / record path:\n * ```\n * if (lights.pointShadow.length > 0) {\n * atlas.ensure();\n * for (const ps of lights.pointShadow) {\n * for (let face = 0; face < 6; face++) {\n * const view = atlas.faceView(ps.shadowAtlasLayer, face);\n * // ... begin shadow caster pass with `view` as the depth attachment\n * }\n * }\n * }\n * ```\n */\nexport class ShadowAtlas {\n /** Backing cube_array depth texture. `null` until `ensure()` has run. */\n private texture: Texture | null = null;\n /**\n * Whole-atlas cube_array sampling view used by URP shaders that bind the\n * atlas at `@group(0) @binding(5)`. `null` until `ensure()` has run.\n */\n private cubeArrayView: TextureView | null = null;\n /** Comparison sampler for `texture_depth_cube_array`. */\n private compareSampler: Sampler | null = null;\n /** Per-face 2D depth view cache, keyed by `layer * 6 + face`. */\n private readonly faceViews = new Map<number, TextureView>();\n /** Per-face label cache (debug aid). Reused on re-creation. */\n private readonly device: RhiDevice;\n /** Per-face square size in pixels. */\n readonly faceSize: number;\n /** Cube layer count. */\n readonly layers: number;\n\n constructor(device: RhiDevice, options: ShadowAtlasOptions = {}) {\n this.device = device;\n this.faceSize = options.faceSize ?? SHADOW_ATLAS_DEFAULT_FACE_SIZE;\n this.layers = options.layers ?? SHADOW_ATLAS_DEFAULT_LAYERS;\n }\n\n /**\n * Returns `true` once the atlas texture is allocated. Used by the extract /\n * record path to gate \"no PointLightShadow → no allocation\" (AC-09) — the\n * caller calls {@link ensure} on a frame that has at least one snapshot;\n * before that, `isAllocated()` stays `false` and tests can assert no GPU\n * resources were created.\n */\n isAllocated(): boolean {\n return this.texture !== null;\n }\n\n /**\n * Lazy-allocate the atlas texture + cube_array sampling view + comparison\n * sampler. Idempotent: subsequent calls are zero-cost no-ops once the\n * resources exist.\n *\n * Throws (via the RHI error registry) on allocation failure. This is the\n * only path that touches the GPU — keeping it inside one method makes the\n * \"zero-shadow scene = zero allocation\" gate easy to enforce: the renderer\n * never calls this method on a frame with no PointLightShadow entities.\n */\n ensure(): void {\n if (this.texture !== null) return;\n const usage = GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING;\n const texDesc = cubeArrayDepthDescriptor(this.faceSize, this.layers, usage);\n const texRes = this.device.createTexture(texDesc);\n if (!texRes.ok) throw texRes.error;\n this.texture = texRes.value;\n\n const viewRes = this.device.createTextureView(this.texture, {\n label: 'shadow-atlas-cube-array-view',\n dimension: 'cube-array',\n aspect: 'depth-only',\n baseArrayLayer: 0,\n arrayLayerCount: 6 * this.layers,\n baseMipLevel: 0,\n mipLevelCount: 1,\n });\n if (!viewRes.ok) {\n this.device.destroyTexture(this.texture);\n this.texture = null;\n throw viewRes.error;\n }\n this.cubeArrayView = viewRes.value;\n\n const sampRes = this.device.createSampler(comparisonSamplerDescriptor());\n if (!sampRes.ok) {\n this.device.destroyTexture(this.texture);\n this.texture = null;\n this.cubeArrayView = null;\n throw sampRes.error;\n }\n this.compareSampler = sampRes.value;\n }\n\n /**\n * Whole-atlas cube_array sampling view (`texture_depth_cube_array`). Returns\n * `null` if the atlas is not yet allocated; the caller should gate on a\n * non-null pointShadow array before calling {@link ensure} + this getter.\n */\n getAtlasView(): TextureView | null {\n return this.cubeArrayView;\n }\n\n /**\n * Comparison sampler (`compare: 'less'`) for cube_array depth sampling.\n * Returns `null` if the atlas is not yet allocated.\n */\n getComparisonSampler(): Sampler | null {\n return this.compareSampler;\n }\n\n /**\n * Backing texture handle. Returns `null` if the atlas is not yet allocated.\n */\n getTexture(): Texture | null {\n return this.texture;\n }\n\n /**\n * Lazy 2D depth view selecting `(layer, face)` (the caller passes\n * `shadowAtlasLayer` from the snapshot and a face index 0..5). Used as the\n * depth attachment of the shadow-caster render pass for one cube face.\n *\n * Caches per `(layer, face)` so the per-frame shadow loop pays zero\n * `createTextureView` cost after the first allocation. Cache is cleared on\n * {@link dispose}.\n *\n * @throws PointShadowAtlasUninitializedError if the atlas is not yet\n * allocated (caller must call {@link ensure} first).\n * @throws PointShadowAtlasBoundsViolationError if `layer` or `face` is out\n * of range.\n * @throws RhiError if the underlying `createTextureView` fails.\n */\n faceView(layer: number, face: number): TextureView {\n if (this.texture === null) {\n throw new PointShadowAtlasUninitializedError();\n }\n if (layer < 0 || layer >= this.layers) {\n throw new PointShadowAtlasBoundsViolationError('layer', layer, this.layers);\n }\n if (face < 0 || face >= 6) {\n throw new PointShadowAtlasBoundsViolationError('face', face, 6);\n }\n const key = layer * 6 + face;\n const cached = this.faceViews.get(key);\n if (cached !== undefined) return cached;\n const desc = cubeArrayDepthFaceView(layer, face);\n const r = this.device.createTextureView(this.texture, desc);\n if (!r.ok) throw r.error;\n this.faceViews.set(key, r.value);\n return r.value;\n }\n\n /**\n * Release the GPU resources and clear the per-face view cache. Idempotent;\n * subsequent calls are zero-cost. After dispose, `isAllocated()` returns\n * `false` and the next `ensure()` re-allocates from scratch.\n */\n dispose(): void {\n this.faceViews.clear();\n if (this.texture !== null) {\n this.device.destroyTexture(this.texture);\n this.texture = null;\n }\n this.cubeArrayView = null;\n this.compareSampler = null;\n }\n}\n","import type { AssetRuntimeError } from '@forgeax/engine-assets-runtime';\nimport type { World } from '@forgeax/engine-ecs';\nimport type { RenderReadLease } from '@forgeax/engine-ecs/projection';\nimport type { Vec3 } from '@forgeax/engine-math';\nimport type { ProfileFrameToken, Profiler } from '@forgeax/engine-profiler';\nimport type { ColorValueDomain, RenderGraphError } from '@forgeax/engine-render-graph';\nimport type {\n BindGroupLayout,\n Buffer,\n Result,\n RhiCanvasSurfacePresentationProof,\n RhiCaps,\n RhiCommandEncoder,\n RhiDevice,\n RhiError,\n RhiInstance,\n RhiRenderPassEncoder,\n RenderPipeline as RhiRenderPipeline,\n Sampler,\n Texture,\n TextureFormat,\n TextureView,\n} from '@forgeax/engine-rhi';\nimport type { SkinError } from '@forgeax/engine-skinning';\nimport type { ImageError } from '@forgeax/engine-types';\nimport type { RhiBackendInstrumentation } from './assembly/backend-contract';\nimport type { Antialias, BloomEnabled, Tonemap } from './components/camera';\nimport type { EnvironmentInspection } from './environment/inspection';\nimport type { RecoveryOutcome, RecoveryPhase } from './errors/recover';\nimport type { RenderError } from './errors/render';\nimport type { RenderFeature, RenderFeatureDiagnostics } from './features/types';\nimport type { PostProcessShaderEntry } from './fullscreen-post-process-pass';\nimport type {\n BloomInspection,\n DirectionalShadowInspection,\n LightInspection,\n LodOcclusionInspection,\n MotionBlurInspection,\n ReflectionProbeInspection,\n RenderSceneInspection,\n SsrDependenciesInspection,\n TemporalTargetInspection,\n TransmissionInspection,\n} from './inspection-types';\nimport type { InstanceCollectionInspection } from './instances';\nimport type { SsrAdmissionIdentity } from './ssr/identity';\nimport type {\n RenderTarget,\n RenderTargetDescriptor,\n RenderTargetReadbackData,\n RenderTargetReadbackRequest,\n RenderTargetReadbackTicket,\n RenderTargetTextureSource,\n RenderTargetTextureSourceOptions,\n} from './targets/contracts';\nimport type { TemporalInspection } from './temporal/inspection';\n\nexport type { TransmissionInspection } from './inspection-types';\nexport type { PointsLinesInspection } from './points-lines/inspection';\n\nimport type {\n IblBindingInspection,\n MeshMaterialBindingObservation,\n} from './mesh-material-bindings';\nimport type { StandardLightingInspection } from './pipeline/standard-lighting/inspection';\nimport type { StandardProfile } from './pipeline/standard-profile';\nimport type { PointShadowInspection } from './point-shadow-inspection';\nimport type { PostProcessError } from './post-process-errors';\nimport type {\n GpuPassTimingObservation,\n GpuPassTimingOptions,\n} from './record/gpu-pass-timing/index.js';\nimport type { VolumeTimingObservation } from './record/gpu-timing';\nimport type { TemporalView } from './temporal/view';\nimport type { VolumetricFogInspection } from './volume/inspection';\n\nexport type {\n CubeCameraFace,\n CubeCameraUpdateIntent,\n} from './components/cube-camera';\n\nexport interface CubeCameraSnapshot {\n readonly entityKey?: number;\n readonly target: RenderTarget;\n readonly position: readonly [number, number, number];\n readonly near: number;\n readonly far: number;\n readonly updateIntent: import('./components/cube-camera').CubeCameraUpdateIntent;\n readonly requestVersion: number;\n readonly faceBudget: number;\n}\n\nexport type RenderResult<T, E> =\n | { readonly ok: true; readonly value: T }\n | { readonly ok: false; readonly error: E };\n\n/** The only World data boundary accepted by the M6 renderer contract. */\nexport type RenderWorldLease = RenderReadLease;\n\n/**\n * Camera facts shared by extract, record, and scene owners.\n *\n * The extract stage resolves ECS camera state once and publishes this closed\n * POD contract. Keeping it beside the render lifecycle contracts prevents\n * extract from depending on the record implementation owner.\n */\nexport interface CameraSnapshot {\n /** Stable ECS identity used by the frame plan's camera authority fact. */\n readonly entityKey?: number;\n /** Auxiliary logical target; physical views remain renderer-owned. */\n readonly target?: RenderTarget;\n /** World index supplied by the multi-world extract merge. */\n readonly worldId?: number;\n /** Camera-owned history generation forwarded into the frame plan. */\n readonly historyVersion?: number;\n /** World-space camera translation (mat4.getTranslation of GlobalTransform.world). */\n readonly position: Vec3;\n /** Resolved world-space camera mat4, copied from GlobalTransform.world. */\n readonly world: Float32Array;\n readonly fov: number;\n readonly aspect: number;\n readonly near: number;\n readonly far: number;\n /** Camera projection variant used by view and shadow matrix builders. */\n readonly projection: 'perspective' | 'orthographic';\n readonly orthoLeft: number;\n readonly orthoRight: number;\n readonly orthoBottom: number;\n readonly orthoTop: number;\n readonly tonemap: Tonemap;\n readonly exposure: number;\n readonly whitePoint: number;\n readonly antialias: Antialias;\n readonly bloom: BloomEnabled;\n readonly bloomThreshold: number;\n readonly bloomIntensity: number;\n readonly bloomBlurRadius: number;\n readonly clearColor: readonly [number, number, number, number];\n /** Renderer-owned temporal projection used by Standard's TAA producer. */\n readonly temporal?: TemporalView;\n /** Active-camera motion blur parameters, present only when demanded. */\n readonly motionBlur?: {\n readonly shutterAngle: number;\n readonly maxRadiusPixels: number;\n readonly sampleCount: number;\n };\n}\n\n/** Stable identity owned by the Standard feature host for output transform. */\nexport const STANDARD_OUTPUT_TRANSFORM_FEATURE_ID = 'forgeax::standard::output-transform';\n\n/** Stable identity for the special FXAA pass' per-frame output policy UBO. */\nexport const FXAA_POST_PROCESS_ID = 'forgeax::post::fxaa';\n\nexport type {\n EnvironmentFrame,\n EnvironmentSource,\n FogFrame,\n FramePlan,\n} from './extract/environment';\nexport type { TemporalView } from './temporal/view';\n\n/**\n * Render-graph state exposed to pipeline declarations. Concrete pipeline\n * caches stay in the assembly owner; graph code only needs the two target\n * formats that affect fullscreen descriptors.\n */\ninterface RenderPipelineStateView {\n readonly format: TextureFormat;\n readonly colorAttachmentFormat: TextureFormat;\n /** Renderer-owned View UBO shared by Standard lighting, shadows, and fog. */\n readonly viewUniformBuffer: Buffer;\n /** Fallback resources keep the shared view layout valid when no projector is authored. */\n readonly defaultWhiteTextureView: TextureView;\n readonly defaultSampler: Sampler;\n}\n\n/**\n * Narrow runtime capability consumed by typed graph primitives. The concrete\n * RenderSystemRuntime structurally satisfies this contract, but the public\n * frame surface does not depend on that assembly owner.\n */\ninterface RenderPipelineRuntime {\n readonly device: RhiDevice;\n /** Runtime-owned shader module factory used by built-in graph producers. */\n readonly shaderModuleFactory?: {\n createShaderModule(input: {\n readonly code: string;\n readonly label?: string | undefined;\n }): import('@forgeax/engine-types').Result<\n import('@forgeax/engine-rhi').ShaderModule,\n RhiError\n >;\n };\n readonly errorRegistry: { fire(error: RendererError): void };\n readonly debugOverlay?: RenderDebugOverlay | undefined;\n readonly lookupPostProcess?: (id: string) => PostProcessShaderEntry | undefined;\n readonly getPostProcessParamsBuffer?: (id: string) => Buffer | undefined;\n readonly getPostProcessPipeline?: (\n id: string,\n bgl: BindGroupLayout,\n colorFormat: GPUTextureFormat,\n entry?: PostProcessShaderEntry,\n ) => RhiRenderPipeline | null;\n}\n\n/**\n * Render-owned declaration for an app-provided debug overlay. App owns the\n * concrete DebugDraw instance and its GPU lifecycle; Render only records this\n * capability in the typed graph.\n */\nexport interface RenderDebugOverlay {\n encode(\n pass: RhiRenderPassEncoder,\n viewProj: import('@forgeax/engine-math').Mat4,\n ): Result<void, unknown>;\n}\n\n/**\n * The leaf frame context consumed by RenderPipeline and graph primitives.\n * Concrete assembly data is added only by the internal record extension in\n * render-system.ts, so this contract never imports the RenderSystem owner.\n */\nexport interface RenderPipelineContext {\n readonly pipelineState: RenderPipelineStateView;\n readonly runtime: RenderPipelineRuntime;\n readonly encoder: RhiCommandEncoder;\n readonly view: TextureView;\n readonly clear: readonly [number, number, number, number] | number[];\n readonly targetW: number;\n readonly targetH: number;\n readonly currentTexture: Texture;\n readonly camera: CameraSnapshot;\n /** Per-frame post-process parameter bytes keyed by shader id. */\n readonly postProcessParams: ReadonlyMap<string, Uint8Array>;\n readonly msaaActive: boolean;\n readonly geometryColorResolveView: TextureView | null;\n readonly ldrSpriteColorView: TextureView | null;\n /** Renderer-owned volume resources prepared from the authored ECS snapshot. */\n readonly volumetricFog?: VolumetricFogFrameContext;\n /** Renderer-owned SpotLight projector resources, independent of fog. */\n readonly spotLightProjector?: SpotLightProjectorFrameContext;\n /** Build-time composed utility sources for the renderer-owned volume passes. */\n readonly volumetricFogShaders?: VolumetricFogShaderSources;\n}\n\n/** Stable utility entry-point sources emitted by the shader manifest. */\nexport interface VolumetricFogShaderSources {\n readonly inject: string;\n readonly temporal: string;\n readonly integrate: string;\n readonly composite: string;\n}\n\n/**\n * GPU resources for one validated volumetric-fog candidate. The record stage\n * owns residency and parameter uploads; graph passes consume this narrow view\n * and never reach into AssetRegistry or World.\n */\nexport interface VolumetricFogFrameContext {\n readonly densityTexture: Texture;\n readonly densityView: TextureView;\n readonly paramsBuffer: Buffer;\n readonly densityGeneration: number;\n /** Accepted graph-owned history slot; null means first frame/reset. */\n readonly historyReadSlot: 0 | 1 | null;\n /** Pending graph-owned history slot; promoted only after queue.submit succeeds. */\n readonly historyWriteSlot: 0 | 1;\n readonly historyValid: boolean;\n /** Accepted SpotLight projector resources resolved by the GPU residency owner. */\n readonly projectorTexture?: Texture;\n readonly projectorView?: TextureView;\n readonly projectorSampler?: Sampler;\n}\n\n/**\n * GPU resources for the single surface SpotLight projector binding. The\n * projector is a SpotLight-owned cookie and therefore remains available when\n * volumetric fog is disabled; volume integration may reuse the same tuple.\n */\nexport interface SpotLightProjectorFrameContext {\n readonly texture: Texture;\n readonly view: TextureView;\n readonly sampler: Sampler;\n /** Spot-light index in ExtractedLights.spot for the accepted texture. */\n readonly spotIndex?: number;\n /** Unified Standard Cluster slot index (points precede spots). */\n readonly lightSlotIndex?: number;\n}\n\n/**\n * The sole public renderer contract. Consume it in this order:\n * `state()` -> `inspect()` -> `recover()` when degraded -> `draw()` and its\n * `FrameReceipt`. Concrete assembly stays behind the host; callers retain only\n * leases, receipts, inspection PODs, and recovery Result values.\n */\nexport interface Renderer {\n /** Renderer-owned authoring and update path for large instance collections. */\n attach(world: World): RenderResult<RenderWorldLease, RenderError>;\n draw(input: RenderFrameInput): RenderResult<FrameReceipt, RenderError>;\n createRenderTarget(descriptor: RenderTargetDescriptor): RenderResult<RenderTarget, RenderError>;\n resizeRenderTarget(\n target: RenderTarget,\n descriptor: RenderTargetDescriptor,\n ): RenderResult<void, RenderError>;\n createRenderTargetTextureSource(\n target: RenderTarget,\n options: RenderTargetTextureSourceOptions,\n ): RenderResult<RenderTargetTextureSource, RenderError>;\n requestTargetReadback(\n target: RenderTarget,\n request: RenderTargetReadbackRequest,\n ): RenderResult<RenderTargetReadbackTicket, RenderError>;\n destroyRenderTarget(target: RenderTarget): RenderResult<void, RenderError>;\n setProfile(profile: RenderProfile): RenderResult<void, RenderError>;\n state(): RendererState;\n inspect(): RenderInspection;\n observe(\n receipt: FrameReceipt,\n request: FrameObservationRequest,\n ): Promise<RenderResult<FrameReceiptObservation, RenderError>>;\n subscribe(listener: (event: RendererEvent) => void): () => void;\n releaseSurface(): RenderResult<void, RenderError>;\n restoreSurface(): RenderResult<void, RenderError>;\n /** Recover only from device-lost; a healthy renderer returns a guard error. */\n recover(): Promise<RenderResult<void, RenderError>>;\n dispose(): Promise<RenderResult<void, RenderError>>;\n}\n\n/**\n * The single public renderer lifecycle authority. This closed union is the\n * frame gate: only `alive` admits World update and draw; `device-lost` and\n * `recovering` are explicit recovery states; `faulted` requires recreation;\n * `disposed` is terminal.\n */\nexport type RendererState = 'alive' | 'device-lost' | 'recovering' | 'faulted' | 'disposed';\n\n/** Immutable, inspectable quality and budget policy for the Standard pipeline. */\nexport type RenderProfile = StandardProfile;\n\n/** Ordered events projected from renderer state and expected-operation failures. */\nexport type RendererEvent =\n | {\n readonly kind: 'state-changed';\n readonly previous: RendererState;\n readonly current: RendererState;\n }\n | { readonly kind: 'error'; readonly error: RenderError }\n /** Emitted only after the renderer's sole submit path returns a receipt. */\n | {\n readonly kind: 'frame-submitted';\n readonly frameId: number;\n readonly deviceGeneration: number;\n };\n\n/** Package-local listener alias used by the renderer assembly implementation. */\nexport type RendererEventListener = (event: RendererEvent) => void;\n\n/**\n * Camera authority supplied for one frame; Render owns the lease contract and\n * the host releases it with the frame lifecycle. It is intentionally bound to\n * the attached scene lease and never accepts a backend object.\n */\nexport interface FrameCamera {\n readonly lease: RenderWorldLease;\n readonly entityKey?: number;\n}\n\n/**\n * Environment authority supplied for one frame. The scene/environment owner\n * supplies the identity; the host validates it against the attached lease.\n */\nexport interface FrameEnvironment {\n readonly lease: RenderWorldLease;\n readonly identity?: string;\n}\n\n/**\n * Receipt-bound observation selection. The request is consumed by `observe`\n * only with the matching FrameReceipt after `receipt.completed` and returns a\n * structured Result error when the generation or frame identity is stale.\n */\nexport interface FrameObservationRequest {\n readonly include: readonly ('timings' | 'draws' | 'bindings' | 'target-readbacks')[];\n readonly targetReadbacks?: readonly RenderTargetReadbackTicket[];\n}\n\n/**\n * Immutable synchronous proof that the sole host-owned submit reached the\n * queue. It is the only successful synchronous draw signal. Its\n * `deviceGeneration` fences stale work, and every observation request must use\n * this exact receipt; a recovery retry must obtain a new one.\n */\nexport interface FrameReceipt {\n readonly frameId: number;\n readonly deviceGeneration: number;\n readonly completed: Promise<RenderResult<void, RenderError>>;\n}\n\n/**\n * The sole public draw input; World objects never cross this boundary. Render\n * owns extraction and graph interpretation, while the host owns encoding,\n * finish, submit, and recovery of the attached lease generation.\n */\nexport interface RenderFrameInput {\n readonly leases: readonly RenderWorldLease[];\n readonly camera: FrameCamera;\n readonly environment: FrameEnvironment;\n /** Optional profiler correlation token owned by App and consumed by Render. */\n readonly profileFrame?: ProfileFrameToken;\n}\n\n/** Detached, bounded observation metadata tied to one FrameReceipt and request. */\nexport interface FrameReceiptObservation {\n readonly frameId: number;\n readonly deviceGeneration: number;\n readonly include: readonly ('timings' | 'draws' | 'bindings' | 'target-readbacks')[];\n /** Receipt-bound Render-owned GPU pass facts; absent when not requested. */\n readonly timings?: GpuPassTimingObservation | undefined;\n /** Receipt-bound volume GPU timing facts; absent when not requested. */\n readonly volumeTimings?: VolumeTimingObservation | undefined;\n readonly targetReadbacks?: readonly RenderTargetReadbackData[];\n}\n\n/** Stable backend facts for the Standard output transform projection. */\nexport interface RenderOutputInspection {\n readonly outputTransform?: typeof STANDARD_OUTPUT_TRANSFORM_FEATURE_ID;\n readonly displayEncoded: boolean;\n readonly intermediateFormat?: TextureFormat;\n /** Concrete surface route committed by configureSurface. */\n readonly surfaceProfile?: 'dual-view' | 'raw-only';\n /** Pass names from the same committed graph as the output facts. */\n readonly graphPassNames: readonly string[];\n /** Detached descriptor for the graph-owned output target, when present. */\n readonly standardOutputColor?: RenderStandardOutputColorInspection;\n readonly surfaceStorage: TextureFormat;\n readonly surfaceDisplay: TextureFormat;\n readonly endpoint: 'surface.storage.raw';\n readonly capability: 'rgba16float-renderable' | 'surface-raw-endpoint' | 'unavailable';\n readonly presentationProof?: RhiCanvasSurfacePresentationProof;\n readonly error:\n | {\n readonly code: string;\n readonly expected: string;\n readonly hint: string;\n readonly detail?: unknown;\n }\n | undefined;\n}\n\n/** Detached descriptor for the graph-owned display-encoded intermediate. */\nexport interface RenderStandardOutputColorInspection {\n readonly format: TextureFormat;\n readonly domain?: ColorValueDomain;\n readonly width: number;\n readonly height: number;\n readonly sampleCount: number;\n readonly usage: number;\n}\n\n/** Stable identity refs for a renderer-owned frame observation. */\nexport interface RenderObservationInspection {\n readonly observationId: string;\n readonly frameId: number;\n /** Camera antialias mode used by the frame carrying this observation. */\n readonly antialias?: Antialias;\n /** Surface route committed for the same frame graph. */\n readonly surfaceProfile?: 'dual-view' | 'raw-only';\n /** Capability fact used when resolving a raw-only float target. */\n readonly rgba16floatRenderable?: boolean;\n /** Exact pass names and target descriptor from the committed graph. */\n readonly passNames: readonly string[];\n readonly standardOutputColor?: RenderStandardOutputColorInspection;\n}\n\n/**\n * Detached renderer facts for host diagnostics and capability selection.\n *\n * The snapshot contains only POD values. It never exposes a device, queue,\n * registry, encoder, or live renderer-owned collection. Read `state` and the\n * bounded `recovery` detail before choosing to wait, retry, repair an owner,\n * or recreate the Renderer; this projection is not a proof of Browser/Dawn\n * execution.\n */\nexport interface RenderInspection {\n readonly state: RendererState;\n /** Bounded detached facts for the current or last recovery attempt. */\n readonly recovery: {\n readonly phase: RecoveryPhase | null;\n readonly fromGeneration: number;\n readonly candidateGeneration: number;\n readonly attempt: number;\n readonly elapsedMs: number;\n readonly lastOutcome: RecoveryOutcome;\n readonly failedOwner?: string;\n readonly failedResourceKind?: string;\n readonly rehydratedRoots: number;\n readonly staleLossEvents: number;\n };\n readonly surface: 'available' | 'released';\n readonly profile: RenderProfile;\n readonly capabilities: Readonly<RhiCaps>;\n readonly frame: {\n readonly frameId: number;\n readonly deviceGeneration: number;\n };\n /** Renderer-owned authored volume projection and submit/LKG state. */\n readonly volumetricFog?: VolumetricFogInspection;\n readonly features: readonly string[];\n /** Truthful lifecycle facts for every registered declarative feature. */\n readonly featureDiagnostics: readonly RenderFeatureDiagnostics[];\n readonly frustumStats: { readonly culled: number; readonly total: number };\n readonly visibilityStats: { readonly explicitlyHidden: number };\n /** Renderer-owned large-instance residency and upload facts. */\n readonly instanceCollections: readonly InstanceCollectionInspection[];\n readonly renderScene: RenderSceneInspection;\n readonly reflectionProbes: ReflectionProbeInspection;\n /** Renderer-owned SSR dependency seam; consumer facts are projected from live owners. */\n readonly ssrDependencies: SsrDependenciesInspection;\n /** Last completed transmission candidate facts, detached from GPU handles. */\n readonly transmission?: TransmissionInspection;\n /** Last prepared Standard transport facts, detached from GPU handles. */\n readonly standardLighting?: StandardLightingInspection;\n /** Renderer-owned point-shadow atlas budget facts from the last frame. */\n readonly pointShadow?: PointShadowInspection;\n readonly meshMaterialBindings: readonly MeshMaterialBindingObservation[];\n /** Final-submit Standard IBL binding-chain receipt, when diagnostics ran. */\n readonly iblBinding?: IblBindingInspection;\n readonly perFramePassNames: readonly string[];\n readonly bindGroupCounts: {\n readonly createBindGroup: number;\n readonly keys: readonly string[];\n };\n /**\n * Recovery evidence projected from production owners. Graph, residency,\n * submit, and receipt fields are observations, not recovery test fixtures.\n */\n readonly recoveryEvidence: {\n readonly producerRoots: readonly {\n readonly kind: string;\n readonly owner: string;\n readonly candidateScope: 'device-scope';\n readonly visibility: 'visible-workset' | 'non-visible-lazy';\n readonly disabledWork: 'zero' | 'lazy';\n }[];\n readonly graph: {\n readonly ready: boolean;\n readonly generation: number;\n readonly passCount: number;\n readonly resourceCount: number;\n };\n readonly residency: { readonly meshResidencyEpoch: number };\n readonly submissions: {\n readonly count: number;\n readonly lastGeneration: number | undefined;\n };\n readonly receipts: {\n readonly count: number;\n readonly lastGeneration: number | undefined;\n };\n };\n /** Output transform facts; never includes fixture metrics or pixel bytes. */\n readonly outputTransform?: typeof STANDARD_OUTPUT_TRANSFORM_FEATURE_ID;\n readonly displayEncoded: boolean;\n readonly intermediateFormat?: TextureFormat;\n readonly surfaceStorage: TextureFormat;\n readonly surfaceDisplay: TextureFormat;\n readonly endpoint: 'surface.storage.raw';\n readonly capability: RenderOutputInspection['capability'];\n readonly presentationProof?: RhiCanvasSurfacePresentationProof;\n readonly error: RenderOutputInspection['error'];\n readonly observation: RenderObservationInspection;\n readonly environment: EnvironmentInspection;\n readonly temporal: TemporalInspection;\n readonly bloom: BloomInspection;\n /** Candidate/accepted/LKG facts for the single extendedLighting topology. */\n readonly extendedLighting: LightInspection;\n readonly directionalShadow: DirectionalShadowInspection;\n /** Semantic Standard temporal target metadata; no graph or RHI handles. */\n readonly temporalTarget?: TemporalTargetInspection;\n /** Renderer-owned Motion Blur facts; absent when no component is active. */\n readonly motionBlur?: MotionBlurInspection;\n /** Bounded renderer-owned LOD/occlusion facts; absent before a candidate frame. */\n readonly lodOcclusion?: LodOcclusionInspection;\n}\n\n/** Backend marker — single-element union preserved for future extensibility (D-2). */\n/**\n * `renderer.draw(worlds, options)` owner options\n * (feat-20260709-editor-world-partition M1 / w6, plan-strategy §2 D-3).\n *\n * The single `owner` index that previously served BOTH the surfaced cameras\n * and the singleton render resources (skylight / skybox / postProcessParams) is\n * split into two independent indices:\n * - `cameraOwner` — the world whose cameras are surfaced.\n * - `resourceOwner` — the world whose skylight / skybox / postProcessParams\n * are surfaced.\n *\n * Both owners are always explicit. Single-world callers pass zero for both;\n * composite callers may select different worlds.\n */\nexport type DrawOwnerOptions = {\n readonly cameraOwner: number;\n readonly resourceOwner: number;\n readonly profileFrame?: ProfileFrameToken;\n};\n\n/** Information attached to a device-loss notification. */\nexport interface RendererLostInfo {\n /** Concise machine-readable cause, mapped to a single vocabulary. */\n reason: string;\n /** Free-form description (UA / extension / driver text). */\n message: string;\n}\n\n/** Listener registered through `Renderer.onLost`. */\nexport type RendererLostListener = (info: RendererLostInfo) => void;\n\n/**\n * Composite error type retained for package-local renderer diagnostics. The\n * public Renderer projects expected operation failures through the single\n * `subscribe` event stream and its `error` event; this type does NOT define a\n * error; it only references the cluster unions whose members can arrive here.\n * As such it is an external wire alias (AGENTS.md Change stance add-only wire\n * exception), NOT the eliminated cross-cluster `RuntimeError` SSOT (D-3).\n *\n * Composition = `RhiError | RenderError | AssetRuntimeError | SkinError |\n * PostProcessError`. This equals the pre-decomposition\n * `RhiError | RuntimeError | PostProcessError` exactly: `RuntimeError` was\n * `RenderError | AssetRuntimeError | SkinError` (27 classes). `RecoverError`\n * and `EngineEnvironmentError` are intentionally excluded — neither is ever\n * emitted through the Renderer event stream (`RecoverError` returns from `recover()`,\n * `EngineEnvironmentError` throws at construction), matching the original\n * `RuntimeError` union which excluded both (OOS-3 behavior equivalence).\n *\n * AI consumers do `switch (err.code)` over the union: the disjoint\n * `RhiErrorCode` / `RenderErrorCode` / `AssetRuntimeErrorCode` / `SkinErrorCode`\n * / `PostProcessErrorCode` literal sets let TS narrow each arm to the concrete\n * class (charter P3 union discoverability — every fan-out member is reachable\n * in an exhaustive switch, no untyped escape). Example:\n *\n * ```ts\n * renderer.subscribe((event) => {\n * if (event.kind !== 'error') return;\n * switch (event.error.code) {\n * case 'asset-not-registered': // AssetRuntimeError arm, err narrowed here\n * return report(err.hint);\n * // ...one arm per RhiErrorCode | RenderErrorCode | AssetRuntimeErrorCode\n * // | SkinErrorCode | PostProcessErrorCode member; no default needed,\n * // TS flags every unhandled code at compile time.\n * }\n * });\n * ```\n */\nexport type RendererError =\n | RhiError\n | RenderGraphError\n | ImageError\n | RenderError\n | AssetRuntimeError\n | SkinError\n | PostProcessError;\n\n/**\n * Package-local error listener retained for host assembly. Public consumers\n * use `Renderer.subscribe` and receive `RendererEvent` instead.\n */\nexport type RendererErrorListener = (error: RendererError) => void;\n\n/**\n * Built-in graph pass owners used as nested children of `record/graph-execute`.\n * Unknown extension pass names use the explicit `other` bucket so custom\n * pipelines retain a bounded catalog while the default render workload gets\n * actionable owner attribution.\n */\nexport const RENDER_GRAPH_EXECUTION_PHASE_CATALOG = [\n 'record/graph-execute/point-shadow',\n 'record/graph-execute/cluster-binner-upload',\n 'record/graph-execute/g-buffer',\n 'record/graph-execute/g-buffer/geometry-loop',\n 'record/graph-execute/g-buffer/material-bind-groups',\n 'record/graph-execute/g-buffer/pipeline-selection',\n 'record/graph-execute/g-buffer/draw-submit',\n 'record/graph-execute/ssao-calc',\n 'record/graph-execute/ssao-blur',\n 'record/graph-execute/lighting',\n 'record/graph-execute/forward',\n 'record/graph-execute/forward/geometry-loop',\n 'record/graph-execute/forward/material-bind-groups',\n 'record/graph-execute/forward/pipeline-selection',\n 'record/graph-execute/forward/draw-submit',\n 'record/graph-execute/output-transform',\n 'record/graph-execute/present',\n 'record/graph-execute/debug-overlay',\n 'record/graph-execute/shadow',\n 'record/graph-execute/spot-shadow',\n 'record/graph-execute/skybox',\n 'record/graph-execute/main',\n 'record/graph-execute/fxaa',\n 'record/graph-execute/bloom-bright',\n 'record/graph-execute/bloom-blur-h',\n 'record/graph-execute/bloom-blur-v',\n 'record/graph-execute/bloom-composite',\n 'record/graph-execute/other',\n] as const;\n\nexport type RenderGraphExecutionPhase = (typeof RENDER_GRAPH_EXECUTION_PHASE_CATALOG)[number];\n\n/** Bounded producer-owned children of the scene-state record owner. */\nexport const RENDER_HDRP_BINNER_PHASE_CATALOG = [\n 'record/scene-state/hdrp-cluster/binner/light-bounds-and-occupancy',\n 'record/scene-state/hdrp-cluster/binner/light-bounds-and-occupancy/light-aabb',\n 'record/scene-state/hdrp-cluster/binner/light-bounds-and-occupancy/cluster-occupancy',\n 'record/scene-state/hdrp-cluster/binner/cluster-reserve',\n 'record/scene-state/hdrp-cluster/binner/input-preparation',\n 'record/scene-state/hdrp-cluster/binner/bin-core',\n 'record/scene-state/hdrp-cluster/binner/light-index-write',\n 'record/scene-state/hdrp-cluster/binner/light-index-write/bounds-read',\n 'record/scene-state/hdrp-cluster/binner/light-index-write/cluster-write',\n] as const;\n\nexport const RENDER_HDRP_CLUSTER_PHASE_CATALOG = [\n 'record/scene-state/hdrp-cluster/binner',\n ...RENDER_HDRP_BINNER_PHASE_CATALOG,\n 'record/scene-state/hdrp-cluster/payload-packing',\n 'record/scene-state/hdrp-cluster/buffer-upload',\n] as const;\n\nexport type RenderHdrpClusterPhase = (typeof RENDER_HDRP_CLUSTER_PHASE_CATALOG)[number];\n\nexport const RENDER_SCENE_STATE_PHASE_CATALOG = [\n 'record/scene-state/fold-buckets',\n 'record/scene-state/lighting-prep',\n 'record/scene-state/ambient-resolution',\n 'record/scene-state/directional-shadow-cache',\n 'record/scene-state/hdrp-cluster',\n ...RENDER_HDRP_CLUSTER_PHASE_CATALOG,\n] as const;\n\n/**\n * Opt-in boundaries inside one `Renderer.draw` call. The observer is a\n * diagnostics seam only: it receives wall-time boundaries and must never be\n * required for rendering correctness. The stage names mirror the existing\n * engine-owned Extract / Prepare / Record orchestration so a host can measure\n * attribution without guessing from RHI command counts.\n */\nexport const RENDER_RECORD_PHASE_CATALOG = [\n 'record/occlusion-query-submit',\n 'record/occlusion-global-advance',\n 'record/scene-state',\n ...RENDER_SCENE_STATE_PHASE_CATALOG,\n 'record/swapchain',\n 'record/render-graph',\n 'record/target-views',\n 'record/validation',\n 'record/dispatch-plan',\n 'record/uploads',\n 'record/bind-groups',\n 'record/graph-execute',\n ...RENDER_GRAPH_EXECUTION_PHASE_CATALOG,\n] as const;\n\nexport type RenderRecordPhase = (typeof RENDER_RECORD_PHASE_CATALOG)[number];\n\nexport const RENDER_PHASE_CATALOG = [\n 'extract',\n 'occlusion-prepare',\n 'bind-groups',\n 'features',\n 'sort',\n 'record',\n ...RENDER_RECORD_PHASE_CATALOG,\n] as const;\n\nexport type RenderPhase = (typeof RENDER_PHASE_CATALOG)[number];\n\nexport type RenderPhaseSkipReason =\n | 'feature-host-unavailable'\n | 'feature-host-empty'\n | 'pipeline-state-unavailable'\n | 'camera-unavailable';\n\n/** First-version options bag (intentionally empty; reserved for v0.1). */\nexport interface RendererOptions {\n /** Producer-owned features installed by the renderer host. */\n readonly features?: readonly RenderFeature<unknown>[] | undefined;\n /** Standard profile consumed by the single renderer-owned pipeline. */\n readonly standardProfile?: RenderProfile | undefined;\n /** Explicit profiler capability shared by App and Render. */\n readonly profiler?: Profiler | undefined;\n /** Explicitly request timestamp-query for receipt-bound GPU profiling. */\n readonly captureGpuTimings?: boolean | undefined;\n /** Optional host-owned RHI lifecycle instrumentation, such as recording. */\n readonly rhiInstrumentation?: RhiBackendInstrumentation | undefined;\n /** Optional bounded GPU pass timing facts; this is not frame latency. */\n readonly gpuPassTiming?: GpuPassTimingOptions | undefined;\n /** Exact source/tree/lock/build identity binding for the renderer-owned SSR seam. */\n readonly ssrIdentity?: SsrAdmissionIdentity | undefined;\n // feat-20260608-create-app-param-surface-trim / M1 / AC-02: `clearColor`\n // was deleted as a one-cut breaking change (AGENTS.md Change stance +\n // requirements constraint #1: no deprecation window, no shim). Scene\n // clear color now lives on the Camera entity (`clearColor`, an inline\n // array<f32,4> column as of feat-20260709 M3); zero-Camera fallback uses\n // `ZERO_CAMERA_CLEAR_FALLBACK = [0, 0, 0, 1]` from\n // `render-system-record`. AI users that pass `{ clearColor: [...] }` on\n // RendererOptions still get a TS2353 excess-property error at compile time.\n //\n // feat-20260608-create-app-param-surface-trim / M2 / AC-06 + D-3:\n // `shaderManifestUrl` was deleted from RendererOptions and moved to\n // the third-arg `BundlerOptions` (build-tool injection channel). The\n // fallback literal '/shaders/manifest.json' stays at the createRenderer\n // body site (D-2 q5-A) so the LO 1.1 zero-config takeoff path keeps\n // working without explicit injection. AI users that pass\n // `{ shaderManifestUrl: '...' }` to RendererOptions get a TS2353\n // excess-property error at compile time pointing them to the third\n // arg (charter P1 progressive disclosure -- the message names\n // BundlerOptions, not a free-form string).\n /**\n * M3 D-P4 escape hatch (feat-20260511-rhi-wgpu-impl): explicit\n * `RhiInstance` injection bypasses the dynamic-import auto-select\n * facade. When set, `createRenderer` uses this instance verbatim and\n * neither concrete backend adapter is imported dynamically (charter\n * proposition 5 discoverable opt-in /\n * plan-strategy §6 M3 + §7.4 escape hatch + Bevy\n * `RenderCreation::Manual` partial equivalent).\n *\n * Typical use cases:\n * - Testing / debugging — inject a deterministic stub.\n * - Pinning a specific backend even when the browser adapter is present,\n * for cross-shim regression tests.\n * - Advanced AI users implementing their own `RhiInstance` shim.\n *\n * AI users who want the default behaviour leave this field omitted;\n * `navigator.gpu` presence/absence drives the dynamic import (see the\n * `createRenderer` JSDoc for the full auto-select decision tree).\n */\n readonly rhi?: RhiInstance | undefined;\n}\n\n// ────────────────────────────────────────────────────────────────────────────\n// Renderer health / recover surface (feat-20260621-renderer-health-recover-skeleton M1)\n// ────────────────────────────────────────────────────────────────────────────\n\n/**\n * Closed union of renderer health states.\n *\n * 3 members per plan-strategy D-1:\n * - `'alive'` — healthy baseline (registry not yet fired)\n * - `'device-lost'` — device loss detected\n * - `'internal-fault'` — internal renderer fault\n *\n * AI users exhaustively switch on `HealthReason` without default; TS guards\n * completeness.\n */\nexport type HealthReason = 'alive' | 'device-lost' | 'internal-fault';\n\n/** Detail for `HealthReason 'device-lost'`. */\nexport interface HealthDetailDeviceLost {\n readonly lostReason: 'unknown' | 'destroyed';\n readonly message: string;\n}\n\n/** Detail for `HealthReason 'internal-fault'`. */\nexport interface HealthDetailInternalFault {\n readonly message: string;\n}\n\n/**\n * Pull-style health snapshot — discriminated union by `reason`.\n *\n * Per plan-strategy D-2: `switch(snap.reason)` narrows `snap.detail` to the\n * per-reason detail type automatically, with zero `as` casts. `alive` has no\n * `.detail` field; `device-lost` / `internal-fault` have a required `.detail`\n * of the respective variant.\n *\n * - `recoverable` — explicit snapshot data owned by the lifecycle authority\n */\nexport type HealthSnapshot =\n | { readonly reason: 'alive'; readonly recoverable: boolean }\n | {\n readonly reason: 'device-lost';\n readonly detail: HealthDetailDeviceLost;\n readonly recoverable: boolean;\n }\n | {\n readonly reason: 'internal-fault';\n readonly detail: HealthDetailInternalFault;\n readonly recoverable: boolean;\n };\n\n/**\n * Maps `HealthReason` to recoverable boolean per the derive table\n * (requirements section \"range\"):\n *\n * | reason | recoverable |\n * |:---------------|:-----------|\n * | `'alive'` | false |\n * | `'device-lost'`| true |\n * | `'internal-fault'` | false |\n */\n/** Callback type for `Renderer.onHealthChange`. */\nexport type HealthChangeListener = (snapshot: HealthSnapshot) => void;\n"]}
@@ -1,62 +0,0 @@
1
- import { HANDLE_CUBE } from '@forgeax/engine-assets-runtime';
2
- import { World } from '@forgeax/engine-ecs';
3
- import { registerPropagateTransforms, Transform } from '@forgeax/engine-scene';
4
- import { describe, expect, it } from 'vitest';
5
- import { Camera } from '../components/camera';
6
- import { Instances } from '../components/instances';
7
- import { MeshFilter } from '../components/mesh-filter';
8
- import { MeshRenderer } from '../components/mesh-renderer';
9
- import { extractFrames } from '../render-system-extract';
10
-
11
- function matrices(count: number, x: number): Float32Array {
12
- const out = new Float32Array(count * 16);
13
- for (let i = 0; i < count; i++) {
14
- out[i * 16] = out[i * 16 + 5] = out[i * 16 + 10] = out[i * 16 + 15] = 1;
15
- out[i * 16 + 12] = x;
16
- }
17
- return out;
18
- }
19
-
20
- function scene(count: number, x: number) {
21
- const world = new World();
22
- registerPropagateTransforms(world);
23
- world
24
- .spawn(
25
- { component: Transform, data: { pos: [0, 0, 5] } },
26
- { component: Camera, data: { fov: Math.PI / 4, aspect: 1, near: 0.1, far: 100 } },
27
- )
28
- .unwrap();
29
- const entity = world
30
- .spawn(
31
- { component: Transform, data: {} },
32
- { component: MeshFilter, data: { assetHandle: HANDLE_CUBE } },
33
- { component: MeshRenderer, data: {} },
34
- { component: Instances, data: { transforms: matrices(count, x) } },
35
- )
36
- .unwrap();
37
- world.update(0).unwrap();
38
- return { world, entity };
39
- }
40
-
41
- describe('World-owned instance authoring', () => {
42
- it.each([1500, 10000, 20000])('extracts %s matrices without creating a Renderer', (count) => {
43
- const { world } = scene(count, 0);
44
- const snapshot = extractFrames([world], 0).renderables[0]?.instances;
45
- expect(snapshot?.instanceCount).toBe(count);
46
- expect(snapshot?.transforms).toEqual(matrices(count, 0));
47
- });
48
-
49
- it('keeps worlds isolated and lets independent consumers observe skipped updates', () => {
50
- const a = scene(2, 0);
51
- const b = scene(2, 1);
52
- const before = extractFrames([a.world], 0).renderables[0]?.instances;
53
- expect(extractFrames([b.world], 0).renderables[0]?.instances?.transforms[12]).toBe(1);
54
- a.world.set(a.entity, Instances, { transforms: matrices(2, 0.5) }).unwrap();
55
- extractFrames([a.world], 0);
56
- a.world.set(a.entity, Instances, { transforms: matrices(2, -0.5) }).unwrap();
57
- const late = extractFrames([a.world], 0).renderables[0]?.instances;
58
- expect(late?.transforms[12]).toBe(-0.5);
59
- expect(before?.transforms[12]).toBe(0);
60
- expect(extractFrames([b.world], 0).renderables[0]?.instances?.transforms[12]).toBe(1);
61
- });
62
- });
@@ -1,36 +0,0 @@
1
- import { execFileSync } from 'node:child_process';
2
- import { describe, expect, it } from 'vitest';
3
-
4
- describe('Renderer block summary candidate receipt', () => {
5
- it('uses the same schema and dynamic workload contract as Scene without a production winner', () => {
6
- const receipt = {
7
- schemaVersion: 1,
8
- exactSha: execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim(),
9
- seed: 20260901,
10
- runner: 'vitest-node',
11
- consumer: 'renderer',
12
- workloads: ['dense-dynamic', 'sparse-dynamic', 'full-dynamic'].map((name) => ({
13
- name,
14
- rows: 10000,
15
- dynamicFrames: 300,
16
- })),
17
- candidates: [
18
- { name: 'row-only', stageMs: 1.4, allocations: 0, bytes: 0, correct: true },
19
- { name: 'row+derived-summary', stageMs: 1.5, allocations: 0, bytes: 640, correct: true },
20
- ],
21
- falsifiers: [
22
- { name: 'exact Changed<T> rows', passed: true },
23
- { name: 'summary-loss rebuild', passed: true },
24
- { name: 'dynamic renderer synchronization', passed: true },
25
- ],
26
- } as const;
27
- expect(receipt.exactSha).toMatch(/^[0-9a-f]{40}$/);
28
- expect(receipt.workloads).toHaveLength(3);
29
- expect(receipt.workloads.every((workload) => workload.dynamicFrames >= 300)).toBe(true);
30
- expect(receipt.candidates.every((candidate) => candidate.correct)).toBe(true);
31
- expect(receipt.falsifiers.every((falsifier) => falsifier.passed)).toBe(true);
32
- expect(receipt).not.toHaveProperty('winner');
33
- expect(receipt).not.toHaveProperty('changedBlockMax');
34
- console.log(JSON.stringify(receipt));
35
- });
36
- });