@forgeax/engine-render 0.1.21 → 0.1.24

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 (584) hide show
  1. package/README.md +281 -38
  2. package/dist/assembly/backend-contract.d.ts +13 -0
  3. package/dist/assembly/backend-contract.d.ts.map +1 -1
  4. package/dist/assembly/bundler-contract.d.ts +9 -0
  5. package/dist/assembly/bundler-contract.d.ts.map +1 -0
  6. package/dist/assembly/device-feature-admission.d.ts +8 -0
  7. package/dist/assembly/device-feature-admission.d.ts.map +1 -1
  8. package/dist/assembly/extended-lighting-fallback.d.ts +13 -0
  9. package/dist/assembly/extended-lighting-fallback.d.ts.map +1 -0
  10. package/dist/assembly/factory.d.ts +7 -235
  11. package/dist/assembly/factory.d.ts.map +1 -1
  12. package/dist/assembly/host-contract.d.ts +10 -0
  13. package/dist/assembly/host-contract.d.ts.map +1 -1
  14. package/dist/assembly/material/assembly.d.ts +3 -2
  15. package/dist/assembly/material/assembly.d.ts.map +1 -1
  16. package/dist/assembly/material/standard-layer-projection.d.ts +10 -0
  17. package/dist/assembly/material/standard-layer-projection.d.ts.map +1 -0
  18. package/dist/assembly/material-shader-policy.d.ts +168 -0
  19. package/dist/assembly/material-shader-policy.d.ts.map +1 -0
  20. package/dist/assembly/material-shader-prewarm.d.ts +21 -0
  21. package/dist/assembly/material-shader-prewarm.d.ts.map +1 -0
  22. package/dist/assembly/mesh-ssbo-grow.d.ts +88 -0
  23. package/dist/assembly/mesh-ssbo-grow.d.ts.map +1 -0
  24. package/dist/assembly/recovery/device-loss-fanout.d.ts +14 -0
  25. package/dist/assembly/recovery/device-loss-fanout.d.ts.map +1 -0
  26. package/dist/assembly/recovery/generation.d.ts +46 -0
  27. package/dist/assembly/recovery/generation.d.ts.map +1 -0
  28. package/dist/assembly/recovery/recovery-attempt.d.ts +63 -0
  29. package/dist/assembly/recovery/recovery-attempt.d.ts.map +1 -0
  30. package/dist/assembly/recovery/renderer-recover.d.ts +115 -0
  31. package/dist/assembly/recovery/renderer-recover.d.ts.map +1 -0
  32. package/dist/assembly/renderer-facade.d.ts +10 -0
  33. package/dist/assembly/renderer-facade.d.ts.map +1 -0
  34. package/dist/assembly/renderer-frame-transaction.d.ts +17 -0
  35. package/dist/assembly/renderer-frame-transaction.d.ts.map +1 -1
  36. package/dist/assembly/renderer-helpers.d.ts +19 -0
  37. package/dist/assembly/renderer-helpers.d.ts.map +1 -0
  38. package/dist/assembly/renderer-lifecycle.d.ts +34 -0
  39. package/dist/assembly/renderer-lifecycle.d.ts.map +1 -1
  40. package/dist/assembly/shader-prewarm-policy.d.ts +15 -0
  41. package/dist/assembly/shader-prewarm-policy.d.ts.map +1 -0
  42. package/dist/assembly/webgpu-ready-contract.d.ts +9 -0
  43. package/dist/assembly/webgpu-ready-contract.d.ts.map +1 -0
  44. package/dist/assembly/webgpu-ready.d.ts +55 -0
  45. package/dist/assembly/webgpu-ready.d.ts.map +1 -0
  46. package/dist/assembly/webgpu-renderer.d.ts +152 -0
  47. package/dist/assembly/webgpu-renderer.d.ts.map +1 -0
  48. package/dist/authoring.mjs +1 -1
  49. package/dist/{chunk-PCHBPYML.mjs → chunk-GE3SDD72.mjs} +37 -5
  50. package/dist/chunk-GE3SDD72.mjs.map +1 -0
  51. package/dist/chunk-KZFTK6DO.mjs +1191 -0
  52. package/dist/chunk-KZFTK6DO.mjs.map +1 -0
  53. package/dist/{chunk-FS2KNUQH.mjs → chunk-Q752SHI5.mjs} +332 -568
  54. package/dist/chunk-Q752SHI5.mjs.map +1 -0
  55. package/dist/{chunk-6OPXDQ2E.mjs → chunk-RR5L4SRS.mjs} +33 -294
  56. package/dist/chunk-RR5L4SRS.mjs.map +1 -0
  57. package/dist/chunk-TFH5I7JJ.mjs +296 -0
  58. package/dist/chunk-TFH5I7JJ.mjs.map +1 -0
  59. package/dist/chunk-UQYS7FRM.mjs +1003 -0
  60. package/dist/chunk-UQYS7FRM.mjs.map +1 -0
  61. package/dist/chunk-YKB5DQV7.mjs +345 -0
  62. package/dist/chunk-YKB5DQV7.mjs.map +1 -0
  63. package/dist/{chunk-5YADUCA7.mjs → chunk-YRUYGA4A.mjs} +1189 -1217
  64. package/dist/chunk-YRUYGA4A.mjs.map +1 -0
  65. package/dist/chunk-Z3YYH2MB.mjs +5082 -0
  66. package/dist/chunk-Z3YYH2MB.mjs.map +1 -0
  67. package/dist/cluster-binner.d.ts +5 -0
  68. package/dist/cluster-binner.d.ts.map +1 -1
  69. package/dist/components/index.d.ts +3 -0
  70. package/dist/components/index.d.ts.map +1 -1
  71. package/dist/components/light-helpers.d.ts +4 -0
  72. package/dist/components/light-helpers.d.ts.map +1 -1
  73. package/dist/components/light-probe.d.ts +9 -0
  74. package/dist/components/light-probe.d.ts.map +1 -0
  75. package/dist/components/rect-area-light.d.ts +12 -0
  76. package/dist/components/rect-area-light.d.ts.map +1 -0
  77. package/dist/components/scene-instance.d.ts +4 -0
  78. package/dist/components/scene-instance.d.ts.map +1 -1
  79. package/dist/components/spot-light.d.ts +3 -0
  80. package/dist/components/spot-light.d.ts.map +1 -1
  81. package/dist/construct-renderer.mjs +27276 -23232
  82. package/dist/construct-renderer.mjs.map +1 -1
  83. package/dist/device/device-scope.d.ts +2 -0
  84. package/dist/device/device-scope.d.ts.map +1 -1
  85. package/dist/device/gpu-residency.d.ts +32 -5
  86. package/dist/device/gpu-residency.d.ts.map +1 -1
  87. package/dist/device/lifecycle-transaction.d.ts +2 -0
  88. package/dist/device/lifecycle-transaction.d.ts.map +1 -0
  89. package/dist/environment/frame.d.ts +5 -0
  90. package/dist/environment/frame.d.ts.map +1 -1
  91. package/dist/environment/inspection.d.ts +7 -0
  92. package/dist/environment/inspection.d.ts.map +1 -1
  93. package/dist/environment/lifecycle.d.ts +20 -2
  94. package/dist/environment/lifecycle.d.ts.map +1 -1
  95. package/dist/errors/gpu-driven.d.ts +26 -0
  96. package/dist/errors/gpu-driven.d.ts.map +1 -0
  97. package/dist/errors/index.d.ts +1 -0
  98. package/dist/errors/index.d.ts.map +1 -1
  99. package/dist/errors/recover.d.ts +67 -3
  100. package/dist/errors/recover.d.ts.map +1 -1
  101. package/dist/errors/render.d.ts +39 -1
  102. package/dist/errors/render.d.ts.map +1 -1
  103. package/dist/extract/contracts.d.ts +899 -0
  104. package/dist/extract/contracts.d.ts.map +1 -0
  105. package/dist/extract/gpu-driven.d.ts +50 -0
  106. package/dist/extract/gpu-driven.d.ts.map +1 -0
  107. package/dist/extract/visibility.d.ts.map +1 -1
  108. package/dist/features/host.d.ts +2 -0
  109. package/dist/features/host.d.ts.map +1 -1
  110. package/dist/features/prepared-gpu-work.d.ts +3 -0
  111. package/dist/features/prepared-gpu-work.d.ts.map +1 -1
  112. package/dist/features/prepared-graphics-store.d.ts +2 -0
  113. package/dist/features/prepared-graphics-store.d.ts.map +1 -1
  114. package/dist/gpu-driven/batch-topology.d.ts +34 -0
  115. package/dist/gpu-driven/batch-topology.d.ts.map +1 -1
  116. package/dist/gpu-driven/prepared-draw.d.ts +63 -0
  117. package/dist/gpu-driven/prepared-draw.d.ts.map +1 -0
  118. package/dist/gpu-driven/production-raster.d.ts +126 -2
  119. package/dist/gpu-driven/production-raster.d.ts.map +1 -1
  120. package/dist/gpu-driven/view-gpu.d.ts +64 -1
  121. package/dist/gpu-driven/view-gpu.d.ts.map +1 -1
  122. package/dist/gpu-scene-schema.d.ts +14 -0
  123. package/dist/gpu-scene-schema.d.ts.map +1 -1
  124. package/dist/gpu-scene.d.ts +9 -1
  125. package/dist/gpu-scene.d.ts.map +1 -1
  126. package/dist/gpu-usage.d.ts +0 -1
  127. package/dist/gpu-usage.d.ts.map +1 -1
  128. package/dist/hdrp-buffers.d.ts +3 -3
  129. package/dist/hdrp-buffers.d.ts.map +1 -1
  130. package/dist/ibl/IblPipelineCache.d.ts +7 -6
  131. package/dist/ibl/IblPipelineCache.d.ts.map +1 -1
  132. package/dist/ibl/skylight-bind-group.d.ts +7 -1
  133. package/dist/ibl/skylight-bind-group.d.ts.map +1 -1
  134. package/dist/index.d.ts +13 -2
  135. package/dist/index.d.ts.map +1 -1
  136. package/dist/index.mjs +90 -5
  137. package/dist/index.mjs.map +1 -1
  138. package/dist/inspection-types.d.ts +163 -1
  139. package/dist/inspection-types.d.ts.map +1 -1
  140. package/dist/internal.d.ts +9 -0
  141. package/dist/internal.d.ts.map +1 -1
  142. package/dist/internal.mjs +23 -2
  143. package/dist/internal.mjs.map +1 -1
  144. package/dist/light-buffer-layout.d.ts +60 -148
  145. package/dist/light-buffer-layout.d.ts.map +1 -1
  146. package/dist/materials.d.ts +34 -10
  147. package/dist/materials.d.ts.map +1 -1
  148. package/dist/mesh-material-bindings.d.ts +56 -0
  149. package/dist/mesh-material-bindings.d.ts.map +1 -1
  150. package/dist/occlusion-proxy.d.ts +4 -0
  151. package/dist/occlusion-proxy.d.ts.map +1 -0
  152. package/dist/pbr-pipeline.d.ts +58 -21
  153. package/dist/pbr-pipeline.d.ts.map +1 -1
  154. package/dist/pipeline/standard-forward-lane.d.ts.map +1 -1
  155. package/dist/pipeline/standard-lighting/graph.d.ts.map +1 -1
  156. package/dist/pipeline/standard-lighting/light-frame.d.ts +3 -3
  157. package/dist/pipeline/standard-lighting/light-frame.d.ts.map +1 -1
  158. package/dist/pipeline/standard-lighting/topology.d.ts +1 -1
  159. package/dist/pipeline/standard-lighting/topology.d.ts.map +1 -1
  160. package/dist/pipeline/standard-lighting/transport.d.ts.map +1 -1
  161. package/dist/pipeline/standard-pipeline.d.ts.map +1 -1
  162. package/dist/pipeline-builder.d.ts +2 -0
  163. package/dist/pipeline-builder.d.ts.map +1 -1
  164. package/dist/pipeline-spec.d.ts +1 -1
  165. package/dist/pipeline-spec.d.ts.map +1 -1
  166. package/dist/plugin.d.ts.map +1 -1
  167. package/dist/points-lines/prepare.d.ts +3 -0
  168. package/dist/points-lines/prepare.d.ts.map +1 -1
  169. package/dist/points-lines/standard-owner.d.ts +33 -0
  170. package/dist/points-lines/standard-owner.d.ts.map +1 -0
  171. package/dist/prepare/extended-lighting/ltc-resources.d.ts +31 -0
  172. package/dist/prepare/extended-lighting/ltc-resources.d.ts.map +1 -0
  173. package/dist/prepare/extended-lighting/resources.d.ts +72 -0
  174. package/dist/prepare/extended-lighting/resources.d.ts.map +1 -0
  175. package/dist/prepare/extended-lighting/spot-modifiers.d.ts +42 -0
  176. package/dist/prepare/extended-lighting/spot-modifiers.d.ts.map +1 -0
  177. package/dist/prepare/extended-lighting/state.d.ts +24 -0
  178. package/dist/prepare/extended-lighting/state.d.ts.map +1 -0
  179. package/dist/record/frame-lighting.d.ts +8 -6
  180. package/dist/record/frame-lighting.d.ts.map +1 -1
  181. package/dist/record/frame-snapshot.d.ts +55 -10
  182. package/dist/record/frame-snapshot.d.ts.map +1 -1
  183. package/dist/record/frame-targets.d.ts.map +1 -1
  184. package/dist/record/frame.d.ts +21 -5
  185. package/dist/record/frame.d.ts.map +1 -1
  186. package/dist/record/gpu-timing.d.ts +19 -7
  187. package/dist/record/gpu-timing.d.ts.map +1 -1
  188. package/dist/record/helpers.d.ts +0 -20
  189. package/dist/record/helpers.d.ts.map +1 -1
  190. package/dist/record/main-pass-geometry.d.ts +20 -2
  191. package/dist/record/main-pass-geometry.d.ts.map +1 -1
  192. package/dist/record/main-pass-material.d.ts +10 -18
  193. package/dist/record/main-pass-material.d.ts.map +1 -1
  194. package/dist/record/main-pass-sprite-draws.d.ts.map +1 -1
  195. package/dist/record/main-pass.d.ts.map +1 -1
  196. package/dist/record/mesh-ssbo.d.ts +11 -3
  197. package/dist/record/mesh-ssbo.d.ts.map +1 -1
  198. package/dist/record/recovery-pipeline.d.ts +30 -0
  199. package/dist/record/recovery-pipeline.d.ts.map +1 -0
  200. package/dist/record/render-context.d.ts +82 -9
  201. package/dist/record/render-context.d.ts.map +1 -1
  202. package/dist/record/shadow-pass.d.ts.map +1 -1
  203. package/dist/record/typed-frame-graph.d.ts +49 -2
  204. package/dist/record/typed-frame-graph.d.ts.map +1 -1
  205. package/dist/record/view-ubo.d.ts +1 -2
  206. package/dist/record/view-ubo.d.ts.map +1 -1
  207. package/dist/recovery/render-system-candidate.d.ts +65 -0
  208. package/dist/recovery/render-system-candidate.d.ts.map +1 -0
  209. package/dist/reflection/inspection.d.ts +10 -0
  210. package/dist/reflection/inspection.d.ts.map +1 -0
  211. package/dist/reflection/projection.d.ts +49 -0
  212. package/dist/reflection/projection.d.ts.map +1 -1
  213. package/dist/reflection/record-owner.d.ts +60 -0
  214. package/dist/reflection/record-owner.d.ts.map +1 -0
  215. package/dist/render-contract.d.ts +78 -15
  216. package/dist/render-contract.d.ts.map +1 -1
  217. package/dist/render-pipeline.d.ts +7 -0
  218. package/dist/render-pipeline.d.ts.map +1 -1
  219. package/dist/render-system-extract-tail.d.ts +12 -0
  220. package/dist/render-system-extract-tail.d.ts.map +1 -0
  221. package/dist/render-system-extract.d.ts +252 -30
  222. package/dist/render-system-extract.d.ts.map +1 -1
  223. package/dist/render-system.d.ts +140 -5
  224. package/dist/render-system.d.ts.map +1 -1
  225. package/dist/scene/probe-blend-record.d.ts +22 -0
  226. package/dist/scene/probe-blend-record.d.ts.map +1 -0
  227. package/dist/scene/probe-blend.d.ts +142 -0
  228. package/dist/scene/probe-blend.d.ts.map +1 -0
  229. package/dist/scene/render-scene-types.d.ts +0 -6
  230. package/dist/scene/render-scene-types.d.ts.map +1 -1
  231. package/dist/scene/render-scene.d.ts +122 -9
  232. package/dist/scene/render-scene.d.ts.map +1 -1
  233. package/dist/scene/visibility/bounds.d.ts +20 -0
  234. package/dist/scene/visibility/bounds.d.ts.map +1 -0
  235. package/dist/scene/visibility/budget.d.ts +16 -0
  236. package/dist/scene/visibility/budget.d.ts.map +1 -0
  237. package/dist/scene/visibility/facet.d.ts +73 -0
  238. package/dist/scene/visibility/facet.d.ts.map +1 -0
  239. package/dist/scene/visibility/gpu-frame-timing.d.ts +41 -0
  240. package/dist/scene/visibility/gpu-frame-timing.d.ts.map +1 -0
  241. package/dist/scene/visibility/gpu-lod.d.ts +46 -0
  242. package/dist/scene/visibility/gpu-lod.d.ts.map +1 -0
  243. package/dist/scene/visibility/inspection.d.ts +132 -0
  244. package/dist/scene/visibility/inspection.d.ts.map +1 -0
  245. package/dist/scene/visibility/lod-selector.d.ts +25 -0
  246. package/dist/scene/visibility/lod-selector.d.ts.map +1 -0
  247. package/dist/scene/visibility/occlusion-confidence.d.ts +81 -0
  248. package/dist/scene/visibility/occlusion-confidence.d.ts.map +1 -0
  249. package/dist/scene/visibility/occlusion-pass.d.ts +57 -0
  250. package/dist/scene/visibility/occlusion-pass.d.ts.map +1 -0
  251. package/dist/scene/visibility/occlusion-query-pool.d.ts +57 -0
  252. package/dist/scene/visibility/occlusion-query-pool.d.ts.map +1 -0
  253. package/dist/scene/visibility/occlusion-runtime.d.ts +96 -0
  254. package/dist/scene/visibility/occlusion-runtime.d.ts.map +1 -0
  255. package/dist/scene/visibility/types.d.ts +34 -0
  256. package/dist/scene/visibility/types.d.ts.map +1 -0
  257. package/dist/ssr/admission.d.ts +122 -0
  258. package/dist/ssr/admission.d.ts.map +1 -0
  259. package/dist/ssr/composition.d.ts +32 -0
  260. package/dist/ssr/composition.d.ts.map +1 -0
  261. package/dist/ssr/errors.d.ts +39 -0
  262. package/dist/ssr/errors.d.ts.map +1 -0
  263. package/dist/ssr/identity.d.ts +13 -0
  264. package/dist/ssr/identity.d.ts.map +1 -0
  265. package/dist/systems/skin-palette-allocator.d.ts +1 -1
  266. package/dist/temporal/frame-coordinator.d.ts +13 -0
  267. package/dist/temporal/frame-coordinator.d.ts.map +1 -1
  268. package/dist/temporal/frame.d.ts +2 -0
  269. package/dist/temporal/frame.d.ts.map +1 -1
  270. package/dist/temporal/index.mjs +6 -5
  271. package/dist/temporal/taa-history-store.d.ts +15 -1
  272. package/dist/temporal/taa-history-store.d.ts.map +1 -1
  273. package/dist/temporal/transaction.d.ts +5 -0
  274. package/dist/temporal/transaction.d.ts.map +1 -1
  275. package/dist/temporal/view.d.ts +7 -0
  276. package/dist/temporal/view.d.ts.map +1 -1
  277. package/dist/tilemap-chunk-extract-system.d.ts +1 -1
  278. package/dist/typed-render-graph-primitives.d.ts +4 -0
  279. package/dist/typed-render-graph-primitives.d.ts.map +1 -1
  280. package/dist/volume/passes.d.ts +8 -4
  281. package/dist/volume/passes.d.ts.map +1 -1
  282. package/package.json +20 -20
  283. package/src/__tests__/cluster-grid-default-surface.unit.test.ts +5 -0
  284. package/src/__tests__/detached-inspection.integration.test.ts +6 -0
  285. package/src/__tests__/device-feature-admission.unit.test.ts +19 -1
  286. package/src/__tests__/device-loss-fanout.unit.test.ts +107 -0
  287. package/src/__tests__/device-scope-lifecycle.unit.test.ts +21 -0
  288. package/src/__tests__/direct-light-snapshot.unit.test.ts +59 -3
  289. package/src/__tests__/environment-generation.integration.test.ts +39 -0
  290. package/src/__tests__/evidence-identity.ts +13 -0
  291. package/src/__tests__/evidence-identity.unit.test.ts +24 -0
  292. package/src/__tests__/expose-renderer-errors.unit.test.ts +34 -0
  293. package/src/__tests__/extended-lighting-recovery.browser.test.ts +14 -0
  294. package/src/__tests__/extended-lighting-recovery.dawn.test.ts +14 -0
  295. package/src/__tests__/extended-lighting-recovery.integration.test.ts +81 -0
  296. package/src/__tests__/extended-lighting-resources.unit.test.ts +51 -0
  297. package/src/__tests__/extended-lighting-zero-feature.integration.test.ts +52 -0
  298. package/src/__tests__/factory-contract.integration.test.ts +154 -6
  299. package/src/__tests__/fallback-row-stride-surface.unit.test.ts +4 -1
  300. package/src/__tests__/frame-observation.contract.test.ts +15 -0
  301. package/src/__tests__/gpu-driven-batch-topology-pbr.unit.test.ts +146 -0
  302. package/src/__tests__/gpu-driven-indirect-raster-evidence.ts +1 -0
  303. package/src/__tests__/gpu-driven-indirect-raster.dawn.test.ts +1 -0
  304. package/src/__tests__/gpu-driven-production.integration.test.ts +572 -9
  305. package/src/__tests__/gpu-driven-scaling.unit.test.ts +66 -2
  306. package/src/__tests__/gpu-driven-view-gpu-evidence.ts +26 -1
  307. package/src/__tests__/gpu-driven-view-graph.integration.test.ts +89 -2
  308. package/src/__tests__/gpu-driven-view.browser.test.ts +3 -3
  309. package/src/__tests__/gpu-driven-view.dawn.test.ts +3 -3
  310. package/src/__tests__/gpu-driven-view.unit.test.ts +50 -0
  311. package/src/__tests__/gpu-lod-evidence.ts +188 -0
  312. package/src/__tests__/gpu-lod-fallback.integration.test.ts +10 -0
  313. package/src/__tests__/gpu-lod-indirect.integration.test.ts +40 -0
  314. package/src/__tests__/gpu-lod-parity.dawn.test.ts +29 -0
  315. package/src/__tests__/gpu-lod-readiness.integration.test.ts +52 -0
  316. package/src/__tests__/gpu-lod-schema.unit.test.ts +66 -0
  317. package/src/__tests__/gpu-lod-selector.unit.test.ts +28 -0
  318. package/src/__tests__/gpu-lod-silhouette.browser.test.ts +13 -0
  319. package/src/__tests__/gpu-resource-store-stride.unit.test.ts +66 -1
  320. package/src/__tests__/gpu-scene.dawn.test.ts +8 -1
  321. package/src/__tests__/gpu-scene.unit.test.ts +49 -3
  322. package/src/__tests__/ibl/face-uniforms.unit.test.ts +2 -0
  323. package/src/__tests__/ibl-residency-publication.unit.test.ts +113 -0
  324. package/src/__tests__/light-buffer-layout.unit.test.ts +113 -3
  325. package/src/__tests__/light-inspection.unit.test.ts +55 -0
  326. package/src/__tests__/light-resource-error.unit.test.ts +43 -0
  327. package/src/__tests__/lighting-scene-roundtrip.integration.test.ts +109 -0
  328. package/src/__tests__/lod-bounds.unit.test.ts +42 -0
  329. package/src/__tests__/lod-cpu-lane.integration.test.ts +55 -0
  330. package/src/__tests__/lod-cpu-no-change.perf.test.ts +19 -0
  331. package/src/__tests__/lod-gpu-frame-timing.unit.test.ts +49 -0
  332. package/src/__tests__/lod-multi-view.integration.test.ts +63 -0
  333. package/src/__tests__/lod-occlusion-device-loss.integration.test.ts +27 -0
  334. package/src/__tests__/lod-occlusion-final-decision.integration.test.ts +47 -0
  335. package/src/__tests__/lod-occlusion-inspection.integration.test.ts +217 -0
  336. package/src/__tests__/lod-occlusion-inspection.schema.test-d.ts +14 -0
  337. package/src/__tests__/lod-occlusion-inspection.unit.test.ts +72 -0
  338. package/src/__tests__/lod-occlusion-visual-evidence.ts +91 -0
  339. package/src/__tests__/lod-occlusion.browser.test.ts +15 -0
  340. package/src/__tests__/lod-occlusion.dawn.test.ts +20 -0
  341. package/src/__tests__/lod-selector.profile.test.ts +35 -0
  342. package/src/__tests__/lod-selector.unit.test.ts +68 -0
  343. package/src/__tests__/lod-visibility-identity.unit.test.ts +198 -0
  344. package/src/__tests__/lod-visibility-lifecycle.integration.test.ts +132 -0
  345. package/src/__tests__/ltc-resources.unit.test.ts +32 -0
  346. package/src/__tests__/material-contract-inventory.unit.test.ts +41 -9
  347. package/src/__tests__/material-cooked-projection.unit.test.ts +19 -1
  348. package/src/__tests__/material-static-dynamic-route.unit.test.ts +29 -0
  349. package/src/__tests__/material-stride-surface.unit.test.ts +7 -3
  350. package/src/__tests__/materials-standard-contract.unit.test.ts +104 -0
  351. package/src/__tests__/mesh-buffer-usage-surface.unit.test.ts +1 -1
  352. package/src/__tests__/occlusion-confidence.unit.test.ts +168 -0
  353. package/src/__tests__/occlusion-invalidation.integration.test.ts +37 -0
  354. package/src/__tests__/occlusion-pass-routing.unit.test.ts +16 -0
  355. package/src/__tests__/occlusion-pass.dawn.test.ts +20 -0
  356. package/src/__tests__/occlusion-pass.integration.test.ts +43 -0
  357. package/src/__tests__/occlusion-pass.rhi-null.test.ts +22 -0
  358. package/src/__tests__/occlusion-query-pool.rhi-null.test.ts +21 -0
  359. package/src/__tests__/occlusion-query-pool.unit.test.ts +95 -0
  360. package/src/__tests__/occlusion-query-ticket.integration.test.ts +47 -0
  361. package/src/__tests__/occlusion-query.dawn.test.ts +16 -0
  362. package/src/__tests__/occlusion-query.evidence.ts +178 -0
  363. package/src/__tests__/occlusion-query.rhi-null.test.ts +31 -0
  364. package/src/__tests__/occlusion-runtime.unit.test.ts +120 -0
  365. package/src/__tests__/physical-clearcoat.integration.test.ts +89 -0
  366. package/src/__tests__/prepared-gpu-driven-pbr.integration.test.ts +196 -0
  367. package/src/__tests__/prepared-graphics-pipeline-warmup.unit.test.ts +1 -1
  368. package/src/__tests__/probe-bindings.unit.test.ts +200 -0
  369. package/src/__tests__/probe-blend-numeric.unit.test.ts +67 -0
  370. package/src/__tests__/probe-blend-oracle.unit.test.ts +136 -0
  371. package/src/__tests__/probe-capacity.integration.test.ts +97 -0
  372. package/src/__tests__/probe-recovery.integration.test.ts +104 -0
  373. package/src/__tests__/probe-scene-dirty.integration.test.ts +211 -0
  374. package/src/__tests__/profiler-phase-catalog.test.ts +4 -1
  375. package/src/__tests__/profiler-phase-token.test.ts +1 -0
  376. package/src/__tests__/recover-error-policy-owner.unit.test.ts +6 -3
  377. package/src/__tests__/recovery-candidate-prepare.contract.test.ts +140 -0
  378. package/src/__tests__/rect-area-boundary.unit.test.ts +24 -0
  379. package/src/__tests__/reflection-fallback-graph.unit.test.ts +67 -0
  380. package/src/__tests__/reflection-fallback-inspection.unit.test.ts +77 -0
  381. package/src/__tests__/reflection-fallback-lifecycle.integration.test.ts +21 -0
  382. package/src/__tests__/reflection-fallback-projection.unit.test.ts +90 -0
  383. package/src/__tests__/reflection-fallback-source.unit.test.ts +32 -0
  384. package/src/__tests__/reflection-probe-owner-placement.unit.test.ts +39 -0
  385. package/src/__tests__/reflection-probe-record-owner.characterization.unit.test.ts +120 -0
  386. package/src/__tests__/render-error-code-owner.test-d.ts +1 -0
  387. package/src/__tests__/render-feature-docs.unit.test.ts +12 -7
  388. package/src/__tests__/render-graph-fallback.integration.test.ts +24 -0
  389. package/src/__tests__/render-perf/extended-lighting.bench.test.ts +66 -0
  390. package/src/__tests__/render-scene-projection.unit.test.ts +447 -18
  391. package/src/__tests__/renderer-factory-material-contract.unit.test.ts +160 -17
  392. package/src/__tests__/renderer-frame-generation-fence.integration.test.ts +47 -0
  393. package/src/__tests__/renderer-generation-assembly.unit.test.ts +77 -0
  394. package/src/__tests__/renderer-generation-failure.unit.test.ts +108 -0
  395. package/src/__tests__/renderer-producer-root-matrix.integration.test.ts +33 -0
  396. package/src/__tests__/renderer-recovery-capability-matrix.unit.test.ts +59 -0
  397. package/src/__tests__/renderer-recovery-contract.unit.test.ts +73 -0
  398. package/src/__tests__/renderer-recovery-lifecycle.unit.test.ts +216 -0
  399. package/src/__tests__/renderer-target-history-recovery.integration.test.ts +80 -0
  400. package/src/__tests__/shader-manifest-fixture.ts +13 -16
  401. package/src/__tests__/shader-stage-surface.unit.test.ts +1 -1
  402. package/src/__tests__/skin-motion-regression.unit.test.ts +22 -0
  403. package/src/__tests__/skinned-shadow-caster.test.ts +2 -2
  404. package/src/__tests__/spot-modifier-projection.unit.test.ts +70 -0
  405. package/src/__tests__/ssr-admission-matrix.integration.test.ts +206 -0
  406. package/src/__tests__/ssr-composition.unit.test.ts +46 -0
  407. package/src/__tests__/ssr-fallback-zero-work.bench.test.ts +94 -0
  408. package/src/__tests__/ssr-recovery-errors.unit.test.ts +58 -0
  409. package/src/__tests__/standard-cluster-variant-resolution.unit.test.ts +67 -0
  410. package/src/__tests__/standard-clustered-pipeline.unit.test.ts +7 -0
  411. package/src/__tests__/standard-layer-projection.unit.test.ts +23 -0
  412. package/src/__tests__/standard-lighting-inspection.integration.test.ts +1 -1
  413. package/src/__tests__/standard-lighting-write.unit.test.ts +66 -2
  414. package/src/__tests__/temporal-fallback-generation.integration.test.ts +16 -0
  415. package/src/__tests__/temporal-view.unit.test.ts +3 -3
  416. package/src/__tests__/transmission-prewarm.unit.test.ts +111 -32
  417. package/src/__tests__/visibility-budget.integration.test.ts +140 -0
  418. package/src/__tests__/visibility-budget.unit.test.ts +70 -0
  419. package/src/__tests__/visibility-extract.integration.test.ts +11 -6
  420. package/src/__tests__/volumetric-fog-point-spot-accumulation.integration.test.ts +6 -3
  421. package/src/__tests__/volumetric-fog-stage-readback.dawn.test.ts +31 -28
  422. package/src/__tests__/volumetric-fog-topology.unit.test.ts +3 -1
  423. package/src/assembly/backend-contract.ts +13 -0
  424. package/src/assembly/bundler-contract.ts +9 -0
  425. package/src/assembly/device-feature-admission.ts +26 -9
  426. package/src/assembly/extended-lighting-fallback.ts +216 -0
  427. package/src/assembly/factory.ts +81 -9634
  428. package/src/assembly/host-contract.ts +10 -0
  429. package/src/assembly/material/assembly.ts +18 -2
  430. package/src/assembly/material/standard-layer-projection.ts +16 -0
  431. package/src/assembly/material-shader-policy.ts +854 -0
  432. package/src/assembly/material-shader-prewarm.ts +88 -0
  433. package/src/assembly/mesh-ssbo-grow.ts +270 -0
  434. package/src/assembly/recovery/device-loss-fanout.ts +89 -0
  435. package/src/assembly/recovery/generation.ts +141 -0
  436. package/src/assembly/recovery/recovery-attempt.ts +800 -0
  437. package/src/assembly/recovery/renderer-recover.ts +906 -0
  438. package/src/assembly/renderer-facade.ts +342 -0
  439. package/src/assembly/renderer-frame-transaction.ts +45 -0
  440. package/src/assembly/renderer-helpers.ts +99 -0
  441. package/src/assembly/renderer-lifecycle.ts +159 -0
  442. package/src/assembly/shader-prewarm-policy.ts +157 -0
  443. package/src/assembly/webgpu-ready-contract.ts +14 -0
  444. package/src/assembly/webgpu-ready.ts +4079 -0
  445. package/src/assembly/webgpu-renderer.ts +4095 -0
  446. package/src/cluster-binner.ts +31 -0
  447. package/src/components/__tests__/lighting-authoring.unit.test.ts +39 -0
  448. package/src/components/__tests__/rect-area-light.unit.test.ts +33 -0
  449. package/src/components/camera.ts +1 -1
  450. package/src/components/index.ts +3 -0
  451. package/src/components/light-helpers.ts +52 -1
  452. package/src/components/light-probe.ts +13 -0
  453. package/src/components/rect-area-light.ts +15 -0
  454. package/src/components/scene-instance.ts +6 -0
  455. package/src/components/spot-light.ts +3 -0
  456. package/src/debug-draw-glue.ts +1 -1
  457. package/src/device/__tests__/extended-lighting-recovery.unit.test.ts +24 -0
  458. package/src/device/device-scope.ts +35 -6
  459. package/src/device/gpu-residency.ts +334 -35
  460. package/src/device/lifecycle-transaction.ts +12 -0
  461. package/src/environment/frame.ts +6 -0
  462. package/src/environment/inspection.ts +10 -0
  463. package/src/environment/lifecycle.ts +122 -9
  464. package/src/errors/gpu-driven.ts +92 -0
  465. package/src/errors/index.ts +1 -0
  466. package/src/errors/recover.ts +108 -5
  467. package/src/errors/render.ts +72 -1
  468. package/src/extract/camera.ts +3 -3
  469. package/src/extract/contracts.ts +974 -0
  470. package/src/extract/gpu-driven.ts +108 -0
  471. package/src/extract/visibility.ts +0 -23
  472. package/src/features/host.ts +16 -0
  473. package/src/features/prepared-gpu-work.ts +20 -2
  474. package/src/features/prepared-graphics-store.ts +17 -0
  475. package/src/gpu-driven/batch-topology.ts +206 -28
  476. package/src/gpu-driven/prepared-draw.ts +208 -0
  477. package/src/gpu-driven/production-raster.ts +1046 -39
  478. package/src/gpu-driven/view-gpu.ts +411 -29
  479. package/src/gpu-scene-schema.ts +13 -0
  480. package/src/gpu-scene.ts +137 -67
  481. package/src/gpu-usage.ts +0 -1
  482. package/src/hdrp-buffers.ts +6 -6
  483. package/src/ibl/IblPipelineCache.ts +134 -50
  484. package/src/ibl/skylight-bind-group.ts +26 -0
  485. package/src/index.ts +83 -1
  486. package/src/inspection-types.ts +220 -1
  487. package/src/internal.ts +38 -0
  488. package/src/light-buffer-layout.ts +157 -324
  489. package/src/materials.ts +278 -47
  490. package/src/mesh-material-bindings.ts +59 -0
  491. package/src/occlusion-proxy.ts +64 -0
  492. package/src/pbr-pipeline.ts +290 -60
  493. package/src/pipeline/standard-forward-lane.ts +47 -0
  494. package/src/pipeline/standard-lighting/graph.ts +2 -1
  495. package/src/pipeline/standard-lighting/light-frame.ts +3 -2
  496. package/src/pipeline/standard-lighting/topology.ts +1 -1
  497. package/src/pipeline/standard-lighting/transport.ts +2 -1
  498. package/src/pipeline/standard-pipeline.ts +2 -0
  499. package/src/pipeline-builder.ts +5 -2
  500. package/src/pipeline-spec.ts +12 -1
  501. package/src/plugin.ts +4 -0
  502. package/src/points-lines/__tests__/cache-recovery.unit.test.ts +22 -0
  503. package/src/points-lines/prepare.ts +9 -0
  504. package/src/points-lines/standard-owner.ts +403 -0
  505. package/src/prepare/__tests__/extended-lighting-capability.unit.test.ts +56 -0
  506. package/src/prepare/extended-lighting/ltc-resources.ts +136 -0
  507. package/src/prepare/extended-lighting/resources.ts +389 -0
  508. package/src/prepare/extended-lighting/spot-modifiers.ts +194 -0
  509. package/src/prepare/extended-lighting/state.ts +92 -0
  510. package/src/record/__tests__/frame-targets-recovery.unit.test.ts +60 -0
  511. package/src/record/__tests__/gpu-timing.unit.test.ts +177 -0
  512. package/src/record/__tests__/main-pass-geometry.unit.test.ts +26 -1
  513. package/src/record/__tests__/mesh-ssbo.unit.test.ts +38 -0
  514. package/src/record/__tests__/recovery-pipeline.unit.test.ts +124 -0
  515. package/src/record/__tests__/sprite-material-abi.unit.test.ts +28 -13
  516. package/src/record/__tests__/standard-pbr-ubo-layout.unit.test.ts +47 -4
  517. package/src/record/__tests__/temporal-payload.unit.test.ts +29 -28
  518. package/src/record/__tests__/typed-frame-graph-plan.unit.test.ts +21 -2
  519. package/src/record/frame-lighting.ts +252 -53
  520. package/src/record/frame-snapshot.ts +72 -12
  521. package/src/record/frame-targets.ts +11 -1
  522. package/src/record/frame.ts +416 -95
  523. package/src/record/gpu-timing.ts +108 -44
  524. package/src/record/helpers.ts +1 -59
  525. package/src/record/main-pass-geometry.ts +434 -44
  526. package/src/record/main-pass-material.ts +324 -210
  527. package/src/record/main-pass-sprite-draws.ts +58 -92
  528. package/src/record/main-pass.ts +94 -6
  529. package/src/record/mesh-ssbo.ts +79 -46
  530. package/src/record/recovery-pipeline.ts +695 -0
  531. package/src/record/render-context.ts +99 -7
  532. package/src/record/shadow-pass.ts +66 -40
  533. package/src/record/typed-frame-graph.ts +270 -84
  534. package/src/record/view-ubo.ts +17 -27
  535. package/src/recovery/render-system-candidate.ts +839 -0
  536. package/src/reflection/inspection.ts +67 -0
  537. package/src/reflection/projection.ts +196 -1
  538. package/src/reflection/record-owner.ts +1283 -0
  539. package/src/render-contract.ts +82 -12
  540. package/src/render-pipeline.ts +5 -0
  541. package/src/render-system-extract-tail.ts +2983 -0
  542. package/src/render-system-extract.ts +290 -2784
  543. package/src/render-system.ts +1597 -1192
  544. package/src/scene/__tests__/changed-block-summary.candidate.test.ts +36 -0
  545. package/src/scene/probe-blend-record.ts +54 -0
  546. package/src/scene/probe-blend.ts +813 -0
  547. package/src/scene/render-scene-types.ts +0 -7
  548. package/src/scene/render-scene.ts +972 -184
  549. package/src/scene/visibility/bounds.ts +57 -0
  550. package/src/scene/visibility/budget.ts +40 -0
  551. package/src/scene/visibility/facet.ts +400 -0
  552. package/src/scene/visibility/gpu-frame-timing.ts +101 -0
  553. package/src/scene/visibility/gpu-lod.ts +119 -0
  554. package/src/scene/visibility/inspection.ts +313 -0
  555. package/src/scene/visibility/lod-selector.ts +84 -0
  556. package/src/scene/visibility/occlusion-confidence.ts +478 -0
  557. package/src/scene/visibility/occlusion-pass.ts +165 -0
  558. package/src/scene/visibility/occlusion-query-pool.ts +178 -0
  559. package/src/scene/visibility/occlusion-runtime.ts +672 -0
  560. package/src/scene/visibility/types.ts +50 -0
  561. package/src/ssr/admission.ts +451 -0
  562. package/src/ssr/composition.ts +73 -0
  563. package/src/ssr/errors.ts +76 -0
  564. package/src/ssr/identity.ts +12 -0
  565. package/src/systems/skin-palette-allocator.ts +1 -1
  566. package/src/temporal/frame-coordinator.ts +30 -1
  567. package/src/temporal/frame.ts +14 -1
  568. package/src/temporal/taa-history-store.ts +46 -2
  569. package/src/temporal/temporal-view.ts +1 -1
  570. package/src/temporal/transaction.ts +9 -0
  571. package/src/temporal/view.ts +11 -0
  572. package/src/tilemap-chunk-extract-system.ts +5 -5
  573. package/src/transmission/__tests__/standard-transmission.dawn.test.ts +19 -12
  574. package/src/typed-render-graph-primitives.ts +48 -0
  575. package/src/volume/passes.ts +46 -49
  576. package/dist/.tsbuildinfo +0 -1
  577. package/dist/chunk-5YADUCA7.mjs.map +0 -1
  578. package/dist/chunk-6OPXDQ2E.mjs.map +0 -1
  579. package/dist/chunk-BXBQQKFQ.mjs +0 -67
  580. package/dist/chunk-BXBQQKFQ.mjs.map +0 -1
  581. package/dist/chunk-FS2KNUQH.mjs.map +0 -1
  582. package/dist/chunk-PCHBPYML.mjs.map +0 -1
  583. package/dist/chunk-VFPLTKCU.mjs +0 -192
  584. package/dist/chunk-VFPLTKCU.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/ibl/kernel-cache.ts","../src/errors/render.ts","../src/temporal/scene-data.ts","../src/temporal/scene-data-catalog.ts","../src/pipeline/standard-lighting/layout.ts","../src/pipeline/standard-profile.ts","../src/gpu-texture-usage.ts","../src/shadow-atlas.ts","../src/render-contract.ts"],"names":[],"mappings":";;;;AAAO,IAAM,2BAAA,GAA8B,CAAC,KAAA,EAAO,UAAA,EAAY,SAAS;AAUxE,IAAM,YAAA,uBAAmB,GAAA,EAA4B;AAE9C,SAAS,qBAAqB,UAAA,EAAoC;AACvE,EAAA,MAAM,QAAA,GAAW,YAAA,CAAa,GAAA,CAAI,UAAU,CAAA;AAC5C,EAAA,IAAI,QAAA,KAAa,QAAW,OAAO,QAAA;AACnC,EAAA,MAAM,OAAA,GAA0B;AAAA,IAC9B,UAAA;AAAA,IACA,kBAAkB,EAAC;AAAA,IACnB,iBAAiB,EAAC;AAAA,IAClB,iBAAiB;AAAC,GACpB;AACA,EAAA,YAAA,CAAa,GAAA,CAAI,YAAY,OAAO,CAAA;AACpC,EAAA,OAAO,OAAA;AACT;AAmBO,SAAS,qBAAqB,KAAA,EAIlB;AACjB,EAAA,OAAO;AAAA,IACL,GAAG,KAAA;AAAA,IACH,KAAK,EAAC;AAAA,IACN,UAAU,EAAC;AAAA,IACX,aAAA,EAAe,CAAA;AAAA,IACf,kBAAA,EAAoB,CAAA;AAAA,IACpB,GAAA,EAAK;AAAA,GACP;AACF;AAEO,SAAS,oBAAoB,MAAA,EAAwC;AAC1E,EAAA,OAAO;AAAA,IACL,GAAG,MAAA;AAAA,IACH,M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A,QAAA;AAAA,EACA,GAAG;AACL","file":"chunk-6OPXDQ2E.mjs","sourcesContent":["export const REFLECTION_PROBE_IBL_STAGES = ['raw', 'filtered', 'publish'] as const;\nexport type ReflectionProbeIblStage = (typeof REFLECTION_PROBE_IBL_STAGES)[number];\n\nexport interface IblKernelCache {\n readonly generation: number;\n readonly pipelineIdentity: object;\n readonly samplerIdentity: object;\n readonly brdfLutIdentity: object;\n}\n\nconst kernelCaches = new Map<number, IblKernelCache>();\n\nexport function createIblKernelCache(generation: number): IblKernelCache {\n const existing = kernelCaches.get(generation);\n if (existing !== undefined) return existing;\n const created: IblKernelCache = {\n generation,\n pipelineIdentity: {},\n samplerIdentity: {},\n brdfLutIdentity: {},\n };\n kernelCaches.set(generation, created);\n return created;\n}\n\nexport interface ProbeIblOutput {\n readonly entityKey: number;\n readonly resolution: number;\n readonly deviceGeneration: number;\n readonly raw: object;\n readonly filtered: object;\n readonly rawGeneration: number;\n readonly filteredGeneration: number;\n readonly lkg: boolean;\n}\n\nexport interface ProbeIblUpdate extends ProbeIblOutput {\n readonly stages: typeof REFLECTION_PROBE_IBL_STAGES;\n readonly nextStage: ReflectionProbeIblStage;\n readonly candidateGeneration: number;\n}\n\nexport function createProbeIblOutput(input: {\n readonly entityKey: number;\n readonly resolution: number;\n readonly deviceGeneration: number;\n}): ProbeIblOutput {\n return {\n ...input,\n raw: {},\n filtered: {},\n rawGeneration: 0,\n filteredGeneration: 0,\n lkg: true,\n };\n}\n\nexport function beginProbeIblUpdate(output: ProbeIblOutput): ProbeIblUpdate {\n return {\n ...output,\n stages: REFLECTION_PROBE_IBL_STAGES,\n nextStage: 'raw',\n candidateGeneration: output.filteredGeneration + 1,\n };\n}\n\nexport function publishProbeIblOutput(\n update: ProbeIblUpdate,\n result: { readonly stage: ReflectionProbeIblStage; readonly ok: boolean },\n): ProbeIblOutput {\n if (!result.ok || result.stage !== update.nextStage) return update;\n if (result.stage === 'raw') {\n return {\n ...update,\n rawGeneration: update.candidateGeneration,\n };\n }\n if (result.stage === 'filtered') return update;\n return {\n ...update,\n filteredGeneration: update.candidateGeneration,\n lkg: true,\n };\n}\n\nexport function resetIblKernelCaches(): void {\n kernelCaches.clear();\n}\n","// @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';\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 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\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 oldGeneration: number;\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 | RenderTargetDescriptorInvalidError\n | RenderTargetCapabilityMissingError\n | RenderTargetStateInvalidError\n | RenderTargetOperationFailedError\n | ReflectionProbeBudgetExceededError\n | RenderIntentInvalidError\n | ProjectorBindingError\n | VolumeError;\n","import { type RenderError, RenderFeaturePreparedStateMismatchError } from '../errors/render';\nimport type { RenderFeatureTargetHandle } from '../features/targets';\n\n/** The closed semantic schema namespace published by the render owner. */\nexport const SCENE_DATA_TEMPORAL_V1_SCHEMA = 'forgeax::scene-data::temporal-v1' as const;\nexport type SceneDataSchemaId = typeof SCENE_DATA_TEMPORAL_V1_SCHEMA;\n\nexport type SceneDataLane = 'direct' | 'clustered' | 'cpu-webgl2';\n\nexport interface SceneDataTemporalV1Descriptor {\n readonly schema: typeof SCENE_DATA_TEMPORAL_V1_SCHEMA;\n readonly format: 'rgba16float';\n readonly sampleCount: 1;\n readonly extent: 'render-resolution';\n readonly clearValue: readonly [0, 0, -1, 1];\n readonly channels: Readonly<{\n readonly motionUv: 'rg';\n readonly viewDepth: 'b-log2-1-plus-depth';\n readonly reactive: 'a';\n }>;\n}\n\nexport const SCENE_DATA_TEMPORAL_V1_DESCRIPTOR: SceneDataTemporalV1Descriptor = Object.freeze({\n schema: SCENE_DATA_TEMPORAL_V1_SCHEMA,\n format: 'rgba16float',\n sampleCount: 1,\n extent: 'render-resolution',\n clearValue: [0, 0, -1, 1] as const,\n channels: Object.freeze({\n motionUv: 'rg',\n viewDepth: 'b-log2-1-plus-depth',\n reactive: 'a',\n }),\n});\n\n/** Opaque, sampled-read-only semantic data token. */\nexport interface SceneDataTarget<Schema extends SceneDataSchemaId = SceneDataSchemaId> {\n readonly kind: 'scene-data';\n readonly schema: Schema;\n readonly access: 'sampled-read';\n readonly format: 'rgba16float';\n readonly sampleCount: 1;\n readonly extent: 'render-resolution';\n readonly __sceneDataTarget: unique symbol;\n}\n\nexport type SceneDataTokenMismatch = RenderFeaturePreparedStateMismatchError;\n\nconst targetOwners = new WeakMap<object, SceneDataCatalogIdentity>();\n\nexport interface SceneDataCatalogIdentity {\n readonly featureIdentity: string;\n readonly planIdentity: string;\n readonly generation: number;\n}\n\nexport function registerSceneDataTarget(\n target: SceneDataTarget,\n owner: SceneDataCatalogIdentity,\n): void {\n targetOwners.set(target, owner);\n}\n\nexport function sceneDataTargetOwner(\n target: SceneDataTarget,\n): SceneDataCatalogIdentity | undefined {\n return typeof target === 'object' && target !== null ? targetOwners.get(target) : undefined;\n}\n\nexport function sceneDataTokenMismatch(\n operation: string,\n reason: 'foreign-feature' | 'foreign-kind' | 'generation-mismatch' | 'layout-mismatch',\n owner: SceneDataCatalogIdentity,\n target: Partial<SceneDataTarget> | undefined,\n): SceneDataTokenMismatch {\n const detail =\n reason === 'generation-mismatch'\n ? {\n featureIdentity: owner.featureIdentity,\n order: -1,\n stage: 'contribute' as const,\n operation,\n resourceKind: 'attachment' as const,\n reason,\n expectedGeneration: owner.generation,\n actualGeneration: targetOwners.get(target as object)?.generation ?? -1,\n recovery: 'renderer-recover' as const,\n }\n : reason === 'foreign-feature'\n ? {\n featureIdentity: owner.featureIdentity,\n order: -1,\n stage: 'contribute' as const,\n operation,\n resourceKind: 'attachment' as const,\n reason,\n expectedFeatureIdentity: owner.featureIdentity,\n actualFeatureIdentity: targetOwners.get(target as object)?.featureIdentity ?? 'unknown',\n recovery: 'next-frame' as const,\n }\n : reason === 'foreign-kind'\n ? {\n featureIdentity: owner.featureIdentity,\n order: -1,\n stage: 'contribute' as const,\n operation,\n resourceKind: 'attachment' as const,\n reason,\n expectedKind: 'attachment' as const,\n actualKind: 'pipeline' as const,\n recovery: 'next-frame' as const,\n }\n : {\n featureIdentity: owner.featureIdentity,\n order: -1,\n stage: 'contribute' as const,\n operation,\n resourceKind: 'attachment' as const,\n reason,\n expectedLayout: 'sampled-read-temporal-v1',\n actualLayout: target?.access ?? 'unknown',\n recovery: 'next-frame' as const,\n };\n return new RenderFeaturePreparedStateMismatchError(detail);\n}\n\nexport function isSceneDataTarget(value: unknown): value is SceneDataTarget {\n if (value === null || typeof value !== 'object') return false;\n const candidate = value as Partial<SceneDataTarget>;\n return (\n candidate.kind === 'scene-data' &&\n candidate.schema === SCENE_DATA_TEMPORAL_V1_SCHEMA &&\n candidate.access === 'sampled-read' &&\n candidate.format === 'rgba16float' &&\n candidate.sampleCount === 1 &&\n candidate.extent === 'render-resolution' &&\n targetOwners.has(value)\n );\n}\n\nexport function sceneDataTargetAsAttachment(_target: SceneDataTarget): never {\n throw new TypeError('SceneDataTarget is sampled-read-only and cannot be used as an attachment');\n}\n\nexport type SceneDataTargetInput = RenderFeatureTargetHandle | SceneDataTarget;\n\nexport function sceneDataError(error: SceneDataTokenMismatch): RenderError {\n return error;\n}\n","import { err, ok, type Result } from '@forgeax/engine-types';\nimport type { RenderError } from '../errors/render';\nimport { SceneDataUnavailableError } from '../errors/render';\nimport {\n registerSceneDataTarget,\n SCENE_DATA_TEMPORAL_V1_DESCRIPTOR,\n SCENE_DATA_TEMPORAL_V1_SCHEMA,\n type SceneDataLane,\n type SceneDataSchemaId,\n type SceneDataTarget,\n sceneDataTargetOwner,\n sceneDataTokenMismatch,\n} from './scene-data';\n\nexport type SceneDataAvailability =\n | {\n readonly status: 'available';\n readonly completeness: 'exact' | 'exact-with-reactive-fallback';\n }\n | {\n readonly status: 'unavailable';\n readonly reason:\n | 'capability-missing'\n | 'producer-missing'\n | 'coverage-incomplete'\n | 'renderer-recovering';\n };\n\nexport interface SceneDataInspection {\n readonly schema: SceneDataSchemaId;\n readonly status: SceneDataAvailability['status'];\n readonly generation: number;\n readonly planIdentity: string;\n readonly lane: SceneDataLane;\n readonly completeness?: 'exact' | 'exact-with-reactive-fallback';\n readonly reason?: Exclude<SceneDataAvailability, { status: 'available' }>['reason'];\n readonly missingContributorIds: readonly string[];\n readonly omittedMissingContributorCount: number;\n}\n\nexport interface SceneDataCatalogOptions {\n readonly featureIdentity: string;\n readonly generation: number;\n readonly planIdentity: string;\n readonly lane?: SceneDataLane;\n readonly rgba16floatRenderable: boolean;\n readonly producerPresent?: boolean;\n readonly coverageComplete?: boolean;\n readonly recovering?: boolean;\n readonly reactiveFallback?: boolean;\n readonly missingContributorIds?: readonly string[];\n}\n\nexport interface SceneDataCatalog {\n readonly schema: typeof SCENE_DATA_TEMPORAL_V1_SCHEMA;\n readonly generation: number;\n readonly planIdentity: string;\n readonly availability: SceneDataAvailability;\n require<Schema extends SceneDataSchemaId>(schema: Schema): SceneDataTarget<Schema>;\n validate(target: SceneDataTarget, generation?: number): Result<SceneDataTarget, RenderError>;\n inspect(): SceneDataInspection;\n}\n\nfunction availability(options: SceneDataCatalogOptions): SceneDataAvailability {\n if (options.recovering) return { status: 'unavailable', reason: 'renderer-recovering' };\n if (!options.rgba16floatRenderable)\n return { status: 'unavailable', reason: 'capability-missing' };\n if (options.producerPresent === false)\n return { status: 'unavailable', reason: 'producer-missing' };\n if (options.coverageComplete === false)\n return { status: 'unavailable', reason: 'coverage-incomplete' };\n return {\n status: 'available',\n completeness: options.reactiveFallback ? 'exact-with-reactive-fallback' : 'exact',\n };\n}\n\nfunction createTarget(owner: SceneDataCatalogOptions): SceneDataTarget {\n const target = Object.freeze({\n kind: 'scene-data' as const,\n schema: SCENE_DATA_TEMPORAL_V1_SCHEMA,\n access: 'sampled-read' as const,\n format: 'rgba16float' as const,\n sampleCount: 1 as const,\n extent: 'render-resolution' as const,\n }) as SceneDataTarget;\n registerSceneDataTarget(target, {\n featureIdentity: owner.featureIdentity,\n planIdentity: owner.planIdentity,\n generation: owner.generation,\n });\n return target;\n}\n\nfunction tokenError(catalog: SceneDataCatalogOptions, operation: string): RenderError {\n return sceneDataTokenMismatch(\n operation,\n 'foreign-kind',\n {\n featureIdentity: catalog.featureIdentity,\n planIdentity: catalog.planIdentity,\n generation: catalog.generation,\n },\n undefined,\n );\n}\n\nfunction unavailableError(\n options: SceneDataCatalogOptions,\n reason: Exclude<SceneDataAvailability, { status: 'available' }>['reason'],\n): RenderError {\n const recovery =\n reason === 'capability-missing'\n ? 'enable-capability'\n : reason === 'renderer-recovering'\n ? 'renderer-recover'\n : 'next-frame';\n return new SceneDataUnavailableError({\n featureIdentity: options.featureIdentity,\n schema: SCENE_DATA_TEMPORAL_V1_SCHEMA,\n lane: options.lane ?? 'direct',\n reason,\n missingContributorIds: options.missingContributorIds ?? [],\n omittedMissingContributorCount: 0,\n recovery,\n });\n}\n\nexport function createSceneDataCatalog(options: SceneDataCatalogOptions): SceneDataCatalog {\n const state = availability(options);\n const owner = {\n featureIdentity: options.featureIdentity,\n planIdentity: options.planIdentity,\n generation: options.generation,\n };\n const missing = [...(options.missingContributorIds ?? [])];\n const inspectionBase = {\n schema: SCENE_DATA_TEMPORAL_V1_SCHEMA,\n generation: options.generation,\n planIdentity: options.planIdentity,\n lane: options.lane ?? 'direct',\n missingContributorIds: Object.freeze(missing.slice(0, 32)),\n omittedMissingContributorCount: Math.max(0, missing.length - 32),\n };\n return {\n schema: SCENE_DATA_TEMPORAL_V1_SCHEMA,\n generation: options.generation,\n planIdentity: options.planIdentity,\n availability: state,\n require(schema) {\n if (schema !== SCENE_DATA_TEMPORAL_V1_SCHEMA || state.status !== 'available') {\n if (state.status === 'unavailable') throw unavailableError(options, state.reason);\n throw tokenError(options, 'require scene-data target');\n }\n return createTarget(options) as SceneDataTarget<typeof schema>;\n },\n validate(target, generation = options.generation) {\n const targetOwner = sceneDataTargetOwner(target);\n if (targetOwner === undefined) {\n return err(\n sceneDataTokenMismatch('validate scene-data target', 'foreign-feature', owner, target),\n );\n }\n if (\n targetOwner.planIdentity !== owner.planIdentity ||\n targetOwner.featureIdentity !== owner.featureIdentity\n ) {\n return err(\n sceneDataTokenMismatch('validate scene-data target', 'foreign-feature', owner, target),\n );\n }\n if (generation !== owner.generation || targetOwner.generation !== owner.generation) {\n return err(\n sceneDataTokenMismatch(\n 'validate scene-data target',\n 'generation-mismatch',\n owner,\n target,\n ),\n );\n }\n if (target.access !== 'sampled-read') {\n return err(\n sceneDataTokenMismatch('validate scene-data target', 'layout-mismatch', owner, target),\n );\n }\n return ok(target);\n },\n inspect() {\n return Object.freeze(\n state.status === 'available'\n ? { ...inspectionBase, status: state.status, completeness: state.completeness }\n : { ...inspectionBase, status: state.status, reason: state.reason },\n );\n },\n };\n}\n\nexport { SCENE_DATA_TEMPORAL_V1_SCHEMA } from './scene-data';\nexport { SCENE_DATA_TEMPORAL_V1_DESCRIPTOR };\n","export const DEFAULT_CLUSTER_GRID = { x: 16, y: 9, z: 24 } as const;\nexport const CLUSTER_GRID_STRIDE_U32 = 2 as const;\nexport const LIGHT_INDEX_LIST_CAPACITY = 1048576 as const;\nexport const MAX_LIGHTS = 256 as const;\n\nexport interface StandardClusterLayout {\n readonly grid: { readonly x: number; readonly y: number; readonly z: number };\n readonly clusterCount: number;\n readonly clusterGridStrideU32: typeof CLUSTER_GRID_STRIDE_U32;\n readonly clusterGridU32Length: number;\n readonly lightIndexListCapacity: typeof LIGHT_INDEX_LIST_CAPACITY;\n readonly lightDataSlotCount: typeof MAX_LIGHTS;\n readonly lightBoundsInt32Length: number;\n}\n\nexport function createStandardClusterLayout(\n grid: { readonly x: number; readonly y: number; readonly z: number } = DEFAULT_CLUSTER_GRID,\n): StandardClusterLayout {\n const clusterCount = grid.x * grid.y * grid.z;\n return Object.freeze({\n grid,\n clusterCount,\n clusterGridStrideU32: CLUSTER_GRID_STRIDE_U32,\n clusterGridU32Length: clusterCount * CLUSTER_GRID_STRIDE_U32,\n lightIndexListCapacity: LIGHT_INDEX_LIST_CAPACITY,\n lightDataSlotCount: MAX_LIGHTS,\n lightBoundsInt32Length: MAX_LIGHTS * 6,\n });\n}\n\nexport const STANDARD_CLUSTER_LAYOUT = createStandardClusterLayout();\n","export const STANDARD_PIPELINE_ID = 'forgeax::standard' as const;\nexport const STANDARD_LIGHT_COUNTS = [1, 32, 256] as const;\nexport {\n CLUSTER_GRID_STRIDE_U32,\n DEFAULT_CLUSTER_GRID,\n LIGHT_INDEX_LIST_CAPACITY,\n MAX_LIGHTS,\n} from './standard-lighting/layout';\n\nexport type StandardLightCount = (typeof STANDARD_LIGHT_COUNTS)[number];\nexport type StandardShadowMode = 'off' | 'hard' | 'filtered';\nexport type StandardVolumetricFogQuality = 'low' | 'high';\n\nexport interface StandardVolumetricFogProfile {\n readonly quality: StandardVolumetricFogQuality;\n readonly depth: 48 | 64;\n readonly tileSize: 4 | 16;\n}\n\nexport const STANDARD_POST_STAGE_NAMES = [\n 'transparent-blend',\n 'bloom',\n 'output-transform',\n 'fxaa',\n 'post-effect',\n 'present',\n] as const;\nexport type StandardPostStage = (typeof STANDARD_POST_STAGE_NAMES)[number];\nexport interface StandardProfile {\n readonly pipelineId: typeof STANDARD_PIPELINE_ID;\n readonly lightCount: StandardLightCount;\n /** Graph topology selector; all local lights use the shared Cluster path. */\n readonly renderPath: 'forward' | 'deferred';\n readonly shadows: StandardShadowMode;\n readonly pbr: boolean;\n readonly ibl: boolean;\n readonly ssao: boolean;\n /** Renderer-owned 1080p volume profile; tile width/height remain surface-derived. */\n readonly volumetricFog?: StandardVolumetricFogProfile | undefined;\n readonly postStages: typeof STANDARD_POST_STAGE_NAMES;\n}\n\nexport const DEFAULT_STANDARD_PROFILE: StandardProfile = Object.freeze({\n pipelineId: STANDARD_PIPELINE_ID,\n lightCount: 32,\n renderPath: 'forward',\n shadows: 'filtered',\n pbr: true,\n ibl: true,\n ssao: false,\n postStages: STANDARD_POST_STAGE_NAMES,\n});\n\nexport function resolveVolumetricFogProfile(\n profile: Pick<StandardProfile, 'volumetricFog'>,\n): StandardVolumetricFogProfile {\n return profile.volumetricFog ?? { quality: 'high', depth: 64, tileSize: 4 };\n}\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 { 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 MotionBlurInspection,\n ReflectionProbeInspection,\n RenderSceneInspection,\n TemporalTargetInspection,\n TransmissionInspection,\n} from './inspection-types';\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 { MeshMaterialBindingObservation } 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 Transform.world). */\n readonly position: Vec3;\n /** Resolved world-space camera mat4, copied from Transform.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 /** Renderer-owned SpotLight std430 buffer shared by Standard and volume. */\n readonly pointLightsBuffer: Buffer;\n readonly spotLightsBuffer: 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. Concrete assembly stays behind the host;\n * callers retain only leases, receipts, inspection PODs, and recovery Result.\n */\nexport interface Renderer {\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/** The single public renderer lifecycle authority. */\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 and is required by\n * every observation request.\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.\n */\nexport interface RenderInspection {\n readonly state: RendererState;\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 readonly renderScene: RenderSceneInspection;\n readonly reflectionProbes: ReflectionProbeInspection;\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 readonly perFramePassNames: readonly string[];\n readonly bindGroupCounts: {\n readonly createBindGroup: number;\n readonly keys: readonly string[];\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 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}\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/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 '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 // 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,67 +0,0 @@
1
- import { vec3 } from '@forgeax/engine-math';
2
-
3
- // src/record/frame-snapshot.ts
4
- function worldEntityKey(worldId, entityKey) {
5
- return worldId * 4294967296 + entityKey;
6
- }
7
- var ZERO_CAMERA_CLEAR_FALLBACK = [0, 0, 0, 1];
8
- var textureIdentities = /* @__PURE__ */ new WeakMap();
9
- var nextTextureIdentity = 1;
10
- function getTextureIdentity(texture) {
11
- const object = texture;
12
- const existing = textureIdentities.get(object);
13
- if (existing !== void 0) return existing;
14
- const identity = nextTextureIdentity++;
15
- textureIdentities.set(object, identity);
16
- return identity;
17
- }
18
- function validateGraphTargetCaptureReadback(input) {
19
- const { bytes, expectedByteLength, sentinel } = input;
20
- if (bytes.byteLength !== expectedByteLength)
21
- return { ok: false, code: "capture-readback-length" };
22
- if (sentinel?.every((value, index) => bytes[index] === value)) {
23
- return { ok: false, code: "capture-readback-untouched-sentinel" };
24
- }
25
- if (bytes.every((value) => value === 0)) return { ok: false, code: "capture-readback-empty" };
26
- for (let index = 0; index + 1 < bytes.length; index += 2) {
27
- const exponent = (bytes[index + 1] ?? 0) >>> 2 & 31;
28
- if (exponent === 31) return { ok: false, code: "capture-readback-non-finite" };
29
- }
30
- return { ok: true };
31
- }
32
- function makeZeroCameraFallbackSnapshot() {
33
- const identityWorld = new Float32Array(16);
34
- identityWorld[0] = 1;
35
- identityWorld[5] = 1;
36
- identityWorld[10] = 1;
37
- identityWorld[15] = 1;
38
- return {
39
- position: vec3.create(0, 0, 0),
40
- world: identityWorld,
41
- fov: Math.PI / 4,
42
- aspect: 1,
43
- near: 0.1,
44
- far: 100,
45
- // feat-20260613 M6 / w20: synthetic camera defaults to perspective so
46
- // the CSM extract path stays consistent with the previously-implicit
47
- // perspective shape (unchanged behavior; explicit field).
48
- projection: "perspective",
49
- orthoLeft: -1,
50
- orthoRight: 1,
51
- orthoBottom: -1,
52
- orthoTop: 1,
53
- tonemap: "none",
54
- exposure: 1,
55
- whitePoint: 4,
56
- antialias: "none",
57
- bloom: "off",
58
- bloomThreshold: 1,
59
- bloomIntensity: 1,
60
- bloomBlurRadius: 4,
61
- clearColor: ZERO_CAMERA_CLEAR_FALLBACK
62
- };
63
- }
64
-
65
- export { getTextureIdentity, makeZeroCameraFallbackSnapshot, validateGraphTargetCaptureReadback, worldEntityKey };
66
- //# sourceMappingURL=chunk-BXBQQKFQ.mjs.map
67
- //# sourceMappingURL=chunk-BXBQQKFQ.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/record/frame-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AAA,IACjB,UAAA,EAAY;AAAA,GACd;AACF","file":"chunk-BXBQQKFQ.mjs","sourcesContent":["// @forgeax/engine-runtime - RenderSystem record stage: frame-snapshot.\n// Extracted from render-system-record.ts (feat-20260704 M3/w17, pure move).\n\nimport type { World } from '@forgeax/engine-ecs';\nimport { vec3 } from '@forgeax/engine-math';\nimport type { ResolvedColorTargetDescriptor } from '@forgeax/engine-render-graph';\nimport type {\n BindGroup,\n BindGroupLayout,\n Buffer,\n RhiDevice,\n Texture,\n TextureView,\n} from '@forgeax/engine-rhi';\nimport type { ClusterBinScratch } from '../cluster-binner';\nimport type { DirectionalShadowQuality } from '../components/directional-shadow-filter';\nimport type { EnvironmentGeneration } from '../environment/generation';\nimport type { EnvironmentLifecycle } from '../environment/lifecycle';\nimport type { GpuBuffer } from '../gpu-resource';\nimport type { StandardLightingInspection } from '../pipeline/standard-lighting/inspection';\nimport type { PointShadowInspection } from '../point-shadow-inspection';\nimport type { TemporalGpuState } from '../temporal/gpu';\nimport type { TemporalView } from '../temporal/view';\n\nexport type TemporalCommitOutcome =\n | { readonly kind: 'none' }\n | { readonly kind: 'off'; readonly view: TemporalView }\n | { readonly kind: 'taa'; readonly view: TemporalView };\n\n/**\n * feat-20260708-composited-multi-world-rendering M1 / D-1 / D-9:\n * worldId-entityKey composite key helper. Formula: `worldId * 2^32 + entityKey`.\n *\n * worldId is the index into `worlds[]` (the `draw` call argument). entityKey\n * is the packed Entity u32 (encodeEntity(indexSlot, generation)) surfaced\n * through `RenderableSnapshot.entityKey`.\n *\n * Key properties:\n * - worldId=0 identity: `worldEntityKey(0, k) === k` — single-world path\n * cache behavior is bit-for-bit unchanged (AC-03 regression guarantee).\n * - JS safe integer: worldId < 2^21 keeps the composite key below\n * Number.MAX_SAFE_INTEGER (2^53).\n * - SSOT: all cache-key compositing consumers import this single helper;\n * no inline `worldId * 2^32 + k` duplication (D-9).\n *\n * @internal — exported for unit test + glyph/tilemap/record consumers;\n * not part of the public @forgeax/engine-runtime API surface.\n */\nexport function worldEntityKey(worldId: number, entityKey: number): number {\n return worldId * 4294967296 + entityKey; // 2^32 = 4294967296\n}\n\n/**\n * Cross-frame cache entry for a material bind group whose source material and\n * all resolved GPU resources are stable. The material snapshot identity is\n * the extract-layer invalidation token; the builder only stores entries after\n * all explicit resource handles resolved to resident GPU objects.\n */\nexport interface MaterialBgAssemblyCacheEntry {\n readonly material: MaterialSnapshot;\n /** Invalidates when a texture/sampler residency identity changes. */\n readonly materialResourceEpoch: number;\n readonly materialBgl: BindGroupLayout;\n /** Buffer identity changes when the shared material capacity grows. */\n readonly materialBuffer: Buffer;\n readonly skylightResources: SkylightBindGroupResources;\n readonly bindGroup: BindGroup;\n}\n\nimport type { CompiledRenderGraph } from '@forgeax/engine-render-graph';\nimport type { MaterialRenderState, RenderPipelineAsset } from '@forgeax/engine-types';\nimport type { MeshGpuHandles } from '../device/gpu-residency';\nimport type { SkylightBindGroupResources } from '../ibl/skylight-bind-group';\nimport type { InstanceBufferCacheEntry } from '../instance-buffer-cache';\nimport type { CameraSnapshot, VolumetricFogFrameContext } from '../render-contract';\nimport type { RenderPipeline as RenderPipelineDef, RenderPipelineFrame } from '../render-pipeline';\nimport type {\n DispatchEntry,\n MaterialSnapshot,\n PointShadowSnapshot,\n RenderableSnapshot,\n SpotLightSnapshot,\n} from '../render-system-extract';\nimport type { ShadowAtlas } from '../shadow-atlas';\nimport type {\n TemporalFrame,\n TemporalFrameInput,\n TemporalFrameTransaction,\n} from '../temporal/frame';\nimport type { VolumetricFogInspection } from '../volume/inspection';\nimport type { VolumeTemporalSignature } from '../volume/temporal';\n\n/**\n * feat-20260608-create-app-param-surface-trim / M1 / D-8 (q8 user lock):\n * fallback clear color when the world carries no Camera entity. Opaque\n * black `[0, 0, 0, 1]`, replacing the historical\n * `[0.06, 0.06, 0.08, 1.0]` dark-slate sentinel. Single SSOT consumed by\n * the synthetic CameraSnapshot built when `cameras.length === 0`\n * (Case B in `recordFrame`) and read directly by tests\n * (`zero-camera-clear-fallback.test.ts`). AC-05.\n */\nexport const ZERO_CAMERA_CLEAR_FALLBACK: readonly [number, number, number, number] = [0, 0, 0, 1];\n\nexport interface FrameObservationSource {\n readonly texture: Texture;\n readonly descriptor: ResolvedColorTargetDescriptor;\n readonly frameId: number;\n readonly pipelineId: 'forgeax::standard';\n readonly backendId: string;\n}\n\n/** Internal test/diagnostic view of one compiled graph color target. */\nexport interface CurrentGraphTarget {\n readonly name: string;\n readonly texture: Texture;\n /** Stable opaque identity for this RHI handle during the renderer lifetime. */\n readonly textureIdentity: number;\n readonly descriptor: ResolvedColorTargetDescriptor;\n readonly frameId: number;\n /** Monotonic identity of the compiled graph that owns this texture. */\n readonly graphGeneration: number;\n}\n\nconst textureIdentities = new WeakMap<object, number>();\nlet nextTextureIdentity = 1;\n\n/**\n * Project an opaque RHI texture handle to a stable diagnostic identity.\n * RHI handles intentionally expose no serializable fields; object identity is\n * the only valid comparison boundary for a copy-time capture.\n */\nexport function getTextureIdentity(texture: Texture): number {\n const object = texture as object;\n const existing = textureIdentities.get(object);\n if (existing !== undefined) return existing;\n const identity = nextTextureIdentity++;\n textureIdentities.set(object, identity);\n return identity;\n}\n\nexport type GraphTargetCaptureReadbackValidation =\n | { readonly ok: true }\n | {\n readonly ok: false;\n readonly code:\n | 'capture-readback-length'\n | 'capture-readback-untouched-sentinel'\n | 'capture-readback-empty'\n | 'capture-readback-non-finite';\n };\n\n/** Validate a mapped rgba16float capture before a consumer decodes its values. */\nexport function validateGraphTargetCaptureReadback(input: {\n readonly bytes: Uint8Array;\n readonly expectedByteLength: number;\n readonly sentinel?: Uint8Array;\n}): GraphTargetCaptureReadbackValidation {\n const { bytes, expectedByteLength, sentinel } = input;\n if (bytes.byteLength !== expectedByteLength)\n return { ok: false, code: 'capture-readback-length' };\n if (sentinel?.every((value, index) => bytes[index] === value)) {\n return { ok: false, code: 'capture-readback-untouched-sentinel' };\n }\n if (bytes.every((value) => value === 0)) return { ok: false, code: 'capture-readback-empty' };\n for (let index = 0; index + 1 < bytes.length; index += 2) {\n const exponent = ((bytes[index + 1] ?? 0) >>> 2) & 0x1f;\n if (exponent === 0x1f) return { ok: false, code: 'capture-readback-non-finite' };\n }\n return { ok: true };\n}\n\n/** Internal readback request consumed by the record encoder in the same submit. */\nexport interface GraphTargetCaptureRequest {\n readonly name: string;\n readonly buffer: Buffer;\n readonly bytesPerRow: number;\n readonly width: number;\n readonly height: number;\n /** Descriptor contract checked against the resolved target at copy time. */\n readonly expected: {\n readonly format: ResolvedColorTargetDescriptor['format'];\n readonly width: number;\n readonly height: number;\n readonly usage: number;\n /** Optional caller binding; when present it is checked at copy time. */\n readonly identity?: {\n readonly graphGeneration: number;\n readonly frameId: number;\n readonly textureIdentity: number;\n };\n };\n}\n\n/**\n * Build a synthetic CameraSnapshot the record stage uses when the world\n * carries no Camera entity. Identity-shaped projection / view inputs\n * keep the existing matrix math numerically stable; clear-color quartet\n * sourced from `ZERO_CAMERA_CLEAR_FALLBACK` so the swap-chain still\n * paints `[0, 0, 0, 1]` (AI-user friendly observable signal that the\n * `'render-system-no-camera'` diagnostic fired without leaving stale\n * pixels on screen).\n */\nexport function makeZeroCameraFallbackSnapshot(): CameraSnapshot {\n // Identity world mat4 so `mat4.invert(world)` yields identity view.\n const identityWorld = new Float32Array(16);\n identityWorld[0] = 1;\n identityWorld[5] = 1;\n identityWorld[10] = 1;\n identityWorld[15] = 1;\n return {\n position: vec3.create(0, 0, 0),\n world: identityWorld,\n fov: Math.PI / 4,\n aspect: 1,\n near: 0.1,\n far: 100,\n // feat-20260613 M6 / w20: synthetic camera defaults to perspective so\n // the CSM extract path stays consistent with the previously-implicit\n // perspective shape (unchanged behavior; explicit field).\n projection: 'perspective',\n orthoLeft: -1,\n orthoRight: 1,\n orthoBottom: -1,\n orthoTop: 1,\n tonemap: 'none',\n exposure: 1.0,\n whitePoint: 4.0,\n antialias: 'none',\n bloom: 'off',\n bloomThreshold: 1.0,\n bloomIntensity: 1.0,\n bloomBlurRadius: 4.0,\n clearColor: ZERO_CAMERA_CLEAR_FALLBACK,\n };\n}\n\n/**\n * Per-RenderSystem mutable frame state.\n *\n * Owned by the `createRenderSystem` closure; advanced once per\n * `recordFrame` invocation. The `instanceBuffers` map holds the per-entity\n * GPU storage buffers for Instances-bearing entities (cache key = the\n * packed Entity u32 surfaced via `InstancesSnapshot.cacheKey`); entries\n * are recreated when the `archVersion` bumps or `byteLength` changes.\n *\n * feat-20260518-pbr-direct-lighting-mvp M3 / w14 (AC-17 a): the\n * `warnedZeroLightStandard` flag latches the first-frame warning that\n * fires when the world contains a StandardMaterial entity but zero\n * DirectionalLight entries — once latched the next 100 frames suppress\n * the warning so the AI user is not flooded with repeated noise (charter\n * P3 silent failure -> explicit warning at most once per RenderSystem\n * lifetime).\n */\nexport interface RenderFrameState {\n frameNumber: number;\n /** Monotonic compiled-graph identity used by diagnostic readbacks. */\n graphGeneration: number;\n /** Number of successfully submitted TAA frames; failed attempts do not advance it. */\n successfulTemporalFrameIndex?: number;\n /** The renderer-owned accepted-submit temporal fact consumed by consumers. */\n temporalFrame?: TemporalFrame;\n /** The sole transaction that advances temporal history after queue.submit. */\n readonly temporalFrameTransaction: TemporalFrameTransaction;\n /** Staged input is consumed only by the graph submit owner. */\n temporalFrameInput: TemporalFrameInput | undefined;\n /** Optional graph resource lookup used by low-level record helpers and tests. */\n perFrameGraph?: {\n readonly getColorTargetDescriptor: (key: string) => ResolvedColorTargetDescriptor | undefined;\n readonly getColorTargetView: (key: string) => TextureView | undefined;\n readonly getColorTargetTexture: (key: string) => Texture | undefined;\n readonly graphGeneration: number;\n } | null;\n graphTargetCapture?: GraphTargetCaptureRequest | undefined;\n /** Last successfully rendered static directional shadow atlas token. */\n directionalShadowCache: DirectionalShadowCache | null;\n /** Last successfully submitted camera post-process mode. */\n lastSuccessfulBloom: 'off' | 'on';\n /** Bloom record receipts staged by this frame; cleared on abort. */\n bloomFrameReceipts?: BloomFrameReceipts | undefined;\n /** Set by a directional shadow pass when this frame refreshed the atlas. */\n directionalShadowCacheRecorded: boolean;\n /** The sole compiled owner for compute, copy, feature, and raster work. */\n compiledFrameGraph: CompiledRenderGraph<RenderPipelineFrame> | null;\n compiledFrameGraphTopologyKey: string | null;\n /** Monotonic generation of successfully promoted compiled graphs. */\n compiledFrameGraphGeneration: number;\n /**\n * Last-known-good graph held while a volume topology candidate is tested.\n * The candidate is promoted only after its command buffer is submitted;\n * failed encoding/finish/submit restores this graph and its topology key.\n */\n volumetricFogPreviousGraph: CompiledRenderGraph<RenderPipelineFrame> | null;\n volumetricFogPreviousGraphKey: string | null;\n volumetricFogCandidateGraph: CompiledRenderGraph<RenderPipelineFrame> | null;\n /** Two renderer-owned parameter slots; only the pending slot is writable. */\n volumetricFogParamsBuffers: [Buffer | null, Buffer | null];\n /** Candidate parameter slot, promoted only after queue submission succeeds. */\n volumetricFogParamsPendingSlot: 0 | 1 | null;\n /** Parameter slot consumed by the last accepted volume frame. */\n volumetricFogParamsAcceptedSlot: 0 | 1 | null;\n /** CPU copy of the accepted parameter payload for degraded-frame staging. */\n volumetricFogAcceptedParams: Float32Array | undefined;\n /** CPU copy of the current candidate payload before submit. */\n volumetricFogPendingParams: Float32Array | undefined;\n /** Last candidate/accepted volume projection exposed through inspect(). */\n volumetricFogInspection: VolumetricFogInspection;\n /** Accepted volume POD/context retained while a later candidate degrades. */\n volumetricFogAccepted: import('../render-system-extract').ExtractedVolumetricFog | undefined;\n volumetricFogAcceptedContext: VolumetricFogFrameContext | undefined;\n /** Accepted graph identity and ping-pong slot for temporal volume history. */\n volumetricFogHistoryGraph: CompiledRenderGraph<RenderPipelineFrame> | null;\n volumetricFogHistorySlot: 0 | 1 | null;\n volumetricFogHistorySignature: VolumeTemporalSignature | null;\n readonly retiredCompiledFrameGraphs: Set<CompiledRenderGraph<RenderPipelineFrame>>;\n /** Physical outputs projected by typed graph passes for downstream observers. */\n currentFrameObservationSource: FrameObservationSource | undefined;\n /** Camera antialias mode for the last successfully submitted graph. */\n lastSuccessfulCameraAntialias: CameraSnapshot['antialias'] | undefined;\n /** Staged TAA GPU state is promoted only after queue.submit succeeds. */\n temporalGpuState: TemporalGpuState | undefined;\n /** Last successful TAA GPU state; candidate replacement stays staged until submit. */\n activeTemporalGpuState: TemporalGpuState | undefined;\n /** Submitted temporal generations retained until their queue fence resolves. */\n readonly retiringTemporalGpuStates: Set<TemporalGpuState>;\n /** Last successful projection; candidate frames never overwrite it. */\n lastSuccessfulTemporalView: TemporalView | undefined;\n pendingTemporalCommit: TemporalCommitOutcome;\n /** Staged environment generation is promoted only after queue.submit succeeds. */\n environmentGeneration: EnvironmentGeneration | undefined;\n readonly environmentLifecycle: EnvironmentLifecycle | undefined;\n currentDirectionalShadowView: TextureView | null;\n currentSpotShadowView: TextureView | null;\n readonly instanceBuffers: Map<number, InstanceBufferCacheEntry>;\n /** Per-entity vertex buffers for the Standard CPU morph lane. */\n readonly morphBuffers?: Map<number, MorphBufferCacheEntry>;\n readonly hdrpClusterBinScratch: ClusterBinScratch;\n /** Reusable HDRP cluster output buffers; sized once and grown only if the grid/cap changes. */\n hdrpClusterGridScratch: Uint32Array | null;\n hdrpLightIndexListScratch: Uint32Array | null;\n /** Device-owned membership binding; layout and device must match the active pipeline. */\n hdrpClusterMembership: {\n readonly device: RhiDevice;\n readonly layout: BindGroupLayout;\n readonly bindGroup: BindGroup;\n /** Cluster buffer identity keeps this group aligned with grown bundles. */\n readonly clusterGridBuffer: Buffer;\n } | null;\n /**\n * Signature of the Standard lighting declaration accepted by the compiled\n * graph. Payload uploads and membership bindings must match this signature;\n * a failed candidate never changes it.\n */\n standardLightingGraphSignature: string;\n /** Last prepared Standard transport facts projected for Renderer.inspect(). */\n standardLightingInspection?: StandardLightingInspection | undefined;\n /** Last submitted point-shadow atlas budget projection. */\n pointShadowInspection?: PointShadowInspection | undefined;\n transientInstanceBuffers: InstanceBufferCacheEntry[];\n warnedZeroLightStandard: boolean;\n /**\n * feax-20260608-multi-light-warn-once M3: once-warn latch for multi-light\n * overrun per bucket (directional N>1 / point N>4 / spot N>4). Fires at\n * most once per RenderSystem lifetime per bucket so AI users see a single\n * actionable console.warn without per-frame flooding (charter P3 explicit\n * failure: warn-once preserves signal/noise floor).\n */\n warnedMultiLightDirectional: boolean;\n warnedMultiLightPoint: boolean;\n warnedMultiLightSpot: boolean;\n /**\n * feat-20260630-equirect-kind-internalized-ibl-declarative-skyligh M3 / w19:\n * once-warn latches for >1 Skylight / >1 SkyboxBackground entity. Fire at most\n * once per RenderSystem lifetime so the multi-entity warn (which names the\n * winning entity handle, F-8) does not flood the console every frame.\n */\n warnedMultiSkylight: boolean;\n warnedMultiSkybox: boolean;\n /** feat-20260531-skybox-env-background M3 / w20: once-warn when camera\n * tonemap is 'none' but a SkyboxBackground entity exists. Skybox needs\n * the HDR render target allocated by the tonemap path; without it the\n * skybox pass is skipped (plan-strategy D-2 NOTE). */\n warnedSkyboxTonemapNone: boolean;\n /**\n * Per-handle warn-once anchor for the missing baseColor-texture fallback,\n * shared by every textured material path (sprite / sprite-lit / standard-pbr\n * / pbr-skin / unlit — feat-20260520-2d-sprite-layer-mvp M-3 / w25 seeded it\n * for sprites; feat-future-pbr-missing-texture-fallback-explicit generalised\n * it to PBR/skin so GLB textures that fail to reach the GPU no longer render\n * silently flat). A `Set<number>` keyed by the raw Handle<TextureAsset> id -\n * the writer fires `console.warn` exactly once per missing texture handle per\n * RenderSystem lifetime so AI users see a single actionable message without\n * per-frame log flooding. The set lives across frames so the second frame on\n * the same missing handle stays silent (charter P3 explicit failure:\n * warn-once preserves signal / noise floor while structured RhiError below\n * stays per-frame fire).\n *\n * Note on the WeakSet/Set choice: plan-strategy mentions WeakSet but\n * Handle values are numeric brand u32s (not object references), so\n * WeakSet<object> is not applicable; Set<number> gives identical\n * warn-once-per-handle semantics at zero additional cost (charter F1\n * minimal surface; the per-RenderSystem lifetime cap is the upper\n * bound).\n */\n readonly warnedMissingBaseColorTextureHandles: Set<number>;\n /**\n * feat-20260527-sprite-nineslice M2 / w11 + M4 / w16 (AC-16): once-per-\n * renderable guard for the `nineslice.scale-too-small` metric increment.\n * Keyed by `renderableIndex` so the second frame on the same mis-scaled\n * entity does NOT keep bumping the counter — AI users see one counter\n * tick per offending entity per RenderSystem lifetime, matching the\n * single-event semantics of the structured fail-fast (charter P3:\n * machine-readable signal, not a per-frame inflation). M4 retired the\n * placeholder console.warn; the increment lands on the per-Renderer\n * EngineMetrics through `runtime.metrics.increment(...)`.\n */\n readonly warnedNineSliceScaleEntities: Set<number>;\n /**\n * feat-20260630-equirect-kind-internalized-ibl-declarative-skyligh M3 / w18:\n * per-handle fire-once anchor for the lazy equirect-to-cubemap projection\n * failure. A `Set<number>` keyed by the raw Handle<EquirectAsset> id - the\n * record arm fires the structured `EquirectProjectionFailedError` exactly\n * once per failed source per RenderSystem lifetime (the store records\n * `status:'failed'` permanently and never retries, R-2 / AC-09; without this\n * latch the record arm would re-fire the error every frame). The set lives\n * across frames so the second frame on the same failed handle stays silent\n * (charter P3: warn-once preserves signal / noise floor).\n */\n readonly firedEquirectProjectionFailedHandles: Set<number>;\n /**\n * feat-20260622-handle-to-id-allocator-elimination M1 / w3: per-frame\n * bind group caches converted to nested WeakMap chain roots (D-3).\n * Each root is a WeakMap<object, WeakMap<...>> walked by\n * getOrCreateFromChain; the chain depth varies by variant\n * (view-main = 7, mesh = 1, hdrp-unified = 5, skin = 2).\n * Roots are stable between device recoveries and replaced when the renderer\n * swaps to a fresh device. Chain keys are always inner buffer handles, never\n * wrappers (D-3).\n */\n viewBindGroupCache: WeakMap<object, unknown>;\n meshBindGroupCache: WeakMap<object, unknown>;\n /**\n * feat-20260622-handle-to-id-allocator-elimination M1 / w2: per-entity\n * bind group caches scoped by entityKey (packed u32 as number).\n * Outer Map<number, WeakMap<handle, ...>> lets GC collect entries for\n * destroyed entities whose handles are unreachable; per-entity material\n * and instances share the same two-level shape (D-1). The inner WeakMap\n * value is opaque (`unknown`) because `getOrCreateFromChain` walks a\n * variable-depth chain — intermediate handles map to nested WeakMaps and\n * only the final handle maps to the variant->BindGroup leaf Map. Direct\n * readers (HDRP shadow-instances read end) assert the leaf shape locally.\n */\n /**\n * feat-20260708-composited-multi-world-rendering M1 / D-1a #2: outer Map\n * keyed by `worldEntityKey(worldId, entityKey)`. Inner WeakMap unchanged.\n */\n readonly materialBgPerEntity: Map<number, WeakMap<object, unknown>>;\n /**\n * feat-20260708-composited-multi-world-rendering M1 / D-1a #3: outer Map\n * keyed by `worldEntityKey(worldId, entityKey)`. Inner WeakMap unchanged.\n */\n readonly instancesBgPerEntity: Map<number, WeakMap<object, unknown>>;\n /** Identity-keyed instances BGs shared across entities using the same buffer. */\n readonly instancesBgShared: WeakMap<object, unknown>;\n /**\n * feat-20260622-handle-to-id-allocator-elimination M1 / w2: cross-entity\n * shared material bind group cache (OQ-1 option A). Outer key is the\n * material shaderId string; inner chain is a WeakMap keyed by the same\n * handle objects used in per-entity chains. Reuses the generic\n * `getOrCreatePerEntity` helper with outerKey string|number (D-1).\n */\n readonly materialBgShared: Map<string, WeakMap<object, unknown>>;\n /** Cross-frame fast path for fully-resident, immutable material snapshots. */\n readonly materialBgAssemblyCache: Map<string, MaterialBgAssemblyCacheEntry>;\n /**\n * feat-20260622-handle-to-id-allocator-elimination M1 / w2: singleton\n * material bind group cache (D-6). Single flat Map<variant, BindGroup>\n * for the one true singleton in production: shadow-material-singleton.\n * shadow-instances-singleton is a test fixture fiction (research F3);\n * no second singleton field is needed.\n */\n readonly singletonMaterialCache: Map<string, BindGroup>;\n /**\n * Post-process bind group cache: nested WeakMap chain root shared by the\n * built-in bloom (bright / blur-H / blur-V / composite), FXAA, and HDRP SSAO\n * (calc / blur) fullscreen passes. Each of these passes samples graph-owned\n * transient render targets (hdrColor / ldrColor / bloom* / ssaoRaw /\n * gbuf0 / hdrDepth); on canvas resize the graph retires the old physical\n * textures and allocates new ones, so the bind group must be rebuilt to\n * reference the new TextureView identity. Keying the cache on the physical\n * TextureView (or `::tex` texture handle for passes that recreate their bound\n * view every frame) makes invalidation automatic: a resized target yields a\n * new key object -> WeakMap miss -> factory rebuild, and dead views are GC'd\n * (same identity-invalidation mechanism as view/mesh caches, D-3). Replaces\n * the pre-fix `pp.*BindGroup === null` single-slot caches that never\n * invalidated on resize and submitted destroyed textures.\n */\n postProcessBgCache: WeakMap<object, unknown>;\n /**\n * Raw handle of the currently installed RenderPipelineAsset (0 = builtin).\n * Installation brands the next candidate topology; the prior compiled graph\n * remains last-known-good until the candidate compiles successfully.\n */\n installedPipelineHandle: number;\n /**\n * Active topology declaration resolved from the pipeline registry.\n */\n activePipeline: RenderPipelineDef;\n /**\n * Install-time config projected into `RenderPipelineTopology.config`.\n */\n installedPipelineConfig: RenderPipelineAsset['config'];\n /**\n * feat-20260608-cluster-lighting M5 / w20 + M6 / w23 + M5 / w22:\n * once-per-frame fire dedup set for Standard per-frame fail-soft errors\n * (`standard-light-budget-exceeded`, `standard-cluster-index-overflow`). Cleared\n * at the end of each frame so the next frame re-fires if the condition\n * persists. Set<string> keyed by RuntimeErrorCode literal.\n */\n standardOncePerFrameFired: Set<string>;\n /**\n * feat-20260612-point-light-shadows-urp-hdrp M3 / T-M3-2 (plan-strategy §D-1).\n * Lazily-allocated cube_array shadow atlas owned by the RenderSystem\n * lifetime. `null` until the first frame whose `lights.pointShadow` is\n * non-empty (zero-shadow scenes never allocate; AC-09). The atlas is\n * disposed by the renderer dispose path; subsequent frames with a non-empty\n * snapshot list re-allocate.\n */\n pointShadowAtlas: ShadowAtlas | null;\n /**\n * feat-20260612-point-light-shadows-urp-hdrp M3 / T-M3-2 (plan-strategy §D-3):\n * per-frame projection of `lights.pointShadow` from the extract stage. The\n * typed point-shadow pass reads this list to drive the 6 x N face iteration.\n * Empty array means the topology declares no point-shadow passes.\n */\n pointShadowSnapshots: readonly PointShadowSnapshot[];\n /**\n * feat-20260622-chunk-gpu-instancing-sprite-tilemap M1 / w4 (D-1):\n * last fold-pass output, computed at `recordFrame` entry from the\n * transparent-sort-ordered dispatch + mode-gate (D-5: only mode 0\n * folds; other modes yield singleton buckets). Currently an\n * observational compute — the drawIndexed swap (1 instanced draw per\n * fold bucket) is the follow-on integration that wires each bucket\n * into the sprite-pass / geometry-pass dispatch loops. The bucket\n * count is the source of truth for `render.instancing.foldedDraws`\n * metric (M3 / w13) — every fold-eligible bucket (bucketSize >= 1\n * under mode 0 AND not bypassed) contributes one increment.\n */\n lastFoldBucketCount: number;\n /**\n * feat-20260625-spot-light-shadow-mapping M2 / w9 (D-2): per-frame projection\n * of `lights.spot` from the extract stage. The typed spot-shadow graph\n * pass reads this list to render each\n * castShadow spot's perspective depth into its `spotShadowDepth` atlas tile\n * (viewport keyed on `shadowAtlasTile`). `recordFrame` writes it before\n * graph execution. Spots with `shadowAtlasTile < 0` (castShadow:false,\n * degenerate direction, or clipped beyond cap 4) are skipped — zero\n * shadow-casting spots means zero spot shadow passes (AC-03).\n */\n spotShadowSnapshots: readonly SpotLightSnapshot[];\n}\n\nexport interface MorphBufferCacheEntry {\n readonly buffer: GpuBuffer;\n readonly byteLength: number;\n}\n\n/**\n * feat-20260518-pbr-direct-lighting-mvp M5 / w22.11 (D-2 + D-10 + AC-06):\n * mutable per-frame dispatch counter object owned by `createRenderSystem`\n * and bumped here at the actual `pass.setPipeline(...)` call site (the\n * only point with both `mat.materialShaderId` and `mesh.layoutProjection` in scope).\n * Unlit / custom shader pipeline dispatch tracked here.\n */\nexport interface DispatchCounts {\n unlit: number;\n /** feat-20260523 M4-T07: 'standard' counter removed; schema-driven\n * materials are tracked via materialShaderId in the pipeline cache. */\n}\n\n/**\n * feat-20260531-per-frame-bind-group-cache M1 / w4: per-frame\n * createBindGroup counter. Closure-mutable object aligned with\n * DispatchCounts precedent. Reset in draw(world) entry, bumped on\n * cache-miss createBindGroup calls (M2-M4).\n */\nexport interface BindGroupCounts {\n createBindGroup: number;\n /**\n * Debug-only: records the variant of every cache-miss BindGroup created via\n * `getOrCreateFromChain` for unit-test observability. Production paths do\n * not read this array.\n */\n keys: string[];\n}\n\n/**\n * Successful Bloom record operations staged for the current frame. These\n * counters are promoted only after the shared renderer queue submission.\n */\nexport interface BloomFrameReceipts {\n readonly uploadCount: number;\n readonly bindGroupCount: number;\n readonly encodeCount: number;\n}\n\n/**\n * A renderable resolved against the AssetRegistry for the current frame:\n * its source snapshot, the GPU mesh handles, the row index used to correlate\n * transparent-sort output back to this entry, and an optional per-material\n * renderState override (bug-20260527-renderstate-pipeline-dispatch-gap D-4).\n * Module-scoped so RenderPipelineContext can type `validated` / `validatedOrdered`\n * without a dynamic type escape (was a recordFrame-local interface before F-4).\n */\nexport interface ValidatedRenderable {\n readonly source: RenderableSnapshot;\n /** World that owns the renderable's asset handles and material snapshots. */\n readonly world?: World;\n readonly mesh: MeshGpuHandles;\n readonly renderableIndex: number;\n readonly renderState: MaterialRenderState | undefined;\n /**\n * Canonical authored material-variant request folded from the selected\n * pass's `defines` map. Capability axes are merged at the renderer seam;\n * this field carries only the pass-owned selection into record.\n */\n readonly variantSet?: string | undefined;\n /**\n * w10: per-pass stencil reference value folded from\n * {@link DispatchEntry.stencilReference} (draw-call dynamic state). The draw\n * loop calls `pass.setStencilReference(stencilReference ?? 0)` before each\n * draw; `undefined` falls back to the WebGPU default 0 (semantic no-op).\n */\n readonly stencilReference: number | undefined;\n}\n\n/**\n * Cross-frame validity token for the directional shadow atlas.\n *\n * The atlas is a render target, not authored state. Keeping its validity\n * token beside the other RenderFrameState caches lets recordFrame skip a\n * static caster submission without teaching the public render-pipeline\n * contract about caching. Every source that can change caster depth is part\n * of the token: world mutation, asset catalogue, graph/target identity, CSM\n * matrices, and the GPU mesh-residency epoch.\n *\n * @internal\n */\nexport interface DirectionalShadowCache {\n readonly worlds: readonly World[];\n readonly worldStateTokens: readonly DirectionalShadowWorldState[];\n readonly assetCatalogEpoch: number;\n readonly pipelineHandle: number;\n readonly graphTopologyKey: string | null;\n readonly shadowMapSize: number;\n readonly cascadeCount: number;\n readonly directionalShadowQuality: DirectionalShadowQuality;\n readonly lightViewProj: readonly Float32Array[];\n readonly meshResidencyEpoch: number;\n}\n\n/**\n * ECS state that can change the contents of a directional shadow map.\n *\n * The ECS-owned RenderReadLease is the only render-facing mutation boundary.\n * Its cursor is intentionally conservative: any published World change\n * invalidates the cached atlas, while render never reaches through World for\n * component-clock storage.\n */\nexport interface DirectionalShadowWorldState {\n readonly worldIdentity: string;\n readonly changeCursor: number;\n}\n"]}