@forgeax/engine-render 0.1.28 → 0.1.30

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 (768) hide show
  1. package/README.md +856 -126
  2. package/dist/assembly/atmosphere-shader-prewarm.d.ts +6 -0
  3. package/dist/assembly/atmosphere-shader-prewarm.d.ts.map +1 -0
  4. package/dist/assembly/device-feature-admission.d.ts +4 -3
  5. package/dist/assembly/device-feature-admission.d.ts.map +1 -1
  6. package/dist/assembly/dynamic-geometry-host.d.ts +27 -0
  7. package/dist/assembly/dynamic-geometry-host.d.ts.map +1 -1
  8. package/dist/assembly/dynamic-geometry-runtime.d.ts +20 -0
  9. package/dist/assembly/dynamic-geometry-runtime.d.ts.map +1 -0
  10. package/dist/assembly/factory.d.ts +3 -1
  11. package/dist/assembly/factory.d.ts.map +1 -1
  12. package/dist/assembly/gpu-driven-owner.d.ts +10 -0
  13. package/dist/assembly/gpu-driven-owner.d.ts.map +1 -0
  14. package/dist/assembly/host-contract.d.ts +14 -0
  15. package/dist/assembly/host-contract.d.ts.map +1 -1
  16. package/dist/assembly/material/assembly.d.ts +31 -1
  17. package/dist/assembly/material/assembly.d.ts.map +1 -1
  18. package/dist/assembly/material/pipeline-helpers.d.ts +24 -0
  19. package/dist/assembly/material/pipeline-helpers.d.ts.map +1 -0
  20. package/dist/assembly/material-shader-policy.d.ts +3 -1
  21. package/dist/assembly/material-shader-policy.d.ts.map +1 -1
  22. package/dist/assembly/recovery/device-loss-fanout.d.ts.map +1 -1
  23. package/dist/assembly/recovery/failure-location.d.ts +12 -0
  24. package/dist/assembly/recovery/failure-location.d.ts.map +1 -0
  25. package/dist/assembly/recovery/recovery-attempt.d.ts +1 -6
  26. package/dist/assembly/recovery/recovery-attempt.d.ts.map +1 -1
  27. package/dist/assembly/recovery/renderer-recover.d.ts +7 -4
  28. package/dist/assembly/recovery/renderer-recover.d.ts.map +1 -1
  29. package/dist/assembly/renderer-facade.d.ts.map +1 -1
  30. package/dist/assembly/renderer-feature-inspection.d.ts +5 -0
  31. package/dist/assembly/renderer-feature-inspection.d.ts.map +1 -0
  32. package/dist/assembly/renderer-frame-transaction.d.ts +19 -0
  33. package/dist/assembly/renderer-frame-transaction.d.ts.map +1 -1
  34. package/dist/assembly/renderer-helpers.d.ts +3 -0
  35. package/dist/assembly/renderer-helpers.d.ts.map +1 -1
  36. package/dist/assembly/renderer-inspection.d.ts +4 -0
  37. package/dist/assembly/renderer-inspection.d.ts.map +1 -1
  38. package/dist/assembly/shader-prewarm-policy.d.ts +7 -1
  39. package/dist/assembly/shader-prewarm-policy.d.ts.map +1 -1
  40. package/dist/assembly/skin-palette-owner.d.ts +8 -0
  41. package/dist/assembly/skin-palette-owner.d.ts.map +1 -0
  42. package/dist/assembly/ssr-shader-prewarm.d.ts +6 -0
  43. package/dist/assembly/ssr-shader-prewarm.d.ts.map +1 -0
  44. package/dist/assembly/webgpu-device-loss.d.ts +15 -0
  45. package/dist/assembly/webgpu-device-loss.d.ts.map +1 -0
  46. package/dist/assembly/webgpu-pbr-ready.d.ts +38 -0
  47. package/dist/assembly/webgpu-pbr-ready.d.ts.map +1 -0
  48. package/dist/assembly/webgpu-ready-mipmap.d.ts +11 -0
  49. package/dist/assembly/webgpu-ready-mipmap.d.ts.map +1 -0
  50. package/dist/assembly/webgpu-ready.d.ts +7 -3
  51. package/dist/assembly/webgpu-ready.d.ts.map +1 -1
  52. package/dist/assembly/webgpu-renderer-bootstrap.d.ts +10 -0
  53. package/dist/assembly/webgpu-renderer-bootstrap.d.ts.map +1 -0
  54. package/dist/assembly/webgpu-renderer-contract.d.ts +62 -0
  55. package/dist/assembly/webgpu-renderer-contract.d.ts.map +1 -0
  56. package/dist/assembly/webgpu-renderer-guards.d.ts +9 -0
  57. package/dist/assembly/webgpu-renderer-guards.d.ts.map +1 -0
  58. package/dist/assembly/webgpu-renderer-observation.d.ts +6 -0
  59. package/dist/assembly/webgpu-renderer-observation.d.ts.map +1 -0
  60. package/dist/assembly/webgpu-renderer-recovery-failure.d.ts +12 -0
  61. package/dist/assembly/webgpu-renderer-recovery-failure.d.ts.map +1 -0
  62. package/dist/assembly/webgpu-renderer.d.ts +7 -141
  63. package/dist/assembly/webgpu-renderer.d.ts.map +1 -1
  64. package/dist/assembly/webgpu-vertex-layouts.d.ts +28 -84
  65. package/dist/assembly/webgpu-vertex-layouts.d.ts.map +1 -1
  66. package/dist/authoring.mjs +2 -2
  67. package/dist/capture/scene-projection.d.ts +41 -0
  68. package/dist/capture/scene-projection.d.ts.map +1 -0
  69. package/dist/{chunk-J52NMQKR.mjs → chunk-7MQ3XBSP.mjs} +1098 -844
  70. package/dist/chunk-7MQ3XBSP.mjs.map +1 -0
  71. package/dist/{chunk-GF523LHF.mjs → chunk-BLXGONR2.mjs} +30 -12
  72. package/dist/chunk-BLXGONR2.mjs.map +1 -0
  73. package/dist/{chunk-VSL23LZE.mjs → chunk-C3DDSXYK.mjs} +1188 -463
  74. package/dist/chunk-C3DDSXYK.mjs.map +1 -0
  75. package/dist/{chunk-IQMKJLNU.mjs → chunk-FUUO4UND.mjs} +443 -30
  76. package/dist/chunk-FUUO4UND.mjs.map +1 -0
  77. package/dist/{chunk-J6KACNOH.mjs → chunk-JRBDO2KB.mjs} +617 -7
  78. package/dist/chunk-JRBDO2KB.mjs.map +1 -0
  79. package/dist/{chunk-GE3SDD72.mjs → chunk-MDQJPY3T.mjs} +20 -40
  80. package/dist/chunk-MDQJPY3T.mjs.map +1 -0
  81. package/dist/{chunk-MYJ5RPJO.mjs → chunk-NO4WZCAH.mjs} +3 -3
  82. package/dist/chunk-NO4WZCAH.mjs.map +1 -0
  83. package/dist/{chunk-RBDBZ5R7.mjs → chunk-PA5DRJNI.mjs} +2 -2
  84. package/dist/chunk-PA5DRJNI.mjs.map +1 -0
  85. package/dist/{chunk-MBU4ZVE7.mjs → chunk-PSEQ6QPH.mjs} +4655 -892
  86. package/dist/chunk-PSEQ6QPH.mjs.map +1 -0
  87. package/dist/{chunk-JAASCMXA.mjs → chunk-S5UE2T5P.mjs} +289 -41
  88. package/dist/chunk-S5UE2T5P.mjs.map +1 -0
  89. package/dist/components/camera.d.ts +62 -2
  90. package/dist/components/camera.d.ts.map +1 -1
  91. package/dist/components/directional-light.d.ts +2 -2
  92. package/dist/components/dynamic-resolution.d.ts +15 -0
  93. package/dist/components/dynamic-resolution.d.ts.map +1 -0
  94. package/dist/components/index.d.ts +2 -0
  95. package/dist/components/index.d.ts.map +1 -1
  96. package/dist/components/instances.d.ts +6 -20
  97. package/dist/components/instances.d.ts.map +1 -1
  98. package/dist/components/light-helpers.d.ts.map +1 -1
  99. package/dist/components/reflection-probe.d.ts +1 -0
  100. package/dist/components/reflection-probe.d.ts.map +1 -1
  101. package/dist/components/scene-instance.d.ts +2 -1
  102. package/dist/components/scene-instance.d.ts.map +1 -1
  103. package/dist/components/screen-space-reflection.d.ts +14 -0
  104. package/dist/components/screen-space-reflection.d.ts.map +1 -0
  105. package/dist/components/skylight.d.ts +4 -1
  106. package/dist/components/skylight.d.ts.map +1 -1
  107. package/dist/construct-renderer.mjs +14809 -7570
  108. package/dist/construct-renderer.mjs.map +1 -1
  109. package/dist/device/device-scope.d.ts +2 -0
  110. package/dist/device/device-scope.d.ts.map +1 -1
  111. package/dist/device/gpu-residency.d.ts +3 -14
  112. package/dist/device/gpu-residency.d.ts.map +1 -1
  113. package/dist/dynamic-geometry.d.ts.map +1 -1
  114. package/dist/environment/background.d.ts +7 -0
  115. package/dist/environment/background.d.ts.map +1 -0
  116. package/dist/environment/ibl.d.ts +11 -0
  117. package/dist/environment/ibl.d.ts.map +1 -0
  118. package/dist/environment/storage.d.ts +14 -0
  119. package/dist/environment/storage.d.ts.map +1 -0
  120. package/dist/errors/gpu-driven.d.ts +6 -3
  121. package/dist/errors/gpu-driven.d.ts.map +1 -1
  122. package/dist/errors/render.d.ts +41 -4
  123. package/dist/errors/render.d.ts.map +1 -1
  124. package/dist/extract/camera.d.ts.map +1 -1
  125. package/dist/extract/contracts.d.ts +7 -0
  126. package/dist/extract/contracts.d.ts.map +1 -1
  127. package/dist/extract/gpu-driven.d.ts +50 -3
  128. package/dist/extract/gpu-driven.d.ts.map +1 -1
  129. package/dist/features/host.d.ts +23 -1
  130. package/dist/features/host.d.ts.map +1 -1
  131. package/dist/features/noise-texture.d.ts +17 -0
  132. package/dist/features/noise-texture.d.ts.map +1 -0
  133. package/dist/features/plan.d.ts +83 -2
  134. package/dist/features/plan.d.ts.map +1 -1
  135. package/dist/features/prepared-gpu-work.d.ts +37 -4
  136. package/dist/features/prepared-gpu-work.d.ts.map +1 -1
  137. package/dist/features/prepared-graphics-store.d.ts.map +1 -1
  138. package/dist/features/prepared-graphics.d.ts +5 -0
  139. package/dist/features/prepared-graphics.d.ts.map +1 -1
  140. package/dist/features/render-graph-compute.d.ts +5 -3
  141. package/dist/features/render-graph-compute.d.ts.map +1 -1
  142. package/dist/features/render-graph-contribution.d.ts +11 -3
  143. package/dist/features/render-graph-contribution.d.ts.map +1 -1
  144. package/dist/features/render-graph-raster.d.ts +19 -3
  145. package/dist/features/render-graph-raster.d.ts.map +1 -1
  146. package/dist/features/types.d.ts +11 -0
  147. package/dist/features/types.d.ts.map +1 -1
  148. package/dist/fullscreen-post-process-pass.d.ts +2 -0
  149. package/dist/fullscreen-post-process-pass.d.ts.map +1 -1
  150. package/dist/gpu-driven/batch-topology.d.ts +34 -1
  151. package/dist/gpu-driven/batch-topology.d.ts.map +1 -1
  152. package/dist/gpu-driven/material-artifacts.d.ts +24 -0
  153. package/dist/gpu-driven/material-artifacts.d.ts.map +1 -0
  154. package/dist/gpu-driven/material-bindings.d.ts +7 -0
  155. package/dist/gpu-driven/material-bindings.d.ts.map +1 -0
  156. package/dist/gpu-driven/pbr-program.d.ts +10 -0
  157. package/dist/gpu-driven/pbr-program.d.ts.map +1 -0
  158. package/dist/gpu-driven/prepared-draw.d.ts +2 -0
  159. package/dist/gpu-driven/prepared-draw.d.ts.map +1 -1
  160. package/dist/gpu-driven/production-raster.d.ts +169 -27
  161. package/dist/gpu-driven/production-raster.d.ts.map +1 -1
  162. package/dist/gpu-driven/shadow-views.d.ts +126 -0
  163. package/dist/gpu-driven/shadow-views.d.ts.map +1 -0
  164. package/dist/gpu-driven/view-gpu.d.ts +18 -2
  165. package/dist/gpu-driven/view-gpu.d.ts.map +1 -1
  166. package/dist/gpu-resource.d.ts +5 -2
  167. package/dist/gpu-resource.d.ts.map +1 -1
  168. package/dist/gpu-scene-schema.d.ts +2 -8
  169. package/dist/gpu-scene-schema.d.ts.map +1 -1
  170. package/dist/gpu-scene.d.ts +14 -0
  171. package/dist/gpu-scene.d.ts.map +1 -1
  172. package/dist/gpu-texture-usage.d.ts +1 -0
  173. package/dist/gpu-texture-usage.d.ts.map +1 -1
  174. package/dist/hdrp-buffers.d.ts +9 -0
  175. package/dist/hdrp-buffers.d.ts.map +1 -1
  176. package/dist/ibl/IblPipelineCache.d.ts +2 -0
  177. package/dist/ibl/IblPipelineCache.d.ts.map +1 -1
  178. package/dist/ibl/frame-resources.d.ts +8 -0
  179. package/dist/ibl/frame-resources.d.ts.map +1 -0
  180. package/dist/ibl/skylight-bind-group.d.ts +3 -1
  181. package/dist/ibl/skylight-bind-group.d.ts.map +1 -1
  182. package/dist/index.d.ts +87 -75
  183. package/dist/index.d.ts.map +1 -1
  184. package/dist/index.mjs +10 -8
  185. package/dist/index.mjs.map +1 -1
  186. package/dist/inspection-types.d.ts +180 -1
  187. package/dist/inspection-types.d.ts.map +1 -1
  188. package/dist/instances-derived-bounds.d.ts +11 -0
  189. package/dist/instances-derived-bounds.d.ts.map +1 -1
  190. package/dist/instances.d.ts +89 -44
  191. package/dist/instances.d.ts.map +1 -1
  192. package/dist/internal.d.ts +3 -0
  193. package/dist/internal.d.ts.map +1 -1
  194. package/dist/internal.mjs +117 -9
  195. package/dist/internal.mjs.map +1 -1
  196. package/dist/lifecycle.d.ts +2 -1
  197. package/dist/lifecycle.d.ts.map +1 -1
  198. package/dist/material-row.d.ts +15 -0
  199. package/dist/material-row.d.ts.map +1 -0
  200. package/dist/materials.d.ts +15 -0
  201. package/dist/materials.d.ts.map +1 -1
  202. package/dist/pbr-pipeline.d.ts +23 -5
  203. package/dist/pbr-pipeline.d.ts.map +1 -1
  204. package/dist/pipeline/render-extent.d.ts +51 -0
  205. package/dist/pipeline/render-extent.d.ts.map +1 -0
  206. package/dist/pipeline/standard-build-context.d.ts +7 -0
  207. package/dist/pipeline/standard-build-context.d.ts.map +1 -0
  208. package/dist/pipeline/standard-forward-lane.d.ts +3 -2
  209. package/dist/pipeline/standard-forward-lane.d.ts.map +1 -1
  210. package/dist/pipeline/standard-output/auto-exposure/capability.d.ts +12 -0
  211. package/dist/pipeline/standard-output/auto-exposure/capability.d.ts.map +1 -0
  212. package/dist/pipeline/standard-output/auto-exposure/gpu.d.ts +70 -0
  213. package/dist/pipeline/standard-output/auto-exposure/gpu.d.ts.map +1 -0
  214. package/dist/pipeline/standard-output/auto-exposure/graph.d.ts +75 -0
  215. package/dist/pipeline/standard-output/auto-exposure/graph.d.ts.map +1 -0
  216. package/dist/pipeline/standard-output/auto-exposure/inspection.d.ts +111 -0
  217. package/dist/pipeline/standard-output/auto-exposure/inspection.d.ts.map +1 -0
  218. package/dist/pipeline/standard-output/auto-exposure/oracle.d.ts +16 -0
  219. package/dist/pipeline/standard-output/auto-exposure/oracle.d.ts.map +1 -0
  220. package/dist/pipeline/standard-output/auto-exposure/preset.d.ts +14 -0
  221. package/dist/pipeline/standard-output/auto-exposure/preset.d.ts.map +1 -0
  222. package/dist/pipeline/standard-output/auto-exposure/state.d.ts +46 -0
  223. package/dist/pipeline/standard-output/auto-exposure/state.d.ts.map +1 -0
  224. package/dist/pipeline/standard-output/color-transform.d.ts +27 -0
  225. package/dist/pipeline/standard-output/color-transform.d.ts.map +1 -0
  226. package/dist/pipeline/standard-output/graph.d.ts +15 -0
  227. package/dist/pipeline/standard-output/graph.d.ts.map +1 -0
  228. package/dist/pipeline/standard-output/lut-admission.d.ts +29 -0
  229. package/dist/pipeline/standard-output/lut-admission.d.ts.map +1 -0
  230. package/dist/pipeline/standard-output/lut-gpu.d.ts +48 -0
  231. package/dist/pipeline/standard-output/lut-gpu.d.ts.map +1 -0
  232. package/dist/pipeline/standard-output/lut-state.d.ts +68 -0
  233. package/dist/pipeline/standard-output/lut-state.d.ts.map +1 -0
  234. package/dist/pipeline/standard-output/resources.d.ts +10 -0
  235. package/dist/pipeline/standard-output/resources.d.ts.map +1 -0
  236. package/dist/pipeline/standard-output/types.d.ts +39 -0
  237. package/dist/pipeline/standard-output/types.d.ts.map +1 -0
  238. package/dist/pipeline/standard-pipeline.d.ts.map +1 -1
  239. package/dist/pipeline/standard-post.d.ts +2 -2
  240. package/dist/pipeline/standard-post.d.ts.map +1 -1
  241. package/dist/pipeline/standard-profile.d.ts +2 -1
  242. package/dist/pipeline/standard-profile.d.ts.map +1 -1
  243. package/dist/pipeline-builder.d.ts +5 -2
  244. package/dist/pipeline-builder.d.ts.map +1 -1
  245. package/dist/pipeline-spec-types.d.ts +4 -0
  246. package/dist/pipeline-spec-types.d.ts.map +1 -1
  247. package/dist/pipeline-spec.d.ts +1 -9
  248. package/dist/pipeline-spec.d.ts.map +1 -1
  249. package/dist/plugin.d.ts.map +1 -1
  250. package/dist/points-lines/standard-owner.d.ts +1 -1
  251. package/dist/points-lines/standard-owner.d.ts.map +1 -1
  252. package/dist/post-process-errors.d.ts +9 -2
  253. package/dist/post-process-errors.d.ts.map +1 -1
  254. package/dist/prepare/extended-lighting/resources.d.ts +3 -3
  255. package/dist/prepare/prepared-graphics-resolver.d.ts +6 -1
  256. package/dist/prepare/prepared-graphics-resolver.d.ts.map +1 -1
  257. package/dist/record/dynamic-geometry-consumption.d.ts +15 -0
  258. package/dist/record/dynamic-geometry-consumption.d.ts.map +1 -0
  259. package/dist/record/frame-lighting.d.ts +3 -3
  260. package/dist/record/frame-lighting.d.ts.map +1 -1
  261. package/dist/record/frame-snapshot.d.ts +109 -13
  262. package/dist/record/frame-snapshot.d.ts.map +1 -1
  263. package/dist/record/frame-targets.d.ts.map +1 -1
  264. package/dist/record/frame.d.ts +41 -5
  265. package/dist/record/frame.d.ts.map +1 -1
  266. package/dist/record/main-pass-geometry.d.ts +13 -9
  267. package/dist/record/main-pass-geometry.d.ts.map +1 -1
  268. package/dist/record/main-pass-material.d.ts +43 -3
  269. package/dist/record/main-pass-material.d.ts.map +1 -1
  270. package/dist/record/main-pass-sprite-draws.d.ts +2 -10
  271. package/dist/record/main-pass-sprite-draws.d.ts.map +1 -1
  272. package/dist/record/main-pass.d.ts +14 -2
  273. package/dist/record/main-pass.d.ts.map +1 -1
  274. package/dist/record/mesh-ssbo.d.ts +15 -6
  275. package/dist/record/mesh-ssbo.d.ts.map +1 -1
  276. package/dist/record/prepared-material-bindings.d.ts +19 -0
  277. package/dist/record/prepared-material-bindings.d.ts.map +1 -0
  278. package/dist/record/recovery-pipeline.d.ts +1 -0
  279. package/dist/record/recovery-pipeline.d.ts.map +1 -1
  280. package/dist/record/render-context.d.ts +101 -22
  281. package/dist/record/render-context.d.ts.map +1 -1
  282. package/dist/record/shadow-pass.d.ts +62 -7
  283. package/dist/record/shadow-pass.d.ts.map +1 -1
  284. package/dist/record/skybox-post-pass.d.ts +1 -1
  285. package/dist/record/skybox-post-pass.d.ts.map +1 -1
  286. package/dist/record/typed-frame-graph.d.ts +39 -8
  287. package/dist/record/typed-frame-graph.d.ts.map +1 -1
  288. package/dist/record/view-ubo.d.ts +1 -0
  289. package/dist/record/view-ubo.d.ts.map +1 -1
  290. package/dist/recovery/render-system-candidate.d.ts +10 -2
  291. package/dist/recovery/render-system-candidate.d.ts.map +1 -1
  292. package/dist/recovery/render-system-roots.d.ts +11 -0
  293. package/dist/recovery/render-system-roots.d.ts.map +1 -0
  294. package/dist/recovery/types.d.ts +76 -0
  295. package/dist/recovery/types.d.ts.map +1 -0
  296. package/dist/reflection/background.d.ts +14 -0
  297. package/dist/reflection/background.d.ts.map +1 -0
  298. package/dist/reflection/filter.d.ts.map +1 -1
  299. package/dist/reflection/projection.d.ts +1 -0
  300. package/dist/reflection/projection.d.ts.map +1 -1
  301. package/dist/reflection/record-owner.d.ts +4 -4
  302. package/dist/reflection/record-owner.d.ts.map +1 -1
  303. package/dist/render-contract.d.ts +211 -53
  304. package/dist/render-contract.d.ts.map +1 -1
  305. package/dist/render-graph-primitives.d.ts +1 -0
  306. package/dist/render-graph-primitives.d.ts.map +1 -1
  307. package/dist/render-pipeline.d.ts +81 -6
  308. package/dist/render-pipeline.d.ts.map +1 -1
  309. package/dist/render-system-extract-tail.d.ts +15 -6
  310. package/dist/render-system-extract-tail.d.ts.map +1 -1
  311. package/dist/render-system-extract.d.ts +128 -41
  312. package/dist/render-system-extract.d.ts.map +1 -1
  313. package/dist/render-system-projections.d.ts +22 -0
  314. package/dist/render-system-projections.d.ts.map +1 -0
  315. package/dist/render-system.d.ts +27 -77
  316. package/dist/render-system.d.ts.map +1 -1
  317. package/dist/scene/render-scene-types.d.ts +14 -7
  318. package/dist/scene/render-scene-types.d.ts.map +1 -1
  319. package/dist/scene/render-scene.d.ts +31 -11
  320. package/dist/scene/render-scene.d.ts.map +1 -1
  321. package/dist/scene/shadow-visibility.d.ts +5 -0
  322. package/dist/scene/shadow-visibility.d.ts.map +1 -0
  323. package/dist/ssao-config.d.ts +8 -6
  324. package/dist/ssao-config.d.ts.map +1 -1
  325. package/dist/ssr/admission.d.ts +70 -1
  326. package/dist/ssr/admission.d.ts.map +1 -1
  327. package/dist/ssr/compose.d.ts +13 -0
  328. package/dist/ssr/compose.d.ts.map +1 -0
  329. package/dist/ssr/errors.d.ts +35 -0
  330. package/dist/ssr/errors.d.ts.map +1 -1
  331. package/dist/ssr/graph.d.ts +60 -0
  332. package/dist/ssr/graph.d.ts.map +1 -0
  333. package/dist/ssr/history.d.ts +97 -0
  334. package/dist/ssr/history.d.ts.map +1 -0
  335. package/dist/ssr/hiz.d.ts +37 -0
  336. package/dist/ssr/hiz.d.ts.map +1 -0
  337. package/dist/ssr/inspection.d.ts +42 -0
  338. package/dist/ssr/inspection.d.ts.map +1 -0
  339. package/dist/ssr/resources.d.ts +58 -0
  340. package/dist/ssr/resources.d.ts.map +1 -0
  341. package/dist/ssr/temporal.d.ts +38 -0
  342. package/dist/ssr/temporal.d.ts.map +1 -0
  343. package/dist/systems/skin-palette-allocator.d.ts +32 -10
  344. package/dist/systems/skin-palette-allocator.d.ts.map +1 -1
  345. package/dist/systems/skin-palette-types.d.ts +15 -0
  346. package/dist/systems/skin-palette-types.d.ts.map +1 -1
  347. package/dist/systems/transparent-dispatch.d.ts +9 -0
  348. package/dist/systems/transparent-dispatch.d.ts.map +1 -0
  349. package/dist/targets/material-source.d.ts +7 -0
  350. package/dist/targets/material-source.d.ts.map +1 -1
  351. package/dist/temporal/frame-coordinator.d.ts +7 -0
  352. package/dist/temporal/frame-coordinator.d.ts.map +1 -1
  353. package/dist/temporal/gpu.d.ts +8 -0
  354. package/dist/temporal/gpu.d.ts.map +1 -1
  355. package/dist/temporal/history.d.ts.map +1 -1
  356. package/dist/temporal/index.mjs +6 -6
  357. package/dist/temporal/inspection.d.ts.map +1 -1
  358. package/dist/temporal/standard-scene-data.d.ts +4 -2
  359. package/dist/temporal/standard-scene-data.d.ts.map +1 -1
  360. package/dist/temporal/target-coverage-attachment.d.ts +15 -0
  361. package/dist/temporal/target-coverage-attachment.d.ts.map +1 -0
  362. package/dist/temporal/temporal-view.d.ts +6 -0
  363. package/dist/temporal/temporal-view.d.ts.map +1 -1
  364. package/dist/temporal/view.d.ts +6 -0
  365. package/dist/temporal/view.d.ts.map +1 -1
  366. package/dist/typed-render-graph-primitives.d.ts +41 -1
  367. package/dist/typed-render-graph-primitives.d.ts.map +1 -1
  368. package/dist/typed-shadow-passes.d.ts +3 -1
  369. package/dist/typed-shadow-passes.d.ts.map +1 -1
  370. package/dist/volume/component.d.ts +1 -0
  371. package/dist/volume/component.d.ts.map +1 -1
  372. package/dist/volume/temporal.d.ts +6 -0
  373. package/dist/volume/temporal.d.ts.map +1 -1
  374. package/package.json +21 -20
  375. package/src/__tests__/auto-exposure-gpu-evidence.ts +291 -0
  376. package/src/__tests__/auto-exposure-inspection.unit.test.ts +80 -0
  377. package/src/__tests__/auto-exposure-transaction.integration.test.ts +99 -0
  378. package/src/__tests__/auto-exposure.browser.test.ts +33 -0
  379. package/src/__tests__/auto-exposure.dawn.test.ts +33 -0
  380. package/src/__tests__/capture-scene-projection.unit.test.ts +24 -0
  381. package/src/__tests__/detached-inspection.integration.test.ts +5 -0
  382. package/src/__tests__/device-feature-admission.unit.test.ts +15 -24
  383. package/src/__tests__/device-loss-fanout.unit.test.ts +43 -0
  384. package/src/__tests__/device-scope-lifecycle.unit.test.ts +18 -0
  385. package/src/__tests__/device-scope-stale-matrix.unit.test.ts +18 -0
  386. package/src/__tests__/docs-gate-green.unit.test.ts +3 -3
  387. package/src/__tests__/dynamic-geometry-batch.unit.test.ts +157 -0
  388. package/src/__tests__/dynamic-geometry.unit.test.ts +36 -0
  389. package/src/__tests__/dynamic-resolution-plugin.integration.test.ts +81 -0
  390. package/src/__tests__/factory-contract.integration.test.ts +231 -9
  391. package/src/__tests__/fallback-row-stride-surface.unit.test.ts +19 -0
  392. package/src/__tests__/feature-depth-input.dawn.test.ts +121 -0
  393. package/src/__tests__/feature-noise.unit.test.ts +38 -0
  394. package/src/__tests__/fixtures/taa-resolve-pinned-baseline.wgsl +301 -0
  395. package/src/__tests__/frame-camera-selection.unit.test.ts +131 -0
  396. package/src/__tests__/frame-observation.contract.test.ts +21 -0
  397. package/src/__tests__/frame-plan-contract.unit.test.ts +24 -0
  398. package/src/__tests__/frame-targets.unit.test.ts +24 -0
  399. package/src/__tests__/fullscreen-feature-plan.unit.test.ts +3 -0
  400. package/src/__tests__/gpu-driven-baseline.characterization.test.ts +79 -0
  401. package/src/__tests__/gpu-driven-batch-topology-pbr.unit.test.ts +307 -7
  402. package/src/__tests__/gpu-driven-indirect-raster-evidence.ts +122 -142
  403. package/src/__tests__/gpu-driven-indirect-raster.browser.test.ts +10 -1
  404. package/src/__tests__/gpu-driven-lod-cache.unit.test.ts +261 -0
  405. package/src/__tests__/gpu-driven-mesh-world-identity.unit.test.ts +346 -0
  406. package/src/__tests__/gpu-driven-pbr.dawn.test.ts +1422 -0
  407. package/src/__tests__/gpu-driven-pbr.integration.test.ts +21 -0
  408. package/src/__tests__/gpu-driven-production-fixture.ts +96 -0
  409. package/src/__tests__/gpu-driven-production.integration.test.ts +1076 -106
  410. package/src/__tests__/gpu-driven-scaling.unit.test.ts +1 -3
  411. package/src/__tests__/gpu-driven-shadow-views.browser.test.ts +63 -0
  412. package/src/__tests__/gpu-driven-shadow-views.dawn.test.ts +294 -0
  413. package/src/__tests__/gpu-driven-shadow-views.integration.test.ts +97 -0
  414. package/src/__tests__/gpu-driven-shadow-views.unit.test.ts +168 -0
  415. package/src/__tests__/gpu-driven-skin-contract.test-d.ts +11 -0
  416. package/src/__tests__/gpu-driven-view-gpu-evidence.ts +72 -20
  417. package/src/__tests__/gpu-driven-view-graph.integration.test.ts +30 -9
  418. package/src/__tests__/gpu-driven-view.unit.test.ts +160 -52
  419. package/src/__tests__/gpu-pass-timing-browser-runner.ts +15 -0
  420. package/src/__tests__/gpu-pass-timing.browser.test.ts +20 -2
  421. package/src/__tests__/gpu-resource-scope.unit.test.ts +71 -0
  422. package/src/__tests__/gpu-resource-store-stride.unit.test.ts +42 -0
  423. package/src/__tests__/gpu-scene-render-graph-gpu.ts +19 -5
  424. package/src/__tests__/gpu-scene.dawn.test.ts +40 -13
  425. package/src/__tests__/gpu-scene.unit.test.ts +613 -33
  426. package/src/__tests__/instances-culling.integration.test.ts +36 -10
  427. package/src/__tests__/instances-derived-bounds.unit.test.ts +54 -0
  428. package/src/__tests__/instances-store.unit.test.ts +242 -39
  429. package/src/__tests__/ktx2-basis-gpu-consumer.dawn.test.ts +6 -0
  430. package/src/__tests__/lighting-scene-roundtrip.integration.test.ts +13 -16
  431. package/src/__tests__/lut-lkg-transaction.integration.test.ts +122 -0
  432. package/src/__tests__/material-contract-inventory.unit.test.ts +5 -6
  433. package/src/__tests__/material-dispatch-shader-id.unit.test.ts +51 -0
  434. package/src/__tests__/material-lane-selection.unit.test.ts +60 -0
  435. package/src/__tests__/material-numeric-upload.unit.test.ts +53 -0
  436. package/src/__tests__/material-texture-handles.unit.test.ts +18 -0
  437. package/src/__tests__/material-texture-source.unit.test.ts +87 -0
  438. package/src/__tests__/materials-authoring-validation.unit.test.ts +41 -0
  439. package/src/__tests__/materials-standard-contract.unit.test.ts +57 -3
  440. package/src/__tests__/mesh-buffer-usage-surface.unit.test.ts +4 -0
  441. package/src/__tests__/mesh-submission-lifetime.unit.test.ts +8 -0
  442. package/src/__tests__/morph-neutral-admission.unit.test.ts +19 -0
  443. package/src/__tests__/normal-fallback.dawn.test.ts +122 -0
  444. package/src/__tests__/particle-material-input-layout.unit.test.ts +104 -0
  445. package/src/__tests__/physical-clearcoat.integration.test.ts +42 -3
  446. package/src/__tests__/pipeline-texture-specialization.unit.test.ts +138 -0
  447. package/src/__tests__/point-shadow-inspection.unit.test.ts +2 -0
  448. package/src/__tests__/post-process-error-policy-owner.unit.test.ts +6 -5
  449. package/src/__tests__/prepared-gpu-driven-pbr-contract.test-d.ts +31 -0
  450. package/src/__tests__/prepared-gpu-driven-pbr-contract.unit.test.ts +39 -0
  451. package/src/__tests__/prepared-gpu-driven-pbr.integration.test.ts +251 -9
  452. package/src/__tests__/prepared-graphics-capability.unit.test.ts +21 -0
  453. package/src/__tests__/prepared-graphics-pipeline-warmup.unit.test.ts +6 -2
  454. package/src/__tests__/profiler-phase-catalog.test.ts +5 -0
  455. package/src/__tests__/public-surface.test-d.ts +3 -0
  456. package/src/__tests__/recovery-candidate-prepare.contract.test.ts +30 -12
  457. package/src/__tests__/reflection-fallback-async-publication.unit.test.ts +171 -0
  458. package/src/__tests__/reflection-probe-authoring.unit.test.ts +12 -10
  459. package/src/__tests__/reflection-probe-box.dawn.test.ts +71 -0
  460. package/src/__tests__/reflection-probe-filter.unit.test.ts +9 -0
  461. package/src/__tests__/reflection-probe-orientation.dawn.test.ts +294 -0
  462. package/src/__tests__/reflection-probe-record-owner.characterization.unit.test.ts +5 -14
  463. package/src/__tests__/reflection-probe-updates.unit.test.ts +129 -0
  464. package/src/__tests__/render-error-code-owner.test-d.ts +7 -0
  465. package/src/__tests__/render-error-detail-ssot.test-d.ts +27 -1
  466. package/src/__tests__/render-error-exhaustive.test-d.ts +15 -0
  467. package/src/__tests__/render-extent.unit.test.ts +63 -0
  468. package/src/__tests__/render-feature-gpu-work.integration.test.ts +285 -2
  469. package/src/__tests__/render-feature-plan.unit.test.ts +245 -0
  470. package/src/__tests__/render-feature-shadow-order.unit.test.ts +228 -0
  471. package/src/__tests__/render-feature-zero-work.unit.test.ts +35 -1
  472. package/src/__tests__/render-graph-fallback.integration.test.ts +2 -2
  473. package/src/__tests__/render-owner-cohesion.unit.test.ts +55 -0
  474. package/src/__tests__/render-scene-mixed-updates.integration.test.ts +426 -0
  475. package/src/__tests__/render-scene-projection.unit.test.ts +915 -23
  476. package/src/__tests__/render-scene-resource-updates.integration.test.ts +214 -0
  477. package/src/__tests__/render-scene-skin-lifecycle.integration.test.ts +173 -0
  478. package/src/__tests__/render-scene-temporal-retry.unit.test.ts +133 -0
  479. package/src/__tests__/render-target-material-source.test-d.ts +27 -3
  480. package/src/__tests__/renderer-factory-material-contract.unit.test.ts +233 -9
  481. package/src/__tests__/renderer-frame-transaction.integration.test.ts +923 -5
  482. package/src/__tests__/shader-manifest-fixture.ts +45 -0
  483. package/src/__tests__/skin-motion-regression.unit.test.ts +0 -33
  484. package/src/__tests__/skin-palette-persistent.integration.test.ts +28 -0
  485. package/src/__tests__/skin-palette-persistent.unit.test.ts +247 -0
  486. package/src/__tests__/skinned-shadow-caster.test.ts +125 -14
  487. package/src/__tests__/specular-environment-scale.dawn.test.ts +158 -0
  488. package/src/__tests__/ssao-config.unit.test.ts +7 -0
  489. package/src/__tests__/ssao-surface.dawn.test.ts +252 -0
  490. package/src/__tests__/ssr-admission-matrix.integration.test.ts +7 -1
  491. package/src/__tests__/ssr-confidence-compose.unit.test.ts +84 -0
  492. package/src/__tests__/ssr-coordinate-oracle.unit.test.ts +28 -0
  493. package/src/__tests__/ssr-cube-silhouette.dawn.test.ts +270 -0
  494. package/src/__tests__/ssr-format-probe-gating.integration.test.ts +82 -0
  495. package/src/__tests__/ssr-gpu-dispatch.browser.test.ts +99 -0
  496. package/src/__tests__/ssr-gpu-dispatch.dawn.test.ts +116 -0
  497. package/src/__tests__/ssr-gpu-dispatch.ts +951 -0
  498. package/src/__tests__/ssr-graph-topology.unit.test.ts +104 -0
  499. package/src/__tests__/ssr-history-filter.dawn.test.ts +198 -0
  500. package/src/__tests__/ssr-hit-color.dawn.test.ts +273 -0
  501. package/src/__tests__/ssr-hiz-odd-reduction.dawn.test.ts +569 -0
  502. package/src/__tests__/ssr-hiz-rescue.dawn.test.ts +279 -0
  503. package/src/__tests__/ssr-hiz.browser.test.ts +150 -0
  504. package/src/__tests__/ssr-hiz.dawn.test.ts +150 -0
  505. package/src/__tests__/ssr-hiz.unit.test.ts +56 -0
  506. package/src/__tests__/ssr-inspection.unit.test.ts +105 -0
  507. package/src/__tests__/ssr-memory-budget.unit.test.ts +45 -0
  508. package/src/__tests__/ssr-performance-sequence-aggregation.unit.test.ts +15 -0
  509. package/src/__tests__/ssr-public-surface.test-d.ts +37 -0
  510. package/src/__tests__/ssr-receiver-coverage.dawn.test.ts +387 -0
  511. package/src/__tests__/ssr-reflection-mip-reducer.dawn.test.ts +309 -0
  512. package/src/__tests__/ssr-reprojection-probe.ts +90 -0
  513. package/src/__tests__/ssr-roughness-mip.dawn.test.ts +163 -0
  514. package/src/__tests__/ssr-shader-prewarm.unit.test.ts +59 -0
  515. package/src/__tests__/ssr-spatial.integration.test.ts +141 -0
  516. package/src/__tests__/ssr-stable-lattice.dawn.test.ts +475 -0
  517. package/src/__tests__/ssr-temporal-history.unit.test.ts +202 -0
  518. package/src/__tests__/ssr-texel-crossing.dawn.test.ts +448 -0
  519. package/src/__tests__/ssr-zero-work.integration.test.ts +87 -0
  520. package/src/__tests__/standard-cluster-variant-resolution.unit.test.ts +84 -12
  521. package/src/__tests__/standard-clustered-pipeline.unit.test.ts +29 -0
  522. package/src/__tests__/standard-output-chain-contract.unit.test.ts +99 -0
  523. package/src/__tests__/standard-output-chain.integration.test.ts +73 -0
  524. package/src/__tests__/standard-output-gpu-evidence.ts +205 -0
  525. package/src/__tests__/standard-output.browser.test.ts +15 -0
  526. package/src/__tests__/standard-output.dawn.test.ts +15 -0
  527. package/src/__tests__/standard-pbr-artifact-assembly.unit.test.ts +275 -0
  528. package/src/__tests__/standard-pipeline.integration.test.ts +320 -3
  529. package/src/__tests__/standard-profile-oracle.unit.test.ts +49 -0
  530. package/src/__tests__/standard-surface-lighting.unit.test.ts +41 -0
  531. package/src/__tests__/standard-texture-specialization.dawn.test.ts +141 -0
  532. package/src/__tests__/surface-adjacent-regressions.integration.test.ts +6 -3
  533. package/src/__tests__/taa-coverage-edge.dawn.test.ts +199 -0
  534. package/src/__tests__/taa-history-clipping.dawn.test.ts +328 -0
  535. package/src/__tests__/taa-neighborhood-equivalence.dawn.test.ts +782 -0
  536. package/src/__tests__/taa-stability-feedback.browser.test.ts +23 -0
  537. package/src/__tests__/taa-stability-feedback.dawn.test.ts +68 -0
  538. package/src/__tests__/taa-stability-feedback.ts +342 -0
  539. package/src/__tests__/temporal-history-lifecycle.unit.test.ts +49 -7
  540. package/src/__tests__/temporal-reset-matrix.unit.test.ts +9 -0
  541. package/src/__tests__/temporal-transaction.integration.test.ts +28 -0
  542. package/src/__tests__/temporal-view.unit.test.ts +17 -0
  543. package/src/__tests__/texture-usage-surface.unit.test.ts +4 -2
  544. package/src/__tests__/transmission-prewarm.unit.test.ts +57 -0
  545. package/src/__tests__/typed-pipeline-topology.unit.test.ts +109 -4
  546. package/src/__tests__/typed-scene-pass-material-cache.integration.test.ts +126 -0
  547. package/src/__tests__/vertex-layouts-ssot.unit.test.ts +47 -0
  548. package/src/__tests__/visibility-extract.perf.test.ts +20 -8
  549. package/src/__tests__/visibility-instances.integration.test.ts +19 -7
  550. package/src/__tests__/visibility-producer-matrix.integration.test.ts +20 -9
  551. package/src/__tests__/volumetric-fog-stage-readback.dawn.test.ts +62 -13
  552. package/src/__tests__/volumetric-fog-topology.unit.test.ts +7 -7
  553. package/src/assembly/atmosphere-shader-prewarm.ts +39 -0
  554. package/src/assembly/device-feature-admission.ts +9 -4
  555. package/src/assembly/dynamic-geometry-host.ts +284 -163
  556. package/src/assembly/dynamic-geometry-runtime.ts +71 -0
  557. package/src/assembly/factory.ts +4 -0
  558. package/src/assembly/gpu-driven-owner.ts +29 -0
  559. package/src/assembly/host-contract.ts +19 -0
  560. package/src/assembly/material/assembly.ts +383 -1
  561. package/src/assembly/material/pipeline-helpers.ts +100 -0
  562. package/src/assembly/material-shader-policy.ts +110 -46
  563. package/src/assembly/recovery/device-loss-fanout.ts +5 -0
  564. package/src/assembly/recovery/failure-location.ts +62 -0
  565. package/src/assembly/recovery/recovery-attempt.ts +2 -29
  566. package/src/assembly/recovery/renderer-recover.ts +16 -17
  567. package/src/assembly/renderer-facade.ts +34 -1
  568. package/src/assembly/renderer-feature-inspection.ts +13 -0
  569. package/src/assembly/renderer-frame-transaction.ts +63 -0
  570. package/src/assembly/renderer-helpers.ts +26 -0
  571. package/src/assembly/renderer-inspection.ts +6 -0
  572. package/src/assembly/shader-prewarm-policy.ts +46 -1
  573. package/src/assembly/skin-palette-owner.ts +21 -0
  574. package/src/assembly/ssr-shader-prewarm.ts +41 -0
  575. package/src/assembly/webgpu-device-loss.ts +75 -0
  576. package/src/assembly/webgpu-pbr-ready.ts +232 -0
  577. package/src/assembly/webgpu-ready-mipmap.ts +26 -0
  578. package/src/assembly/webgpu-ready.ts +161 -131
  579. package/src/assembly/webgpu-renderer-bootstrap.ts +85 -0
  580. package/src/assembly/webgpu-renderer-contract.ts +69 -0
  581. package/src/assembly/webgpu-renderer-guards.ts +32 -0
  582. package/src/assembly/webgpu-renderer-observation.ts +43 -0
  583. package/src/assembly/webgpu-renderer-recovery-failure.ts +62 -0
  584. package/src/assembly/webgpu-renderer.ts +744 -730
  585. package/src/assembly/webgpu-vertex-layouts.ts +233 -87
  586. package/src/capture/scene-projection.ts +37 -0
  587. package/src/components/__tests__/camera-exposure.contract.unit.test.ts +153 -0
  588. package/src/components/__tests__/dynamic-resolution-schema.unit.test.ts +65 -0
  589. package/src/components/__tests__/light-radius.integration.test.ts +59 -0
  590. package/src/components/camera.ts +287 -7
  591. package/src/components/directional-light.ts +3 -3
  592. package/src/components/dynamic-resolution.ts +67 -0
  593. package/src/components/index.ts +2 -0
  594. package/src/components/instances.ts +45 -18
  595. package/src/components/light-helpers.ts +6 -1
  596. package/src/components/reflection-probe.ts +1 -0
  597. package/src/components/scene-instance.ts +2 -1
  598. package/src/components/screen-space-reflection.ts +21 -0
  599. package/src/components/skylight.ts +4 -1
  600. package/src/components/sprite-animation.ts +2 -2
  601. package/src/components/sprite-instances.ts +1 -1
  602. package/src/device/device-scope.ts +13 -7
  603. package/src/device/gpu-residency.ts +45 -42
  604. package/src/dynamic-geometry.ts +13 -8
  605. package/src/environment/background.ts +281 -0
  606. package/src/environment/ibl.ts +211 -0
  607. package/src/environment/storage.ts +63 -0
  608. package/src/errors/gpu-driven.ts +49 -8
  609. package/src/errors/render.ts +91 -3
  610. package/src/extract/camera.ts +37 -1
  611. package/src/extract/contracts.ts +10 -0
  612. package/src/extract/gpu-driven.ts +240 -10
  613. package/src/features/host.ts +237 -19
  614. package/src/features/noise-texture.ts +91 -0
  615. package/src/features/plan.ts +553 -24
  616. package/src/features/prepared-gpu-work.ts +631 -49
  617. package/src/features/prepared-graphics-store.ts +31 -0
  618. package/src/features/prepared-graphics.ts +5 -0
  619. package/src/features/render-graph-compute.ts +41 -8
  620. package/src/features/render-graph-contribution.ts +141 -3
  621. package/src/features/render-graph-raster.ts +143 -30
  622. package/src/features/types.ts +11 -0
  623. package/src/fullscreen-post-process-pass.ts +3 -0
  624. package/src/gpu-driven/batch-topology.ts +452 -108
  625. package/src/gpu-driven/material-artifacts.ts +179 -0
  626. package/src/gpu-driven/material-bindings.ts +41 -0
  627. package/src/gpu-driven/pbr-program.ts +31 -0
  628. package/src/gpu-driven/prepared-draw.ts +42 -6
  629. package/src/gpu-driven/production-raster.ts +2806 -716
  630. package/src/gpu-driven/shadow-views.ts +539 -0
  631. package/src/gpu-driven/view-gpu.ts +188 -41
  632. package/src/gpu-resource.ts +21 -2
  633. package/src/gpu-scene-schema.ts +61 -11
  634. package/src/gpu-scene.ts +197 -99
  635. package/src/gpu-texture-usage.ts +1 -0
  636. package/src/hdrp-buffers.ts +141 -36
  637. package/src/ibl/IblPipelineCache.ts +5 -0
  638. package/src/ibl/frame-resources.ts +38 -0
  639. package/src/ibl/skylight-bind-group.ts +32 -21
  640. package/src/index.ts +194 -75
  641. package/src/inspection-types.ts +207 -1
  642. package/src/instances-derived-bounds.ts +258 -34
  643. package/src/instances.ts +459 -150
  644. package/src/internal.ts +22 -0
  645. package/src/lifecycle.ts +2 -0
  646. package/src/material-row.ts +194 -0
  647. package/src/materials.ts +44 -8
  648. package/src/pbr-pipeline.ts +172 -19
  649. package/src/pipeline/render-extent.ts +111 -0
  650. package/src/pipeline/standard-build-context.ts +7 -0
  651. package/src/pipeline/standard-forward-lane.ts +74 -29
  652. package/src/pipeline/standard-output/__tests__/lut-admission.unit.test.ts +103 -0
  653. package/src/pipeline/standard-output/auto-exposure/__tests__/capability.unit.test.ts +40 -0
  654. package/src/pipeline/standard-output/auto-exposure/__tests__/gpu.contract.unit.test.ts +125 -0
  655. package/src/pipeline/standard-output/auto-exposure/__tests__/graph.contract.unit.test.ts +94 -0
  656. package/src/pipeline/standard-output/auto-exposure/__tests__/oracle.test.ts +108 -0
  657. package/src/pipeline/standard-output/auto-exposure/__tests__/preset.test.ts +26 -0
  658. package/src/pipeline/standard-output/auto-exposure/capability.ts +38 -0
  659. package/src/pipeline/standard-output/auto-exposure/gpu.ts +567 -0
  660. package/src/pipeline/standard-output/auto-exposure/graph.ts +221 -0
  661. package/src/pipeline/standard-output/auto-exposure/inspection.ts +231 -0
  662. package/src/pipeline/standard-output/auto-exposure/oracle.ts +291 -0
  663. package/src/pipeline/standard-output/auto-exposure/preset.ts +28 -0
  664. package/src/pipeline/standard-output/auto-exposure/state.ts +156 -0
  665. package/src/pipeline/standard-output/color-transform.ts +124 -0
  666. package/src/pipeline/standard-output/graph.ts +139 -0
  667. package/src/pipeline/standard-output/lut-admission.ts +121 -0
  668. package/src/pipeline/standard-output/lut-gpu.ts +399 -0
  669. package/src/pipeline/standard-output/lut-state.ts +176 -0
  670. package/src/pipeline/standard-output/resources.ts +121 -0
  671. package/src/pipeline/standard-output/types.ts +58 -0
  672. package/src/pipeline/standard-pipeline.ts +232 -70
  673. package/src/pipeline/standard-post.ts +190 -27
  674. package/src/pipeline/standard-profile.ts +2 -1
  675. package/src/pipeline-builder.ts +28 -9
  676. package/src/pipeline-spec-types.ts +4 -0
  677. package/src/pipeline-spec.ts +37 -29
  678. package/src/plugin.ts +4 -0
  679. package/src/points-lines/standard-owner.ts +6 -14
  680. package/src/post-process-errors.ts +26 -18
  681. package/src/prepare/__tests__/extended-lighting-capability.unit.test.ts +2 -2
  682. package/src/prepare/extended-lighting/resources.ts +3 -3
  683. package/src/prepare/prepared-graphics-resolver.ts +9 -2
  684. package/src/record/__tests__/main-pass-geometry.unit.test.ts +68 -0
  685. package/src/record/__tests__/material-bg-cache.unit.test.ts +45 -0
  686. package/src/record/__tests__/material-slot-plan.unit.test.ts +57 -0
  687. package/src/record/__tests__/mesh-ssbo.unit.test.ts +40 -1
  688. package/src/record/__tests__/recovery-pipeline.unit.test.ts +20 -1
  689. package/src/record/__tests__/sprite-material-abi.unit.test.ts +41 -6
  690. package/src/record/__tests__/temporal-payload.unit.test.ts +2 -0
  691. package/src/record/__tests__/typed-frame-graph-plan.unit.test.ts +45 -0
  692. package/src/record/__tests__/view-ubo-layout.unit.test.ts +5 -0
  693. package/src/record/dynamic-geometry-consumption.ts +59 -0
  694. package/src/record/frame-lighting.ts +15 -12
  695. package/src/record/frame-snapshot.ts +146 -34
  696. package/src/record/frame-targets.ts +9 -0
  697. package/src/record/frame.ts +838 -170
  698. package/src/record/main-pass-geometry.ts +209 -103
  699. package/src/record/main-pass-material.ts +157 -40
  700. package/src/record/main-pass-sprite-draws.ts +16 -107
  701. package/src/record/main-pass.ts +141 -12
  702. package/src/record/material-uniforms.ts +1 -1
  703. package/src/record/mesh-ssbo.ts +59 -15
  704. package/src/record/prepared-material-bindings.ts +238 -0
  705. package/src/record/recovery-pipeline.ts +69 -90
  706. package/src/record/render-context.ts +123 -24
  707. package/src/record/shadow-pass.ts +1389 -230
  708. package/src/record/skybox-post-pass.ts +14 -3
  709. package/src/record/typed-frame-graph.ts +1064 -47
  710. package/src/record/view-ubo.ts +12 -1
  711. package/src/recovery/render-system-candidate.ts +135 -68
  712. package/src/recovery/render-system-roots.ts +113 -0
  713. package/src/recovery/types.ts +77 -0
  714. package/src/reflection/background.ts +151 -0
  715. package/src/reflection/filter.ts +3 -0
  716. package/src/reflection/projection.ts +16 -6
  717. package/src/reflection/record-owner.ts +308 -140
  718. package/src/render-contract.ts +237 -49
  719. package/src/render-graph-primitives.ts +34 -5
  720. package/src/render-pipeline.ts +90 -2
  721. package/src/render-system-extract-tail.ts +431 -162
  722. package/src/render-system-extract.ts +478 -119
  723. package/src/render-system-projections.ts +241 -0
  724. package/src/render-system.ts +715 -828
  725. package/src/scene/render-scene-types.ts +13 -4
  726. package/src/scene/render-scene.ts +577 -355
  727. package/src/scene/shadow-visibility.ts +21 -0
  728. package/src/ssao-config.ts +25 -8
  729. package/src/ssr/admission.ts +380 -14
  730. package/src/ssr/compose.ts +144 -0
  731. package/src/ssr/errors.ts +48 -0
  732. package/src/ssr/graph.ts +797 -0
  733. package/src/ssr/history.ts +436 -0
  734. package/src/ssr/hiz.ts +124 -0
  735. package/src/ssr/inspection.ts +124 -0
  736. package/src/ssr/resources.ts +202 -0
  737. package/src/ssr/temporal.ts +164 -0
  738. package/src/systems/skin-palette-allocator.ts +495 -148
  739. package/src/systems/skin-palette-types.ts +17 -0
  740. package/src/systems/transparent-dispatch.ts +90 -0
  741. package/src/targets/material-source.ts +34 -0
  742. package/src/temporal/coverage.ts +1 -1
  743. package/src/temporal/frame-coordinator.ts +23 -2
  744. package/src/temporal/gpu.ts +79 -12
  745. package/src/temporal/history.ts +3 -1
  746. package/src/temporal/inspection.ts +2 -1
  747. package/src/temporal/standard-scene-data.ts +10 -2
  748. package/src/temporal/target-coverage-attachment.ts +72 -0
  749. package/src/temporal/temporal-view.ts +11 -2
  750. package/src/temporal/view.ts +12 -2
  751. package/src/transmission/__tests__/standard-transmission.dawn.test.ts +219 -139
  752. package/src/typed-render-graph-primitives.ts +304 -74
  753. package/src/typed-shadow-passes.ts +122 -12
  754. package/src/volume/component.ts +1 -0
  755. package/src/volume/passes.ts +3 -3
  756. package/src/volume/temporal.ts +10 -0
  757. package/dist/chunk-GE3SDD72.mjs.map +0 -1
  758. package/dist/chunk-GF523LHF.mjs.map +0 -1
  759. package/dist/chunk-IQMKJLNU.mjs.map +0 -1
  760. package/dist/chunk-J52NMQKR.mjs.map +0 -1
  761. package/dist/chunk-J6KACNOH.mjs.map +0 -1
  762. package/dist/chunk-JAASCMXA.mjs.map +0 -1
  763. package/dist/chunk-MBU4ZVE7.mjs.map +0 -1
  764. package/dist/chunk-MYJ5RPJO.mjs.map +0 -1
  765. package/dist/chunk-RBDBZ5R7.mjs.map +0 -1
  766. package/dist/chunk-VSL23LZE.mjs.map +0 -1
  767. package/src/__tests__/instances-world-ownership.integration.test.ts +0 -62
  768. package/src/scene/__tests__/changed-block-summary.candidate.test.ts +0 -36
@@ -1,7 +1,18 @@
1
- import type { RenderGraphBuilder, RenderGraphError } from '@forgeax/engine-render-graph';
1
+ import type {
2
+ GraphAccess,
3
+ RenderGraphBuilder,
4
+ RenderGraphError,
5
+ } from '@forgeax/engine-render-graph';
2
6
  import { ok, type Result } from '@forgeax/engine-types';
3
7
  import { PointShadowAtlasUninitializedError } from './errors/render';
8
+ import type { RenderFeatureShadowDraws } from './features/render-graph-raster';
9
+ import {
10
+ type ShadowViewIdentity,
11
+ type ShadowViewProjection,
12
+ shadowViewRasterAccesses,
13
+ } from './gpu-driven/shadow-views';
4
14
  import { GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING } from './gpu-texture-usage';
15
+ import type { RenderFrameState } from './record/frame-snapshot';
5
16
  import type { _InternalRenderPipelineContext } from './record/render-context';
6
17
  import {
7
18
  encodeDirectionalShadowPass,
@@ -18,6 +29,25 @@ export interface TypedShadowTargets {
18
29
  readonly point?: RenderPipelineTarget | undefined;
19
30
  }
20
31
 
32
+ /**
33
+ * Cache decisions are frame facts, not graph topology guesses. The
34
+ * directional cache predates the view pool and remains a direct context field;
35
+ * point/spot entries are optional projections published by the GPU shadow
36
+ * owner. A missing projection is a cache miss, preserving the existing CPU
37
+ * shadow path until that view has a committed generation.
38
+ */
39
+ function shadowViewCacheReuse(frame: RenderPipelineFrame, identity: ShadowViewIdentity): boolean {
40
+ const context = frame as _InternalRenderPipelineContext;
41
+ const gpuShadowViews = context.gpuDrivenShadowViews;
42
+ if (gpuShadowViews !== undefined) return gpuShadowViews.cacheHit(identity);
43
+ if (identity.kind === 'directional') return context.directionalShadowCacheReuse;
44
+ const state = context.frameState as RenderFrameState & {
45
+ readonly shadowViewCacheReuse?: ReadonlyMap<string, boolean> | undefined;
46
+ };
47
+ const key = `${identity.kind}:${identity.index}:${identity.face ?? ''}`;
48
+ return state.shadowViewCacheReuse?.get(key) === true;
49
+ }
50
+
21
51
  function recordShadowPass(
22
52
  graph: RenderGraphBuilder<RenderPipelineFrame>,
23
53
  name: string,
@@ -25,9 +55,10 @@ function recordShadowPass(
25
55
  loadOp: 'clear' | 'load',
26
56
  encode: Parameters<RenderGraphBuilder<RenderPipelineFrame>['addRasterPass']>[1]['encode'],
27
57
  executeIf?: (frame: RenderPipelineFrame) => boolean,
58
+ extraAccesses: readonly GraphAccess[] = [],
28
59
  ): Result<void, RenderGraphError> {
29
60
  return graph.addRasterPass(name, {
30
- accesses: [{ resource: target.view, usage: 'depth-stencil-write' }],
61
+ accesses: [{ resource: target.view, usage: 'depth-stencil-write' }, ...extraAccesses],
31
62
  colorAttachments: [],
32
63
  depthStencilAttachment: {
33
64
  view: target.view,
@@ -43,7 +74,19 @@ function recordShadowPass(
43
74
  export function addTypedShadowPasses(
44
75
  graph: RenderGraphBuilder<RenderPipelineFrame>,
45
76
  topology: RenderPipelineTopology,
77
+ projectGpuDrivenShadowOrFeatures?:
78
+ | ((identity: ShadowViewIdentity) => Result<ShadowViewProjection | undefined, RenderGraphError>)
79
+ | RenderFeatureShadowDraws<RenderPipelineFrame>,
80
+ features?: RenderFeatureShadowDraws<RenderPipelineFrame>,
46
81
  ): Result<TypedShadowTargets, RenderGraphError> {
82
+ const projectGpuDrivenShadow =
83
+ typeof projectGpuDrivenShadowOrFeatures === 'function'
84
+ ? projectGpuDrivenShadowOrFeatures
85
+ : undefined;
86
+ const shadowFeatures =
87
+ typeof projectGpuDrivenShadowOrFeatures === 'function'
88
+ ? features
89
+ : (projectGpuDrivenShadowOrFeatures ?? features);
47
90
  let directional: RenderPipelineTarget | undefined;
48
91
  if (topology.shadow.directional !== 'disabled') {
49
92
  const { mapSize, cascadeCount } = topology.shadow.directional;
@@ -61,19 +104,40 @@ export function addTypedShadowPasses(
61
104
  for (let cascade = 0; cascade < cascadeCount; cascade += 1) {
62
105
  const col = cascade % atlasGrid.columns;
63
106
  const row = Math.floor(cascade / atlasGrid.columns);
107
+ const shadowProjection = projectGpuDrivenShadow?.({
108
+ kind: 'directional',
109
+ index: cascade,
110
+ });
111
+ if (shadowProjection !== undefined && !shadowProjection.ok) return shadowProjection;
64
112
  const added = recordShadowPass(
65
113
  graph,
66
114
  `shadowCascade${cascade}`,
67
115
  directionalTarget,
68
116
  cascade === 0 ? 'clear' : 'load',
69
- ({ pass, frame }) =>
70
- encodeDirectionalShadowPass(frame as never, pass, cascade, {
71
- x: col * mapSize,
72
- y: row * mapSize,
73
- w: mapSize,
74
- h: mapSize,
75
- }),
76
- (frame) => !(frame as _InternalRenderPipelineContext).directionalShadowCacheReuse,
117
+ ({ pass, frame, resources }) =>
118
+ encodeDirectionalShadowPass(
119
+ frame as never,
120
+ pass,
121
+ cascade,
122
+ {
123
+ x: col * mapSize,
124
+ y: row * mapSize,
125
+ w: mapSize,
126
+ h: mapSize,
127
+ },
128
+ shadowFeatures === undefined
129
+ ? undefined
130
+ : (view) => shadowFeatures.encode(pass, frame, resources, view),
131
+ ),
132
+ (frame) =>
133
+ shadowFeatures !== undefined ||
134
+ !shadowViewCacheReuse(frame, { kind: 'directional', index: cascade }),
135
+ [
136
+ ...(shadowProjection?.ok === true && shadowProjection.value?.graphResources !== undefined
137
+ ? shadowViewRasterAccesses(shadowProjection.value.graphResources)
138
+ : []),
139
+ ...(shadowFeatures?.accesses ?? []),
140
+ ],
77
141
  );
78
142
  if (!added.ok) return added;
79
143
  }
@@ -127,6 +191,15 @@ export function addTypedShadowPasses(
127
191
  };
128
192
  for (let pointIndex = 0; pointIndex < topology.shadow.pointCount; pointIndex += 1) {
129
193
  for (let face = 0; face < 6; face += 1) {
194
+ const shadowProjection = projectGpuDrivenShadow?.({
195
+ kind: 'point',
196
+ index: pointIndex,
197
+ face,
198
+ });
199
+ if (shadowProjection !== undefined && !shadowProjection.ok) return shadowProjection;
200
+ const identity = { kind: 'point' as const, index: pointIndex, face };
201
+ const cacheReuse = (frame: RenderPipelineFrame): boolean =>
202
+ shadowViewCacheReuse(frame, identity);
130
203
  const faceView = graph.view(texture.value, {
131
204
  label: `point-shadow-${pointIndex}-${face}`,
132
205
  dimension: '2d',
@@ -145,7 +218,24 @@ export function addTypedShadowPasses(
145
218
  sampleCount: 1,
146
219
  },
147
220
  'clear',
148
- ({ pass, frame }) => encodePointShadowPass(frame as never, pass, pointIndex, face),
221
+ ({ pass, frame, resources }) =>
222
+ encodePointShadowPass(
223
+ frame as never,
224
+ pass,
225
+ pointIndex,
226
+ face,
227
+ shadowFeatures === undefined
228
+ ? undefined
229
+ : (view) => shadowFeatures.encode(pass, frame, resources, view),
230
+ ),
231
+ (frame) => shadowFeatures !== undefined || !cacheReuse(frame),
232
+ [
233
+ ...(shadowProjection?.ok === true &&
234
+ shadowProjection.value?.graphResources !== undefined
235
+ ? shadowViewRasterAccesses(shadowProjection.value.graphResources)
236
+ : []),
237
+ ...(shadowFeatures?.accesses ?? []),
238
+ ],
149
239
  );
150
240
  if (!added.ok) return added;
151
241
  }
@@ -158,12 +248,32 @@ export function addTypedShadowPasses(
158
248
  });
159
249
  if (!spot.ok) return spot;
160
250
  for (let spotIndex = 0; spotIndex < Math.max(1, topology.shadow.spotCount); spotIndex += 1) {
251
+ const shadowProjection = projectGpuDrivenShadow?.({ kind: 'spot', index: spotIndex });
252
+ if (shadowProjection !== undefined && !shadowProjection.ok) return shadowProjection;
253
+ const identity = { kind: 'spot' as const, index: spotIndex };
254
+ const cacheReuse = (frame: RenderPipelineFrame): boolean =>
255
+ shadowViewCacheReuse(frame, identity);
161
256
  const added = recordShadowPass(
162
257
  graph,
163
258
  topology.shadow.spotCount === 0 ? 'spot-shadow' : `spot-shadow-${spotIndex}`,
164
259
  spot.value,
165
260
  spotIndex === 0 ? 'clear' : 'load',
166
- ({ pass, frame }) => encodeSpotShadowPass(frame as never, pass, spotIndex),
261
+ ({ pass, frame, resources }) =>
262
+ encodeSpotShadowPass(
263
+ frame as never,
264
+ pass,
265
+ spotIndex,
266
+ shadowFeatures === undefined
267
+ ? undefined
268
+ : (view) => shadowFeatures.encode(pass, frame, resources, view),
269
+ ),
270
+ (frame) => shadowFeatures !== undefined || !cacheReuse(frame),
271
+ [
272
+ ...(shadowProjection?.ok === true && shadowProjection.value?.graphResources !== undefined
273
+ ? shadowViewRasterAccesses(shadowProjection.value.graphResources)
274
+ : []),
275
+ ...(shadowFeatures?.accesses ?? []),
276
+ ],
167
277
  );
168
278
  if (!added.ok) return added;
169
279
  }
@@ -35,6 +35,7 @@ export interface VolumetricFogAuthoring {
35
35
  readonly light: EntityHandle;
36
36
  /** The optional same-World SpotLight paired with a PointLight. */
37
37
  readonly spotLight?: EntityHandle;
38
+ /** Linear scalar density over bounds; the renderer adds no noise or animation. */
38
39
  readonly density: VolumeDensityBinding;
39
40
  readonly bounds: VolumeBounds;
40
41
  readonly extinction: readonly [number, number, number];
@@ -481,9 +481,9 @@ export function addVolumetricFogPasses(
481
481
  const densitySampler = frame.runtime.device.createSampler({
482
482
  minFilter: 'linear',
483
483
  magFilter: 'linear',
484
- addressModeU: 'repeat',
485
- addressModeV: 'repeat',
486
- addressModeW: 'repeat',
484
+ addressModeU: 'clamp-to-edge',
485
+ addressModeV: 'clamp-to-edge',
486
+ addressModeW: 'clamp-to-edge',
487
487
  });
488
488
  if (!densitySampler.ok) throw densitySampler.error;
489
489
  const bindings = volumeBindGroup(frame, integrate.layout, [
@@ -36,6 +36,16 @@ export type VolumeTemporalReset =
36
36
  | { readonly reset: false }
37
37
  | { readonly reset: true; readonly reason: VolumeTemporalResetReason };
38
38
 
39
+ /** TAAU remains dependency-deferred until its sibling reaches this branch. */
40
+ export const VOLUME_TAAU_DEPENDENCY = Object.freeze({
41
+ status: 'dependency-deferred' as const,
42
+ siblingFeature: 'feat-20260831-taau-dynamic-resolution',
43
+ candidateShas: Object.freeze([
44
+ '6a0b8fe01ab81d5b60704f2120fa3f9b056742e4',
45
+ '677a7a40852d748e2af3352e2666d7c310115d0a',
46
+ ]),
47
+ });
48
+
39
49
  export function resolveVolumeTemporalReset(
40
50
  previous: VolumeTemporalSignature,
41
51
  next: VolumeTemporalSignature,
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/temporal/coverage.ts","../src/temporal/temporal-view.ts","../src/temporal/taa-history-store.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AA,CAAa,KAAA;AAAA,MAChB,MAAA,KAAW,KAAA,IAAS,MAAA,KAAW,eAAA,GAC3B,YAAA,GACA,MAAA,KAAW,QAAA,GACT,QAAA,GACA,MAAA,KAAW,mBAAA,IAAuB,MAAA,KAAW,aAAA,GAC3C,mBAAA,GACA;AAAA,KACV;AACA,IAAA,IAAA,CAAK,OAAA,GAAU,MAAA;AACf,IAAA,IAAA,CAAK,cAAA,GAAiB,MAAA;AACtB,IAAA,IAAA,CAAK,WAAA,GAAc,MAAA;AACnB,IAAA,IAAA,CAAK,QAAA,GAAW;AAAA,MACd,qBAAqB,EAAC;AAAA,MACtB,wBAAwB,EAAC;AAAA,MACzB,uBAAuB,EAAC;AAAA,MACxB,8BAAA,EAAgC;AAAA,KAClC;AAAA,EACF;AAAA,EAEQ,eAAe,KAAA,EAAoC;AACzD,IAAA,IAAI,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA,IAAQ,WAAW,KAAA,EAAO;AACnE,MAAA,MAAM,QAAS,KAAA,CAA8B,KAAA;AAC7C,MAAA,IAAI,UAAU,OAAA,IAAW,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,YAAY,KAAA,KAAU,QAAA;AAC7E,QAAA,OAAO,KAAA;AAAA,IACX;AACA,IAAA,OAAO,QAAA;AAAA,EACT;AACF","file":"chunk-GE3SDD72.mjs","sourcesContent":["import type { SceneDataLane, SceneDataSchemaId } from './scene-data';\n\nexport interface SceneDataCoverage {\n readonly schema: SceneDataSchemaId;\n readonly lane: SceneDataLane;\n readonly producerId: string;\n readonly complete: boolean;\n readonly contributorIds: readonly string[];\n readonly exactContributorIds: readonly string[];\n readonly reactiveContributorIds: readonly string[];\n readonly missingContributorIds: readonly string[];\n readonly omittedMissingContributorCount: number;\n}\n\nexport interface TemporalCoverage {\n readonly width: number;\n readonly height: number;\n readonly bytes: number;\n readonly fullScreen: true;\n}\n\nexport function createTemporalCoverage(width: number, height: number): TemporalCoverage {\n if (!Number.isSafeInteger(width) || width <= 0) throw new RangeError('width must be positive.');\n if (!Number.isSafeInteger(height) || height <= 0)\n throw new RangeError('height must be positive.');\n return Object.freeze({ width, height, bytes: 32 * width * height, fullScreen: true as const });\n}\n\nexport type SceneDataContributorKind = 'exact' | 'reactive';\nexport interface SceneDataContributor {\n readonly id: string;\n readonly kind: SceneDataContributorKind;\n}\nexport function classifySceneDataCoverage(input: {\n readonly contributors: readonly SceneDataContributor[];\n readonly requiredContributorIds: readonly string[];\n}): {\n readonly exactContributorIds: readonly string[];\n readonly reactiveContributorIds: readonly string[];\n readonly missingContributorIds: readonly string[];\n readonly omittedMissingContributorCount: number;\n readonly complete: boolean;\n} {\n const exactContributorIds = input.contributors.filter((c) => c.kind === 'exact').map((c) => c.id);\n const reactiveContributorIds = input.contributors\n .filter((c) => c.kind === 'reactive')\n .map((c) => c.id);\n const available = new Set(input.contributors.map((c) => c.id));\n const missing = input.requiredContributorIds.filter((id) => !available.has(id));\n return {\n exactContributorIds: Object.freeze(exactContributorIds),\n reactiveContributorIds: Object.freeze(reactiveContributorIds),\n missingContributorIds: Object.freeze(missing.slice(0, 32)),\n omittedMissingContributorCount: Math.max(0, missing.length - 32),\n complete: missing.length === 0,\n };\n}\nexport function scanSceneDataCoverage(input: {\n readonly schema: SceneDataSchemaId;\n readonly lane: SceneDataLane;\n readonly producerId: string;\n readonly contributorIds: readonly string[];\n readonly requiredContributorIds: readonly string[];\n}): SceneDataCoverage {\n const classification = classifySceneDataCoverage({\n contributors: input.contributorIds.map((id) => ({ id, kind: 'exact' as const })),\n requiredContributorIds: input.requiredContributorIds,\n });\n return Object.freeze({\n schema: input.schema,\n lane: input.lane,\n producerId: input.producerId,\n ...classification,\n contributorIds: Object.freeze([...input.contributorIds]),\n });\n}\n","import { mat4 } from '@forgeax/engine-math';\nimport type { CameraProjection } from '../components/camera';\nimport type { CameraSnapshot } from '../render-contract';\n\nexport const TEMPORAL_JITTER_SAMPLE_COUNT = 8;\n\nexport type TemporalViewResetReason =\n | 'first-frame'\n | 'camera-switch'\n | 'history-version-changed'\n | 'projection-kind-changed'\n | 'projection-range-changed';\n\nexport interface SubmittedTemporalView {\n readonly viewId: string;\n readonly historyVersion: number;\n readonly projection: CameraProjection;\n readonly near: number;\n readonly far: number;\n readonly jitterUv: readonly [number, number];\n readonly unjitteredViewProjection: Float32Array;\n}\n\nexport interface TemporalView {\n readonly viewId: string;\n readonly historyVersion: number;\n readonly temporalFrameIndex: number;\n readonly historyValid: boolean;\n readonly resetReason: TemporalViewResetReason | undefined;\n readonly currentJitterUv: readonly [number, number];\n readonly previousJitterUv: readonly [number, number];\n readonly currentJitteredViewProjection: Float32Array;\n readonly currentUnjitteredViewProjection: Float32Array;\n readonly previousUnjitteredViewProjection: Float32Array;\n readonly projection: CameraProjection;\n readonly near: number;\n readonly far: number;\n}\n\nexport interface TemporalViewInput {\n readonly camera: CameraSnapshot;\n readonly temporalFrameIndex: number;\n readonly surfaceWidth: number;\n readonly surfaceHeight: number;\n readonly lastSubmitted?: SubmittedTemporalView;\n}\n\nexport function temporalViewId(worldId: number, entityKey: number): string {\n const raw = entityKey >>> 0;\n const index = raw & 0x00ffffff;\n const generation = (raw >>> 24) & 0xff;\n return `${worldId}:${index}:${generation}`;\n}\n\nfunction halton(index: number, base: number): number {\n let result = 0;\n let fraction = 1 / base;\n let value = index;\n while (value > 0) {\n result += fraction * (value % base);\n value = Math.floor(value / base);\n fraction /= base;\n }\n return result;\n}\n\nexport function temporalJitterSample(temporalFrameIndex: number): readonly [number, number] {\n const sampleIndex =\n ((Math.trunc(temporalFrameIndex) % TEMPORAL_JITTER_SAMPLE_COUNT) +\n TEMPORAL_JITTER_SAMPLE_COUNT) %\n TEMPORAL_JITTER_SAMPLE_COUNT;\n const haltonIndex = sampleIndex + 1;\n return [halton(haltonIndex, 2) - 0.5, halton(haltonIndex, 3) - 0.5];\n}\n\nfunction temporalJitterUv(\n temporalFrameIndex: number,\n surfaceWidth: number,\n surfaceHeight: number,\n): readonly [number, number] {\n const sample = temporalJitterSample(temporalFrameIndex);\n return [sample[0] / Math.max(1, surfaceWidth), sample[1] / Math.max(1, surfaceHeight)];\n}\n\nfunction cameraProjection(camera: CameraSnapshot): Float32Array {\n const projection = mat4.create();\n if (camera.projection === 'orthographic') {\n mat4.orthographic(\n projection,\n camera.orthoLeft,\n camera.orthoRight,\n camera.orthoTop,\n camera.orthoBottom,\n camera.near,\n camera.far,\n );\n } else {\n mat4.perspective(projection, camera.fov, camera.aspect, camera.near, camera.far);\n }\n return projection;\n}\n\nfunction resetReason(\n current: CameraSnapshot,\n viewId: string,\n previous: SubmittedTemporalView | undefined,\n): TemporalViewResetReason | undefined {\n if (previous === undefined) return 'first-frame';\n if (previous.viewId !== viewId) return 'camera-switch';\n if (previous.historyVersion !== (current.historyVersion ?? 0)) {\n return 'history-version-changed';\n }\n if (previous.projection !== current.projection) return 'projection-kind-changed';\n if (!Object.is(previous.near, current.near) || !Object.is(previous.far, current.far)) {\n return 'projection-range-changed';\n }\n return undefined;\n}\n\nexport function projectTemporalView(input: TemporalViewInput): TemporalView {\n const { camera } = input;\n const viewId = temporalViewId(camera.worldId ?? 0, camera.entityKey ?? 0);\n const currentJitterUv = temporalJitterUv(\n input.temporalFrameIndex,\n input.surfaceWidth,\n input.surfaceHeight,\n );\n const view = mat4.invert(mat4.create(), camera.world);\n const projection = cameraProjection(camera);\n const currentUnjitteredViewProjection = mat4.multiply(mat4.create(), projection, view);\n const clipJitter = mat4.identity(mat4.create());\n clipJitter[12] = currentJitterUv[0] * 2;\n clipJitter[13] = currentJitterUv[1] * -2;\n const jitteredProjection = mat4.multiply(mat4.create(), clipJitter, projection);\n const currentJitteredViewProjection = mat4.multiply(mat4.create(), jitteredProjection, view);\n const reason = resetReason(camera, viewId, input.lastSubmitted);\n const historyValid = reason === undefined;\n return {\n viewId,\n historyVersion: camera.historyVersion ?? 0,\n temporalFrameIndex: input.temporalFrameIndex,\n historyValid,\n resetReason: reason,\n currentJitterUv,\n previousJitterUv: historyValid\n ? (input.lastSubmitted?.jitterUv ?? currentJitterUv)\n : currentJitterUv,\n currentJitteredViewProjection,\n currentUnjitteredViewProjection,\n previousUnjitteredViewProjection: historyValid\n ? (input.lastSubmitted?.unjitteredViewProjection ?? currentUnjitteredViewProjection)\n : currentUnjitteredViewProjection,\n projection: camera.projection,\n near: camera.near,\n far: camera.far,\n };\n}\n\nexport function snapshotSubmittedTemporalView(view: TemporalView): SubmittedTemporalView {\n return {\n viewId: view.viewId,\n historyVersion: view.historyVersion,\n projection: view.projection,\n near: view.near,\n far: view.far,\n jitterUv: [view.currentJitterUv[0], view.currentJitterUv[1]],\n unjitteredViewProjection: new Float32Array(view.currentUnjitteredViewProjection),\n };\n}\n","export type TaaHistoryResetReason =\n | 'first-frame'\n | 'camera-cut'\n | 'resize'\n | 'recover'\n | 'device-generation';\n\nexport interface TaaHistoryInspection {\n readonly token: number;\n readonly deviceGeneration: number;\n readonly content: 'uninitialized' | 'active';\n readonly fallback: 'neutral-texture';\n readonly requestVersion: number;\n readonly generation: number;\n readonly seed: number;\n readonly attempt: 'none' | 'active' | 'committed' | 'aborted';\n readonly valid: boolean;\n readonly resetReason: TaaHistoryResetReason | undefined;\n}\n\nexport interface TaaHistoryReceipt {\n readonly deviceGeneration: number;\n readonly completed: boolean;\n}\n\nexport interface TaaHistoryAttempt {\n readonly generation: number;\n readonly seed: number;\n commit(receipt?: TaaHistoryReceipt): void;\n abort(): void;\n}\n\nlet nextHistoryToken = 1;\n\n/** TAA-only history owner. No global registry or backend handle crosses this boundary. */\nexport class TaaHistoryStore {\n private readonly token = nextHistoryToken++;\n private deviceGeneration = 0;\n private content: TaaHistoryInspection['content'] = 'uninitialized';\n private requestVersion = 0;\n private generation = 0;\n private seed = 0;\n private valid = false;\n private attempt: TaaHistoryInspection['attempt'] = 'none';\n private resetReason: TaaHistoryResetReason | undefined;\n\n begin(reason: TaaHistoryResetReason | undefined = undefined): TaaHistoryAttempt {\n const generation = this.generation;\n const seed = this.seed;\n this.attempt = 'active';\n let state: 'active' | 'committed' | 'aborted' = 'active';\n return {\n generation,\n seed,\n commit: (receipt) => {\n if (state !== 'active') return;\n if (\n receipt !== undefined &&\n (!receipt.completed || receipt.deviceGeneration !== this.deviceGeneration)\n ) {\n state = 'aborted';\n this.attempt = 'aborted';\n return;\n }\n state = 'committed';\n this.attempt = 'committed';\n this.valid = true;\n this.content = 'active';\n this.requestVersion += 1;\n this.generation += 1;\n this.seed += 1;\n this.resetReason = reason;\n },\n abort: () => {\n if (state !== 'active') return;\n state = 'aborted';\n this.attempt = 'aborted';\n },\n };\n }\n\n seedHistory(reason: TaaHistoryResetReason = 'first-frame'): void {\n this.valid = false;\n this.content = 'uninitialized';\n this.resetReason = reason;\n this.attempt = 'none';\n }\n\n reset(reason: TaaHistoryResetReason): void {\n this.generation = 0;\n this.seed = 0;\n this.valid = false;\n this.content = 'uninitialized';\n this.attempt = 'none';\n this.resetReason = reason;\n }\n\n recoverForGeneration(deviceGeneration: number): void {\n if (!Number.isSafeInteger(deviceGeneration) || deviceGeneration < 0) {\n throw new RangeError('deviceGeneration must be a non-negative safe integer.');\n }\n this.deviceGeneration = deviceGeneration;\n this.valid = false;\n this.content = 'uninitialized';\n this.attempt = 'none';\n this.resetReason = 'device-generation';\n }\n\n inspect(): TaaHistoryInspection {\n return {\n token: this.token,\n deviceGeneration: this.deviceGeneration,\n content: this.content,\n fallback: 'neutral-texture',\n requestVersion: this.requestVersion,\n generation: this.generation,\n seed: this.seed,\n attempt: this.attempt,\n valid: this.valid,\n resetReason: this.resetReason,\n };\n }\n}\n","import { err, ok, type Result } from '@forgeax/engine-types';\nimport type { CameraSnapshot } from '../render-contract';\nimport { classifySceneDataCoverage, type SceneDataContributor } from './coverage';\nimport { type TaaHistoryAttempt, TaaHistoryStore } from './taa-history-store';\nimport {\n projectTemporalView,\n type SubmittedTemporalView,\n snapshotSubmittedTemporalView,\n type TemporalView,\n} from './temporal-view';\n\n/** The only stages that may publish a temporal frame. */\nexport type TemporalFrameStage = 'build' | 'encode' | 'finish' | 'submit';\n\nexport type TemporalFrameErrorCode = 'taa-unavailable' | 'temporal-active' | 'temporal-not-active';\n\nexport interface TemporalFrameError {\n readonly code: TemporalFrameErrorCode;\n readonly expected: string;\n readonly hint: string;\n readonly detail?: Readonly<Record<string, unknown>>;\n}\n\nexport interface TemporalFrameSnapshot<T = unknown> {\n readonly epoch: number;\n readonly previous: T | undefined;\n readonly historyAttempt: 'none' | 'active' | 'committed' | 'aborted';\n readonly attempt: 'none' | 'active' | 'committed' | 'aborted';\n readonly lastFailure: TemporalFrameStage | undefined;\n readonly coverage: {\n readonly exactContributorIds: readonly string[];\n readonly reactiveContributorIds: readonly string[];\n readonly missingContributorIds: readonly string[];\n readonly omittedMissingContributorCount: number;\n };\n}\n\nexport interface TemporalFrameBeginInput<T = unknown> {\n readonly current: T;\n readonly antialias: 'none' | 'fxaa' | 'msaa' | 'taa';\n /** Enables the shared transaction for a temporal feature without TAA. */\n readonly temporalDemand?: boolean;\n readonly available?: boolean;\n readonly contributors?: readonly SceneDataContributor[];\n readonly requiredContributorIds?: readonly string[];\n /** Projection produced before record uploads; it commits with the frame. */\n readonly temporalView?: TemporalView;\n}\n\nexport interface TemporalFrameCandidate<T = unknown> {\n readonly epoch: number;\n readonly current: T;\n readonly previous: T | undefined;\n readonly history: { readonly direction: 'a-to-b' | 'b-to-a'; readonly valid: boolean };\n readonly contributors: readonly SceneDataContributor[];\n readonly requiredContributorIds: readonly string[];\n readonly temporalView?: TemporalView;\n}\n\nexport interface TemporalFramePhases<T = unknown> {\n readonly build: () => T;\n readonly encode: (built: T) => void;\n readonly finish: () => void;\n readonly submit: () => void;\n}\n\nexport interface TemporalFrameReceipt<T = unknown> {\n readonly epoch: number;\n readonly previous: T;\n readonly historyDirection: 'a-to-b' | 'b-to-a';\n}\n\nexport type ReflectionFallbackTemporalReset =\n | { readonly reset: false }\n | { readonly reset: true; readonly reason: 'reflection-fallback-generation' };\n\n/** Maps committed producer generations into the existing temporal reset seam. */\nexport function resolveReflectionFallbackTemporalReset(\n previousGeneration: number | undefined,\n nextGeneration: number | undefined,\n): ReflectionFallbackTemporalReset {\n if (previousGeneration === undefined || nextGeneration === undefined) return { reset: false };\n return previousGeneration === nextGeneration\n ? { reset: false }\n : { reset: true, reason: 'reflection-fallback-generation' };\n}\n\n/**\n * Keeps SSR admission on the existing producer-generation reset seam. The\n * admission path never allocates or resolves temporal history itself.\n */\nexport function resolveSsrAdmissionTemporalReset(\n previousGeneration: number | undefined,\n nextGeneration: number | undefined,\n): ReflectionFallbackTemporalReset {\n return resolveReflectionFallbackTemporalReset(previousGeneration, nextGeneration);\n}\n\nfunction failure(code: TemporalFrameErrorCode, hint: string): TemporalFrameError {\n return {\n code,\n expected:\n code === 'taa-unavailable'\n ? 'TAA resources and capability are available'\n : 'one temporal frame is active',\n hint,\n };\n}\n\n/**\n * Renderer-owned temporal transaction. It has no graph or backend dependency:\n * graph assembly supplies the four phase callbacks and only submit publishes\n * the candidate snapshot.\n */\nexport class TemporalFrameCoordinator<T = unknown> {\n readonly historyStore: TaaHistoryStore;\n private epoch: number;\n private previous: T | undefined;\n private active: TemporalFrameCandidate<T> | undefined;\n private attempt: TemporalFrameSnapshot<T>['attempt'] = 'none';\n private historyAttempt: TemporalFrameSnapshot<T>['historyAttempt'] = 'none';\n private lastFailure: TemporalFrameStage | undefined;\n private historyDirection: 'a-to-b' | 'b-to-a' = 'a-to-b';\n private temporalFrameIndex = 0;\n private lastSubmittedView: SubmittedTemporalView | undefined;\n private coverage: TemporalFrameSnapshot<T>['coverage'] = {\n exactContributorIds: [],\n reactiveContributorIds: [],\n missingContributorIds: [],\n omittedMissingContributorCount: 0,\n };\n private readonly historyAttempts = new WeakMap<object, TaaHistoryAttempt>();\n\n constructor(\n initial: {\n readonly epoch?: number;\n readonly previous?: T;\n readonly historyStore?: TaaHistoryStore;\n } = {},\n ) {\n this.historyStore = initial.historyStore ?? new TaaHistoryStore();\n this.epoch = initial.epoch ?? 0;\n this.previous = initial.previous;\n }\n\n begin(input: TemporalFrameBeginInput<T>): Result<TemporalFrameCandidate<T>, TemporalFrameError> {\n const demanded = input.antialias === 'taa' || input.temporalDemand === true;\n if (!demanded) {\n return ok({\n epoch: this.epoch,\n current: input.current,\n previous: this.previous,\n history: { direction: this.historyDirection, valid: false },\n contributors: Object.freeze([...(input.contributors ?? [])]),\n requiredContributorIds: Object.freeze([...(input.requiredContributorIds ?? [])]),\n ...(input.temporalView === undefined ? {} : { temporalView: input.temporalView }),\n });\n }\n if (input.available === false) {\n return err(\n failure('taa-unavailable', 'enable rgba16float temporal targets and retry the frame'),\n );\n }\n if (this.active !== undefined) {\n return err(\n failure(\n 'temporal-active',\n 'commit or abort the active temporal frame before beginning another',\n ),\n );\n }\n const candidate: TemporalFrameCandidate<T> = {\n epoch: this.epoch + 1,\n current: input.current,\n previous: this.previous,\n history: { direction: this.historyDirection, valid: this.previous !== undefined },\n contributors: Object.freeze([...(input.contributors ?? [])]),\n requiredContributorIds: Object.freeze([...(input.requiredContributorIds ?? [])]),\n ...(input.temporalView === undefined ? {} : { temporalView: input.temporalView }),\n };\n if (input.antialias === 'taa') {\n this.historyAttempts.set(candidate, this.historyStore.begin());\n }\n this.active = candidate;\n this.attempt = 'active';\n this.historyAttempt = input.antialias === 'taa' ? 'active' : 'none';\n this.lastFailure = undefined;\n return ok(candidate);\n }\n\n commit(\n candidate: TemporalFrameCandidate<T>,\n ): Result<TemporalFrameReceipt<T>, TemporalFrameError> {\n if (this.active !== candidate) {\n return err(failure('temporal-not-active', 'commit the candidate returned by begin'));\n }\n this.epoch = candidate.epoch;\n this.previous = candidate.current;\n if (candidate.temporalView !== undefined) {\n this.lastSubmittedView = snapshotSubmittedTemporalView(candidate.temporalView);\n this.temporalFrameIndex += 1;\n }\n this.historyDirection = candidate.history.direction === 'a-to-b' ? 'b-to-a' : 'a-to-b';\n const historyAttempt = this.historyAttempts.get(candidate);\n historyAttempt?.commit({\n deviceGeneration: this.historyStore.inspect().deviceGeneration,\n completed: true,\n });\n this.coverage = classifySceneDataCoverage({\n contributors: candidate.contributors,\n requiredContributorIds: candidate.requiredContributorIds,\n });\n this.active = undefined;\n historyAttempt?.abort();\n this.historyAttempts.delete(candidate);\n this.attempt = 'committed';\n this.historyAttempt = historyAttempt === undefined ? 'none' : 'committed';\n return ok({\n epoch: this.epoch,\n previous: candidate.current,\n historyDirection: candidate.history.direction,\n });\n }\n\n abort(candidate: TemporalFrameCandidate<T>, stage: TemporalFrameStage = 'submit'): void {\n if (this.active !== candidate) return;\n this.historyAttempts.get(candidate)?.abort();\n this.historyAttempts.delete(candidate);\n this.active = undefined;\n this.attempt = 'aborted';\n this.historyAttempt = 'aborted';\n this.lastFailure = stage;\n }\n\n run(\n input: TemporalFrameBeginInput<T>,\n phases: TemporalFramePhases<T>,\n ): Result<TemporalFrameReceipt<T> | undefined, TemporalFrameError> {\n const started = this.begin(input);\n if (!started.ok) return started;\n const candidate = started.value;\n if (input.antialias !== 'taa' && input.temporalDemand !== true) return ok(undefined);\n try {\n const built = phases.build();\n phases.encode(built);\n phases.finish();\n phases.submit();\n } catch (cause) {\n const stage = this.stageFromError(cause);\n this.abort(candidate, stage);\n return err({\n code: 'temporal-not-active',\n expected: `temporal ${stage} succeeds before commit`,\n hint: 'inspect the underlying stage failure and retry the frame',\n detail: { stage, cause },\n });\n }\n return this.commit(candidate);\n }\n\n inspect(): TemporalFrameSnapshot<T> {\n return {\n epoch: this.epoch,\n previous: this.previous,\n historyAttempt: this.historyAttempt,\n attempt: this.attempt,\n lastFailure: this.lastFailure,\n coverage: this.coverage,\n };\n }\n\n /**\n * Derive the current/previous camera matrices without mutating history.\n * `commit()` is the only operation that publishes the returned view, so a\n * graph/finish/submit failure leaves the last successful view intact.\n */\n prepareTemporalView(\n camera: CameraSnapshot,\n surfaceWidth: number,\n surfaceHeight: number,\n ): TemporalView | undefined {\n const demanded =\n camera.antialias === 'taa' ||\n (camera.motionBlur?.shutterAngle !== undefined && camera.motionBlur.shutterAngle > 0);\n if (!demanded) return undefined;\n return projectTemporalView({\n camera,\n temporalFrameIndex: this.temporalFrameIndex,\n surfaceWidth,\n surfaceHeight,\n ...(this.lastSubmittedView === undefined ? {} : { lastSubmitted: this.lastSubmittedView }),\n });\n }\n\n reset(\n reason:\n | 'cut'\n | 'resize'\n | 'camera-switch'\n | 'detach'\n | 'recover'\n | 'device-loss'\n | 'device-generation' = 'recover',\n ): void {\n void reason;\n this.active = undefined;\n this.epoch = 0;\n this.previous = undefined;\n this.temporalFrameIndex = 0;\n this.lastSubmittedView = undefined;\n this.historyDirection = 'a-to-b';\n this.historyStore.reset(\n reason === 'cut' || reason === 'camera-switch'\n ? 'camera-cut'\n : reason === 'resize'\n ? 'resize'\n : reason === 'device-generation' || reason === 'device-loss'\n ? 'device-generation'\n : 'recover',\n );\n this.attempt = 'none';\n this.historyAttempt = 'none';\n this.lastFailure = undefined;\n this.coverage = {\n exactContributorIds: [],\n reactiveContributorIds: [],\n missingContributorIds: [],\n omittedMissingContributorCount: 0,\n };\n }\n\n private stageFromError(cause: unknown): TemporalFrameStage {\n if (typeof cause === 'object' && cause !== null && 'stage' in cause) {\n const stage = (cause as { stage?: unknown }).stage;\n if (stage === 'build' || stage === 'encode' || stage === 'finish' || stage === 'submit')\n return stage;\n }\n return 'submit';\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/assembly/material/surface-projection.ts","../src/materials.ts"],"names":["pass"],"mappings":";;;;;AAQO,IAAM,wBAAA,GAA2B,4BAAA;AAsBxC,SAAS,IAAA,CACP,IAAA,EACA,OAAA,EACA,aAAA,EACc;AACd,EAAA,MAAM,aAAA,GAAgB,OAAA,CAAQ,WAAA,IAAe,EAAC;AAC9C,EAAA,MAAM,cAAA,GAAiB,aAAA;AACvB,EAAA,MAAM,IAAA,GAAQ,cAAA,CAAe,IAAA,IAAQ,EAAC;AACtC,EAAA,MAAM,YACJ,IAAA,KAAS,eAAA,GAAkB,cAAA,GAAiB,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A;AAAA,IACD,UAAA,EAAY,yBAAA,CAA0B,IAAA,CAAK,UAAU,CAAA;AAAA,IACrD,QAAQ,IAAA,CAAK;AAAA,GACf;AACF;AAEO,SAAS,SAAS,OAAA,EAAyC;AAChE,EAAA,OAAO,QAAQ,aAAA,KAAkB,MAAA,GAAY,gBAAgB,OAAO,CAAA,GAAI,eAAe,OAAO,CAAA;AAChG;AAEO,IAAM,SAAA,GAAY,EAAE,KAAA,EAAO,QAAA,EAAU,IAAA","file":"chunk-GF523LHF.mjs","sourcesContent":["import { DEFAULT_STANDARD_SURFACE_MODULE } from '@forgeax/engine-shader';\nimport type {\n MaterialPass,\n MaterialRenderState,\n MaterialValue,\n StandardLayerPlan,\n} from '@forgeax/engine-types';\n\nexport const STANDARD_MATERIAL_MODULE = 'forgeax_material::standard';\nexport { DEFAULT_STANDARD_SURFACE_MODULE };\n\nexport type StandardSurfacePassName = 'forward' | 'deferred' | 'shadow-caster';\nexport type StandardSurfaceGeometryVariant = 'rigid' | 'skinned' | 'instanced';\nexport type StandardSurfaceLightingLane = 'direct' | 'clustered';\nexport type StandardSurfaceKind = 'standard' | 'full-custom';\n\nexport interface StandardSurfaceProjectionOptions {\n readonly surfaceModule: string;\n readonly values: Readonly<Record<string, MaterialValue | null>>;\n readonly renderState?: MaterialRenderState;\n readonly castShadow?: boolean;\n readonly queue?: number;\n readonly geometryVariant?: StandardSurfaceGeometryVariant;\n readonly lightingLane?: StandardSurfaceLightingLane;\n readonly alphaClip?: boolean;\n readonly surfaceKind?: StandardSurfaceKind;\n readonly declaredPasses?: readonly StandardSurfacePassName[];\n readonly layerPlan?: StandardLayerPlan;\n}\n\nfunction pass(\n name: StandardSurfacePassName,\n options: StandardSurfaceProjectionOptions,\n fragmentEntry: string,\n): MaterialPass {\n const authoredState = options.renderState ?? {};\n const authoredRecord = authoredState as Readonly<Record<string, unknown>>;\n const tags = (authoredRecord.tags ?? {}) as Readonly<Record<string, string>>;\n const lightMode =\n name === 'shadow-caster' ? 'ShadowCaster' : name === 'forward' ? 'Forward' : 'Deferred';\n return {\n name,\n program: {\n module:\n name === 'shadow-caster' ? 'forgeax::default-shadow-caster' : STANDARD_MATERIAL_MODULE,\n fragmentEntry,\n moduleSlots: { surface: options.surfaceModule },\n },\n renderState: {\n ...authoredState,\n tags:\n options.surfaceModule === DEFAULT_STANDARD_SURFACE_MODULE\n ? { LightMode: lightMode, ...tags }\n : {\n ...tags,\n LightMode: lightMode,\n SurfaceModule: options.surfaceModule,\n SurfaceKind: options.surfaceKind ?? 'standard',\n GeometryVariant: options.geometryVariant ?? 'rigid',\n LightingLane: options.lightingLane ?? 'direct',\n AlphaClip: options.alphaClip === true ? 'enabled' : 'disabled',\n },\n ...(options.queue === undefined ? {} : { queue: options.queue }),\n },\n };\n}\n\n/** Project one custom or default Surface into the existing Standard pass family. */\nexport function projectStandardSurfacePasses(\n options: StandardSurfaceProjectionOptions,\n): [MaterialPass, ...MaterialPass[]] {\n const authoredPasses = options.declaredPasses;\n const passNames: StandardSurfacePassName[] =\n options.surfaceKind === 'full-custom' && authoredPasses !== undefined\n ? [...authoredPasses]\n : (['forward'] as StandardSurfacePassName[]);\n if (authoredPasses === undefined || options.surfaceKind !== 'full-custom') {\n const blended = options.renderState?.blend !== undefined;\n if (!blended && options.layerPlan?.mode !== 'physical') passNames.push('deferred');\n if (options.castShadow !== false) passNames.push('shadow-caster');\n }\n const entries = passNames.map((name) =>\n pass(\n name,\n options,\n name === 'forward' ? 'fs_main' : name === 'deferred' ? 'fs_gbuffer' : 'fs_shadow',\n ),\n );\n const passes = entries as [MaterialPass, ...MaterialPass[]];\n return passes;\n}\n","import { color } from '@forgeax/engine-math';\nimport { DEFAULT_STANDARD_PBR_PARAM_SCHEMA } from '@forgeax/engine-shader';\nimport type {\n MaterialAsset,\n MaterialColorSpace,\n MaterialParameter,\n MaterialPass,\n MaterialRenderState,\n MaterialValue,\n} from '@forgeax/engine-types';\nimport { deriveStandardLayerPlan, standardSurfaceParameters } from '@forgeax/engine-types';\nimport {\n DEFAULT_STANDARD_SURFACE_MODULE,\n projectStandardSurfacePasses,\n} from './assembly/material/surface-projection';\n\nexport type MaterialTransmissionValidationReason =\n | 'non-finite'\n | 'range'\n | 'shape'\n | 'blend'\n | 'depth-write';\n\n/** Structured authoring failure for the Standard transmission contract. */\nexport class MaterialTransmissionContractError extends Error {\n readonly code = 'material-transmission-contract-invalid' as const;\n readonly expected = 'transmission material values satisfy finite ranges and Forward depth rules';\n readonly hint =\n 'repair the named transmission value or pass state before publishing the material';\n readonly detail: {\n readonly code: 'material-transmission-contract-invalid';\n readonly material: 'Standard';\n readonly parameter:\n | 'transmission'\n | 'ior'\n | 'thickness'\n | 'attenuationColor'\n | 'attenuationDistance';\n readonly reason: MaterialTransmissionValidationReason;\n readonly actual?: unknown;\n };\n\n constructor(\n parameter: (typeof MaterialTransmissionContractError.prototype.detail)['parameter'],\n reason: MaterialTransmissionValidationReason,\n actual?: unknown,\n ) {\n super(`Materials.standard: ${parameter} violates the transmission contract (${reason})`);\n this.name = 'MaterialTransmissionContractError';\n this.detail = {\n code: 'material-transmission-contract-invalid',\n material: 'Standard',\n parameter,\n reason,\n ...(actual === undefined ? {} : { actual }),\n };\n }\n}\n\nexport const SPRITE_PREMULTIPLIED_ALPHA_BLEND: GPUBlendState = {\n color: { srcFactor: 'one', dstFactor: 'one-minus-src-alpha', operation: 'add' },\n alpha: { srcFactor: 'one', dstFactor: 'one-minus-src-alpha', operation: 'add' },\n};\n\nconst UNLIT_MODULE = 'forgeax_material::unlit';\nconst SPRITE_MODULE = 'forgeax_material::sprite';\n\nexport type MaterialColorTuple3 = readonly [number, number, number];\nexport type MaterialColorTuple4 = readonly [number, number, number, number];\nexport type MaterialColorInput3 = MaterialColorTuple3 | string | number;\nexport type MaterialColorInput4 = MaterialColorTuple4 | string | number;\n\nfunction colorHexFromNumber(value: number): string {\n if (!Number.isInteger(value) || value < 0 || value > 0xffffff) {\n throw new Error(`material color number must be an integer in [0, 0xffffff], got ${value}`);\n }\n return `#${value.toString(16).padStart(6, '0')}`;\n}\n\nfunction linearColorFromInput(\n input: MaterialColorInput3 | MaterialColorInput4,\n channels: 3 | 4,\n): readonly number[] {\n if (typeof input === 'number' || typeof input === 'string') {\n const parsed = color.create();\n color.fromCss(parsed, typeof input === 'number' ? colorHexFromNumber(input) : input);\n return channels === 3\n ? [parsed[0] as number, parsed[1] as number, parsed[2] as number]\n : Array.from(parsed);\n }\n if (input.length !== channels) {\n throw new Error(`material color tuple must contain ${channels} channels, got ${input.length}`);\n }\n return [...input];\n}\n\n/** Convert an explicit sRGB numeric tuple into the linear tuple factories store. */\nexport function srgb(input: MaterialColorTuple3): MaterialColorTuple3;\nexport function srgb(input: MaterialColorTuple4): MaterialColorTuple4;\nexport function srgb(input: readonly number[]): readonly number[] {\n if (input.length !== 3 && input.length !== 4) {\n throw new Error(`sRGB material color tuple must contain 3 or 4 channels, got ${input.length}`);\n }\n const parsed = color.create(input[0] ?? 0, input[1] ?? 0, input[2] ?? 0, input[3] ?? 1);\n color.srgbToLinear(parsed, parsed);\n return input.length === 3\n ? [parsed[0] as number, parsed[1] as number, parsed[2] as number]\n : [parsed[0] as number, parsed[1] as number, parsed[2] as number, parsed[3] as number];\n}\n\nfunction authoredColorParameter(\n name: string,\n type: 'color' | 'vec3',\n colorSpace: MaterialColorSpace,\n optional = false,\n): MaterialParameter {\n return {\n name,\n type,\n ...(type === 'color' && colorSpace === 'srgb' ? {} : { colorSpace }),\n ...(optional ? { optional: true } : {}),\n };\n}\n\nfunction standardParameters(\n colorSpace: MaterialColorSpace,\n opts: StandardOpts,\n): readonly MaterialParameter[] {\n const physicalNames = new Set<string>();\n const addPhysical = (...names: readonly string[]) => {\n for (const name of names) physicalNames.add(name);\n };\n if (\n opts.clearcoat !== undefined ||\n opts.clearcoatRoughness !== undefined ||\n opts.clearcoatNormalScale !== undefined ||\n opts.clearcoatTexture !== undefined ||\n opts.clearcoatRoughnessTexture !== undefined ||\n opts.clearcoatNormalTexture !== undefined\n ) {\n addPhysical(\n 'clearcoat',\n 'clearcoatRoughness',\n 'clearcoatNormalScale',\n ...(opts.clearcoatTexture === undefined ? [] : ['clearcoatTexture']),\n ...(opts.clearcoatRoughnessTexture === undefined ? [] : ['clearcoatRoughnessTexture']),\n ...(opts.clearcoatNormalTexture === undefined ? [] : ['clearcoatNormalTexture']),\n );\n }\n if (\n opts.anisotropyStrength !== undefined ||\n opts.anisotropyRotation !== undefined ||\n opts.anisotropyTexture !== undefined\n ) {\n addPhysical('anisotropyStrength', 'anisotropyRotation');\n if (opts.anisotropyTexture !== undefined) addPhysical('anisotropyTexture');\n }\n if (\n opts.sheenColor !== undefined ||\n opts.sheenRoughness !== undefined ||\n opts.sheenColorTexture !== undefined ||\n opts.sheenRoughnessTexture !== undefined\n ) {\n addPhysical('sheenColor', 'sheenRoughness');\n if (opts.sheenColorTexture !== undefined) addPhysical('sheenColorTexture');\n if (opts.sheenRoughnessTexture !== undefined) addPhysical('sheenRoughnessTexture');\n }\n if (\n opts.iridescence !== undefined ||\n opts.iridescenceIor !== undefined ||\n opts.iridescenceThicknessMinimum !== undefined ||\n opts.iridescenceThicknessMaximum !== undefined ||\n opts.iridescenceTexture !== undefined ||\n opts.iridescenceThicknessTexture !== undefined\n ) {\n addPhysical(\n 'iridescence',\n 'iridescenceIor',\n 'iridescenceThicknessMinimum',\n 'iridescenceThicknessMaximum',\n ...(opts.iridescenceTexture === undefined ? [] : ['iridescenceTexture']),\n ...(opts.iridescenceThicknessTexture === undefined ? [] : ['iridescenceThicknessTexture']),\n );\n }\n const baseNames = new Set([\n 'baseColor',\n 'metallic',\n 'roughness',\n 'metallicChannel',\n 'roughnessChannel',\n 'aoChannel',\n 'extraChannel',\n 'emissive',\n 'emissiveIntensity',\n 'occlusionStrength',\n 'alphaCutoff',\n 'normalScale',\n 'baseColorTexture',\n 'metallicRoughnessTexture',\n 'normalTexture',\n 'emissiveTexture',\n 'occlusionTexture',\n 'specular',\n 'specularColor',\n // IOR is part of the always-present dielectric F0 contract. The\n // transmission layer may be absent, but the Standard shader still\n // consumes this scalar for the base reflection path.\n 'ior',\n ]);\n if (opts.specularTexture !== undefined) baseNames.add('specularTexture');\n if (opts.specularColorTexture !== undefined) baseNames.add('specularColorTexture');\n if (\n opts.transmission !== undefined ||\n opts.ior !== undefined ||\n opts.thickness !== undefined ||\n opts.transmissionTexture !== undefined ||\n opts.thicknessTexture !== undefined ||\n opts.attenuationColor !== undefined ||\n opts.attenuationDistance !== undefined\n ) {\n for (const name of [\n 'transmission',\n 'ior',\n 'thickness',\n 'attenuationColor',\n 'attenuationDistance',\n 'transmissionTexture',\n 'thicknessTexture',\n ]) {\n baseNames.add(name);\n }\n }\n // All Standard fields come from one root schema. Physical fields are\n // projected by the authored option membership above; appending a second\n // physical schema would create a parallel ABI authority.\n const availableSchema = DEFAULT_STANDARD_PBR_PARAM_SCHEMA;\n // Keep the generated Standard UBO's numeric run contiguous before any\n // texture coordinate records. The built-in WGSL places the complete\n // physical root (including clearcoat scalars) after the base numeric run\n // and before all coordinate pairs; appending physical entries after the\n // base texture records would otherwise derive a different ABI.\n const numericSchema = availableSchema.filter((entry) => !entry.type.startsWith('texture'));\n const textureSchema = availableSchema.filter((entry) => entry.type.startsWith('texture'));\n const orderedSchema = [...numericSchema, ...textureSchema];\n return orderedSchema\n .filter((entry) => baseNames.has(entry.name) || physicalNames.has(entry.name))\n .map((entry) => {\n const type = entry.type.startsWith('texture') ? 'texture' : entry.type;\n const isRequired =\n entry.name === 'baseColor' || entry.name === 'metallic' || entry.name === 'roughness';\n const authoredColor =\n entry.type === 'color' || (entry.type === 'vec3' && entry.name !== 'attenuationColor');\n const schemaColorSpace = 'colorSpace' in entry ? entry.colorSpace : undefined;\n const colorSpaceProjection: { colorSpace?: MaterialColorSpace } = {};\n if (authoredColor && !(type === 'color' && colorSpace === 'srgb')) {\n colorSpaceProjection.colorSpace = colorSpace;\n } else if (!authoredColor && schemaColorSpace !== undefined) {\n colorSpaceProjection.colorSpace = schemaColorSpace;\n }\n return {\n name: entry.name,\n type,\n ...colorSpaceProjection,\n ...(isRequired ? {} : { optional: true }),\n } as MaterialParameter;\n });\n}\n\nfunction unlitParameters(colorSpace: MaterialColorSpace): readonly MaterialParameter[] {\n return [\n authoredColorParameter('baseColor', 'color', colorSpace),\n { name: 'alphaCutoff', type: 'f32', optional: true },\n { name: 'baseColorTexture', type: 'texture', optional: true },\n ];\n}\n\nfunction pass(\n name: string,\n module: string,\n renderState: MaterialRenderState | undefined,\n fragmentEntry?: string,\n queue?: number,\n): MaterialPass {\n const lightMode =\n name === 'shadow-caster' ? 'ShadowCaster' : name === 'deferred' ? 'Deferred' : 'Forward';\n const authoredState = (renderState ?? {}) as Readonly<Record<string, unknown>>;\n const authoredTags = authoredState.tags as Readonly<Record<string, string>> | undefined;\n return {\n name,\n program: {\n module,\n ...(fragmentEntry === undefined ? {} : { fragmentEntry }),\n },\n renderState: {\n ...authoredState,\n tags: { LightMode: lightMode, ...authoredTags },\n ...(queue === undefined ? {} : { queue }),\n },\n };\n}\n\nfunction shadowCasterRenderState(\n renderState: MaterialRenderState | undefined,\n): MaterialRenderState | undefined {\n if (renderState?.cullMode === undefined && renderState?.frontFace === undefined) return undefined;\n return {\n ...(renderState.cullMode === undefined ? {} : { cullMode: renderState.cullMode }),\n ...(renderState.frontFace === undefined ? {} : { frontFace: renderState.frontFace }),\n };\n}\n\ninterface UnlitOpts {\n readonly castShadow?: boolean;\n readonly baseColorTexture?: MaterialValue;\n readonly alphaCutoff?: number;\n readonly renderState?: MaterialRenderState;\n readonly queue?: number;\n}\n\nfunction unlit(rgba: MaterialColorInput4, opts?: UnlitOpts): MaterialAsset {\n if (opts?.alphaCutoff !== undefined && (opts.alphaCutoff < 0 || opts.alphaCutoff > 1)) {\n throw new Error(`Materials.unlit: alphaCutoff must be in [0, 1], got ${opts.alphaCutoff}`);\n }\n const values: Record<string, MaterialValue> = { baseColor: linearColorFromInput(rgba, 4) };\n if (opts?.baseColorTexture !== undefined) values.baseColorTexture = opts.baseColorTexture;\n if (opts?.alphaCutoff !== undefined) values.alphaCutoff = opts.alphaCutoff;\n const passes: [MaterialPass, ...MaterialPass[]] = [\n pass('forward', UNLIT_MODULE, opts?.renderState, undefined, opts?.queue),\n ];\n if (opts?.castShadow !== false) {\n passes.push(pass('shadow-caster', UNLIT_MODULE, shadowCasterRenderState(opts?.renderState)));\n }\n return {\n kind: 'material',\n colorSpace: 'linear',\n passes,\n parameters: unlitParameters('linear'),\n values,\n };\n}\n\ninterface StandardOpts {\n /** Numeric tuples are linear; Hex/CSS strings and numbers are sRGB inputs. */\n readonly baseColor: MaterialColorInput4;\n readonly metallic?: number;\n readonly roughness?: number;\n /** Texture channel used for the metallic factor; glTF defaults to B (2). */\n readonly metallicChannel?: number;\n /** Texture channel used for the roughness factor; glTF defaults to G (1). */\n readonly roughnessChannel?: number;\n readonly clearcoat?: number;\n readonly clearcoatRoughness?: number;\n readonly clearcoatTexture?: MaterialValue;\n readonly clearcoatRoughnessTexture?: MaterialValue;\n readonly clearcoatNormalTexture?: MaterialValue;\n readonly clearcoatNormalScale?: number;\n readonly anisotropyStrength?: number;\n readonly anisotropyRotation?: number;\n readonly anisotropyTexture?: MaterialValue;\n readonly sheenColor?: MaterialColorInput3;\n readonly sheenRoughness?: number;\n readonly sheenColorTexture?: MaterialValue;\n readonly sheenRoughnessTexture?: MaterialValue;\n readonly iridescence?: number;\n readonly iridescenceIor?: number;\n readonly iridescenceThicknessMinimum?: number;\n readonly iridescenceThicknessMaximum?: number;\n readonly iridescenceTexture?: MaterialValue;\n readonly iridescenceThicknessTexture?: MaterialValue;\n readonly specular?: number;\n readonly specularColor?: MaterialColorInput3;\n readonly specularTexture?: MaterialValue;\n readonly specularColorTexture?: MaterialValue;\n readonly emissive?: MaterialColorInput3;\n readonly emissiveIntensity?: number;\n readonly emissiveTexture?: MaterialValue;\n readonly baseColorTexture?: MaterialValue;\n readonly metallicRoughnessTexture?: MaterialValue;\n readonly normalTexture?: MaterialValue;\n readonly occlusionTexture?: MaterialValue;\n readonly occlusionStrength?: number;\n readonly alphaCutoff?: number;\n readonly transmission?: number;\n readonly transmissionTexture?: MaterialValue;\n readonly ior?: number;\n readonly thickness?: number;\n readonly thicknessTexture?: MaterialValue;\n readonly attenuationColor?: readonly [number, number, number];\n readonly attenuationDistance?: number;\n readonly renderState?: MaterialRenderState;\n readonly castShadow?: boolean;\n readonly queue?: number;\n}\n\n/** Built-in Standard authoring surface with engine-owned parameter defaults. */\nexport interface DefaultStandardOptions extends StandardOpts {\n readonly surfaceModule?: never;\n readonly parameters?: never;\n readonly values?: never;\n}\n\n/** Import-first Standard Surface authoring; the root parameter contract stays caller-owned. */\nexport interface CustomStandardSurfaceOptions {\n readonly surfaceModule: string;\n readonly parameters: readonly MaterialParameter[];\n readonly values: Readonly<Record<string, MaterialValue>>;\n readonly colorSpace?: MaterialColorSpace;\n readonly renderState?: MaterialRenderState;\n readonly castShadow?: boolean;\n readonly queue?: number;\n readonly baseColor?: never;\n readonly metallic?: never;\n readonly roughness?: never;\n readonly metallicChannel?: never;\n readonly roughnessChannel?: never;\n readonly clearcoat?: never;\n readonly clearcoatRoughness?: never;\n readonly clearcoatTexture?: never;\n readonly clearcoatRoughnessTexture?: never;\n readonly clearcoatNormalTexture?: never;\n readonly clearcoatNormalScale?: never;\n readonly anisotropyStrength?: never;\n readonly anisotropyRotation?: never;\n readonly anisotropyTexture?: never;\n readonly sheenColor?: never;\n readonly sheenRoughness?: never;\n readonly sheenColorTexture?: never;\n readonly sheenRoughnessTexture?: never;\n readonly iridescence?: never;\n readonly iridescenceIor?: never;\n readonly iridescenceThicknessMinimum?: never;\n readonly iridescenceThicknessMaximum?: never;\n readonly iridescenceTexture?: never;\n readonly iridescenceThicknessTexture?: never;\n readonly specular?: never;\n readonly specularColor?: never;\n readonly specularTexture?: never;\n readonly specularColorTexture?: never;\n readonly emissive?: never;\n readonly emissiveIntensity?: never;\n readonly emissiveTexture?: never;\n readonly baseColorTexture?: never;\n readonly metallicRoughnessTexture?: never;\n readonly normalTexture?: never;\n readonly occlusionTexture?: never;\n readonly occlusionStrength?: never;\n readonly alphaCutoff?: never;\n readonly transmission?: never;\n readonly transmissionTexture?: never;\n readonly ior?: never;\n readonly thickness?: never;\n readonly thicknessTexture?: never;\n readonly attenuationColor?: never;\n readonly attenuationDistance?: never;\n}\n\nexport type StandardOptions = DefaultStandardOptions | CustomStandardSurfaceOptions;\n\nfunction validateChannel(\n name: 'metallicChannel' | 'roughnessChannel',\n value: number | undefined,\n): void {\n if (value !== undefined && (!Number.isInteger(value) || value < 0 || value > 3)) {\n throw new Error(`Materials.standard: ${name} must be an integer in [0, 3], got ${value}`);\n }\n}\n\nfunction validateFiniteRange(\n name: 'transmission' | 'ior' | 'thickness' | 'attenuationDistance',\n value: number | undefined,\n minimum: number,\n maximum?: number,\n): void {\n if (value === undefined || !Number.isFinite(value)) {\n if (value === undefined) return;\n throw new MaterialTransmissionContractError(name, 'non-finite', value);\n }\n if (value < minimum || (maximum !== undefined && value > maximum)) {\n throw new MaterialTransmissionContractError(name, 'range', value);\n }\n}\n\nfunction standardDefault(opts: DefaultStandardOptions): MaterialAsset {\n const occlusionStrength = opts.occlusionStrength ?? 1;\n if (occlusionStrength < 0 || occlusionStrength > 1) {\n throw new Error(\n `Materials.standard: occlusionStrength must be in [0, 1], got ${occlusionStrength}`,\n );\n }\n if (opts.alphaCutoff !== undefined && (opts.alphaCutoff < 0 || opts.alphaCutoff > 1)) {\n throw new Error(`Materials.standard: alphaCutoff must be in [0, 1], got ${opts.alphaCutoff}`);\n }\n validateChannel('metallicChannel', opts.metallicChannel);\n validateChannel('roughnessChannel', opts.roughnessChannel);\n const transmission = opts.transmission ?? 0;\n const ior = opts.ior ?? 1.5;\n const thickness = opts.thickness ?? 0;\n const attenuationColor = opts.attenuationColor ?? [1, 1, 1];\n validateFiniteRange('transmission', transmission, 0, 1);\n validateFiniteRange('ior', ior, 1);\n validateFiniteRange('thickness', thickness, 0);\n validateFiniteRange('attenuationDistance', opts.attenuationDistance, Number.MIN_VALUE);\n if (\n attenuationColor.length !== 3 ||\n attenuationColor.some((value) => !Number.isFinite(value) || value < 0 || value > 1)\n ) {\n throw new MaterialTransmissionContractError('attenuationColor', 'shape', attenuationColor);\n }\n if (transmission > 0 && opts.renderState?.blend !== undefined) {\n throw new MaterialTransmissionContractError('transmission', 'blend', opts.renderState.blend);\n }\n if (transmission > 0 && opts.renderState?.depthWriteEnabled === true) {\n throw new MaterialTransmissionContractError('transmission', 'depth-write', true);\n }\n const values: Record<string, MaterialValue> = {\n baseColor: linearColorFromInput(opts.baseColor, 4),\n metallic: opts.metallic ?? 0,\n roughness: opts.roughness ?? 0.5,\n occlusionStrength,\n specular: opts.specular ?? 1,\n specularColor:\n opts.specularColor === undefined ? [1, 1, 1] : linearColorFromInput(opts.specularColor, 3),\n transmission,\n ior,\n thickness,\n attenuationColor,\n };\n if (opts.metallicChannel !== undefined) values.metallicChannel = opts.metallicChannel;\n if (opts.roughnessChannel !== undefined) values.roughnessChannel = opts.roughnessChannel;\n if (opts.clearcoat !== undefined) values.clearcoat = opts.clearcoat;\n if (opts.clearcoatRoughness !== undefined) values.clearcoatRoughness = opts.clearcoatRoughness;\n if (opts.clearcoatTexture !== undefined) values.clearcoatTexture = opts.clearcoatTexture;\n if (opts.clearcoatRoughnessTexture !== undefined) {\n values.clearcoatRoughnessTexture = opts.clearcoatRoughnessTexture;\n }\n if (opts.clearcoatNormalTexture !== undefined) {\n values.clearcoatNormalTexture = opts.clearcoatNormalTexture;\n }\n if (opts.clearcoatNormalScale !== undefined)\n values.clearcoatNormalScale = opts.clearcoatNormalScale;\n if (opts.anisotropyStrength !== undefined) values.anisotropyStrength = opts.anisotropyStrength;\n if (opts.anisotropyRotation !== undefined) values.anisotropyRotation = opts.anisotropyRotation;\n if (opts.anisotropyTexture !== undefined) values.anisotropyTexture = opts.anisotropyTexture;\n if (opts.sheenColor !== undefined) values.sheenColor = linearColorFromInput(opts.sheenColor, 3);\n if (opts.sheenRoughness !== undefined) values.sheenRoughness = opts.sheenRoughness;\n if (opts.sheenColorTexture !== undefined) values.sheenColorTexture = opts.sheenColorTexture;\n if (opts.sheenRoughnessTexture !== undefined) {\n values.sheenRoughnessTexture = opts.sheenRoughnessTexture;\n }\n if (opts.iridescence !== undefined) values.iridescence = opts.iridescence;\n if (opts.iridescenceIor !== undefined) values.iridescenceIor = opts.iridescenceIor;\n if (opts.iridescenceThicknessMinimum !== undefined) {\n values.iridescenceThicknessMinimum = opts.iridescenceThicknessMinimum;\n }\n if (opts.iridescenceThicknessMaximum !== undefined) {\n values.iridescenceThicknessMaximum = opts.iridescenceThicknessMaximum;\n }\n if (opts.iridescenceTexture !== undefined) values.iridescenceTexture = opts.iridescenceTexture;\n if (opts.iridescenceThicknessTexture !== undefined) {\n values.iridescenceThicknessTexture = opts.iridescenceThicknessTexture;\n }\n if (opts.emissive !== undefined) values.emissive = linearColorFromInput(opts.emissive, 3);\n if (opts.emissiveIntensity !== undefined) values.emissiveIntensity = opts.emissiveIntensity;\n if (opts.emissiveTexture !== undefined) values.emissiveTexture = opts.emissiveTexture;\n if (opts.baseColorTexture !== undefined) values.baseColorTexture = opts.baseColorTexture;\n if (opts.metallicRoughnessTexture !== undefined) {\n values.metallicRoughnessTexture = opts.metallicRoughnessTexture;\n }\n if (opts.normalTexture !== undefined) values.normalTexture = opts.normalTexture;\n if (opts.occlusionTexture !== undefined) values.occlusionTexture = opts.occlusionTexture;\n if (opts.specularTexture !== undefined) values.specularTexture = opts.specularTexture;\n if (opts.specularColorTexture !== undefined) {\n values.specularColorTexture = opts.specularColorTexture;\n }\n if (opts.alphaCutoff !== undefined) values.alphaCutoff = opts.alphaCutoff;\n if (opts.transmissionTexture !== undefined) values.transmissionTexture = opts.transmissionTexture;\n if (opts.thicknessTexture !== undefined) values.thicknessTexture = opts.thicknessTexture;\n if (opts.attenuationDistance !== undefined) values.attenuationDistance = opts.attenuationDistance;\n const forwardRenderState =\n transmission > 0 ? { ...(opts.renderState ?? {}), depthWriteEnabled: false } : opts.renderState;\n const parameters = standardSurfaceParameters(standardParameters('linear', opts));\n const declaredNames = new Set(parameters.map((parameter) => parameter.name));\n for (const name of Object.keys(values)) {\n if (!declaredNames.has(name)) delete values[name];\n }\n const layerPlan = deriveStandardLayerPlan(parameters);\n const projected = projectStandardSurfacePasses({\n surfaceModule: DEFAULT_STANDARD_SURFACE_MODULE,\n values,\n ...(forwardRenderState === undefined ? {} : { renderState: forwardRenderState }),\n ...(opts.castShadow === undefined ? {} : { castShadow: opts.castShadow }),\n ...(opts.queue === undefined ? {} : { queue: opts.queue }),\n layerPlan,\n });\n const passes = (\n transmission > 0 ? projected.filter((entry) => entry.name !== 'deferred') : projected\n ) as [MaterialPass, ...MaterialPass[]];\n return {\n kind: 'material',\n colorSpace: 'linear',\n passes,\n parameters,\n values,\n };\n}\n\nfunction standardCustom(opts: CustomStandardSurfaceOptions): MaterialAsset {\n const layerPlan = deriveStandardLayerPlan(\n opts.parameters.filter((parameter) => parameter.optional !== true),\n );\n return {\n kind: 'material',\n ...(opts.colorSpace === undefined || opts.colorSpace === 'srgb'\n ? {}\n : { colorSpace: opts.colorSpace }),\n passes: projectStandardSurfacePasses({\n surfaceModule: opts.surfaceModule,\n values: opts.values,\n ...(opts.renderState === undefined ? {} : { renderState: opts.renderState }),\n ...(opts.castShadow === undefined ? {} : { castShadow: opts.castShadow }),\n ...(opts.queue === undefined ? {} : { queue: opts.queue }),\n layerPlan,\n }),\n parameters: standardSurfaceParameters(opts.parameters),\n values: opts.values,\n };\n}\n\nexport function standard(options: StandardOptions): MaterialAsset {\n return options.surfaceModule === undefined ? standardDefault(options) : standardCustom(options);\n}\n\nexport const Materials = { unlit, standard, srgb } as const;\n\nexport { SPRITE_MODULE };\n"]}