@forgeax/engine-render 0.1.31 → 0.1.32

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 (118) hide show
  1. package/README.md +68 -1
  2. package/dist/assembly/webgpu-ready.d.ts +2 -1
  3. package/dist/assembly/webgpu-ready.d.ts.map +1 -1
  4. package/dist/assembly/webgpu-renderer.d.ts.map +1 -1
  5. package/dist/{chunk-C3DDSXYK.mjs → chunk-4NNZQCL3.mjs} +110 -35
  6. package/dist/chunk-4NNZQCL3.mjs.map +1 -0
  7. package/dist/{chunk-JRBDO2KB.mjs → chunk-6TFBXLRJ.mjs} +19 -7
  8. package/dist/chunk-6TFBXLRJ.mjs.map +1 -0
  9. package/dist/{chunk-FUUO4UND.mjs → chunk-DRR7D3KX.mjs} +3 -3
  10. package/dist/chunk-DRR7D3KX.mjs.map +1 -0
  11. package/dist/{chunk-S5UE2T5P.mjs → chunk-GWCEMDVR.mjs} +380 -4
  12. package/dist/chunk-GWCEMDVR.mjs.map +1 -0
  13. package/dist/{chunk-MDQJPY3T.mjs → chunk-JCIRYQ4V.mjs} +3 -3
  14. package/dist/{chunk-MDQJPY3T.mjs.map → chunk-JCIRYQ4V.mjs.map} +1 -1
  15. package/dist/{chunk-PSEQ6QPH.mjs → chunk-JRIPCMYC.mjs} +17 -10
  16. package/dist/chunk-JRIPCMYC.mjs.map +1 -0
  17. package/dist/{chunk-7MQ3XBSP.mjs → chunk-LULCA3OF.mjs} +4 -4
  18. package/dist/{chunk-7MQ3XBSP.mjs.map → chunk-LULCA3OF.mjs.map} +1 -1
  19. package/dist/{chunk-NO4WZCAH.mjs → chunk-S665NJNF.mjs} +3 -3
  20. package/dist/{chunk-NO4WZCAH.mjs.map → chunk-S665NJNF.mjs.map} +1 -1
  21. package/dist/components/depth-of-field.d.ts +28 -0
  22. package/dist/components/depth-of-field.d.ts.map +1 -0
  23. package/dist/components/directional-light.d.ts +2 -1
  24. package/dist/components/directional-light.d.ts.map +1 -1
  25. package/dist/components/index.d.ts +1 -0
  26. package/dist/components/index.d.ts.map +1 -1
  27. package/dist/construct-renderer.mjs +898 -328
  28. package/dist/construct-renderer.mjs.map +1 -1
  29. package/dist/extract/camera.d.ts.map +1 -1
  30. package/dist/features/depth-of-field/depth-of-field-assembly.d.ts +19 -0
  31. package/dist/features/depth-of-field/depth-of-field-assembly.d.ts.map +1 -0
  32. package/dist/features/depth-of-field/depth-of-field-feature.d.ts +43 -0
  33. package/dist/features/depth-of-field/depth-of-field-feature.d.ts.map +1 -0
  34. package/dist/features/depth-of-field/depth-of-field-inspection.d.ts +34 -0
  35. package/dist/features/depth-of-field/depth-of-field-inspection.d.ts.map +1 -0
  36. package/dist/features/depth-of-field/depth-of-field-params.d.ts +83 -0
  37. package/dist/features/depth-of-field/depth-of-field-params.d.ts.map +1 -0
  38. package/dist/features/types.d.ts +19 -1
  39. package/dist/features/types.d.ts.map +1 -1
  40. package/dist/index.d.ts +4 -2
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.mjs +6 -5
  43. package/dist/index.mjs.map +1 -1
  44. package/dist/inspection-types.d.ts +35 -0
  45. package/dist/inspection-types.d.ts.map +1 -1
  46. package/dist/instances.d.ts +7 -0
  47. package/dist/instances.d.ts.map +1 -1
  48. package/dist/internal.mjs +6 -6
  49. package/dist/mesh-material-bindings.d.ts +3 -0
  50. package/dist/mesh-material-bindings.d.ts.map +1 -1
  51. package/dist/pipeline/standard-output/graph.d.ts.map +1 -1
  52. package/dist/pipeline/standard-output/types.d.ts +4 -2
  53. package/dist/pipeline/standard-output/types.d.ts.map +1 -1
  54. package/dist/pipeline/standard-post.d.ts.map +1 -1
  55. package/dist/plugin.d.ts.map +1 -1
  56. package/dist/record/frame-snapshot.d.ts +21 -1
  57. package/dist/record/frame-snapshot.d.ts.map +1 -1
  58. package/dist/record/frame.d.ts.map +1 -1
  59. package/dist/record/main-pass.d.ts.map +1 -1
  60. package/dist/record/typed-frame-graph.d.ts +7 -0
  61. package/dist/record/typed-frame-graph.d.ts.map +1 -1
  62. package/dist/recovery/render-system-candidate.d.ts.map +1 -1
  63. package/dist/render-contract.d.ts +8 -1
  64. package/dist/render-contract.d.ts.map +1 -1
  65. package/dist/render-graph-primitives.d.ts +2 -0
  66. package/dist/render-graph-primitives.d.ts.map +1 -1
  67. package/dist/render-pipeline.d.ts +13 -1
  68. package/dist/render-pipeline.d.ts.map +1 -1
  69. package/dist/render-system-extract-tail.d.ts.map +1 -1
  70. package/dist/render-system-extract.d.ts +18 -4
  71. package/dist/render-system-extract.d.ts.map +1 -1
  72. package/dist/render-system.d.ts +2 -1
  73. package/dist/render-system.d.ts.map +1 -1
  74. package/dist/temporal/index.mjs +5 -5
  75. package/dist/typed-render-graph-primitives.d.ts.map +1 -1
  76. package/package.json +21 -21
  77. package/src/__tests__/gpu-driven-baseline.characterization.test.ts +12 -0
  78. package/src/__tests__/gpu-driven-production.integration.test.ts +27 -1
  79. package/src/__tests__/instances-store.unit.test.ts +15 -0
  80. package/src/__tests__/prepared-gpu-driven-pbr.integration.test.ts +28 -0
  81. package/src/assembly/webgpu-ready.ts +5 -5
  82. package/src/assembly/webgpu-renderer.ts +14 -14
  83. package/src/components/depth-of-field.ts +45 -0
  84. package/src/components/directional-light.ts +2 -1
  85. package/src/components/index.ts +1 -0
  86. package/src/extract/camera.ts +22 -2
  87. package/src/features/depth-of-field/__tests__/depth-of-field-params.unit.test.ts +943 -0
  88. package/src/features/depth-of-field/depth-of-field-assembly.ts +100 -0
  89. package/src/features/depth-of-field/depth-of-field-feature.ts +295 -0
  90. package/src/features/depth-of-field/depth-of-field-inspection.ts +237 -0
  91. package/src/features/depth-of-field/depth-of-field-params.ts +556 -0
  92. package/src/features/host.ts +1 -1
  93. package/src/features/types.ts +18 -1
  94. package/src/index.ts +32 -0
  95. package/src/inspection-types.ts +38 -0
  96. package/src/instances.ts +19 -5
  97. package/src/mesh-material-bindings.ts +4 -0
  98. package/src/pipeline/standard-output/graph.ts +3 -0
  99. package/src/pipeline/standard-output/types.ts +4 -1
  100. package/src/pipeline/standard-post.ts +21 -2
  101. package/src/plugin.ts +2 -0
  102. package/src/record/frame-snapshot.ts +26 -1
  103. package/src/record/frame.ts +39 -6
  104. package/src/record/main-pass.ts +1 -5
  105. package/src/record/typed-frame-graph.ts +106 -6
  106. package/src/recovery/render-system-candidate.ts +6 -0
  107. package/src/render-contract.ts +11 -0
  108. package/src/render-graph-primitives.ts +8 -1
  109. package/src/render-pipeline.ts +17 -1
  110. package/src/render-system-extract-tail.ts +87 -13
  111. package/src/render-system-extract.ts +103 -25
  112. package/src/render-system.ts +78 -0
  113. package/src/typed-render-graph-primitives.ts +3 -0
  114. package/dist/chunk-C3DDSXYK.mjs.map +0 -1
  115. package/dist/chunk-FUUO4UND.mjs.map +0 -1
  116. package/dist/chunk-JRBDO2KB.mjs.map +0 -1
  117. package/dist/chunk-PSEQ6QPH.mjs.map +0 -1
  118. package/dist/chunk-S5UE2T5P.mjs.map +0 -1
@@ -1,14 +1,14 @@
1
- import { inspectVolumetricFog, resolveSsrAdmissionGeneration, inspectLodOcclusion, zeroSsrAdmissionWork, projectSsrSpatialInspection, createDynamicGeometryLifecycle, inspectReflectionFallback, admitReflectionProbe, DEFAULT_REFLECTION_PROBE_LIMITS, buildReflectionProbeTable, advanceProbeFilter, commitProbeFilterStep, resolveReflectionFallbackSource, deriveReflectionFallbackProjection, reflectionFallbackCoverage, reflectionFallbackSourceKey, reflectionFallbackProjectionSignature, createProbeFilterState, ReflectionProbeProjection, admitPointsLines, projectSsrDependencies, admitSsrSpatial, inspectPointShadow, DynamicGeometryError, sameCandidateCredential } from './chunk-7MQ3XBSP.mjs';
2
- import { createExtendedLightingState, promoteExtendedLightingCandidate, glyphTextLayoutSystem, projectExtendedLightingInspection, OcclusionRenderRuntime, extractFrames, viewKey, primitiveKey, viewKeyId, primitiveKeyId, ProbeBlendSceneProjection, SKYLIGHT_RECOVERY_FALLBACK, InstanceBoundsCache, fingerprintNumericArray, buildShadowFrusta, createSsrHistoryOwner, createSsrSpatialResources, createCookieProjectionMatrixData } from './chunk-C3DDSXYK.mjs';
1
+ import { inspectVolumetricFog, resolveSsrAdmissionGeneration, inspectLodOcclusion, zeroSsrAdmissionWork, projectSsrSpatialInspection, createDynamicGeometryLifecycle, inspectReflectionFallback, admitReflectionProbe, DEFAULT_REFLECTION_PROBE_LIMITS, buildReflectionProbeTable, advanceProbeFilter, commitProbeFilterStep, resolveReflectionFallbackSource, deriveReflectionFallbackProjection, reflectionFallbackCoverage, reflectionFallbackSourceKey, reflectionFallbackProjectionSignature, createProbeFilterState, ReflectionProbeProjection, admitPointsLines, projectSsrDependencies, admitSsrSpatial, inspectPointShadow, DynamicGeometryError, sameCandidateCredential } from './chunk-LULCA3OF.mjs';
2
+ import { createExtendedLightingState, promoteExtendedLightingCandidate, glyphTextLayoutSystem, projectExtendedLightingInspection, OcclusionRenderRuntime, extractFrames, viewKey, primitiveKey, viewKeyId, primitiveKeyId, ProbeBlendSceneProjection, SKYLIGHT_RECOVERY_FALLBACK, InstanceBoundsCache, fingerprintNumericArray, buildShadowFrusta, createSsrHistoryOwner, createSsrSpatialResources, createCookieProjectionMatrixData } from './chunk-4NNZQCL3.mjs';
3
3
  import './chunk-ILQ5MEZF.mjs';
4
- import { MeshFilter, MeshRenderer, Instances, Layer, Visibility, Points, Lines, SortKey, projectMeshMaterialBindingObservation, buildCubeCameraFaceViews, hasVolumetricFogCapability, Camera, CAMERA_PROJECTION_ORTHOGRAPHIC, CUBE_CAMERA_FACE_ORDER } from './chunk-S5UE2T5P.mjs';
4
+ import { DEFAULT_DEPTH_OF_FIELD_PARAMS, MeshFilter, MeshRenderer, Instances, Layer, Visibility, Points, Lines, SortKey, projectMeshMaterialBindingObservation, resolveDepthOfFieldFrameParams, buildCubeCameraFaceViews, hasVolumetricFogCapability, packDepthOfFieldParams, Camera, CAMERA_PROJECTION_ORTHOGRAPHIC, CUBE_CAMERA_FACE_ORDER } from './chunk-GWCEMDVR.mjs';
5
5
  import { SpriteInstances, SpriteRegionOverride, TileLayer, decodeSortScope, Tilemap } from './chunk-PA5DRJNI.mjs';
6
- import { GPU_SCENE_LAYOUTS, deviceOptionsForAdapter, PipelineSpecError, assertStorageBufferCap, STANDARD_PBR_REQUIRED_SAMPLED_TEXTURES, GpuBuffer, GpuTexture, deriveRenderDataTexture, deriveRenderDataMesh, deriveRenderDataCubemap, createIblPipelines, CUBEMAP_FACE_VERTICES, runIblPrecompute, createClusterBinScratch, resetHdrpBuffers, retireTemporalGpuState, PostProcessError, entryHasDepthRead, DEPTH_MIN_PARAMS_BYTE_SIZE, postProcessShaderModuleLabel, resolveSsaoParameters, buildPerFrameBindGroups, resolveMaterialSkylight, postProcessShaderEntrySignature, selectSwapChainFormat, setIblComposedShaders, POINTS_LINES_MATERIAL_SHADER_ID, selectStandardPbrTransmissionPrewarmVariants, selectHdrpPbrPrewarmVariants, prewarmMaterialShaderVariants, selectProbePrewarmVariants, createHdrpClusterMembershipBindGroupLayoutDescriptor, createSkylightFallback, buildSpecConstTable, buildLinearLdrMaterialSpecTable, getOrBuildPipeline, cacheKeyOf, configureSurface, CAPTURE_VIEW_PROJS, PREFILTER_MIP_LEVELS, REFLECTION_PROBE_VIEW_SLOT_BASE, VIEW_UNIFORM_SLOT_STRIDE, getOrCreateIblCache, decideVisibility, BatchTopology, postProcessShaderPipelineLabel, createPointsLinesLaneAdapter, computeViewMatrix, computeProjectionMatrix, prepareFrameLighting, warnMultiSkylight, warnMultiSkybox, selectLazyEquirectHandle, driveLazyEquirectProjection, warnZeroLightStandard, writeShadowParamsBuffer, deriveRenderExtent, writeSpotModifierTextures, writeHdrpClusterAndSsaoBuffers, resolveSkyboxActive, computeSplitLdrSprite, writeViewUbo, writePointsLinesViewUbo, writeShadowCasterUniforms, uploadMeshSsboBatch, passKindPolicyTable, colorFormatsForPassKind, GPU_DRIVEN_VIEW_WGSL, selectGpuDrivenSceneIndexVariant, selectSkinPrewarmVariants, transmissionBackdropAvailable, VIEW_UNIFORM_BUFFER_SIZE, POINTS_LINES_VIEW_BUFFER_SIZE, SHADOW_CASTER_BUFFER_SIZE, FALLBACK_BYTES_PER_ROW, getIblProbeBackgroundSource, OcclusionConfidenceScheduler, shouldIssueRetest, selectGpuLodLane, ShadowViewStatePool, GpuDrivenView, MATERIAL_PER_ENTITY_STRIDE, shadowViewIdentityKey, createPointsLinesLaneContract, foldDispatchBuckets, CUBE_CAPTURE_VIEW_SLOT_BASE, variantSetFromDefines, resolveReflectionProbeBinding, cleanPerEntityCache, ensureMeshSsboCapacity, buildFoldDispatchPlan, evaluateFoldBucketUniformCap, incrementFoldedDrawsMetric, writePbrMaterialUboPayload, applyParamSnapshotToUbo, applyMaterialTextureUvScales, residentTextureView, detectNineSliceScaleTooSmall, PREFILTER_SIZE, gpuSceneFieldOffset, projectedHeightForCandidate, geometryRenderStateForTopology, packInstanceStorageBuffer, MESH_SSBO_BYTES, buildFullscreenPostProcessPass, getTemporalGpuState, getTemporalParamsBuffer, getTemporalBindGroupResources, TEMPORAL_HISTORY_FORMATS, resolveSurfaceFormatPair, resolveSurfaceProfile, createRenderPipelineTarget, encodeMainPass, STANDARD_PBR_UBO_SIZE, abortTemporalGpuSubmit, commitTemporalGpuSubmit, retireTemporalGpuStateAfterFence, hasPendingTemporalGpuSubmit, importRenderPipelineSurface, renderExtentSize, DEFERRED_COLOR_FORMATS, aggregateTemporalDemand, standardTemporalLaneAdmission, addTypedScenePass, addTypedSsaoPasses, addTypedSkyboxPass, createStandardSceneDataTarget, addStandardSceneDataPass, VIEW_UNIFORM_BYTES, addTypedFrameObservationPass, addReflectionFallbackObservationPass, selectLod, temporalReadIndex, temporalWriteIndex, prepareMaterialSkylight, BYTES_PER_DIRECT_LIGHT_SLOT, shadowViewRasterAccesses, encodeDirectionalShadowPass, encodePointShadowPass, encodeSpotShadowPass, getOrCreateFromChain, resolveOutputDither, addTypedTemporalResolvePass, addTypedBloomPasses, addTypedOutputTransformPass, addTypedFullscreenPass, addTypedCompositePostEffects, standardTopologyVariantSet, geometryRenderStateForPass, standardStorageVariantSet, getOrCreateHdrpBuffers, variantSetFromVertexLayoutProjection, createStandardSurfaceLightingBindGroup, isTemporalFullscreenBinding, createFullscreenBindGroup, applyParamSchemaDefaultsToUbo, defaultViewForUserRegionField, assembleMaterialWithSkylightEntries, TYPED_BLOOM_PASS_NAMES } from './chunk-PSEQ6QPH.mjs';
6
+ import { GPU_SCENE_LAYOUTS, deviceOptionsForAdapter, PipelineSpecError, assertStorageBufferCap, STANDARD_PBR_REQUIRED_SAMPLED_TEXTURES, GpuBuffer, GpuTexture, deriveRenderDataTexture, deriveRenderDataMesh, deriveRenderDataCubemap, createIblPipelines, CUBEMAP_FACE_VERTICES, runIblPrecompute, createClusterBinScratch, resetHdrpBuffers, retireTemporalGpuState, PostProcessError, entryHasDepthRead, DEPTH_MIN_PARAMS_BYTE_SIZE, postProcessShaderModuleLabel, resolveSsaoParameters, buildPerFrameBindGroups, resolveMaterialSkylight, postProcessShaderEntrySignature, selectSwapChainFormat, setIblComposedShaders, POINTS_LINES_MATERIAL_SHADER_ID, selectStandardPbrTransmissionPrewarmVariants, selectHdrpPbrPrewarmVariants, prewarmMaterialShaderVariants, selectProbePrewarmVariants, createHdrpClusterMembershipBindGroupLayoutDescriptor, createSkylightFallback, buildSpecConstTable, buildLinearLdrMaterialSpecTable, getOrBuildPipeline, cacheKeyOf, configureSurface, CAPTURE_VIEW_PROJS, PREFILTER_MIP_LEVELS, REFLECTION_PROBE_VIEW_SLOT_BASE, VIEW_UNIFORM_SLOT_STRIDE, getOrCreateIblCache, decideVisibility, BatchTopology, postProcessShaderPipelineLabel, createPointsLinesLaneAdapter, computeViewMatrix, computeProjectionMatrix, prepareFrameLighting, warnMultiSkylight, warnMultiSkybox, selectLazyEquirectHandle, driveLazyEquirectProjection, warnZeroLightStandard, writeShadowParamsBuffer, deriveRenderExtent, writeSpotModifierTextures, writeHdrpClusterAndSsaoBuffers, resolveSkyboxActive, computeSplitLdrSprite, writeViewUbo, writePointsLinesViewUbo, writeShadowCasterUniforms, uploadMeshSsboBatch, passKindPolicyTable, colorFormatsForPassKind, GPU_DRIVEN_VIEW_WGSL, selectGpuDrivenSceneIndexVariant, selectSkinPrewarmVariants, transmissionBackdropAvailable, VIEW_UNIFORM_BUFFER_SIZE, POINTS_LINES_VIEW_BUFFER_SIZE, SHADOW_CASTER_BUFFER_SIZE, FALLBACK_BYTES_PER_ROW, getIblProbeBackgroundSource, OcclusionConfidenceScheduler, shouldIssueRetest, selectGpuLodLane, ShadowViewStatePool, GpuDrivenView, MATERIAL_PER_ENTITY_STRIDE, shadowViewIdentityKey, createPointsLinesLaneContract, foldDispatchBuckets, CUBE_CAPTURE_VIEW_SLOT_BASE, variantSetFromDefines, resolveReflectionProbeBinding, cleanPerEntityCache, ensureMeshSsboCapacity, buildFoldDispatchPlan, evaluateFoldBucketUniformCap, incrementFoldedDrawsMetric, writePbrMaterialUboPayload, applyParamSnapshotToUbo, applyMaterialTextureUvScales, residentTextureView, detectNineSliceScaleTooSmall, PREFILTER_SIZE, gpuSceneFieldOffset, projectedHeightForCandidate, geometryRenderStateForTopology, packInstanceStorageBuffer, MESH_SSBO_BYTES, buildFullscreenPostProcessPass, getTemporalGpuState, getTemporalParamsBuffer, getTemporalBindGroupResources, TEMPORAL_HISTORY_FORMATS, resolveSurfaceFormatPair, resolveSurfaceProfile, createRenderPipelineTarget, encodeMainPass, STANDARD_PBR_UBO_SIZE, abortTemporalGpuSubmit, commitTemporalGpuSubmit, retireTemporalGpuStateAfterFence, hasPendingTemporalGpuSubmit, importRenderPipelineSurface, renderExtentSize, DEFERRED_COLOR_FORMATS, aggregateTemporalDemand, standardTemporalLaneAdmission, addTypedScenePass, addTypedSsaoPasses, addTypedSkyboxPass, createStandardSceneDataTarget, addStandardSceneDataPass, VIEW_UNIFORM_BYTES, addTypedFrameObservationPass, addReflectionFallbackObservationPass, selectLod, temporalReadIndex, temporalWriteIndex, prepareMaterialSkylight, BYTES_PER_DIRECT_LIGHT_SLOT, shadowViewRasterAccesses, encodeDirectionalShadowPass, encodePointShadowPass, encodeSpotShadowPass, getOrCreateFromChain, resolveOutputDither, addTypedTemporalResolvePass, addTypedBloomPasses, addTypedOutputTransformPass, addTypedFullscreenPass, addTypedCompositePostEffects, standardTopologyVariantSet, geometryRenderStateForPass, standardStorageVariantSet, getOrCreateHdrpBuffers, variantSetFromVertexLayoutProjection, createStandardSurfaceLightingBindGroup, isTemporalFullscreenBinding, createFullscreenBindGroup, applyParamSchemaDefaultsToUbo, defaultViewForUserRegionField, assembleMaterialWithSkylightEntries, TYPED_BLOOM_PASS_NAMES } from './chunk-JRIPCMYC.mjs';
7
7
  import { getTransparentSortConfig, TRANSPARENT_SORT_MODE_DISTANCE, TRANSPARENT_SORT_MODE_LAYER_Z, TRANSPARENT_SORT_MODE_LAYER_Y, TRANSPARENT_SORT_MODE_LAYER_YZ } from './chunk-RXZ3RGOU.mjs';
8
- import { DEFAULT_STANDARD_PROFILE, DEFAULT_CLUSTER_GRID, STANDARD_PIPELINE_ID, STANDARD_LIGHT_COUNTS, STANDARD_POST_STAGE_NAMES, createSceneDataCatalog, resolveVolumetricFogProfile, isSceneDataTarget } from './chunk-NO4WZCAH.mjs';
8
+ import { DEFAULT_STANDARD_PROFILE, DEFAULT_CLUSTER_GRID, STANDARD_PIPELINE_ID, STANDARD_LIGHT_COUNTS, STANDARD_POST_STAGE_NAMES, createSceneDataCatalog, resolveVolumetricFogProfile, isSceneDataTarget } from './chunk-S665NJNF.mjs';
9
9
  import { SPRITE_PREMULTIPLIED_ALPHA_BLEND } from './chunk-BLXGONR2.mjs';
10
- import { DeviceScope, SKIN_MATERIAL_SHADER_ID, EXTENDED_LIGHTING_TOPOLOGY, getTextureIdentity, GPU_BUFFER_USAGE_COPY_DST, GPU_BUFFER_USAGE_MAP_READ, resolveRenderTargetMaterialSource, createRenderTargetMaterialSource, deriveExtendedLightingCapability, GPU_BUFFER_USAGE_VERTEX, GPU_BUFFER_USAGE_INDEX, IES_SLICE_WIDTH, IES_SLICE_HEIGHT, COOKIE_SLICE_SIZE, COOKIE_MATRIX_BYTES, GPU_BUFFER_USAGE_UNIFORM, worldEntityKey, createHdrpBindGroupLayoutDescriptor, createHdrpSkinBindGroupLayoutDescriptor, GPU_BUFFER_USAGE_QUERY_RESOLVE, GPU_BUFFER_USAGE_COPY_SRC, gpuDrivenShadowDrawKey, makeZeroCameraFallbackSnapshot, buildPbrPipelineLayouts, buildPbrSkinLayouts, buildGpuDrivenPbrInstancesBindGroupLayout, buildGpuDrivenPbrPipelineLayout, buildGpuDrivenPbrSkinPipelineLayout, GPU_BUFFER_USAGE_STORAGE, resolvePipelineGroup2Contract, GPU_SHADER_STAGE_FRAGMENT, gpuDrivenDrawKey, gpuDrivenSourceDrawItemIndex, instanceCollectionCacheKey, validateGraphTargetCaptureReadback, createTemporalCoverage, isCanonicalStandardPbrMaterialShader, isStandardPbrMaterialShader, buildBindGroupLayoutDescriptor, gpuDrivenMaterialArtifactKey, buildPbrMaterialUserRegionEntries, extendedLightingSampledTextureCapacityAvailable, GPU_SHADER_STAGE_VERTEX, SPRITE_PASS_PER_INSTANCE_REGION_VARIANT_SET, SHADOW_CASTER_SHADER_ID, shadowCasterVariantSet, GPU_SHADER_STAGE_COMPUTE, LifecycleTransaction } from './chunk-FUUO4UND.mjs';
11
- import { RendererContractFailureError, RendererOperationError, STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, FrameReceiptStaleError, RenderFeatureStageFailedError, RenderFeatureCapabilityMissingError, RenderTargetStateInvalidError, RenderTargetOperationFailedError, RenderTargetCapabilityMissingError, RenderTargetDescriptorInvalidError, GPU_TEXTURE_USAGE_TEXTURE_BINDING, GPU_TEXTURE_USAGE_COPY_DST, RENDER_PHASE_CATALOG, InstanceCollectionStore, createAutoExposureInspection, RenderFeatureRegistrationConflictError, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING, GPU_TEXTURE_USAGE_COPY_SRC, createVisibilityBudget, EnvironmentGenerationFailedError, PointsLinesMaterialUnsupportedError, StandardProfileInvalidError, TransmissionCapabilityMissingError, SHADOW_ATLAS_DEFAULT_LAYERS, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT, GpuDrivenPreparationError, TemporalFrameSubmitError, ObservationUnavailableError, RenderFeaturePreparationFailedError, AutoExposureInvalidParameterError, PointsLinesPrepareFailedError, SHADOW_ATLAS_DEFAULT_FACE_SIZE, SceneDataUnavailableError, SkinPaletteOverflowError, GPU_TEXTURE_USAGE_STORAGE_BINDING, RenderFeatureDrawRecordingFailedError, PointShadowAtlasUninitializedError, RenderFeaturePreparedStateMismatchError, FXAA_POST_PROCESS_ID } from './chunk-JRBDO2KB.mjs';
10
+ import { DeviceScope, SKIN_MATERIAL_SHADER_ID, EXTENDED_LIGHTING_TOPOLOGY, getTextureIdentity, GPU_BUFFER_USAGE_COPY_DST, GPU_BUFFER_USAGE_MAP_READ, resolveRenderTargetMaterialSource, createRenderTargetMaterialSource, deriveExtendedLightingCapability, GPU_BUFFER_USAGE_VERTEX, GPU_BUFFER_USAGE_INDEX, IES_SLICE_WIDTH, IES_SLICE_HEIGHT, COOKIE_SLICE_SIZE, COOKIE_MATRIX_BYTES, GPU_BUFFER_USAGE_UNIFORM, worldEntityKey, createHdrpBindGroupLayoutDescriptor, createHdrpSkinBindGroupLayoutDescriptor, GPU_BUFFER_USAGE_QUERY_RESOLVE, GPU_BUFFER_USAGE_COPY_SRC, gpuDrivenShadowDrawKey, makeZeroCameraFallbackSnapshot, buildPbrPipelineLayouts, buildPbrSkinLayouts, buildGpuDrivenPbrInstancesBindGroupLayout, buildGpuDrivenPbrPipelineLayout, buildGpuDrivenPbrSkinPipelineLayout, GPU_BUFFER_USAGE_STORAGE, resolvePipelineGroup2Contract, GPU_SHADER_STAGE_FRAGMENT, gpuDrivenDrawKey, gpuDrivenSourceDrawItemIndex, instanceCollectionCacheKey, validateGraphTargetCaptureReadback, createTemporalCoverage, isCanonicalStandardPbrMaterialShader, isStandardPbrMaterialShader, buildBindGroupLayoutDescriptor, gpuDrivenMaterialArtifactKey, buildPbrMaterialUserRegionEntries, extendedLightingSampledTextureCapacityAvailable, GPU_SHADER_STAGE_VERTEX, SPRITE_PASS_PER_INSTANCE_REGION_VARIANT_SET, SHADOW_CASTER_SHADER_ID, shadowCasterVariantSet, GPU_SHADER_STAGE_COMPUTE, LifecycleTransaction } from './chunk-DRR7D3KX.mjs';
11
+ import { RendererContractFailureError, RendererOperationError, STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, FrameReceiptStaleError, RenderFeatureStageFailedError, RenderFeatureCapabilityMissingError, RenderTargetStateInvalidError, RenderTargetOperationFailedError, RenderTargetCapabilityMissingError, RenderTargetDescriptorInvalidError, GPU_TEXTURE_USAGE_TEXTURE_BINDING, GPU_TEXTURE_USAGE_COPY_DST, RENDER_PHASE_CATALOG, InstanceCollectionStore, createAutoExposureInspection, RenderFeatureRegistrationConflictError, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING, GPU_TEXTURE_USAGE_COPY_SRC, createVisibilityBudget, EnvironmentGenerationFailedError, PointsLinesMaterialUnsupportedError, StandardProfileInvalidError, TransmissionCapabilityMissingError, SHADOW_ATLAS_DEFAULT_LAYERS, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT, GpuDrivenPreparationError, TemporalFrameSubmitError, ObservationUnavailableError, RenderFeaturePreparationFailedError, AutoExposureInvalidParameterError, PointsLinesPrepareFailedError, SHADOW_ATLAS_DEFAULT_FACE_SIZE, SceneDataUnavailableError, SkinPaletteOverflowError, GPU_TEXTURE_USAGE_STORAGE_BINDING, RenderFeatureDrawRecordingFailedError, PointShadowAtlasUninitializedError, RenderFeaturePreparedStateMismatchError, FXAA_POST_PROCESS_ID } from './chunk-6TFBXLRJ.mjs';
12
12
  import { ok, err, RhiError, validateDrawArgs } from '@forgeax/engine-rhi';
13
13
  import { AssetRegistry, DynamicTextureStore, adaptDynamicTextureDevice, getOrCreateMipmapPipeline, prepareMipmaps, blitMipmapsSync, HANDLE_CUBE, HANDLE_TRIANGLE, HANDLE_QUAD, HANDLE_SPHERE, HANDLE_NINESLICE_QUAD, BuiltinAssetRegistry, resolveAssetHandle, numMipLevels, encodeMipmapLevel, resolveTilesetRuntime, MeshSsboCeilingReachedError, MeshSsboCapacityExceededError } from '@forgeax/engine-assets-runtime';
14
14
  import { audioLoader } from '@forgeax/engine-audio-webaudio';
@@ -294,10 +294,10 @@ function exposeRenderer(renderer) {
294
294
  cancelDynamicGeometry: (candidate) => renderer.cancelDynamicGeometry(candidate),
295
295
  retireDynamicGeometry: (candidate) => renderer.retireDynamicGeometry(candidate),
296
296
  createRenderTarget: (descriptor) => renderer.createRenderTarget(descriptor),
297
- resizeRenderTarget: (target4, descriptor) => renderer.resizeRenderTarget(target4, descriptor),
298
- createRenderTargetTextureSource: (target4, options) => renderer.createRenderTargetTextureSource(target4, options),
299
- requestTargetReadback: (target4, request) => renderer.requestTargetReadback(target4, request),
300
- destroyRenderTarget: (target4) => renderer.destroyRenderTarget(target4),
297
+ resizeRenderTarget: (target5, descriptor) => renderer.resizeRenderTarget(target5, descriptor),
298
+ createRenderTargetTextureSource: (target5, options) => renderer.createRenderTargetTextureSource(target5, options),
299
+ requestTargetReadback: (target5, request) => renderer.requestTargetReadback(target5, request),
300
+ destroyRenderTarget: (target5) => renderer.destroyRenderTarget(target5),
301
301
  setProfile: (profile) => {
302
302
  const state = lifecycle.state();
303
303
  if (!isRendererStateOperational(state)) {
@@ -2131,6 +2131,277 @@ var EngineMetricsImpl = class {
2131
2131
  function createEngineMetrics() {
2132
2132
  return new EngineMetricsImpl();
2133
2133
  }
2134
+ var DEPTH_OF_FIELD_COC_ID = "forgeax.dof.coc";
2135
+ var DEPTH_OF_FIELD_PREFILTER_ID = "forgeax.dof.prefilter";
2136
+ var DEPTH_OF_FIELD_PREFILTER_METADATA_ID = "forgeax.dof.prefilter.metadata";
2137
+ var DEPTH_OF_FIELD_GATHER_ID = "forgeax.dof.gather";
2138
+ var DEPTH_OF_FIELD_BACKGROUND_ID = "forgeax.dof.background";
2139
+ var DEPTH_OF_FIELD_COMPOSITE_ID = "forgeax.dof.composite";
2140
+ var DEPTH_OF_FIELD_POST_PROCESS_IDS = Object.freeze([
2141
+ DEPTH_OF_FIELD_COC_ID,
2142
+ DEPTH_OF_FIELD_PREFILTER_ID,
2143
+ DEPTH_OF_FIELD_PREFILTER_METADATA_ID,
2144
+ DEPTH_OF_FIELD_GATHER_ID,
2145
+ DEPTH_OF_FIELD_BACKGROUND_ID,
2146
+ DEPTH_OF_FIELD_COMPOSITE_ID
2147
+ ]);
2148
+ var DEPTH_OF_FIELD_MSAA_POST_PROCESS_IDS = Object.freeze(
2149
+ DEPTH_OF_FIELD_POST_PROCESS_IDS.map((id) => `${id}.msaa`)
2150
+ );
2151
+ function depthOfFieldPostProcessId(id, multisampled) {
2152
+ return multisampled ? `${id}.msaa` : id;
2153
+ }
2154
+ function depthOfFieldTopology(params) {
2155
+ if (params === void 0 || params.maxRadiusPixels <= 0) return void 0;
2156
+ return {
2157
+ blurSide: params.blurSide,
2158
+ useNear: params.blurSide === "near" || params.blurSide === "both",
2159
+ useFar: params.blurSide === "far" || params.blurSide === "both"
2160
+ };
2161
+ }
2162
+ function target(graph, label, descriptor) {
2163
+ return createRenderPipelineTarget(graph, label, descriptor);
2164
+ }
2165
+ function addPass(graph, options) {
2166
+ return addTypedFullscreenPass(graph, options);
2167
+ }
2168
+ function addDepthOfFieldPasses(context, input, depth, temporal) {
2169
+ const params = context.camera.depthOfField;
2170
+ const topology = depthOfFieldTopology(params);
2171
+ if (params === void 0 || topology === void 0) return ok$1(input);
2172
+ const multisampled = depth.sampleCount === 4;
2173
+ const graph = context.graph;
2174
+ const extentSize = context.extent === void 0 ? void 0 : renderExtentSize(context.extent, context.temporalTaa ? "output" : "internal");
2175
+ const fullSize = extentSize ?? "surface";
2176
+ const halfSize = extentSize === void 0 ? "half-surface" : {
2177
+ width: Math.max(1, Math.ceil(extentSize.width / 2)),
2178
+ height: Math.max(1, Math.ceil(extentSize.height / 2))
2179
+ };
2180
+ const coc = target(graph, "dof-coc", {
2181
+ format: "rgba16float",
2182
+ size: fullSize,
2183
+ domain: "linear-hdr"
2184
+ });
2185
+ if (!coc.ok) return coc;
2186
+ const cocPass = addPass(graph, {
2187
+ name: "dof-coc",
2188
+ shader: depthOfFieldPostProcessId(DEPTH_OF_FIELD_COC_ID, multisampled),
2189
+ fragmentEntryPoint: "fs_coc",
2190
+ input,
2191
+ depth,
2192
+ output: coc.value,
2193
+ additionalReads: [
2194
+ {
2195
+ key: "scene-temporal",
2196
+ // No-TAA DoF deliberately aliases this optional input to current color;
2197
+ // only the TAA route consumes the matching resolved temporal attachment.
2198
+ target: context.temporalTaa && temporal !== void 0 ? temporal : input
2199
+ }
2200
+ ]
2201
+ });
2202
+ if (!cocPass.ok) return cocPass;
2203
+ const near = topology.useNear ? target(graph, "dof-near", { format: "rgba16float", size: halfSize }) : void 0;
2204
+ if (near !== void 0 && !near.ok) return near;
2205
+ const far = topology.useFar ? target(graph, "dof-far", { format: "rgba16float", size: halfSize }) : void 0;
2206
+ if (far !== void 0 && !far.ok) return far;
2207
+ const background = topology.useNear ? target(graph, "dof-background", { format: "rgba16float", size: halfSize }) : void 0;
2208
+ if (background !== void 0 && !background.ok) return background;
2209
+ for (const side of ["near", "far"]) {
2210
+ const enabled = side === "near" ? topology.useNear : topology.useFar;
2211
+ if (!enabled) continue;
2212
+ const prefilter = target(graph, `dof-prefilter-${side}`, {
2213
+ format: "rgba16float",
2214
+ size: halfSize
2215
+ });
2216
+ if (!prefilter.ok) return prefilter;
2217
+ const blur = side === "near" ? near : far;
2218
+ if (blur === void 0 || !blur.ok) {
2219
+ return err$1(
2220
+ new RenderGraphError({
2221
+ code: "resource-resolution-failed",
2222
+ expected: `${side} DoF target is declared before its gather pass`,
2223
+ hint: "retain the last-known-good Standard graph and retry DoF admission",
2224
+ detail: { resourceLabel: `dof-${side}` }
2225
+ })
2226
+ );
2227
+ }
2228
+ const prefilterPass = addPass(graph, {
2229
+ name: `dof-prefilter-${side}`,
2230
+ shader: depthOfFieldPostProcessId(DEPTH_OF_FIELD_PREFILTER_ID, multisampled),
2231
+ fragmentEntryPoint: side === "near" ? "fs_prefilter_near" : "fs_prefilter_far",
2232
+ input,
2233
+ depth,
2234
+ output: prefilter.value,
2235
+ additionalReads: [{ key: "dof-coc", target: coc.value }]
2236
+ });
2237
+ if (!prefilterPass.ok) return prefilterPass;
2238
+ const prefilterMetadata = target(graph, `dof-prefilter-${side}-metadata`, {
2239
+ format: "rgba16float",
2240
+ size: halfSize
2241
+ });
2242
+ if (!prefilterMetadata.ok) return prefilterMetadata;
2243
+ const metadataPass = addPass(graph, {
2244
+ name: `dof-prefilter-${side}-metadata`,
2245
+ shader: depthOfFieldPostProcessId(DEPTH_OF_FIELD_PREFILTER_METADATA_ID, multisampled),
2246
+ fragmentEntryPoint: side === "near" ? "fs_prefilter_metadata_near" : "fs_prefilter_metadata_far",
2247
+ input,
2248
+ depth,
2249
+ output: prefilterMetadata.value,
2250
+ additionalReads: [
2251
+ {
2252
+ key: "scene-temporal",
2253
+ target: context.temporalTaa && temporal !== void 0 ? temporal : input
2254
+ },
2255
+ { key: "dof-coc", target: coc.value }
2256
+ ]
2257
+ });
2258
+ if (!metadataPass.ok) return metadataPass;
2259
+ const gatherPass = addPass(graph, {
2260
+ name: `dof-gather-${side}`,
2261
+ shader: depthOfFieldPostProcessId(DEPTH_OF_FIELD_GATHER_ID, multisampled),
2262
+ fragmentEntryPoint: side === "near" ? "fs_gather_near" : "fs_gather_far",
2263
+ input: prefilter.value,
2264
+ depth,
2265
+ output: blur.value,
2266
+ additionalReads: [
2267
+ {
2268
+ key: "scene-temporal",
2269
+ target: context.temporalTaa && temporal !== void 0 ? temporal : input
2270
+ },
2271
+ { key: "dof-coc", target: coc.value },
2272
+ { key: "dof-prefilter-metadata", target: prefilterMetadata.value }
2273
+ ]
2274
+ });
2275
+ if (!gatherPass.ok) return gatherPass;
2276
+ }
2277
+ if (background?.ok) {
2278
+ const backgroundPass = addPass(graph, {
2279
+ name: "dof-fill-background",
2280
+ shader: depthOfFieldPostProcessId(DEPTH_OF_FIELD_BACKGROUND_ID, multisampled),
2281
+ fragmentEntryPoint: "fs_background",
2282
+ input,
2283
+ depth,
2284
+ output: background.value,
2285
+ additionalReads: [
2286
+ {
2287
+ key: "scene-temporal",
2288
+ target: context.temporalTaa && temporal !== void 0 ? temporal : input
2289
+ },
2290
+ { key: "dof-coc", target: coc.value }
2291
+ ]
2292
+ });
2293
+ if (!backgroundPass.ok) return backgroundPass;
2294
+ }
2295
+ const composite = target(graph, "dof-composite", {
2296
+ format: input.format,
2297
+ size: fullSize,
2298
+ domain: input.domain
2299
+ });
2300
+ if (!composite.ok) return composite;
2301
+ const nearInput = near?.ok === true ? near.value : input;
2302
+ const farInput = far?.ok === true ? far.value : input;
2303
+ const backgroundInput = background?.ok === true ? background.value : input;
2304
+ const compositePass = addPass(graph, {
2305
+ name: "dof-composite",
2306
+ shader: depthOfFieldPostProcessId(DEPTH_OF_FIELD_COMPOSITE_ID, multisampled),
2307
+ fragmentEntryPoint: "fs_composite",
2308
+ input,
2309
+ depth,
2310
+ output: composite.value,
2311
+ additionalReads: [
2312
+ {
2313
+ key: "scene-temporal",
2314
+ // The composite shader always owns the temporal-depth slot. Without
2315
+ // TAA, the current input is the explicit alias for that slot.
2316
+ target: context.temporalTaa && temporal !== void 0 ? temporal : input
2317
+ },
2318
+ { key: "dof-coc", target: coc.value },
2319
+ // Disabled sides alias the original input so their resources and gathers
2320
+ // are absent while the fixed composite binding contract stays valid.
2321
+ { key: "dof-near", target: nearInput },
2322
+ { key: "dof-far", target: farInput },
2323
+ { key: "dof-background", target: backgroundInput }
2324
+ ]
2325
+ });
2326
+ if (!compositePass.ok) return compositePass;
2327
+ return ok$1(composite.value);
2328
+ }
2329
+ function depthOfFieldPassNames(topology) {
2330
+ const names = ["dof-coc"];
2331
+ if (topology.useNear)
2332
+ names.push(
2333
+ "dof-prefilter-near",
2334
+ "dof-prefilter-near-metadata",
2335
+ "dof-gather-near",
2336
+ "dof-fill-background"
2337
+ );
2338
+ if (topology.useFar)
2339
+ names.push("dof-prefilter-far", "dof-prefilter-far-metadata", "dof-gather-far");
2340
+ names.push("dof-composite");
2341
+ return Object.freeze(names);
2342
+ }
2343
+
2344
+ // src/features/depth-of-field/depth-of-field-assembly.ts
2345
+ function dofInspection(inspection) {
2346
+ return inspection === void 0 ? {} : { depthOfField: Object.freeze(inspection) };
2347
+ }
2348
+ var DEPTH_READ = { key: "scene-depth", sampleType: "depth" };
2349
+ var DEPTH_OF_FIELD_READS = {
2350
+ "forgeax.dof.coc": ["scene-color", "scene-temporal", DEPTH_READ],
2351
+ "forgeax.dof.prefilter": ["scene-color", "dof-coc", DEPTH_READ],
2352
+ "forgeax.dof.prefilter.metadata": ["scene-color", "scene-temporal", "dof-coc", DEPTH_READ],
2353
+ "forgeax.dof.gather": [
2354
+ "dof-prefilter",
2355
+ "scene-temporal",
2356
+ "dof-coc",
2357
+ "dof-prefilter-metadata",
2358
+ DEPTH_READ
2359
+ ],
2360
+ "forgeax.dof.background": ["scene-color", "scene-temporal", "dof-coc", DEPTH_READ],
2361
+ "forgeax.dof.composite": [
2362
+ "scene-color",
2363
+ "scene-temporal",
2364
+ "dof-coc",
2365
+ "dof-near",
2366
+ "dof-far",
2367
+ "dof-background",
2368
+ DEPTH_READ
2369
+ ]
2370
+ };
2371
+ function registerDepthOfFieldBuiltins(renderSystem, entries) {
2372
+ const register = (baseId, source, suffix) => {
2373
+ const id = `${baseId}${suffix}`;
2374
+ renderSystem.registerBuiltinPostProcess(id, {
2375
+ source,
2376
+ params: { byteSize: 64, defaultValue: new Uint8Array(64) },
2377
+ reads: DEPTH_OF_FIELD_READS[baseId]
2378
+ });
2379
+ };
2380
+ if (entries.singleSample !== void 0) {
2381
+ for (const id of DEPTH_OF_FIELD_POST_PROCESS_IDS) register(id, entries.singleSample, "");
2382
+ }
2383
+ if (entries.multisampled !== void 0) {
2384
+ for (const id of DEPTH_OF_FIELD_POST_PROCESS_IDS) register(id, entries.multisampled, ".msaa");
2385
+ }
2386
+ }
2387
+ async function prewarmDepthOfField(manifestEntries, prewarm, register) {
2388
+ let singleSample;
2389
+ let multisampled;
2390
+ for (const entry of manifestEntries) {
2391
+ if (!entry.wgsl.includes("DepthOfFieldParams")) continue;
2392
+ if (entry.wgsl.includes("texture_depth_multisampled_2d")) {
2393
+ multisampled ??= entry;
2394
+ } else {
2395
+ singleSample ??= entry;
2396
+ }
2397
+ }
2398
+ for (const id of DEPTH_OF_FIELD_POST_PROCESS_IDS) await prewarm(singleSample, id);
2399
+ for (const id of DEPTH_OF_FIELD_POST_PROCESS_IDS) await prewarm(multisampled, `${id}.msaa`);
2400
+ register({
2401
+ ...singleSample === void 0 ? {} : { singleSample: singleSample.wgsl },
2402
+ ...multisampled === void 0 ? {} : { multisampled: multisampled.wgsl }
2403
+ });
2404
+ }
2134
2405
  function stageFailure(identity) {
2135
2406
  return {
2136
2407
  code: "render-feature-stage-failed",
@@ -2464,7 +2735,7 @@ function validPositiveInteger(value) {
2464
2735
  }
2465
2736
  function freezeRenderFeaturePlan(identity, plan, logicalTargets2 = []) {
2466
2737
  const resources = /* @__PURE__ */ new Map();
2467
- const targets = /* @__PURE__ */ new Set(["swapchain", ...logicalTargets2.map((target4) => target4.name)]);
2738
+ const targets = /* @__PURE__ */ new Set(["swapchain", ...logicalTargets2.map((target5) => target5.name)]);
2468
2739
  for (const resource of plan.resources) {
2469
2740
  if (!validName(resource.name) || resources.has(resource.name))
2470
2741
  return err$1(stageFailure(identity));
@@ -2513,7 +2784,7 @@ function freezeRenderFeaturePlan(identity, plan, logicalTargets2 = []) {
2513
2784
  continue;
2514
2785
  }
2515
2786
  if (pass.draws.length === 0 || pass.kind === "raster" && (pass.colorAttachments.some((attachment) => !targets.has(attachment.target)) || pass.depthStencilAttachment !== void 0 && !targets.has(pass.depthStencilAttachment.target) || pass.sampledTargets?.some(
2516
- (target4) => typeof target4 === "string" && !targets.has(target4)
2787
+ (target5) => typeof target5 === "string" && !targets.has(target5)
2517
2788
  ) === true)) {
2518
2789
  return err$1(stageFailure(identity));
2519
2790
  }
@@ -3186,11 +3457,11 @@ function recordFailure(slot, stage, failure5, errors) {
3186
3457
  }
3187
3458
  function logicalTargets(targets) {
3188
3459
  return Object.freeze(
3189
- targets.map((target4) => ({
3190
- name: target4.name ?? (target4.kind === "scene-color" ? "color" : "depth"),
3191
- kind: target4.kind === "scene-color" ? "color" : "depth",
3192
- format: target4.format,
3193
- sampleCount: target4.sampleCount
3460
+ targets.map((target5) => ({
3461
+ name: target5.name ?? (target5.kind === "scene-color" ? "color" : "depth"),
3462
+ kind: target5.kind === "scene-color" ? "color" : "depth",
3463
+ format: target5.format,
3464
+ sampleCount: target5.sampleCount
3194
3465
  }))
3195
3466
  );
3196
3467
  }
@@ -3201,12 +3472,12 @@ function targetHandle(name, targets) {
3201
3472
  if (name === "swapchain") return "swapchain";
3202
3473
  if (typeof name !== "string") return name;
3203
3474
  return targets.find(
3204
- (target4) => target4.name === name || target4.name === void 0 && (name === "color" && target4.kind === "scene-color" || name === "depth" && target4.kind === "scene-depth")
3475
+ (target5) => target5.name === name || target5.name === void 0 && (name === "color" && target5.kind === "scene-color" || name === "depth" && target5.kind === "scene-depth")
3205
3476
  );
3206
3477
  }
3207
3478
  function targetFormat(name, targets, fallback) {
3208
- const target4 = targets.find((candidate) => candidate.name === name);
3209
- return target4?.format ?? fallback;
3479
+ const target5 = targets.find((candidate) => candidate.name === name);
3480
+ return target5?.format ?? fallback;
3210
3481
  }
3211
3482
  function preparePlanResources(slot, plan, graphics, gpu, targets) {
3212
3483
  const computePrograms = /* @__PURE__ */ new Map();
@@ -3304,9 +3575,9 @@ function preparePlanResources(slot, plan, graphics, gpu, targets) {
3304
3575
  if (program === void 0) return err$1(planFailure(slot));
3305
3576
  const values = { ...resource.values };
3306
3577
  for (const [key, targetName] of Object.entries(resource.logicalTargets ?? {})) {
3307
- const target4 = targetHandle(targetName, targets);
3308
- if (target4 === void 0 || typeof target4 === "string") return err$1(planFailure(slot));
3309
- values[key] = target4;
3578
+ const target5 = targetHandle(targetName, targets);
3579
+ if (target5 === void 0 || typeof target5 === "string") return err$1(planFailure(slot));
3580
+ values[key] = target5;
3310
3581
  }
3311
3582
  const prepared = graphics.prepareBindings(resource.name, { pipeline: program, values });
3312
3583
  if (!prepared.ok) return prepared;
@@ -3503,7 +3774,7 @@ function projectPlanPasses(slot, plan, prepared, gpu, targets, validateGraphics,
3503
3774
  );
3504
3775
  if (colors.some(
3505
3776
  (attachment) => attachment.resource === void 0 || attachment.format === void 0
3506
- ) || depth !== void 0 && (depth.resource === void 0 || depth.format === void 0) || sampledTargets.some((target4) => target4 === void 0 || typeof target4 === "string")) {
3777
+ ) || depth !== void 0 && (depth.resource === void 0 || depth.format === void 0) || sampledTargets.some((target5) => target5 === void 0 || typeof target5 === "string")) {
3507
3778
  return err$1(planFailure(slot));
3508
3779
  }
3509
3780
  const attachments = depth === void 0 ? { colors } : {
@@ -4017,7 +4288,7 @@ function runRenderFeatureFrame(host, input) {
4017
4288
  submissionSensitivePlans.add(plannedFrame);
4018
4289
  submissionAcknowledgments.set(
4019
4290
  plannedFrame,
4020
- () => feature.onFrameSubmitted?.(extracted.value)
4291
+ () => feature.onFrameSubmitted?.(extracted.value, projected.value)
4021
4292
  );
4022
4293
  }
4023
4294
  plans.push(plannedFrame);
@@ -4318,22 +4589,22 @@ function addAtmosphereIbl(graph, sky, vertices, dirty) {
4318
4589
  for (const product of ["irradiance", "prefilter"]) {
4319
4590
  for (let mip = 0; mip < (product === "irradiance" ? 1 : 5); mip++)
4320
4591
  for (let face = 0; face < 6; face++) {
4321
- const target4 = graph.view(product === "irradiance" ? irradiance.value : prefilter.value, {
4592
+ const target5 = graph.view(product === "irradiance" ? irradiance.value : prefilter.value, {
4322
4593
  dimension: "2d",
4323
4594
  baseArrayLayer: face,
4324
4595
  arrayLayerCount: 1,
4325
4596
  baseMipLevel: mip,
4326
4597
  mipLevelCount: 1
4327
4598
  });
4328
- if (!target4.ok) return target4;
4599
+ if (!target5.ok) return target5;
4329
4600
  const pass = graph.addRasterPass(`atmosphere-${product}-${mip}-${face}`, {
4330
4601
  accesses: [
4331
4602
  { resource: sky, usage: "sampled-read" },
4332
4603
  { resource: parameters.value, usage: "uniform-read" },
4333
4604
  { resource: vertices, usage: "vertex-read" },
4334
- { resource: target4.value, usage: "color-attachment" }
4605
+ { resource: target5.value, usage: "color-attachment" }
4335
4606
  ],
4336
- colorAttachments: [{ view: target4.value, loadOp: "clear", storeOp: "store" }],
4607
+ colorAttachments: [{ view: target5.value, loadOp: "clear", storeOp: "store" }],
4337
4608
  executeIf: dirty,
4338
4609
  encode: ({ frame, resources, pass: pass2 }) => {
4339
4610
  const current = ensureState(frame);
@@ -4797,7 +5068,7 @@ function resolvedBuffer(resources, buffer) {
4797
5068
  if (!resolved2.ok) throw resolved2.error;
4798
5069
  return resolved2.value;
4799
5070
  }
4800
- function addPass(graph, name, accesses, encode = () => void 0) {
5071
+ function addPass2(graph, name, accesses, encode = () => void 0) {
4801
5072
  return graph.addComputePass(name, { accesses, encode });
4802
5073
  }
4803
5074
  function addSsrSpatialPasses(graph, input) {
@@ -5008,7 +5279,7 @@ function addSsrSpatialPasses(graph, input) {
5008
5279
  }
5009
5280
  ]
5010
5281
  };
5011
- let added = addPass(
5282
+ let added = addPass2(
5012
5283
  graph,
5013
5284
  "ssr-hiz-seed",
5014
5285
  [
@@ -5048,7 +5319,7 @@ function addSsrSpatialPasses(graph, input) {
5048
5319
  if (added.ok) passNames.push("ssr-hiz-seed");
5049
5320
  if (!added.ok) return added;
5050
5321
  if (hiz.levels.length > 1) {
5051
- added = addPass(
5322
+ added = addPass2(
5052
5323
  graph,
5053
5324
  "ssr-hiz-reduce-chain",
5054
5325
  hiz.levels.map((resource, level) => ({
@@ -5068,9 +5339,9 @@ function addSsrSpatialPasses(graph, input) {
5068
5339
  pass.setPipeline(hizReduceState.pipeline);
5069
5340
  for (let level = 1; level < hiz.levels.length; level++) {
5070
5341
  const source = hiz.levels[level - 1];
5071
- const target4 = hiz.levels[level];
5342
+ const target5 = hiz.levels[level];
5072
5343
  const extent = hiz.plan.levels[level];
5073
- if (source === void 0 || target4 === void 0 || extent === void 0)
5344
+ if (source === void 0 || target5 === void 0 || extent === void 0)
5074
5345
  throw pipelineError("Hi-Z mip chain");
5075
5346
  pass.setBindGroup(
5076
5347
  0,
@@ -5081,7 +5352,7 @@ function addSsrSpatialPasses(graph, input) {
5081
5352
  },
5082
5353
  {
5083
5354
  binding: 1,
5084
- resource: { kind: "textureView", value: resolvedView(resolver, target4) }
5355
+ resource: { kind: "textureView", value: resolvedView(resolver, target5) }
5085
5356
  }
5086
5357
  ])
5087
5358
  );
@@ -5092,7 +5363,7 @@ function addSsrSpatialPasses(graph, input) {
5092
5363
  if (!added.ok) return added;
5093
5364
  passNames.push("ssr-hiz-reduce-chain");
5094
5365
  }
5095
- added = addPass(
5366
+ added = addPass2(
5096
5367
  graph,
5097
5368
  "ssr-trace",
5098
5369
  [
@@ -5149,7 +5420,7 @@ function addSsrSpatialPasses(graph, input) {
5149
5420
  if (!added.ok) return added;
5150
5421
  passNames.push("ssr-trace");
5151
5422
  if (temporal !== void 0) {
5152
- added = addPass(
5423
+ added = addPass2(
5153
5424
  graph,
5154
5425
  "ssr-temporal",
5155
5426
  [
@@ -5263,7 +5534,7 @@ function addSsrSpatialPasses(graph, input) {
5263
5534
  if (reflectionLevels.length > 1 && resolved2 !== void 0) {
5264
5535
  const output = resolved2;
5265
5536
  const name = "ssr-reflection-mip-chain";
5266
- const added2 = addPass(
5537
+ const added2 = addPass2(
5267
5538
  graph,
5268
5539
  name,
5269
5540
  reflectionLevels.map((resource, level) => ({
@@ -5294,8 +5565,8 @@ function addSsrSpatialPasses(graph, input) {
5294
5565
  pass.setPipeline(reflectionMipState.pipeline);
5295
5566
  for (let level = 1; level < reflectionLevels.length; level++) {
5296
5567
  const previous = reflectionLevels[level - 1];
5297
- const target4 = reflectionLevels[level];
5298
- if (previous === void 0 || target4 === void 0)
5568
+ const target5 = reflectionLevels[level];
5569
+ if (previous === void 0 || target5 === void 0)
5299
5570
  throw pipelineError("reflection mip chain");
5300
5571
  pass.setBindGroup(
5301
5572
  0,
@@ -5311,7 +5582,7 @@ function addSsrSpatialPasses(graph, input) {
5311
5582
  binding: 7,
5312
5583
  resource: {
5313
5584
  kind: "textureView",
5314
- value: resolvedView(resolver, target4)
5585
+ value: resolvedView(resolver, target5)
5315
5586
  }
5316
5587
  }
5317
5588
  ])
@@ -5367,12 +5638,12 @@ function createTargetCoverageAttachment(graph, extent) {
5367
5638
  outputHeight: extent.outputHeight
5368
5639
  });
5369
5640
  }
5370
- function addTargetCoveragePass(graph, target4) {
5641
+ function addTargetCoveragePass(graph, target5) {
5371
5642
  return addTypedScenePass(graph, {
5372
5643
  name: "standard-scene-coverage",
5373
- color: target4.coverage,
5374
- colorTargets: [target4.coverage],
5375
- depth: target4.depth,
5644
+ color: target5.coverage,
5645
+ colorTargets: [target5.coverage],
5646
+ depth: target5.depth,
5376
5647
  selector: { LightMode: ["Deferred", "Forward"] },
5377
5648
  passKind: "temporal",
5378
5649
  clearColor: [0, 0, 0, 0],
@@ -5619,12 +5890,12 @@ function addTransmissionBackdropPasses(input) {
5619
5890
  ],
5620
5891
  encode: ({ encoder, resources }) => {
5621
5892
  const source = resources.texture(input.source.texture);
5622
- const target4 = resources.texture(backdrop.value.texture);
5893
+ const target5 = resources.texture(backdrop.value.texture);
5623
5894
  if (!source.ok) throw source.error;
5624
- if (!target4.ok) throw target4.error;
5895
+ if (!target5.ok) throw target5.error;
5625
5896
  encoder.copyTextureToTexture(
5626
5897
  { texture: source.value, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } },
5627
- { texture: target4.value, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } },
5898
+ { texture: target5.value, mipLevel: 0, origin: { x: 0, y: 0, z: 0 } },
5628
5899
  { ...input.copySize, depthOrArrayLayers: 1 }
5629
5900
  );
5630
5901
  }
@@ -5726,12 +5997,12 @@ function shadowViewCacheReuse(frame, identity) {
5726
5997
  const key = `${identity.kind}:${identity.index}:${identity.face ?? ""}`;
5727
5998
  return state.shadowViewCacheReuse?.get(key) === true;
5728
5999
  }
5729
- function recordShadowPass(graph, name, target4, loadOp, encode, executeIf, extraAccesses = []) {
6000
+ function recordShadowPass(graph, name, target5, loadOp, encode, executeIf, extraAccesses = []) {
5730
6001
  return graph.addRasterPass(name, {
5731
- accesses: [{ resource: target4.view, usage: "depth-stencil-write" }, ...extraAccesses],
6002
+ accesses: [{ resource: target5.view, usage: "depth-stencil-write" }, ...extraAccesses],
5732
6003
  colorAttachments: [],
5733
6004
  depthStencilAttachment: {
5734
- view: target4.view,
6005
+ view: target5.view,
5735
6006
  depthLoadOp: loadOp,
5736
6007
  depthStoreOp: "store",
5737
6008
  ...loadOp === "clear" ? { depthClearValue: 1 } : {}
@@ -5747,15 +6018,15 @@ function addTypedShadowPasses(graph, topology, projectGpuDrivenShadowOrFeatures,
5747
6018
  if (topology.shadow.directional !== "disabled") {
5748
6019
  const { mapSize, cascadeCount } = topology.shadow.directional;
5749
6020
  const atlasGrid = resolveDirectionalShadowAtlasGrid(cascadeCount);
5750
- const target4 = createRenderPipelineTarget(graph, "directional-shadow-depth", {
6021
+ const target5 = createRenderPipelineTarget(graph, "directional-shadow-depth", {
5751
6022
  format: "depth32float",
5752
6023
  size: {
5753
6024
  width: mapSize * atlasGrid.columns,
5754
6025
  height: mapSize * atlasGrid.rows
5755
6026
  }
5756
6027
  });
5757
- if (!target4.ok) return target4;
5758
- const directionalTarget = target4.value;
6028
+ if (!target5.ok) return target5;
6029
+ const directionalTarget = target5.value;
5759
6030
  directional = directionalTarget;
5760
6031
  for (let cascade = 0; cascade < cascadeCount; cascade += 1) {
5761
6032
  const col = cascade % atlasGrid.columns;
@@ -7153,6 +7424,7 @@ function requestedStages(input) {
7153
7424
  const stages = [];
7154
7425
  if (input.temporal) stages.push("temporal");
7155
7426
  if (input.meter) stages.push("meter");
7427
+ if (input.dof === true) stages.push("dof");
7156
7428
  if (input.bloom) stages.push("bloom");
7157
7429
  if (input.exposure || input.whiteBalance) stages.push("exposure-white-balance");
7158
7430
  stages.push("tone");
@@ -7167,6 +7439,7 @@ function physicalStages(logicalStages) {
7167
7439
  case "temporal":
7168
7440
  case "meter":
7169
7441
  case "bloom":
7442
+ case "dof":
7170
7443
  case "exposure-white-balance":
7171
7444
  return { name, input: LINEAR_HDR_DOMAIN, output: LINEAR_HDR_DOMAIN };
7172
7445
  case "tone":
@@ -7191,6 +7464,7 @@ function createStandardOutputPlan(input) {
7191
7464
  temporal: input.temporal,
7192
7465
  meter: input.meter,
7193
7466
  bloom: input.bloom,
7467
+ dof: input.dof === true,
7194
7468
  exposure: input.exposure,
7195
7469
  whiteBalance: input.whiteBalance,
7196
7470
  lut: input.lut,
@@ -7610,13 +7884,13 @@ function inspectStandardBloomGraph(graph) {
7610
7884
  status: "valid",
7611
7885
  targetCount: targets.length,
7612
7886
  targetBytes: targets.reduce(
7613
- (bytes2, target4) => bytes2 + textureBytes(target4.resource, target4.expected),
7887
+ (bytes2, target5) => bytes2 + textureBytes(target5.resource, target5.expected),
7614
7888
  0
7615
7889
  ),
7616
7890
  passCount: passes.length
7617
7891
  };
7618
7892
  }
7619
- function target(context, label, descriptor) {
7893
+ function target2(context, label, descriptor) {
7620
7894
  return createRenderPipelineTarget(context.graph, label, descriptor);
7621
7895
  }
7622
7896
  function missingTemporalContributor(topology, contributorId) {
@@ -7637,6 +7911,7 @@ function addStandardPost(context, topology, scene, depth, surface, sceneTemporal
7637
7911
  temporal: !clearOnly && topology.camera.antialias === "taa",
7638
7912
  meter: topology.output?.autoExposure === true,
7639
7913
  bloom: !clearOnly && topology.camera.bloom === "on" && topology.camera.tonemap !== "none",
7914
+ dof: !clearOnly && topology.camera.depthOfField !== void 0,
7640
7915
  exposure: topology.output?.autoExposure === true,
7641
7916
  whiteBalance: topology.output?.whiteBalance === true,
7642
7917
  lut: topology.output?.colorLut === true,
@@ -7651,7 +7926,7 @@ function addStandardPost(context, topology, scene, depth, surface, sceneTemporal
7651
7926
  const outputDither = resolveOutputDither(topology.config);
7652
7927
  const motionBlur = !clearOnly && topology.temporal?.motionBlur === true;
7653
7928
  const postEffects = clearOnly ? [] : topology.config?.postEffects ?? [];
7654
- const rawOnlyPostInput = rawOnly && topology.lane.storageBuffer && postEffects.length > 0 ? target(context, "standard-post-effects-input", {
7929
+ const rawOnlyPostInput = rawOnly && topology.lane.storageBuffer && postEffects.length > 0 ? target2(context, "standard-post-effects-input", {
7655
7930
  format: "rgba16float",
7656
7931
  size: "surface",
7657
7932
  usage: GPU_TEXTURE_USAGE_COPY_SRC,
@@ -7722,7 +7997,7 @@ function addStandardPost(context, topology, scene, depth, surface, sceneTemporal
7722
7997
  new Error("Motion Blur requires the Standard scene-data producer")
7723
7998
  );
7724
7999
  }
7725
- const blurred = target(context, "motion-blurred-color", {
8000
+ const blurred = target2(context, "motion-blurred-color", {
7726
8001
  format: "rgba16float",
7727
8002
  size: "surface",
7728
8003
  domain: hdr ? "linear-hdr" : "linear-ldr"
@@ -7757,26 +8032,42 @@ function addStandardPost(context, topology, scene, depth, surface, sceneTemporal
7757
8032
  });
7758
8033
  if (!added.ok) return added;
7759
8034
  }
8035
+ if (outputPlan.features.dof) {
8036
+ const dof = addDepthOfFieldPasses(
8037
+ {
8038
+ graph: context.graph,
8039
+ camera: context.camera ?? {},
8040
+ temporalTaa: topology.temporal?.taa === true,
8041
+ msaaActive: depth.sampleCount === 4,
8042
+ ...topology.extent === void 0 ? {} : { extent: topology.extent }
8043
+ },
8044
+ postInput,
8045
+ depth,
8046
+ topology.temporal?.taa === true ? postTemporal : void 0
8047
+ );
8048
+ if (!dof.ok) return dof;
8049
+ postInput = dof.value;
8050
+ }
7760
8051
  if (bloomActive) {
7761
- const composited = target(
8052
+ const composited = target2(
7762
8053
  context,
7763
8054
  STANDARD_BLOOM_TARGET_SPEC.composited.label,
7764
8055
  STANDARD_BLOOM_TARGET_SPEC.composited
7765
8056
  );
7766
8057
  if (!composited.ok) return composited;
7767
- const bright = target(
8058
+ const bright = target2(
7768
8059
  context,
7769
8060
  STANDARD_BLOOM_TARGET_SPEC.bright.label,
7770
8061
  STANDARD_BLOOM_TARGET_SPEC.bright
7771
8062
  );
7772
8063
  if (!bright.ok) return bright;
7773
- const blurH = target(
8064
+ const blurH = target2(
7774
8065
  context,
7775
8066
  STANDARD_BLOOM_TARGET_SPEC.blurH.label,
7776
8067
  STANDARD_BLOOM_TARGET_SPEC.blurH
7777
8068
  );
7778
8069
  if (!blurH.ok) return blurH;
7779
- const blurV = target(
8070
+ const blurV = target2(
7780
8071
  context,
7781
8072
  STANDARD_BLOOM_TARGET_SPEC.blurV.label,
7782
8073
  STANDARD_BLOOM_TARGET_SPEC.blurV
@@ -7793,7 +8084,7 @@ function addStandardPost(context, topology, scene, depth, surface, sceneTemporal
7793
8084
  postInput = composited.value;
7794
8085
  }
7795
8086
  if (outputPlan.features.exposure || outputPlan.features.whiteBalance) {
7796
- const exposureOutput = target(context, "standard-exposure-white-balance", {
8087
+ const exposureOutput = target2(context, "standard-exposure-white-balance", {
7797
8088
  format: "rgba16float",
7798
8089
  size: "surface",
7799
8090
  domain: "linear-hdr"
@@ -7818,7 +8109,7 @@ function addStandardPost(context, topology, scene, depth, surface, sceneTemporal
7818
8109
  // that the LUT and auto-exposure routes already use so the graph can
7819
8110
  // capture it without changing unobserved frames.
7820
8111
  context.observationCaptureDomains?.includes("linear-ldr") === true;
7821
- const toneOutput = splitOutput ? target(context, "standard-tone-output", {
8112
+ const toneOutput = splitOutput ? target2(context, "standard-tone-output", {
7822
8113
  format: "rgba16float",
7823
8114
  size: "surface",
7824
8115
  domain: "linear-ldr"
@@ -7845,7 +8136,7 @@ function addStandardPost(context, topology, scene, depth, surface, sceneTemporal
7845
8136
  })
7846
8137
  );
7847
8138
  }
7848
- const lutOutput = target(context, "standard-color-lut", {
8139
+ const lutOutput = target2(context, "standard-color-lut", {
7849
8140
  format: "rgba16float",
7850
8141
  size: "surface",
7851
8142
  domain: "linear-ldr"
@@ -7861,11 +8152,11 @@ function addStandardPost(context, topology, scene, depth, surface, sceneTemporal
7861
8152
  }
7862
8153
  if (hdr || linearLdr || fxaa || rawOnly || motionBlur) {
7863
8154
  if (fxaa) {
7864
- const output = splitOutput ? target(context, "standard-fxaa-output", {
8155
+ const output = splitOutput ? target2(context, "standard-fxaa-output", {
7865
8156
  format: "rgba16float",
7866
8157
  size: "surface",
7867
8158
  domain: "linear-ldr"
7868
- }) : target(context, "standard-output-color", {
8159
+ }) : target2(context, "standard-output-color", {
7869
8160
  format: "rgba16float",
7870
8161
  size: "surface",
7871
8162
  usage: GPU_TEXTURE_USAGE_COPY_SRC,
@@ -7955,7 +8246,7 @@ function addStandardPost(context, topology, scene, depth, surface, sceneTemporal
7955
8246
  }
7956
8247
 
7957
8248
  // src/pipeline/standard-forward-lane.ts
7958
- function target2(graph, label, descriptor) {
8249
+ function target3(graph, label, descriptor) {
7959
8250
  return createRenderPipelineTarget(graph, label, descriptor);
7960
8251
  }
7961
8252
  function buildUrp(context, topology, lighting) {
@@ -7976,31 +8267,31 @@ function buildUrp(context, topology, lighting) {
7976
8267
  });
7977
8268
  const needsTemporalIntermediate = temporalDemand.targetCount === 1;
7978
8269
  const sceneFormat = hdr || linearLdr || rawOnly || needsTemporalIntermediate ? "rgba16float" : topology.surface.storageFormat;
7979
- const depth = target2(graph, "scene-depth", {
8270
+ const depth = target3(graph, "scene-depth", {
7980
8271
  format: "depth24plus-stencil8",
7981
8272
  size: internalSize,
7982
8273
  sampleCount: msaa ? 4 : 1
7983
8274
  });
7984
8275
  if (!depth.ok) return depth;
7985
- const sceneResolved = clearOnly ? surface.value.display === void 0 ? target2(graph, "scene-color", {
8276
+ const sceneResolved = clearOnly ? surface.value.display === void 0 ? target3(graph, "scene-color", {
7986
8277
  format: topology.surface.storageFormat,
7987
8278
  size: "surface",
7988
8279
  sampleCount: 1,
7989
8280
  domain: "display-encoded"
7990
- }) : ok$1(surface.value.display) : hdr || fxaa || linearLdr || msaa || rawOnly || needsTemporalIntermediate ? target2(graph, "scene-color", {
8281
+ }) : ok$1(surface.value.display) : hdr || fxaa || linearLdr || msaa || rawOnly || needsTemporalIntermediate ? target3(graph, "scene-color", {
7991
8282
  format: sceneFormat,
7992
8283
  size: internalSize,
7993
8284
  sampleCount: 1,
7994
8285
  domain: "linear-ldr",
7995
8286
  ...sceneFormat === topology.surface.storageFormat && topology.surface.storageFormat !== topology.surface.viewFormat ? { viewFormats: [topology.surface.viewFormat] } : {}
7996
- }) : surface.value.display === void 0 ? target2(graph, "scene-color", {
8287
+ }) : surface.value.display === void 0 ? target3(graph, "scene-color", {
7997
8288
  format: topology.surface.storageFormat,
7998
8289
  size: "surface",
7999
8290
  sampleCount: 1,
8000
8291
  domain: "display-encoded"
8001
8292
  }) : ok$1(surface.value.display);
8002
8293
  if (!sceneResolved.ok) return sceneResolved;
8003
- const scene = msaa ? target2(graph, "scene-color-msaa", {
8294
+ const scene = msaa ? target3(graph, "scene-color-msaa", {
8004
8295
  format: sceneFormat,
8005
8296
  size: internalSize,
8006
8297
  sampleCount: 4,
@@ -8008,7 +8299,7 @@ function buildUrp(context, topology, lighting) {
8008
8299
  ...sceneFormat === topology.surface.storageFormat && topology.surface.storageFormat !== topology.surface.viewFormat ? { viewFormats: [topology.surface.viewFormat] } : {}
8009
8300
  }) : sceneResolved;
8010
8301
  if (!scene.ok) return scene;
8011
- const reflectionFallback = topology.reflectionFallback?.enabled ? target2(graph, "reflection-fallback-linear-hdr", {
8302
+ const reflectionFallback = topology.reflectionFallback?.enabled ? target3(graph, "reflection-fallback-linear-hdr", {
8012
8303
  format: "rgba16float",
8013
8304
  size: internalSize,
8014
8305
  sampleCount: scene.value.sampleCount,
@@ -8221,7 +8512,7 @@ function buildUrp(context, topology, lighting) {
8221
8512
  [
8222
8513
  ...clusterReads,
8223
8514
  ...[shadows.value.directional, shadows.value.spot, shadows.value.point].flatMap(
8224
- (target4) => target4 === void 0 ? [] : [{ resource: target4.view, usage: "sampled-read" }]
8515
+ (target5) => target5 === void 0 ? [] : [{ resource: target5.view, usage: "sampled-read" }]
8225
8516
  )
8226
8517
  ]
8227
8518
  );
@@ -8380,7 +8671,7 @@ function validateClusterGrid(grid) {
8380
8671
  )
8381
8672
  );
8382
8673
  }
8383
- function target3(graph, label, descriptor) {
8674
+ function target4(graph, label, descriptor) {
8384
8675
  return createRenderPipelineTarget(graph, label, descriptor);
8385
8676
  }
8386
8677
  function buildStandardDeferredLane(context, topology, lighting) {
@@ -8401,7 +8692,7 @@ function buildStandardDeferredLane(context, topology, lighting) {
8401
8692
  featureShadows?.value
8402
8693
  );
8403
8694
  if (!shadows.ok) return shadows;
8404
- const depth = target3(graph, "hdrp-depth", {
8695
+ const depth = target4(graph, "hdrp-depth", {
8405
8696
  format: "depth24plus-stencil8",
8406
8697
  size: internalSize
8407
8698
  });
@@ -8412,24 +8703,24 @@ function buildStandardDeferredLane(context, topology, lighting) {
8412
8703
  aspect: "depth-only"
8413
8704
  });
8414
8705
  if (!depthSample.ok) return depthSample;
8415
- const gbuffer0 = target3(graph, "gbuffer-normal-roughness", {
8706
+ const gbuffer0 = target4(graph, "gbuffer-normal-roughness", {
8416
8707
  format: DEFERRED_COLOR_FORMATS[0] ?? "rgba16float",
8417
8708
  size: internalSize
8418
8709
  });
8419
8710
  if (!gbuffer0.ok) return gbuffer0;
8420
- const gbuffer1 = target3(graph, "gbuffer-albedo-metallic", {
8711
+ const gbuffer1 = target4(graph, "gbuffer-albedo-metallic", {
8421
8712
  format: DEFERRED_COLOR_FORMATS[1] ?? "rgba8unorm",
8422
8713
  size: internalSize
8423
8714
  });
8424
8715
  if (!gbuffer1.ok) return gbuffer1;
8425
- const gbuffer2 = target3(graph, "gbuffer-specular-response-ao", {
8716
+ const gbuffer2 = target4(graph, "gbuffer-specular-response-ao", {
8426
8717
  format: DEFERRED_COLOR_FORMATS[2] ?? "rgba16float",
8427
8718
  size: internalSize
8428
8719
  });
8429
8720
  if (!gbuffer2.ok) return gbuffer2;
8430
- const scene = target3(graph, "hdrp-scene-color", { format: "rgba16float", size: internalSize });
8721
+ const scene = target4(graph, "hdrp-scene-color", { format: "rgba16float", size: internalSize });
8431
8722
  if (!scene.ok) return scene;
8432
- const reflectionFallback = topology.reflectionFallback?.enabled === true || topology.ssr?.status === "admitted" ? target3(graph, "reflection-fallback-linear-hdr", {
8723
+ const reflectionFallback = topology.reflectionFallback?.enabled === true || topology.ssr?.status === "admitted" ? target4(graph, "reflection-fallback-linear-hdr", {
8433
8724
  format: "rgba16float",
8434
8725
  size: internalSize,
8435
8726
  domain: "linear-hdr"
@@ -8483,9 +8774,9 @@ function buildStandardDeferredLane(context, topology, lighting) {
8483
8774
  if (!gbuffer.ok) return gbuffer;
8484
8775
  let ssao;
8485
8776
  if (topology.config?.ssao?.enabled === true) {
8486
- const raw = target3(graph, "ssao-raw", { format: "r8unorm", size: "half-surface" });
8777
+ const raw = target4(graph, "ssao-raw", { format: "r8unorm", size: "half-surface" });
8487
8778
  if (!raw.ok) return raw;
8488
- const blurred = target3(graph, "ssao-blurred", { format: "r8unorm", size: "half-surface" });
8779
+ const blurred = target4(graph, "ssao-blurred", { format: "r8unorm", size: "half-surface" });
8489
8780
  if (!blurred.ok) return blurred;
8490
8781
  const passes = addTypedSsaoPasses(graph, {
8491
8782
  normal: gbuffer0.value,
@@ -8732,7 +9023,7 @@ function buildStandardDeferredLane(context, topology, lighting) {
8732
9023
  [
8733
9024
  ...forwardExtraAccesses,
8734
9025
  ...[shadows.value.directional, shadows.value.spot, shadows.value.point].flatMap(
8735
- (target4) => target4 === void 0 ? [] : [{ resource: target4.view, usage: "sampled-read" }]
9026
+ (target5) => target5 === void 0 ? [] : [{ resource: target5.view, usage: "sampled-read" }]
8736
9027
  ),
8737
9028
  ...ssao === void 0 ? [] : [{ resource: ssao.view, usage: "sampled-read" }]
8738
9029
  ]
@@ -10196,10 +10487,10 @@ function projectStandardPbrScene(input) {
10196
10487
  const normalMatrix = mat3.normalMatrix(normal, world);
10197
10488
  for (let column = 0; column < 3; column += 1) {
10198
10489
  const source = column * 3;
10199
- const target4 = base + 16 + column * 4;
10200
- rows[target4] = normalMatrix[source] ?? 0;
10201
- rows[target4 + 1] = normalMatrix[source + 1] ?? 0;
10202
- rows[target4 + 2] = normalMatrix[source + 2] ?? 0;
10490
+ const target5 = base + 16 + column * 4;
10491
+ rows[target5] = normalMatrix[source] ?? 0;
10492
+ rows[target5 + 1] = normalMatrix[source + 1] ?? 0;
10493
+ rows[target5 + 2] = normalMatrix[source + 2] ?? 0;
10203
10494
  }
10204
10495
  rows[base + 47] = candidate.materialIndex ?? 0;
10205
10496
  }
@@ -13130,7 +13421,7 @@ var EnvironmentLifecycle = class _EnvironmentLifecycle {
13130
13421
  const generation = (value) => {
13131
13422
  if (value === void 0) return void 0;
13132
13423
  const resourceCount = value.resourceCount;
13133
- const resourceBytes = value.resourceBytes;
13424
+ const resourceBytes2 = value.resourceBytes;
13134
13425
  const source = this.frames.get(value.signature)?.source.kind ?? "none";
13135
13426
  return Object.freeze({
13136
13427
  signature: value.signature,
@@ -13138,8 +13429,8 @@ var EnvironmentLifecycle = class _EnvironmentLifecycle {
13138
13429
  lane: value.lane,
13139
13430
  source,
13140
13431
  resourceCount,
13141
- bytes: resourceBytes,
13142
- residentBytes: value.retired ? 0 : resourceBytes,
13432
+ bytes: resourceBytes2,
13433
+ residentBytes: value.retired ? 0 : resourceBytes2,
13143
13434
  retiringBytes: 0
13144
13435
  });
13145
13436
  };
@@ -13188,6 +13479,121 @@ var EnvironmentLifecycle = class _EnvironmentLifecycle {
13188
13479
  return { ...generation, lane };
13189
13480
  }
13190
13481
  };
13482
+
13483
+ // src/features/depth-of-field/depth-of-field-inspection.ts
13484
+ var DOF_FORMAT_BYTES = Object.freeze({
13485
+ rgba16float: 8,
13486
+ rgba8unorm: 4
13487
+ });
13488
+ function resourceBytes(resource) {
13489
+ if (resource.byteSize !== void 0) return resource.byteSize;
13490
+ const descriptor = resource.descriptor;
13491
+ if (descriptor.kind !== "texture") return 0;
13492
+ const texelBytes = DOF_FORMAT_BYTES[descriptor.format] ?? 0;
13493
+ if (texelBytes === 0) return 0;
13494
+ let bytes2 = 0;
13495
+ for (let level = 0; level < descriptor.mipLevelCount; level += 1) {
13496
+ bytes2 += Math.max(1, descriptor.width >> level) * Math.max(1, descriptor.height >> level) * descriptor.depthOrArrayLayers * texelBytes;
13497
+ }
13498
+ return bytes2 * descriptor.sampleCount;
13499
+ }
13500
+ function textureExtent(graph, label) {
13501
+ const resource = graph.resources.find(
13502
+ (candidate) => candidate.kind === "texture" && candidate.label === label
13503
+ );
13504
+ if (resource?.descriptor.kind !== "texture") return void 0;
13505
+ return { width: resource.descriptor.width, height: resource.descriptor.height };
13506
+ }
13507
+ var emptyExtent = Object.freeze({ width: 0, height: 0 });
13508
+ var OFF_PARAMS = Object.freeze({ ...DEFAULT_DEPTH_OF_FIELD_PARAMS, maxRadiusPixels: 0 });
13509
+ function inspectDepthOfFieldGraph(graph, params) {
13510
+ const topology = depthOfFieldTopology(params);
13511
+ if (graph === void 0 || topology === void 0) {
13512
+ return {
13513
+ status: "empty",
13514
+ outputExtent: emptyExtent,
13515
+ workExtent: emptyExtent,
13516
+ passCount: 0,
13517
+ textureBytes: 0,
13518
+ graphGeneration: graph?.generation ?? 0
13519
+ };
13520
+ }
13521
+ const expectedPasses = new Set(depthOfFieldPassNames(topology));
13522
+ const passes = graph.passes.filter((pass) => expectedPasses.has(pass.name));
13523
+ const dofResources = graph.resources.filter(
13524
+ (resource) => resource.kind === "texture" && resource.label.startsWith("dof-")
13525
+ );
13526
+ const expectedResourceLabels = [
13527
+ "dof-coc",
13528
+ ...topology.useNear ? ["dof-near", "dof-prefilter-near", "dof-prefilter-near-metadata", "dof-background"] : [],
13529
+ ...topology.useFar ? ["dof-far", "dof-prefilter-far", "dof-prefilter-far-metadata"] : [],
13530
+ "dof-composite"
13531
+ ];
13532
+ const resourceLabels = new Set(dofResources.map((resource) => resource.label));
13533
+ const completePasses = passes.length === expectedPasses.size && passes.every((pass) => expectedPasses.has(pass.name));
13534
+ const completeResources = dofResources.length === expectedResourceLabels.length && expectedResourceLabels.every((label) => resourceLabels.has(label)) && dofResources.every((resource) => resourceBytes(resource) > 0);
13535
+ const outputExtent = textureExtent(graph, "dof-composite") ?? emptyExtent;
13536
+ const workExtent = textureExtent(graph, topology.useNear ? "dof-near" : "dof-far") ?? emptyExtent;
13537
+ return {
13538
+ status: completePasses && completeResources ? "active" : "invalid",
13539
+ outputExtent,
13540
+ workExtent,
13541
+ passCount: completePasses ? passes.length : 0,
13542
+ textureBytes: completeResources ? dofResources.reduce((bytes2, resource) => bytes2 + resourceBytes(resource), 0) : 0,
13543
+ graphGeneration: graph.generation
13544
+ };
13545
+ }
13546
+ function projectDepthOfFieldInspection(input) {
13547
+ const params = input.params ?? OFF_PARAMS;
13548
+ const topology = input.error === void 0 ? depthOfFieldTopology(input.params) : void 0;
13549
+ const requested = {
13550
+ focusDistance: params.focusDistance,
13551
+ fStop: params.fStop,
13552
+ sensorHeight: params.sensorHeight,
13553
+ maxRadiusPixels: params.maxRadiusPixels,
13554
+ quality: params.quality,
13555
+ blurSide: params.blurSide
13556
+ };
13557
+ const enabled = input.error !== void 0 || topology !== void 0;
13558
+ const transactionBound = "accepted" in input;
13559
+ const accepted = input.accepted;
13560
+ const acceptedTopology = depthOfFieldTopology(accepted?.params);
13561
+ const acceptedGraph = accepted === void 0 ? void 0 : inspectDepthOfFieldGraph(accepted.graph, accepted.params);
13562
+ const acceptedValid = accepted !== void 0 && accepted.deviceGeneration === input.deviceGeneration && acceptedTopology !== void 0 && acceptedGraph?.status === "active";
13563
+ const candidateGraph = inspectDepthOfFieldGraph(input.graph, input.params);
13564
+ const graph = transactionBound ? acceptedValid ? acceptedGraph ?? candidateGraph : candidateGraph : candidateGraph;
13565
+ const status = input.error?.code === "depth-of-field-orthographic-unsupported" ? "unsupported" : input.error !== void 0 ? "invalid" : !enabled ? "off" : transactionBound ? acceptedValid && !input.lastSubmitFailed && requestedEqual(requested, accepted.params) ? "active" : input.lastSubmitFailed ? "invalid" : candidateGraph.status === "invalid" ? "invalid" : "reset" : graph.status === "active" ? "active" : graph.status === "invalid" ? "invalid" : "reset";
13566
+ const effective = acceptedValid ? {
13567
+ focusDistance: accepted.params.focusDistance,
13568
+ fStop: accepted.params.fStop,
13569
+ sensorHeight: accepted.params.sensorHeight,
13570
+ maxRadiusPixels: accepted.params.maxRadiusPixels,
13571
+ quality: accepted.params.quality,
13572
+ blurSide: accepted.params.blurSide
13573
+ } : status === "active" ? requested : void 0;
13574
+ const effectiveParams = acceptedValid ? accepted.params : status === "active" ? params : void 0;
13575
+ return Object.freeze({
13576
+ enabled,
13577
+ status,
13578
+ requested,
13579
+ ...effective === void 0 ? {} : { effective },
13580
+ focalLength: effectiveParams?.focalLength ?? params.focalLength,
13581
+ outputExtent: graph.outputExtent,
13582
+ workExtent: graph.workExtent,
13583
+ tapCount: effectiveParams !== void 0 ? effectiveParams.quality === "low" ? 16 : effectiveParams.quality === "medium" ? 32 : 64 : 0,
13584
+ passCount: graph.passCount,
13585
+ textureBytes: graph.textureBytes,
13586
+ transparentPolicy: "opaque-depth-approximation",
13587
+ graphGeneration: graph.graphGeneration,
13588
+ deviceGeneration: input.deviceGeneration,
13589
+ lastKnownGood: acceptedValid || status === "active",
13590
+ ...input.error === void 0 ? {} : { error: input.error },
13591
+ ...input.error?.code === "depth-of-field-orthographic-unsupported" ? { fallbackReason: "orthographic-unsupported" } : input.error !== void 0 ? { fallbackReason: "invalid-params" } : status === "off" ? { fallbackReason: "zero-radius" } : status === "reset" ? { fallbackReason: "shader-not-ready" } : status === "invalid" ? { fallbackReason: "candidate-failed" } : {}
13592
+ });
13593
+ }
13594
+ function requestedEqual(requested, params) {
13595
+ return requested.focusDistance === params.focusDistance && requested.fStop === params.fStop && requested.sensorHeight === params.sensorHeight && requested.maxRadiusPixels === params.maxRadiusPixels && requested.quality === params.quality && requested.blurSide === params.blurSide;
13596
+ }
13191
13597
  function createFeatureNoisePixels() {
13192
13598
  const pixels = new Uint8Array(64 * 64 * 4);
13193
13599
  let state = 1831565813;
@@ -15332,7 +15738,7 @@ function collectGpuDrivenMaterialArtifacts({
15332
15738
  entry.materialShaderId
15333
15739
  );
15334
15740
  }
15335
- const collectArtifacts = (rows2, pass, target4) => {
15741
+ const collectArtifacts = (rows2, pass, target5) => {
15336
15742
  if (resolve === void 0) return;
15337
15743
  for (const row of rows2) {
15338
15744
  for (const draw of row.source.gpuDrivenDraws ?? []) {
@@ -15382,7 +15788,7 @@ function collectGpuDrivenMaterialArtifacts({
15382
15788
  if (selectedIdentityArtifact === void 0 || receipt === void 0 || !shadowVertexInputsMatch || pass !== "shadow" && (receipt.receiptIdentity !== prepared.receiptIdentity || receipt.generation !== prepared.receiptGeneration)) {
15383
15789
  continue;
15384
15790
  }
15385
- target4.set(
15791
+ target5.set(
15386
15792
  gpuDrivenMaterialArtifactKey({
15387
15793
  material: prepared.identity.material,
15388
15794
  deformation: prepared.identity.deformation,
@@ -15926,18 +16332,18 @@ var RenderFeatureComputeGraphProjection = class {
15926
16332
  const accesses = [];
15927
16333
  const targets = /* @__PURE__ */ new Map();
15928
16334
  for (const handle of work.sampledTargets ?? []) {
15929
- let target4 = this.resolveTarget?.(handle);
15930
- if (target4 === void 0)
16335
+ let target5 = this.resolveTarget?.(handle);
16336
+ if (target5 === void 0)
15931
16337
  return err$1(
15932
16338
  new RenderFeatureStageFailedError(featureIdentity, order, "record", "renderer-recover")
15933
16339
  );
15934
16340
  if (handle.kind === "scene-depth") {
15935
- const view = this.builder.view(target4.texture, { aspect: "depth-only" });
16341
+ const view = this.builder.view(target5.texture, { aspect: "depth-only" });
15936
16342
  if (!view.ok) return view;
15937
- target4 = { ...target4, view: view.value };
16343
+ target5 = { ...target5, view: view.value };
15938
16344
  }
15939
- targets.set(handle, target4);
15940
- accesses.push({ resource: target4.view, usage: "sampled-read" });
16345
+ targets.set(handle, target5);
16346
+ accesses.push({ resource: target5.view, usage: "sampled-read" });
15941
16347
  }
15942
16348
  for (const resource of work.buffers) {
15943
16349
  const imported = importRenderFeatureGraphBuffer(
@@ -15954,9 +16360,9 @@ var RenderFeatureComputeGraphProjection = class {
15954
16360
  encode: ({ pass, resources }) => {
15955
16361
  try {
15956
16362
  encodeRenderFeatureGpuComputePass(pass, work, (name2) => {
15957
- const target4 = targets.get(name2);
15958
- if (target4 === void 0) throw new Error(`Missing sampled graph target: ${name2}`);
15959
- const view = resources.textureView(target4.view);
16363
+ const target5 = targets.get(name2);
16364
+ if (target5 === void 0) throw new Error(`Missing sampled graph target: ${name2}`);
16365
+ const view = resources.textureView(target5.view);
15960
16366
  if (!view.ok) throw view.error;
15961
16367
  return view.value;
15962
16368
  });
@@ -16076,15 +16482,15 @@ var RenderFeatureRasterGraphProjection = class {
16076
16482
  accesses.push(...this.standardSurfaceAccesses);
16077
16483
  const colors = [];
16078
16484
  for (const attachment of descriptor.attachments.colors) {
16079
- const target4 = this.resolveTarget(attachment.resource);
16080
- if (target4 === void 0) return err$1(missing(featureIdentity, order));
16081
- accesses.push({ resource: target4.view, usage: "color-attachment" });
16082
- if (target4.resolveTarget !== void 0) {
16083
- accesses.push({ resource: target4.resolveTarget, usage: "color-attachment" });
16485
+ const target5 = this.resolveTarget(attachment.resource);
16486
+ if (target5 === void 0) return err$1(missing(featureIdentity, order));
16487
+ accesses.push({ resource: target5.view, usage: "color-attachment" });
16488
+ if (target5.resolveTarget !== void 0) {
16489
+ accesses.push({ resource: target5.resolveTarget, usage: "color-attachment" });
16084
16490
  }
16085
16491
  colors.push({
16086
- view: target4.view,
16087
- ...target4.resolveTarget === void 0 ? {} : { resolveTarget: target4.resolveTarget },
16492
+ view: target5.view,
16493
+ ...target5.resolveTarget === void 0 ? {} : { resolveTarget: target5.resolveTarget },
16088
16494
  loadOp: attachment.loadOp,
16089
16495
  storeOp: attachment.storeOp
16090
16496
  });
@@ -16092,17 +16498,17 @@ var RenderFeatureRasterGraphProjection = class {
16092
16498
  let depthStencilAttachment;
16093
16499
  const depth = descriptor.attachments.depthStencil;
16094
16500
  if (depth !== void 0) {
16095
- const target4 = this.resolveTarget(depth.resource);
16096
- if (target4 === void 0) return err$1(missing(featureIdentity, order));
16501
+ const target5 = this.resolveTarget(depth.resource);
16502
+ if (target5 === void 0) return err$1(missing(featureIdentity, order));
16097
16503
  const sampled = (descriptor.sampledTargets ?? []).some(
16098
16504
  (candidate) => typeof depth.resource !== "string" && candidate.kind === depth.resource.kind && candidate.format === depth.resource.format && candidate.sampleCount === depth.resource.sampleCount
16099
16505
  );
16100
16506
  accesses.push({
16101
- resource: target4.view,
16507
+ resource: target5.view,
16102
16508
  usage: sampled ? "depth-stencil-read" : "depth-stencil-write"
16103
16509
  });
16104
- depthStencilAttachment = sampled ? { view: target4.view, depthReadOnly: true, stencilReadOnly: true } : {
16105
- view: target4.view,
16510
+ depthStencilAttachment = sampled ? { view: target5.view, depthReadOnly: true, stencilReadOnly: true } : {
16511
+ view: target5.view,
16106
16512
  depthLoadOp: depth.depthLoadOp,
16107
16513
  depthStoreOp: depth.depthStoreOp,
16108
16514
  stencilLoadOp: depth.depthLoadOp,
@@ -16110,9 +16516,9 @@ var RenderFeatureRasterGraphProjection = class {
16110
16516
  };
16111
16517
  }
16112
16518
  for (const sampled of descriptor.sampledTargets ?? []) {
16113
- const target4 = this.resolveTarget(sampled);
16114
- if (target4 === void 0) return err$1(missing(featureIdentity, order));
16115
- accesses.push({ resource: target4.view, usage: "sampled-read" });
16519
+ const target5 = this.resolveTarget(sampled);
16520
+ if (target5 === void 0) return err$1(missing(featureIdentity, order));
16521
+ accesses.push({ resource: target5.view, usage: "sampled-read" });
16116
16522
  }
16117
16523
  const drawBuffers = this.importDrawBuffers(name, featureIdentity, order, descriptor, snapshot);
16118
16524
  if (!drawBuffers.ok) return drawBuffers;
@@ -17273,6 +17679,7 @@ function topologyOf(internals, frameState, pipelineState, camera, clearOnly, lig
17273
17679
  );
17274
17680
  const selectedVolumeLight = volumetricFog?.lightKind === "spot" ? lights.spot.find((light) => light.entity === volumetricFog.lightEntity) : volumetricFog?.lightKind === "point" ? lights.point.find((light) => light.entity === volumetricFog.lightEntity) : volumetricFog?.lightKind === "directional" && lights.directional?.entity === volumetricFog.lightEntity ? lights.directional : volumetricFog?.lightKind === void 0 ? lights.directional : void 0;
17275
17681
  const preparedLut = frameState.pendingStandardLutGpuResources ?? frameState.standardLutGpuResources;
17682
+ const depthOfField = depthOfFieldTopology(camera.depthOfField);
17276
17683
  return ok$1({
17277
17684
  pipelineId: STANDARD_PIPELINE_ID,
17278
17685
  standardProfile: internals.standardProfile,
@@ -17291,7 +17698,8 @@ function topologyOf(internals, frameState, pipelineState, camera, clearOnly, lig
17291
17698
  camera: {
17292
17699
  tonemap: camera.tonemap,
17293
17700
  antialias: camera.antialias,
17294
- bloom: camera.bloom
17701
+ bloom: camera.bloom,
17702
+ ...depthOfField === void 0 ? {} : { depthOfField }
17295
17703
  },
17296
17704
  atmosphere: !clearOnly && frameState.environmentFrame?.source.kind === "atmosphere",
17297
17705
  output: {
@@ -17391,13 +17799,13 @@ function targetResolver(targets, semanticTargets = [], namedTargets = {}) {
17391
17799
  return semantic === void 0 ? void 0 : { texture: semantic.texture, view: semantic.view };
17392
17800
  }
17393
17801
  if (!isRenderFeatureTargetHandle(resource)) return void 0;
17394
- const target4 = targets.find(
17802
+ const target5 = targets.find(
17395
17803
  (candidate) => candidate.kind === resource.kind && candidate.format === resource.format && candidate.sampleCount === resource.sampleCount
17396
17804
  );
17397
- return target4 === void 0 ? void 0 : {
17398
- texture: target4.texture,
17399
- view: target4.view,
17400
- ...target4.resolveTarget === void 0 ? {} : { resolveTarget: target4.resolveTarget }
17805
+ return target5 === void 0 ? void 0 : {
17806
+ texture: target5.texture,
17807
+ view: target5.view,
17808
+ ...target5.resolveTarget === void 0 ? {} : { resolveTarget: target5.resolveTarget }
17401
17809
  };
17402
17810
  };
17403
17811
  }
@@ -17452,9 +17860,9 @@ function resolveTargetBindings(input, featurePostProcessEntries) {
17452
17860
  ) ?? void 0;
17453
17861
  }
17454
17862
  if (sceneDepthBinding === 1) {
17455
- const target5 = sceneDepth === void 0 ? void 0 : input.resolveTarget(sceneDepth);
17456
- const depthView2 = target5 === void 0 ? frame.pipelineState.shadowFallbackTextureView : (() => {
17457
- const texture2 = input.resources.texture(target5.texture);
17863
+ const target6 = sceneDepth === void 0 ? void 0 : input.resolveTarget(sceneDepth);
17864
+ const depthView2 = target6 === void 0 ? frame.pipelineState.shadowFallbackTextureView : (() => {
17865
+ const texture2 = input.resources.texture(target6.texture);
17458
17866
  if (!texture2.ok) throw texture2.error;
17459
17867
  const created3 = frame.runtime.device.createTextureView(texture2.value, {
17460
17868
  aspect: "depth-only",
@@ -17499,9 +17907,9 @@ function resolveTargetBindings(input, featurePostProcessEntries) {
17499
17907
  ).viewBindGroup;
17500
17908
  return viewBindGroup === null ? void 0 : { handle: viewBindGroup, dynamicOffsets: [0, 0] };
17501
17909
  }
17502
- const target4 = input.resolveTarget(sceneDepth);
17503
- if (target4 === void 0) return void 0;
17504
- const texture = input.resources.texture(target4.texture);
17910
+ const target5 = input.resolveTarget(sceneDepth);
17911
+ if (target5 === void 0) return void 0;
17912
+ const texture = input.resources.texture(target5.texture);
17505
17913
  if (!texture.ok) throw texture.error;
17506
17914
  const depthView = frame.runtime.device.createTextureView(texture.value, {
17507
17915
  aspect: "depth-only",
@@ -17527,21 +17935,57 @@ function settleVolumetricFogGraphCandidate(frameState, submitted) {
17527
17935
  if (candidate === null) return;
17528
17936
  const previous = frameState.volumetricFogPreviousGraph ?? null;
17529
17937
  const previousKey = frameState.volumetricFogPreviousGraphKey ?? null;
17938
+ const sharedWithDepthOfField = frameState.depthOfFieldCandidateGraph === candidate;
17530
17939
  if (submitted) {
17531
- if (previous !== null && previous !== candidate) retire(frameState, previous);
17940
+ if (!sharedWithDepthOfField && previous !== null && previous !== candidate) {
17941
+ retire(frameState, previous);
17942
+ }
17532
17943
  } else {
17533
- if (candidate !== previous) retire(frameState, candidate);
17534
- frameState.compiledFrameGraph = previous;
17535
- frameState.compiledFrameGraphTopologyKey = previousKey;
17944
+ if (!sharedWithDepthOfField) {
17945
+ if (candidate !== previous) retire(frameState, candidate);
17946
+ frameState.compiledFrameGraph = previous;
17947
+ frameState.compiledFrameGraphTopologyKey = previousKey;
17948
+ }
17536
17949
  }
17537
17950
  frameState.volumetricFogPreviousGraph = null;
17538
17951
  frameState.volumetricFogPreviousGraphKey = null;
17539
17952
  frameState.volumetricFogCandidateGraph = null;
17540
17953
  }
17954
+ function settleDepthOfFieldGraphCandidate(frameState, submitted) {
17955
+ const candidate = frameState.depthOfFieldCandidateGraph;
17956
+ if (candidate === null || candidate === void 0) return;
17957
+ const previous = frameState.depthOfFieldPreviousGraph ?? null;
17958
+ if (submitted) {
17959
+ if (previous !== null && previous !== candidate) retire(frameState, previous);
17960
+ } else {
17961
+ if (candidate !== previous) retire(frameState, candidate);
17962
+ frameState.compiledFrameGraph = previous;
17963
+ frameState.compiledFrameGraphTopologyKey = frameState.depthOfFieldPreviousGraphKey ?? null;
17964
+ if (frameState.depthOfFieldPreviousPerFrameGraph === void 0) {
17965
+ delete frameState.perFrameGraph;
17966
+ } else {
17967
+ frameState.perFrameGraph = frameState.depthOfFieldPreviousPerFrameGraph;
17968
+ }
17969
+ frameState.graphGeneration = frameState.depthOfFieldPreviousGraphGeneration ?? 0;
17970
+ frameState.standardLightingGraphSignature = frameState.depthOfFieldPreviousStandardLightingGraphSignature ?? "";
17971
+ }
17972
+ frameState.depthOfFieldPreviousGraph = null;
17973
+ frameState.depthOfFieldPreviousGraphKey = null;
17974
+ frameState.depthOfFieldPreviousPerFrameGraph = void 0;
17975
+ frameState.depthOfFieldPreviousGraphGeneration = 0;
17976
+ frameState.depthOfFieldPreviousStandardLightingGraphSignature = "";
17977
+ frameState.depthOfFieldCandidateGraph = null;
17978
+ }
17541
17979
  function ensureCompiledFrameGraph(internals, frameState, pipelineState, camera, lights, width, height, shadowMapSize, gpuDriven, featureGraphCandidate, cubeCaptureState, clearOnly = false, transmissionDemand, occlusion, volumetricFog, volumeTopologyCandidate = false, standardLighting, onRecoveryError, ssr, renderExtent) {
17542
17980
  const featureMetrics = mutableFeatureGraphInspection(internals);
17543
17981
  featureMetrics.ensureCalls += 1;
17544
17982
  const requestedStandardLightingSignature = standardLightingTopologySignature(standardLighting);
17983
+ const frameDepthOfField = resolveDepthOfFieldFrameParams(
17984
+ camera.depthOfField,
17985
+ camera.depthOfFieldError,
17986
+ frameState.depthOfFieldAccepted?.params
17987
+ );
17988
+ const graphCamera = frameDepthOfField === void 0 || frameDepthOfField === camera.depthOfField ? camera : { ...camera, depthOfField: frameDepthOfField };
17545
17989
  const lastKnownGood = () => frameState.compiledFrameGraph !== null && !hasSubmissionSensitiveFeatures(getRenderFeatureGraphState(internals).plans) && frameState.standardLightingGraphSignature === requestedStandardLightingSignature ? frameState.compiledFrameGraph : null;
17546
17990
  const surfaceWidth = Math.max(1, width);
17547
17991
  const surfaceHeight = Math.max(1, height);
@@ -17569,7 +18013,7 @@ function ensureCompiledFrameGraph(internals, frameState, pipelineState, camera,
17569
18013
  internals,
17570
18014
  frameState,
17571
18015
  pipelineState,
17572
- camera,
18016
+ graphCamera,
17573
18017
  clearOnly,
17574
18018
  lights,
17575
18019
  surfaceWidth,
@@ -17737,6 +18181,7 @@ function ensureCompiledFrameGraph(internals, frameState, pipelineState, camera,
17737
18181
  const built = frameState.activePipeline.build(
17738
18182
  {
17739
18183
  graph: builder,
18184
+ camera: { depthOfField: graphCamera.depthOfField },
17740
18185
  observationCaptureDomains: internals.observationCaptureDomains,
17741
18186
  ...autoExposureResources?.ok === true ? { standardOutput: { autoExposure: autoExposureResources.value } } : {},
17742
18187
  ...lutResources?.ok === true ? {
@@ -17763,14 +18208,14 @@ function ensureCompiledFrameGraph(internals, frameState, pipelineState, camera,
17763
18208
  const encoded = encodeMipmapLevel(internals.device, pass, sourceView.value, "rgba16float");
17764
18209
  if (!encoded.ok) throw encoded.error;
17765
18210
  },
17766
- projectGpuDriven: (target4) => {
18211
+ projectGpuDriven: (target5) => {
17767
18212
  if (projectedGpuDriven || gpuDriven === void 0) return ok$1(void 0);
17768
18213
  projectedGpuDriven = true;
17769
18214
  return gpuDriven.project(
17770
18215
  builder,
17771
- target4.format,
17772
- target4.sampleCount,
17773
- target4.additionalColorFormats
18216
+ target5.format,
18217
+ target5.sampleCount,
18218
+ target5.additionalColorFormats
17774
18219
  );
17775
18220
  },
17776
18221
  ...gpuDriven?.projectShadow === void 0 ? {} : {
@@ -17850,10 +18295,26 @@ function ensureCompiledFrameGraph(internals, frameState, pipelineState, camera,
17850
18295
  return lastKnownGood();
17851
18296
  }
17852
18297
  const previous = frameState.compiledFrameGraph;
18298
+ const depthOfFieldReplacement = (frameState.depthOfFieldCandidateGraph === null || frameState.depthOfFieldCandidateGraph === void 0) && (topologyResult.value.camera.depthOfField !== void 0 || frameState.depthOfFieldAccepted !== void 0);
17853
18299
  if (volumeTopologyCandidate) {
17854
18300
  frameState.volumetricFogPreviousGraph = previous;
17855
18301
  frameState.volumetricFogPreviousGraphKey = frameState.compiledFrameGraphTopologyKey;
17856
18302
  frameState.volumetricFogCandidateGraph = compiled.value;
18303
+ if (depthOfFieldReplacement) {
18304
+ frameState.depthOfFieldPreviousGraph = previous;
18305
+ frameState.depthOfFieldPreviousGraphKey = frameState.compiledFrameGraphTopologyKey;
18306
+ frameState.depthOfFieldPreviousPerFrameGraph = frameState.perFrameGraph;
18307
+ frameState.depthOfFieldPreviousGraphGeneration = frameState.graphGeneration;
18308
+ frameState.depthOfFieldPreviousStandardLightingGraphSignature = frameState.standardLightingGraphSignature;
18309
+ frameState.depthOfFieldCandidateGraph = compiled.value;
18310
+ }
18311
+ } else if (depthOfFieldReplacement) {
18312
+ frameState.depthOfFieldPreviousGraph = previous;
18313
+ frameState.depthOfFieldPreviousGraphKey = frameState.compiledFrameGraphTopologyKey;
18314
+ frameState.depthOfFieldPreviousPerFrameGraph = frameState.perFrameGraph;
18315
+ frameState.depthOfFieldPreviousGraphGeneration = frameState.graphGeneration;
18316
+ frameState.depthOfFieldPreviousStandardLightingGraphSignature = frameState.standardLightingGraphSignature;
18317
+ frameState.depthOfFieldCandidateGraph = compiled.value;
17857
18318
  }
17858
18319
  frameState.compiledFrameGraph = compiled.value;
17859
18320
  frameState.compiledFrameGraphTopologyKey = key;
@@ -17882,7 +18343,9 @@ function ensureCompiledFrameGraph(internals, frameState, pipelineState, camera,
17882
18343
  } else if (featureGraphCandidate !== void 0) {
17883
18344
  recordRenderFeatureCandidateEvent(internals, featureGraphCandidate, "abandoned");
17884
18345
  }
17885
- if (!volumeTopologyCandidate && previous !== null) retire(frameState, previous);
18346
+ if (!volumeTopologyCandidate && !depthOfFieldReplacement && previous !== null) {
18347
+ retire(frameState, previous);
18348
+ }
17886
18349
  return compiled.value;
17887
18350
  }
17888
18351
  function executeCompiledFrameGraph(internals, frameState, frame, encoder, runPass, frameHooks, readbackFaces, onSubmitted, timingCapture) {
@@ -17899,6 +18362,7 @@ function executeCompiledFrameGraph(internals, frameState, frame, encoder, runPas
17899
18362
  frameState.pendingAutoExposureState = void 0;
17900
18363
  frameState.pendingStandardLutState = void 0;
17901
18364
  settleVolumetricFogGraphCandidate(frameState, false);
18365
+ settleDepthOfFieldGraphCandidate(frameState, false);
17902
18366
  rejectTemporalFrame();
17903
18367
  return false;
17904
18368
  }
@@ -17935,6 +18399,8 @@ function executeCompiledFrameGraph(internals, frameState, frame, encoder, runPas
17935
18399
  }
17936
18400
  })
17937
18401
  );
18402
+ settleVolumetricFogGraphCandidate(frameState, false);
18403
+ settleDepthOfFieldGraphCandidate(frameState, false);
17938
18404
  return false;
17939
18405
  }
17940
18406
  const capturedGeneration = deviceScope?.generation;
@@ -18100,8 +18566,8 @@ function executeCompiledFrameGraph(internals, frameState, frame, encoder, runPas
18100
18566
  replayFailure(`pass-replay-depth-attachment-missing:${pass.name}`);
18101
18567
  return;
18102
18568
  }
18103
- const target5 = replayTarget;
18104
- if (target5 === void 0 || depthView !== target5.view) {
18569
+ const target6 = replayTarget;
18570
+ if (target6 === void 0 || depthView !== target6.view) {
18105
18571
  replayFailure(`pass-replay-attachment-target-mismatch:${pass.name}`);
18106
18572
  return;
18107
18573
  }
@@ -18123,9 +18589,9 @@ function executeCompiledFrameGraph(internals, frameState, frame, encoder, runPas
18123
18589
  encode();
18124
18590
  encoded2 = true;
18125
18591
  if (replayValidationFailed || pass.name !== observeAfterPassName) return;
18126
- const target5 = replayTarget;
18592
+ const target6 = replayTarget;
18127
18593
  const anchor = depthAnchorReceipt;
18128
- if (target5 === void 0 || anchor === void 0) {
18594
+ if (target6 === void 0 || anchor === void 0) {
18129
18595
  replayFailure("pass-replay-depth-attachment-anchor-missing-at-boundary");
18130
18596
  return;
18131
18597
  }
@@ -18133,11 +18599,11 @@ function executeCompiledFrameGraph(internals, frameState, frame, encoder, runPas
18133
18599
  passName: pass.name,
18134
18600
  executionIndex: pass.executionIndex,
18135
18601
  resolvedDepthStencilAttachmentView: anchor.view,
18136
- graphGeneration: target5.graphGeneration,
18137
- targetName: target5.name,
18138
- targetView: target5.view,
18139
- targetTexture: target5.texture,
18140
- targetTextureIdentity: target5.textureIdentity,
18602
+ graphGeneration: target6.graphGeneration,
18603
+ targetName: target6.name,
18604
+ targetView: target6.view,
18605
+ targetTexture: target6.texture,
18606
+ targetTextureIdentity: target6.textureIdentity,
18141
18607
  replayPassNames: [...selectedReplayPassNames],
18142
18608
  depthAttachmentPassName: anchor.pass.name,
18143
18609
  observeAfterPassName: pass.name,
@@ -18164,12 +18630,12 @@ function executeCompiledFrameGraph(internals, frameState, frame, encoder, runPas
18164
18630
  else runPass(pass, encode);
18165
18631
  return;
18166
18632
  }
18167
- const target4 = replayTarget;
18168
- if (target4 === void 0 || depthView === void 0) {
18633
+ const target5 = replayTarget;
18634
+ if (target5 === void 0 || depthView === void 0) {
18169
18635
  replayFailure(`pass-replay-depth-attachment-missing:${pass.name}`);
18170
18636
  return;
18171
18637
  }
18172
- if (depthView !== target4.view) {
18638
+ if (depthView !== target5.view) {
18173
18639
  replayFailure(`pass-replay-attachment-target-mismatch:${pass.name}`);
18174
18640
  return;
18175
18641
  }
@@ -18186,11 +18652,11 @@ function executeCompiledFrameGraph(internals, frameState, frame, encoder, runPas
18186
18652
  passName: pass.name,
18187
18653
  executionIndex: pass.executionIndex,
18188
18654
  resolvedDepthStencilAttachmentView: depthView,
18189
- graphGeneration: target4.graphGeneration,
18190
- targetName: target4.name,
18191
- targetView: target4.view,
18192
- targetTexture: target4.texture,
18193
- targetTextureIdentity: target4.textureIdentity
18655
+ graphGeneration: target5.graphGeneration,
18656
+ targetName: target5.name,
18657
+ targetView: target5.view,
18658
+ targetTexture: target5.texture,
18659
+ targetTextureIdentity: target5.textureIdentity
18194
18660
  };
18195
18661
  try {
18196
18662
  onPassEncoded(receipt);
@@ -18547,6 +19013,8 @@ function executeCompiledFrameGraph(internals, frameState, frame, encoder, runPas
18547
19013
  frameState.pendingAtmospherePublish?.();
18548
19014
  frameState.pendingAtmospherePublish = void 0;
18549
19015
  onSubmitted?.(internals.device.queue.onSubmittedWorkDone());
19016
+ settleVolumetricFogGraphCandidate(frameState, true);
19017
+ settleDepthOfFieldGraphCandidate(frameState, true);
18550
19018
  },
18551
19019
  abort: (failure5) => {
18552
19020
  frameState.pendingAtmospherePublish = void 0;
@@ -18585,9 +19053,12 @@ function executeCompiledFrameGraph(internals, frameState, frame, encoder, runPas
18585
19053
  frameState.environmentLifecycle?.discard(frameState.environmentGeneration);
18586
19054
  frameState.environmentGeneration = void 0;
18587
19055
  }
19056
+ settleVolumetricFogGraphCandidate(frameState, false);
19057
+ settleDepthOfFieldGraphCandidate(frameState, false);
18588
19058
  }
18589
19059
  });
18590
19060
  settleVolumetricFogGraphCandidate(frameState, transaction.ok);
19061
+ settleDepthOfFieldGraphCandidate(frameState, transaction.ok);
18591
19062
  if (!transaction.ok) rejectTemporalFrame();
18592
19063
  return transaction.ok;
18593
19064
  }
@@ -18733,12 +19204,12 @@ function gpuDrivenRenderableConsumed(entry, drawKeys) {
18733
19204
  );
18734
19205
  });
18735
19206
  }
18736
- function projectValidatedRows(validated, target4) {
19207
+ function projectValidatedRows(validated, target5) {
18737
19208
  const byIdentity = /* @__PURE__ */ new Map();
18738
19209
  for (const row of validated) byIdentity.set(renderableIdentity(row.source), row);
18739
19210
  const projected = [];
18740
- for (let index = 0; index < target4.length; index += 1) {
18741
- const snapshot = target4[index];
19211
+ for (let index = 0; index < target5.length; index += 1) {
19212
+ const snapshot = target5[index];
18742
19213
  if (snapshot === void 0) continue;
18743
19214
  const row = byIdentity.get(renderableIdentity(snapshot));
18744
19215
  if (row === void 0) continue;
@@ -19639,8 +20110,14 @@ function recordFrame(internals, world, cameras, lights, renderables, transparent
19639
20110
  })
19640
20111
  );
19641
20112
  }
19642
- const camera = activeCameras[0];
19643
- if (!camera) return false;
20113
+ const requestedCamera = activeCameras[0];
20114
+ if (!requestedCamera) return false;
20115
+ const frameDepthOfField = resolveDepthOfFieldFrameParams(
20116
+ requestedCamera.depthOfField,
20117
+ requestedCamera.depthOfFieldError,
20118
+ frameState.depthOfFieldAccepted?.params
20119
+ );
20120
+ const camera = frameDepthOfField === void 0 || frameDepthOfField === requestedCamera.depthOfField ? requestedCamera : { ...requestedCamera, depthOfField: frameDepthOfField };
19644
20121
  frameState.ssrRequested = camera.screenSpaceReflection !== void 0;
19645
20122
  const pipelineState = internals.getPipelineState();
19646
20123
  if (pipelineState === null) return false;
@@ -20291,6 +20768,20 @@ function recordFrame(internals, world, cameras, lights, renderables, transparent
20291
20768
  motionBlurView.setUint32(12, temporalView?.historyValid === true ? 0 : 1, true);
20292
20769
  framePostProcessParams.set("forgeax.motion-blur", motionBlurParams);
20293
20770
  }
20771
+ if (camera.depthOfField !== void 0) {
20772
+ const dofParams = packDepthOfFieldParams(camera.depthOfField, {
20773
+ outputHeight: targetH,
20774
+ near: camera.near,
20775
+ far: camera.far,
20776
+ useTemporalDepth: camera.antialias === "taa" && temporalView !== void 0
20777
+ });
20778
+ for (const id of [
20779
+ ...DEPTH_OF_FIELD_POST_PROCESS_IDS,
20780
+ ...DEPTH_OF_FIELD_MSAA_POST_PROCESS_IDS
20781
+ ]) {
20782
+ framePostProcessParams.set(id, dofParams);
20783
+ }
20784
+ }
20294
20785
  const passCtx = {
20295
20786
  assets: internals.assets,
20296
20787
  world,
@@ -20516,6 +21007,7 @@ function recordFrame(internals, world, cameras, lights, renderables, transparent
20516
21007
  frameState.ssrHistoryCandidate = void 0;
20517
21008
  }
20518
21009
  settleVolumetricFogGraphCandidate(frameState, submitted);
21010
+ settleDepthOfFieldGraphCandidate(frameState, submitted);
20519
21011
  if (volumeInspectionReady && (submitted || volumeSubmissionAttempted)) {
20520
21012
  updateVolumetricFogInspection(
20521
21013
  frameState,
@@ -21561,6 +22053,12 @@ function createRenderSystemRecovery(deps) {
21561
22053
  directionalShadowCacheRecorded: false,
21562
22054
  compiledFrameGraph: null,
21563
22055
  compiledFrameGraphTopologyKey: null,
22056
+ depthOfFieldPreviousGraph: null,
22057
+ depthOfFieldPreviousGraphKey: null,
22058
+ depthOfFieldPreviousPerFrameGraph: void 0,
22059
+ depthOfFieldPreviousGraphGeneration: 0,
22060
+ depthOfFieldPreviousStandardLightingGraphSignature: "",
22061
+ depthOfFieldCandidateGraph: null,
21564
22062
  volumetricFogPreviousGraph: null,
21565
22063
  volumetricFogPreviousGraphKey: null,
21566
22064
  volumetricFogCandidateGraph: null,
@@ -23392,17 +23890,17 @@ function createCubeCaptureScheduler(options = {}) {
23392
23890
  const states = /* @__PURE__ */ new WeakMap();
23393
23891
  let activeCapture;
23394
23892
  let frameOpen = false;
23395
- const stateFor = (target4) => {
23396
- const existing = states.get(target4);
23893
+ const stateFor = (target5) => {
23894
+ const existing = states.get(target5);
23397
23895
  if (existing !== void 0) return existing;
23398
23896
  const created = {
23399
- target: target4,
23897
+ target: target5,
23400
23898
  activeGeneration: 0,
23401
23899
  completedVersion: 0,
23402
23900
  pending: void 0,
23403
23901
  nestedRejections: 0
23404
23902
  };
23405
- states.set(target4, created);
23903
+ states.set(target5, created);
23406
23904
  return created;
23407
23905
  };
23408
23906
  return {
@@ -23481,8 +23979,8 @@ function createCubeCaptureScheduler(options = {}) {
23481
23979
  });
23482
23980
  return { ok: true, value: void 0 };
23483
23981
  },
23484
- inspect(target4) {
23485
- const state = stateFor(target4);
23982
+ inspect(target5) {
23983
+ const state = stateFor(target5);
23486
23984
  const pending = state.pending;
23487
23985
  const pendingFaces = pending === void 0 ? [] : pending.views.filter(
23488
23986
  (view) => !pending.written.has(view.face) && !pending.inFlight.some((work) => work.face === view.face)
@@ -25365,12 +25863,12 @@ function ownPointsLinesSnapshot(snapshot) {
25365
25863
  function intersects(left, right) {
25366
25864
  return left.min[0] <= right.max[0] && left.max[0] >= right.min[0] && left.min[1] <= right.max[1] && left.max[1] >= right.min[1] && left.min[2] <= right.max[2] && left.max[2] >= right.min[2];
25367
25865
  }
25368
- function worldBounds(snapshot, target4) {
25866
+ function worldBounds(snapshot, target5) {
25369
25867
  const local = snapshot.localAabb;
25370
25868
  if (local === void 0 || local.length < 6) return void 0;
25371
25869
  const world = snapshot.transform.world;
25372
- const min = target4?.min ?? [0, 0, 0];
25373
- const max = target4?.max ?? [0, 0, 0];
25870
+ const min = target5?.min ?? [0, 0, 0];
25871
+ const max = target5?.max ?? [0, 0, 0];
25374
25872
  const centerX = ((local[0] ?? 0) + (local[3] ?? 0)) * 0.5;
25375
25873
  const centerY = ((local[1] ?? 0) + (local[4] ?? 0)) * 0.5;
25376
25874
  const centerZ = ((local[2] ?? 0) + (local[5] ?? 0)) * 0.5;
@@ -25389,7 +25887,7 @@ function worldBounds(snapshot, target4) {
25389
25887
  max[0] = worldCenterX + worldExtentX;
25390
25888
  max[1] = worldCenterY + worldExtentY;
25391
25889
  max[2] = worldCenterZ + worldExtentZ;
25392
- return target4 ?? { min, max };
25890
+ return target5 ?? { min, max };
25393
25891
  }
25394
25892
  function boundsFromArray(bounds) {
25395
25893
  if (bounds.length < 6) return void 0;
@@ -25472,12 +25970,12 @@ var RenderScene = class {
25472
25970
  return pending;
25473
25971
  };
25474
25972
  const updateWorld = (pending, source, offset2) => {
25475
- const target4 = pending.current?.transform.world;
25476
- if (target4 === void 0) return;
25973
+ const target5 = pending.current?.transform.world;
25974
+ if (target5 === void 0) return;
25477
25975
  for (let lane = 0; lane < 16; lane += 1) {
25478
25976
  const value = source[offset2 + lane] ?? 0;
25479
- if (target4[lane] !== value) {
25480
- target4[lane] = value;
25977
+ if (target5[lane] !== value) {
25978
+ target5[lane] = value;
25481
25979
  pending.transformChanged = true;
25482
25980
  }
25483
25981
  }
@@ -25869,11 +26367,11 @@ var RenderScene = class {
25869
26367
  if (orderIndex >= 0) this.orderedSlots.splice(orderIndex, 1);
25870
26368
  this.freeSlots.push(record.slot);
25871
26369
  }
25872
- addSharedRefConsumers(worldId, handle, target4) {
26370
+ addSharedRefConsumers(worldId, handle, target5) {
25873
26371
  for (const index of [this.slotsByAsset, this.slotsByMaterial]) {
25874
26372
  for (const slot of index.get(handle) ?? []) {
25875
26373
  const record = this.slots[slot];
25876
- if (record?.worldId === worldId) target4.add(record.entityKey);
26374
+ if (record?.worldId === worldId) target5.add(record.entityKey);
25877
26375
  }
25878
26376
  }
25879
26377
  }
@@ -28193,6 +28691,14 @@ function createRenderSystem(internals) {
28193
28691
  compiledFrameGraph: null,
28194
28692
  compiledFrameGraphTopologyKey: null,
28195
28693
  compiledFrameGraphGeneration: 0,
28694
+ depthOfFieldPreviousGraph: null,
28695
+ depthOfFieldPreviousGraphKey: null,
28696
+ depthOfFieldPreviousPerFrameGraph: void 0,
28697
+ depthOfFieldPreviousGraphGeneration: 0,
28698
+ depthOfFieldPreviousStandardLightingGraphSignature: "",
28699
+ depthOfFieldCandidateGraph: null,
28700
+ depthOfFieldAccepted: void 0,
28701
+ depthOfFieldLastSubmitFailed: false,
28196
28702
  volumetricFogPreviousGraph: null,
28197
28703
  volumetricFogPreviousGraphKey: null,
28198
28704
  volumetricFogCandidateGraph: null,
@@ -29021,8 +29527,8 @@ function createRenderSystem(internals) {
29021
29527
  get reflectionFallbackCompletion() {
29022
29528
  return frameState.reflectionFallbackCompletion;
29023
29529
  },
29024
- isCubeCapturePending(target4) {
29025
- return cubeCaptureScheduler.inspect(target4).candidateGeneration !== void 0;
29530
+ isCubeCapturePending(target5) {
29531
+ return cubeCaptureScheduler.inspect(target5).candidateGeneration !== void 0;
29026
29532
  },
29027
29533
  get environment() {
29028
29534
  return environmentLifecycle.inspect();
@@ -29073,17 +29579,37 @@ function createRenderSystem(internals) {
29073
29579
  ...unavailable3 ? { lastFailure: "scene-data-unavailable" } : {}
29074
29580
  };
29075
29581
  },
29582
+ get depthOfFieldInspection() {
29583
+ const camera = latestCamera;
29584
+ if (camera === void 0) return void 0;
29585
+ const graph = frameState.compiledFrameGraph?.inspect();
29586
+ return projectDepthOfFieldInspection({
29587
+ ...camera.depthOfField === void 0 ? {} : { params: camera.depthOfField },
29588
+ ...camera.depthOfFieldError === void 0 ? {} : { error: camera.depthOfFieldError },
29589
+ ...graph === void 0 ? {} : { graph },
29590
+ // The explicit property keeps the inspector on the submit-bound
29591
+ // transaction path even before the first accepted frame. A missing
29592
+ // property remains supported for direct structural callers/tests.
29593
+ accepted: frameState.depthOfFieldAccepted,
29594
+ ...frameState.depthOfFieldLastSubmitFailed === true ? { lastSubmitFailed: true } : {},
29595
+ // Inspection can be queried while the renderer is being assembled,
29596
+ // before a device scope has been published. Keep that observation
29597
+ // bounded instead of turning a not-yet-ready renderer into a getter
29598
+ // exception.
29599
+ deviceGeneration: internals.deviceScope?.generation ?? 0
29600
+ });
29601
+ },
29076
29602
  get temporalTargetInspection() {
29077
29603
  const graph = frameState.compiledFrameGraph?.inspect();
29078
29604
  if (graph === void 0) return void 0;
29079
29605
  const producer = graph.passes.find((pass) => pass.name === "standard-scene-data");
29080
- const target4 = graph.resources.find(
29606
+ const target5 = graph.resources.find(
29081
29607
  (resource) => resource.kind === "texture" && resource.label === "standard-scene-temporal"
29082
29608
  );
29083
- if (producer === void 0 || target4 === void 0) {
29609
+ if (producer === void 0 || target5 === void 0) {
29084
29610
  return void 0;
29085
29611
  }
29086
- const descriptor = target4.descriptor.kind === "texture" ? target4.descriptor : void 0;
29612
+ const descriptor = target5.descriptor.kind === "texture" ? target5.descriptor : void 0;
29087
29613
  const width = descriptor?.width ?? Math.max(1, internals.canvas.width);
29088
29614
  const height = descriptor?.height ?? Math.max(1, internals.canvas.height);
29089
29615
  return Object.freeze({
@@ -29580,6 +30106,7 @@ function createRenderSystem(internals) {
29580
30106
  const materialWorld = preparedWorlds[renderable.worldId];
29581
30107
  return projectMeshMaterialBindingObservation({
29582
30108
  worldId: renderable.worldId,
30109
+ ...materialWorld === void 0 ? {} : { worldIdentity: materialWorld.identity },
29583
30110
  entityKey: renderable.entityKey,
29584
30111
  bindings: renderable.materials.map((material, slotIndex) => ({
29585
30112
  handle: material.materialHandle ?? 0,
@@ -29885,6 +30412,26 @@ function createRenderSystem(internals) {
29885
30412
  internals.errorRegistry.fire(temporalCommit.error);
29886
30413
  }
29887
30414
  frameState.lastSuccessfulCameraAntialias = cameras[0]?.antialias;
30415
+ const submittedCamera = cameras[0];
30416
+ const submittedDepthOfField = submittedCamera === void 0 ? void 0 : resolveDepthOfFieldFrameParams(
30417
+ submittedCamera.depthOfField,
30418
+ submittedCamera.depthOfFieldError,
30419
+ frameState.depthOfFieldAccepted?.params
30420
+ );
30421
+ const submittedDepthOfFieldGraph = frameState.compiledFrameGraph?.inspect();
30422
+ if (submittedDepthOfField !== void 0 && submittedDepthOfFieldGraph !== void 0) {
30423
+ frameState.depthOfFieldAccepted = {
30424
+ params: submittedDepthOfField,
30425
+ graph: submittedDepthOfFieldGraph,
30426
+ deviceGeneration: internals.deviceScope.generation
30427
+ };
30428
+ frameState.depthOfFieldLastSubmitFailed = false;
30429
+ } else if (submittedDepthOfField === void 0) {
30430
+ frameState.depthOfFieldAccepted = void 0;
30431
+ frameState.depthOfFieldLastSubmitFailed = false;
30432
+ } else {
30433
+ frameState.depthOfFieldLastSubmitFailed = true;
30434
+ }
29888
30435
  internals.getPipelineState()?.perPassResources.commitBloomResources?.();
29889
30436
  const nextBloom = cameras[0]?.bloom ?? "off";
29890
30437
  if (frameState.lastSuccessfulBloom === "on" && nextBloom !== "on") {
@@ -29894,6 +30441,9 @@ function createRenderSystem(internals) {
29894
30441
  }
29895
30442
  frameState.lastSuccessfulBloom = nextBloom;
29896
30443
  } else {
30444
+ if (cameras[0]?.depthOfField !== void 0) {
30445
+ frameState.depthOfFieldLastSubmitFailed = true;
30446
+ }
29897
30447
  internals.getPipelineState()?.perPassResources.discardBloomResources?.();
29898
30448
  }
29899
30449
  if (!submitted && frameState.environmentGeneration !== void 0) {
@@ -29917,20 +30467,20 @@ function createRenderSystem(internals) {
29917
30467
  if (!retired.ok) internals.errorRegistry.fire(retired.error);
29918
30468
  }
29919
30469
  }
29920
- } catch (err53) {
30470
+ } catch (err54) {
29921
30471
  discardLiveFeatureState();
29922
30472
  if (!submitted) {
29923
30473
  internals.getPipelineState()?.perPassResources.discardBloomResources?.();
29924
30474
  }
29925
- const innerError = err53 instanceof PipelineSpecError ? {
29926
- name: err53.name,
29927
- code: err53.code,
29928
- message: err53.message,
29929
- detail: err53.detail
29930
- } : err53 instanceof RhiError ? err53 : {
30475
+ const innerError = err54 instanceof PipelineSpecError ? {
30476
+ name: err54.name,
30477
+ code: err54.code,
30478
+ message: err54.message,
30479
+ detail: err54.detail
30480
+ } : err54 instanceof RhiError ? err54 : {
29931
30481
  code: "unknown",
29932
- message: String(err53),
29933
- name: err53?.name
30482
+ message: String(err54),
30483
+ name: err54?.name
29934
30484
  };
29935
30485
  internals.errorRegistry.fire(
29936
30486
  new RhiError({
@@ -30207,6 +30757,7 @@ function createRenderSystem(internals) {
30207
30757
  frameState.volumetricFogHistorySlot = null;
30208
30758
  frameState.volumetricFogHistorySignature = null;
30209
30759
  frameState.hdrpClusterMembership = null;
30760
+ settleDepthOfFieldGraphCandidate(frameState, false);
30210
30761
  const compiled = frameState.compiledFrameGraph;
30211
30762
  frameState.compiledFrameGraph = null;
30212
30763
  frameState.compiledFrameGraphTopologyKey = null;
@@ -30214,6 +30765,14 @@ function createRenderSystem(internals) {
30214
30765
  frameState.standardLightingGraphSignature = "";
30215
30766
  frameState.standardLightingInspection = void 0;
30216
30767
  frameState.pointShadowInspection = void 0;
30768
+ frameState.depthOfFieldPreviousGraph = null;
30769
+ frameState.depthOfFieldPreviousGraphKey = null;
30770
+ frameState.depthOfFieldPreviousPerFrameGraph = void 0;
30771
+ frameState.depthOfFieldPreviousGraphGeneration = 0;
30772
+ frameState.depthOfFieldPreviousStandardLightingGraphSignature = "";
30773
+ frameState.depthOfFieldCandidateGraph = null;
30774
+ frameState.depthOfFieldAccepted = void 0;
30775
+ frameState.depthOfFieldLastSubmitFailed = false;
30217
30776
  if (compiled !== null) compiled.retire().catch(() => void 0);
30218
30777
  for (const retired of frameState.retiredCompiledFrameGraphs) {
30219
30778
  retired.retire().catch(() => void 0);
@@ -30283,12 +30842,19 @@ function createRenderSystem(internals) {
30283
30842
  frameState.ssrLastHistoryVersion = void 0;
30284
30843
  (retiringPipelineState ?? internals.getPipelineState())?.perPassResources.drainBloomResources?.();
30285
30844
  settleVolumetricFogGraphCandidate(frameState, false);
30845
+ settleDepthOfFieldGraphCandidate(frameState, false);
30286
30846
  frameState.compiledFrameGraph?.retire().catch(() => void 0);
30287
30847
  frameState.compiledFrameGraph = null;
30288
30848
  frameState.compiledFrameGraphTopologyKey = null;
30289
30849
  frameState.volumetricFogPreviousGraph = null;
30290
30850
  frameState.volumetricFogPreviousGraphKey = null;
30291
30851
  frameState.volumetricFogCandidateGraph = null;
30852
+ frameState.depthOfFieldPreviousGraph = null;
30853
+ frameState.depthOfFieldPreviousGraphKey = null;
30854
+ frameState.depthOfFieldPreviousPerFrameGraph = void 0;
30855
+ frameState.depthOfFieldPreviousGraphGeneration = 0;
30856
+ frameState.depthOfFieldPreviousStandardLightingGraphSignature = "";
30857
+ frameState.depthOfFieldCandidateGraph = null;
30292
30858
  frameState.volumetricFogAccepted = void 0;
30293
30859
  frameState.volumetricFogAcceptedContext = void 0;
30294
30860
  frameState.volumetricFogHistoryGraph = null;
@@ -30303,6 +30869,8 @@ function createRenderSystem(internals) {
30303
30869
  frameState.standardLightingGraphSignature = "";
30304
30870
  frameState.standardLightingInspection = void 0;
30305
30871
  frameState.pointShadowInspection = void 0;
30872
+ frameState.depthOfFieldAccepted = void 0;
30873
+ frameState.depthOfFieldLastSubmitFailed = false;
30306
30874
  frameState.directionalShadowCache = null;
30307
30875
  frameState.directionalShadowCacheRecorded = false;
30308
30876
  frameState.currentFrameObservationSource = void 0;
@@ -32923,7 +33491,7 @@ async function probeCandidateDeviceExecution(device) {
32923
33491
  }
32924
33492
  return outcome;
32925
33493
  }
32926
- async function probeCandidateGraphTarget(device, target4, encode) {
33494
+ async function probeCandidateGraphTarget(device, target5, encode) {
32927
33495
  let readback;
32928
33496
  let mapped;
32929
33497
  let outcome = err(
@@ -32969,7 +33537,7 @@ async function probeCandidateGraphTarget(device, target4, encode) {
32969
33537
  label: "renderer-recovery-graph-probe.pass",
32970
33538
  colorAttachments: [
32971
33539
  {
32972
- view: target4.view,
33540
+ view: target5.view,
32973
33541
  loadOp: "clear",
32974
33542
  storeOp: "store",
32975
33543
  clearValue: {
@@ -32995,7 +33563,7 @@ async function probeCandidateGraphTarget(device, target4, encode) {
32995
33563
  return outcome;
32996
33564
  }
32997
33565
  encoder.copyTextureToBuffer(
32998
- { texture: target4.texture },
33566
+ { texture: target5.texture },
32999
33567
  {
33000
33568
  buffer: readback,
33001
33569
  bytesPerRow: PROBE_READBACK_BYTES_PER_ROW,
@@ -33038,7 +33606,7 @@ async function probeCandidateGraphTarget(device, target4, encode) {
33038
33606
  return outcome;
33039
33607
  }
33040
33608
  mapped = mappedResult.value;
33041
- const rangeResult = mapped.getMappedRange(0, target4.format === "rgba16float" ? 8 : 4);
33609
+ const rangeResult = mapped.getMappedRange(0, target5.format === "rgba16float" ? 8 : 4);
33042
33610
  if (!rangeResult.ok) {
33043
33611
  outcome = err(
33044
33612
  recoveryDeviceProbeFailure(
@@ -33050,8 +33618,8 @@ async function probeCandidateGraphTarget(device, target4, encode) {
33050
33618
  return outcome;
33051
33619
  }
33052
33620
  const view = new DataView(rangeResult.value);
33053
- const actual = target4.format === "rgba16float" ? [0, 1, 2, 3].map((channel) => halfToFloat(view.getUint16(channel * 2, true))) : [0, 1, 2, 3].map((channel) => (view.getUint8(channel) ?? 0) / 255);
33054
- const epsilon = target4.format === "rgba16float" ? 0.02 : 2 / 255;
33621
+ const actual = target5.format === "rgba16float" ? [0, 1, 2, 3].map((channel) => halfToFloat(view.getUint16(channel * 2, true))) : [0, 1, 2, 3].map((channel) => (view.getUint8(channel) ?? 0) / 255);
33622
+ const epsilon = target5.format === "rgba16float" ? 0.02 : 2 / 255;
33055
33623
  if (!actual.every((value, index) => Math.abs(value - (PROBE_CLEAR[index] ?? 0)) <= epsilon)) {
33056
33624
  outcome = err(
33057
33625
  recoveryDeviceProbeFailure(
@@ -33091,18 +33659,18 @@ async function probeCandidateGraphTarget(device, target4, encode) {
33091
33659
  }
33092
33660
  return outcome;
33093
33661
  }
33094
- async function probeCandidateGraphExecution(device, target4) {
33662
+ async function probeCandidateGraphExecution(device, target5) {
33095
33663
  if (device.caps.backendKind === "null") return ok$1(void 0);
33096
33664
  const builder = new RenderGraphBuilder();
33097
33665
  const texture = builder.importTexture(
33098
33666
  "renderer-recovery-graph-execution-probe.texture",
33099
33667
  {
33100
- format: target4.format,
33668
+ format: target5.format,
33101
33669
  size: { width: 1, height: 1 },
33102
33670
  usage: PROBE_TEXTURE_USAGE_RENDER_ATTACHMENT | PROBE_TEXTURE_USAGE_COPY_SRC,
33103
33671
  dimension: "2d"
33104
33672
  },
33105
- () => target4.texture
33673
+ () => target5.texture
33106
33674
  );
33107
33675
  if (!texture.ok) {
33108
33676
  return err(
@@ -33116,7 +33684,7 @@ async function probeCandidateGraphExecution(device, target4) {
33116
33684
  const view = builder.importView(
33117
33685
  texture.value,
33118
33686
  { label: "renderer-recovery-graph-execution-probe.view", dimension: "2d" },
33119
- () => target4.view
33687
+ () => target5.view
33120
33688
  );
33121
33689
  if (!view.ok) {
33122
33690
  return err(
@@ -33164,7 +33732,7 @@ async function probeCandidateGraphExecution(device, target4) {
33164
33732
  );
33165
33733
  }
33166
33734
  try {
33167
- return await probeCandidateGraphTarget(device, target4, (encoder) => {
33735
+ return await probeCandidateGraphTarget(device, target5, (encoder) => {
33168
33736
  const executed = compiled.value.execute({ encoder });
33169
33737
  return executed.ok ? ok$1(void 0) : err(
33170
33738
  recoveryDeviceProbeFailure(
@@ -34037,8 +34605,8 @@ function token() {
34037
34605
  }
34038
34606
  function createRenderTargetOwner(options) {
34039
34607
  const targets = /* @__PURE__ */ new WeakMap();
34040
- const requireTarget = (target4, operation) => {
34041
- const state = targets.get(target4);
34608
+ const requireTarget = (target5, operation) => {
34609
+ const state = targets.get(target5);
34042
34610
  if (state === void 0) return invalid5(operation, "foreign-renderer", "destroyed", 0);
34043
34611
  if (state.rendererId !== options.rendererId) {
34044
34612
  return invalid5(operation, "foreign-renderer", state.state, state.generation);
@@ -34050,9 +34618,9 @@ function createRenderTargetOwner(options) {
34050
34618
  };
34051
34619
  return {
34052
34620
  create(descriptor) {
34053
- const target4 = token();
34054
- targets.set(target4, {
34055
- target: target4,
34621
+ const target5 = token();
34622
+ targets.set(target5, {
34623
+ target: target5,
34056
34624
  rendererId: options.rendererId,
34057
34625
  state: "uninitialized",
34058
34626
  generation: 0,
@@ -34060,10 +34628,10 @@ function createRenderTargetOwner(options) {
34060
34628
  candidate: void 0,
34061
34629
  retiredGenerations: /* @__PURE__ */ new Set()
34062
34630
  });
34063
- return { ok: true, value: target4 };
34631
+ return { ok: true, value: target5 };
34064
34632
  },
34065
- stage(target4, descriptor) {
34066
- const found = requireTarget(target4, "resize");
34633
+ stage(target5, descriptor) {
34634
+ const found = requireTarget(target5, "resize");
34067
34635
  if (!found.ok) return found;
34068
34636
  const state = found.value;
34069
34637
  if (state.state === "rebuilding") {
@@ -34077,8 +34645,8 @@ function createRenderTargetOwner(options) {
34077
34645
  state.state = "candidate";
34078
34646
  return { ok: true, value: candidate };
34079
34647
  },
34080
- promote(target4, generation) {
34081
- const found = requireTarget(target4, "resize");
34648
+ promote(target5, generation) {
34649
+ const found = requireTarget(target5, "resize");
34082
34650
  if (!found.ok) return found;
34083
34651
  const state = found.value;
34084
34652
  if (state.candidate?.generation !== generation) {
@@ -34090,8 +34658,8 @@ function createRenderTargetOwner(options) {
34090
34658
  state.state = "active";
34091
34659
  return { ok: true, value: void 0 };
34092
34660
  },
34093
- rejectCandidate(target4, generation, stage) {
34094
- const found = requireTarget(target4, "resize");
34661
+ rejectCandidate(target5, generation, stage) {
34662
+ const found = requireTarget(target5, "resize");
34095
34663
  if (!found.ok) return found;
34096
34664
  const state = found.value;
34097
34665
  if (state.candidate?.generation !== generation) {
@@ -34110,8 +34678,8 @@ function createRenderTargetOwner(options) {
34110
34678
  })
34111
34679
  };
34112
34680
  },
34113
- beginRecovery(target4, generation) {
34114
- const found = requireTarget(target4, "resize");
34681
+ beginRecovery(target5, generation) {
34682
+ const found = requireTarget(target5, "resize");
34115
34683
  if (!found.ok) return found;
34116
34684
  const state = found.value;
34117
34685
  if (state.state !== "active" || generation <= state.generation) {
@@ -34122,8 +34690,8 @@ function createRenderTargetOwner(options) {
34122
34690
  state.state = "rebuilding";
34123
34691
  return { ok: true, value: void 0 };
34124
34692
  },
34125
- finishRecovery(target4) {
34126
- const found = requireTarget(target4, "resize");
34693
+ finishRecovery(target5) {
34694
+ const found = requireTarget(target5, "resize");
34127
34695
  if (!found.ok) return found;
34128
34696
  const state = found.value;
34129
34697
  if (state.state !== "rebuilding") {
@@ -34132,14 +34700,14 @@ function createRenderTargetOwner(options) {
34132
34700
  state.state = "uninitialized";
34133
34701
  return { ok: true, value: void 0 };
34134
34702
  },
34135
- retire(target4, generation) {
34136
- const found = requireTarget(target4, "destroy");
34703
+ retire(target5, generation) {
34704
+ const found = requireTarget(target5, "destroy");
34137
34705
  if (!found.ok) return found;
34138
34706
  found.value.retiredGenerations.add(generation);
34139
34707
  return { ok: true, value: void 0 };
34140
34708
  },
34141
- destroy(target4) {
34142
- const state = targets.get(target4);
34709
+ destroy(target5) {
34710
+ const state = targets.get(target5);
34143
34711
  if (state === void 0) return invalid5("destroy", "foreign-renderer", "destroyed", 0);
34144
34712
  if (state.rendererId !== options.rendererId) {
34145
34713
  return invalid5("destroy", "foreign-renderer", state.state, state.generation);
@@ -34149,8 +34717,8 @@ function createRenderTargetOwner(options) {
34149
34717
  state.state = "destroyed";
34150
34718
  return { ok: true, value: void 0 };
34151
34719
  },
34152
- inspect(target4) {
34153
- const found = requireTarget(target4, "inspect");
34720
+ inspect(target5) {
34721
+ const found = requireTarget(target5, "inspect");
34154
34722
  if (!found.ok) return found;
34155
34723
  const state = found.value;
34156
34724
  return {
@@ -34188,7 +34756,7 @@ function bindRenderTargetReadbackTicket(ticket, receipt) {
34188
34756
  ticket.deviceGeneration = receipt.deviceGeneration;
34189
34757
  return { ok: true, value: void 0 };
34190
34758
  }
34191
- function createRenderTargetReadbackTicket(target4, input) {
34759
+ function createRenderTargetReadbackTicket(target5, input) {
34192
34760
  if (input.frameId !== void 0 && (!Number.isInteger(input.frameId) || input.frameId < 0) || !Number.isInteger(input.deviceGeneration) || input.deviceGeneration < 0 || !Number.isInteger(input.mipLevel) || input.mipLevel < 0 || !Number.isInteger(input.width) || input.width < 1 || !Number.isInteger(input.height) || input.height < 1 || !Number.isInteger(input.bytesPerPixel) || input.bytesPerPixel < 1) {
34193
34761
  return {
34194
34762
  ok: false,
@@ -34206,7 +34774,7 @@ function createRenderTargetReadbackTicket(target4, input) {
34206
34774
  return {
34207
34775
  ok: true,
34208
34776
  value: {
34209
- target: target4,
34777
+ target: target5,
34210
34778
  frameId: input.frameId,
34211
34779
  deviceGeneration: input.deviceGeneration,
34212
34780
  mipLevel: input.mipLevel,
@@ -34502,12 +35070,12 @@ function createRenderTargetHost(options = {}) {
34502
35070
  const readbacks = /* @__PURE__ */ new WeakMap();
34503
35071
  const readbackRecords = /* @__PURE__ */ new Set();
34504
35072
  const currentGeneration = () => options.getGeneration?.() ?? options.initialGeneration ?? 0;
34505
- const stagePhysical = (target4, descriptor) => {
34506
- const stagedTarget = owner.stage(target4, descriptor);
35073
+ const stagePhysical = (target5, descriptor) => {
35074
+ const stagedTarget = owner.stage(target5, descriptor);
34507
35075
  if (!stagedTarget.ok) return stagedTarget;
34508
35076
  const device = options.getDevice?.();
34509
35077
  if (device === void 0) {
34510
- staged.add(target4);
35078
+ staged.add(target5);
34511
35079
  return { ok: true, value: void 0 };
34512
35080
  }
34513
35081
  const physical = makePhysical(
@@ -34516,11 +35084,11 @@ function createRenderTargetHost(options = {}) {
34516
35084
  stagedTarget.value.generation
34517
35085
  );
34518
35086
  if (!physical.ok) {
34519
- owner.rejectCandidate(target4, stagedTarget.value.generation, "allocation");
35087
+ owner.rejectCandidate(target5, stagedTarget.value.generation, "allocation");
34520
35088
  return physical;
34521
35089
  }
34522
- candidatePhysical.set(target4, physical.value);
34523
- staged.add(target4);
35090
+ candidatePhysical.set(target5, physical.value);
35091
+ staged.add(target5);
34524
35092
  return { ok: true, value: void 0 };
34525
35093
  };
34526
35094
  return Object.freeze({
@@ -34543,13 +35111,13 @@ function createRenderTargetHost(options = {}) {
34543
35111
  if (created.ok) targets.add(created.value);
34544
35112
  return created;
34545
35113
  },
34546
- resizeRenderTarget(target4, descriptor) {
35114
+ resizeRenderTarget(target5, descriptor) {
34547
35115
  const admitted = admitRenderTargetDescriptor(descriptor, limits);
34548
35116
  if (!admitted.ok) return admitted;
34549
- return stagePhysical(target4, admitted.value);
35117
+ return stagePhysical(target5, admitted.value);
34550
35118
  },
34551
- createRenderTargetTextureSource(target4, sourceOptions) {
34552
- const inspected = owner.inspect(target4);
35119
+ createRenderTargetTextureSource(target5, sourceOptions) {
35120
+ const inspected = owner.inspect(target5);
34553
35121
  if (!inspected.ok) return inspected;
34554
35122
  if (!inspected.value.descriptor.sampled) {
34555
35123
  return {
@@ -34582,7 +35150,7 @@ function createRenderTargetHost(options = {}) {
34582
35150
  })
34583
35151
  };
34584
35152
  }
34585
- const binding = createRenderTargetMaterialSource(target4, inspected.value.descriptor, {
35153
+ const binding = createRenderTargetMaterialSource(target5, inspected.value.descriptor, {
34586
35154
  ...sourceOptions,
34587
35155
  generation: inspected.value.generation
34588
35156
  });
@@ -34599,8 +35167,8 @@ function createRenderTargetHost(options = {}) {
34599
35167
  if (binding.generation !== physical.generation) return binding;
34600
35168
  return { ...binding, textureView: view };
34601
35169
  },
34602
- requestTargetReadback(target4, request) {
34603
- const inspected = owner.inspect(target4);
35170
+ requestTargetReadback(target5, request) {
35171
+ const inspected = owner.inspect(target5);
34604
35172
  if (!inspected.ok) return inspected;
34605
35173
  if (!inspected.value.descriptor.readback) {
34606
35174
  return {
@@ -34668,7 +35236,7 @@ function createRenderTargetHost(options = {}) {
34668
35236
  })
34669
35237
  };
34670
35238
  }
34671
- const internalTicket = createRenderTargetReadbackTicket(target4, {
35239
+ const internalTicket = createRenderTargetReadbackTicket(target5, {
34672
35240
  deviceGeneration: inspected.value.generation,
34673
35241
  mipLevel: request.mipLevel,
34674
35242
  ...request.face === void 0 ? {} : { face: request.face },
@@ -34678,7 +35246,7 @@ function createRenderTargetHost(options = {}) {
34678
35246
  });
34679
35247
  if (!internalTicket.ok) return internalTicket;
34680
35248
  const record = {
34681
- target: target4,
35249
+ target: target5,
34682
35250
  request,
34683
35251
  ticket: internalTicket.value,
34684
35252
  ...buffer === void 0 ? {} : { buffer: buffer.value },
@@ -34775,31 +35343,31 @@ function createRenderTargetHost(options = {}) {
34775
35343
  }
34776
35344
  return { ok: true, value: Object.freeze(results) };
34777
35345
  },
34778
- destroyRenderTarget(target4) {
34779
- const destroyed = owner.destroy(target4);
35346
+ destroyRenderTarget(target5) {
35347
+ const destroyed = owner.destroy(target5);
34780
35348
  if (destroyed.ok) {
34781
- destroyPhysical(options.getDevice?.(), activePhysical.get(target4));
34782
- destroyPhysical(options.getDevice?.(), candidatePhysical.get(target4));
34783
- activePhysical.delete(target4);
34784
- candidatePhysical.delete(target4);
35349
+ destroyPhysical(options.getDevice?.(), activePhysical.get(target5));
35350
+ destroyPhysical(options.getDevice?.(), candidatePhysical.get(target5));
35351
+ activePhysical.delete(target5);
35352
+ candidatePhysical.delete(target5);
34785
35353
  for (const record of readbackRecords) {
34786
- if (record.target !== target4) continue;
35354
+ if (record.target !== target5) continue;
34787
35355
  if (record.buffer !== void 0) options.getDevice?.()?.destroyBuffer(record.buffer);
34788
35356
  readbacks.delete(record.ticket);
34789
35357
  readbackRecords.delete(record);
34790
35358
  }
34791
- targets.delete(target4);
35359
+ targets.delete(target5);
34792
35360
  }
34793
35361
  return destroyed;
34794
35362
  },
34795
35363
  beginFrame() {
34796
35364
  if (disposed) return;
34797
- for (const target4 of targets) {
34798
- const inspected = owner.inspect(target4);
35365
+ for (const target5 of targets) {
35366
+ const inspected = owner.inspect(target5);
34799
35367
  if (!inspected.ok || inspected.value.state === "active" || inspected.value.state === "candidate") {
34800
35368
  continue;
34801
35369
  }
34802
- stagePhysical(target4);
35370
+ stagePhysical(target5);
34803
35371
  }
34804
35372
  },
34805
35373
  onFrameSubmitted(completed = Promise.resolve({ ok: true, value: void 0 })) {
@@ -34807,40 +35375,40 @@ function createRenderTargetHost(options = {}) {
34807
35375
  const submittedTargets = [...staged];
34808
35376
  staged.clear();
34809
35377
  void completed.then((result) => {
34810
- for (const target4 of submittedTargets) {
34811
- const candidate = owner.inspect(target4);
35378
+ for (const target5 of submittedTargets) {
35379
+ const candidate = owner.inspect(target5);
34812
35380
  if (!candidate.ok || candidate.value.candidate === void 0) continue;
34813
35381
  if (!result.ok) {
34814
- owner.rejectCandidate(target4, candidate.value.candidate.generation, "submit");
34815
- destroyPhysical(options.getDevice?.(), candidatePhysical.get(target4));
34816
- candidatePhysical.delete(target4);
35382
+ owner.rejectCandidate(target5, candidate.value.candidate.generation, "submit");
35383
+ destroyPhysical(options.getDevice?.(), candidatePhysical.get(target5));
35384
+ candidatePhysical.delete(target5);
34817
35385
  continue;
34818
35386
  }
34819
- if (options.canPromoteTarget?.(target4) === false) {
34820
- staged.add(target4);
35387
+ if (options.canPromoteTarget?.(target5) === false) {
35388
+ staged.add(target5);
34821
35389
  continue;
34822
35390
  }
34823
35391
  const generation = candidate.value.candidate.generation;
34824
- const physical = candidatePhysical.get(target4);
35392
+ const physical = candidatePhysical.get(target5);
34825
35393
  if (physical === void 0) {
34826
- owner.rejectCandidate(target4, generation, "submit");
35394
+ owner.rejectCandidate(target5, generation, "submit");
34827
35395
  continue;
34828
35396
  }
34829
- const promoted = owner.promote(target4, generation);
35397
+ const promoted = owner.promote(target5, generation);
34830
35398
  if (!promoted.ok) {
34831
35399
  destroyPhysical(options.getDevice?.(), physical);
34832
- candidatePhysical.delete(target4);
35400
+ candidatePhysical.delete(target5);
34833
35401
  continue;
34834
35402
  }
34835
- const previous = activePhysical.get(target4);
34836
- activePhysical.set(target4, physical);
34837
- candidatePhysical.delete(target4);
35403
+ const previous = activePhysical.get(target5);
35404
+ activePhysical.set(target5, physical);
35405
+ candidatePhysical.delete(target5);
34838
35406
  destroyPhysical(options.getDevice?.(), previous);
34839
35407
  }
34840
35408
  });
34841
35409
  },
34842
- getPhysicalTarget(target4) {
34843
- return candidatePhysical.get(target4) ?? activePhysical.get(target4);
35410
+ getPhysicalTarget(target5) {
35411
+ return candidatePhysical.get(target5) ?? activePhysical.get(target5);
34844
35412
  },
34845
35413
  encodePendingReadbacks(encoder, faces) {
34846
35414
  for (const record of readbackRecords) {
@@ -34871,37 +35439,37 @@ function createRenderTargetHost(options = {}) {
34871
35439
  recover() {
34872
35440
  if (disposed) return;
34873
35441
  const generation = currentGeneration();
34874
- for (const target4 of targets) {
34875
- const inspected = owner.inspect(target4);
35442
+ for (const target5 of targets) {
35443
+ const inspected = owner.inspect(target5);
34876
35444
  if (!inspected.ok || inspected.value.state !== "active") continue;
34877
- destroyPhysical(options.getDevice?.(), activePhysical.get(target4));
34878
- destroyPhysical(options.getDevice?.(), candidatePhysical.get(target4));
34879
- activePhysical.delete(target4);
34880
- candidatePhysical.delete(target4);
35445
+ destroyPhysical(options.getDevice?.(), activePhysical.get(target5));
35446
+ destroyPhysical(options.getDevice?.(), candidatePhysical.get(target5));
35447
+ activePhysical.delete(target5);
35448
+ candidatePhysical.delete(target5);
34881
35449
  for (const record of readbackRecords) {
34882
- if (record.target !== target4) continue;
35450
+ if (record.target !== target5) continue;
34883
35451
  if (record.buffer !== void 0) options.getDevice?.()?.destroyBuffer(record.buffer);
34884
35452
  readbacks.delete(record.ticket);
34885
35453
  readbackRecords.delete(record);
34886
35454
  }
34887
- const begun = owner.beginRecovery(target4, generation);
34888
- if (begun.ok) owner.finishRecovery(target4);
35455
+ const begun = owner.beginRecovery(target5, generation);
35456
+ if (begun.ok) owner.finishRecovery(target5);
34889
35457
  }
34890
35458
  },
34891
35459
  dispose() {
34892
35460
  disposed = true;
34893
- for (const target4 of [...targets]) {
34894
- destroyPhysical(options.getDevice?.(), activePhysical.get(target4));
34895
- destroyPhysical(options.getDevice?.(), candidatePhysical.get(target4));
35461
+ for (const target5 of [...targets]) {
35462
+ destroyPhysical(options.getDevice?.(), activePhysical.get(target5));
35463
+ destroyPhysical(options.getDevice?.(), candidatePhysical.get(target5));
34896
35464
  for (const record of readbackRecords) {
34897
- if (record.target !== target4) continue;
35465
+ if (record.target !== target5) continue;
34898
35466
  if (record.buffer !== void 0) options.getDevice?.()?.destroyBuffer(record.buffer);
34899
35467
  readbacks.delete(record.ticket);
34900
35468
  readbackRecords.delete(record);
34901
35469
  }
34902
- activePhysical.delete(target4);
34903
- candidatePhysical.delete(target4);
34904
- owner.destroy(target4);
35470
+ activePhysical.delete(target5);
35471
+ candidatePhysical.delete(target5);
35472
+ owner.destroy(target5);
34905
35473
  }
34906
35474
  targets.clear();
34907
35475
  staged.clear();
@@ -35786,11 +36354,11 @@ function createMeshSsboGrowController(init) {
35786
36354
  if (state.slotCount >= neededSlots) {
35787
36355
  return { ok: true };
35788
36356
  }
35789
- let target4 = state.slotCount > 0 ? state.slotCount : 1;
35790
- while (target4 < neededSlots) target4 = target4 * 2;
35791
- target4 = Math.max(target4, nextPow2(neededSlots));
36357
+ let target5 = state.slotCount > 0 ? state.slotCount : 1;
36358
+ while (target5 < neededSlots) target5 = target5 * 2;
36359
+ target5 = Math.max(target5, nextPow2(neededSlots));
35792
36360
  const ceilingBytes = deriveStorageBufferCeiling(device.limits);
35793
- const targetBytes = target4 * perEntityStride;
36361
+ const targetBytes = target5 * perEntityStride;
35794
36362
  if (targetBytes > ceilingBytes) {
35795
36363
  errorRegistry.fire(
35796
36364
  new MeshSsboCeilingReachedError(neededSlots, state.slotCount, ceilingBytes)
@@ -35801,7 +36369,7 @@ function createMeshSsboGrowController(init) {
35801
36369
  degradedToSlotCount: state.slotCount
35802
36370
  };
35803
36371
  }
35804
- allocBufferPair(target4);
36372
+ allocBufferPair(target5);
35805
36373
  if (state.slotCount < neededSlots) {
35806
36374
  errorRegistry.fire(
35807
36375
  new MeshSsboCapacityExceededError(neededSlots, state.slotCount, ceilingBytes)
@@ -35973,7 +36541,7 @@ async function prewarmMipmapPipeline(rhiDevice, gpuStore, hasMaterialManifest) {
35973
36541
  }
35974
36542
 
35975
36543
  // src/assembly/webgpu-ready.ts
35976
- async function buildReadyWebGPU(rhiDevice, rendererScope, getShader, gpuStore, asyncCreateShaderModule, errorRegistry, requiredMaterialShaders, standardPbrShaderUvSetCount, requiredFullscreenPostProcesses, setGrowMeshSsboHook, seedShaderModule, seedMaterialShaderPipelineCache, registerBuiltinTonemap, registerBuiltinFxaa, registerBuiltinTemporalPostProcesses, setVolumetricFogShaderSources, setSsrShaderSources, setAtmosphereShaderSources) {
36544
+ async function buildReadyWebGPU(rhiDevice, rendererScope, getShader, gpuStore, asyncCreateShaderModule, errorRegistry, requiredMaterialShaders, standardPbrShaderUvSetCount, requiredFullscreenPostProcesses, setGrowMeshSsboHook, seedShaderModule, seedMaterialShaderPipelineCache, registerBuiltinTonemap, registerBuiltinFxaa, registerBuiltinTemporalPostProcesses, registerBuiltinDepthOfField, setVolumetricFogShaderSources, setSsrShaderSources, setAtmosphereShaderSources) {
35977
36545
  const extendedLightingShaderAvailable = deriveExtendedLightingCapability(rhiDevice).admitted;
35978
36546
  const capValue = rhiDevice.limits.maxStorageBuffersPerShaderStage;
35979
36547
  const webgl2Downlevel = rhiDevice.caps.backendKind === "wgpu-webgl2";
@@ -36578,6 +37146,7 @@ async function buildReadyWebGPU(rhiDevice, rendererScope, getShader, gpuStore, a
36578
37146
  };
36579
37147
  await prewarmTemporal(motionBlurEntry, "forgeax.motion-blur");
36580
37148
  await prewarmTemporal(taaResolveEntry, "forgeax.taa-resolve");
37149
+ await prewarmDepthOfField(manifestEntries, prewarmTemporal, registerBuiltinDepthOfField);
36581
37150
  registerBuiltinTemporalPostProcesses({
36582
37151
  ...motionBlurEntry === void 0 ? {} : { motionBlur: motionBlurEntry.wgsl },
36583
37152
  ...taaResolveEntry === void 0 ? {} : { taaResolve: taaResolveEntry.wgsl }
@@ -37448,11 +38017,11 @@ async function buildReadyWebGPU(rhiDevice, rendererScope, getShader, gpuStore, a
37448
38017
  }
37449
38018
  try {
37450
38019
  getOrBuildPipeline(spec, pipelineDeviceProvider, pipelineCache, modules);
37451
- } catch (err53) {
37452
- if (err53 instanceof PipelineSpecError) throw err53;
38020
+ } catch (err54) {
38021
+ if (err54 instanceof PipelineSpecError) throw err54;
37453
38022
  throw new PipelineSpecError({
37454
38023
  code: "pipeline-build-failed",
37455
- detail: { cause: err53 },
38024
+ detail: { cause: err54 },
37456
38025
  hint: `Boot-time SPEC_CONST pre-warm failed for shader '${spec.shader.id}'; inspect gpuMessage on the cause`
37457
38026
  });
37458
38027
  }
@@ -37621,11 +38190,11 @@ async function buildReadyWebGPU(rhiDevice, rendererScope, getShader, gpuStore, a
37621
38190
  pipelineCache,
37622
38191
  modules
37623
38192
  );
37624
- } catch (err53) {
37625
- if (err53 instanceof PipelineSpecError) throw err53;
38193
+ } catch (err54) {
38194
+ if (err54 instanceof PipelineSpecError) throw err54;
37626
38195
  throw new PipelineSpecError({
37627
38196
  code: "pipeline-build-failed",
37628
- detail: { cause: err53 },
38197
+ detail: { cause: err54 },
37629
38198
  hint: "createRenderPipeline (fxaa fullscreen) failed; inspect gpuMessage"
37630
38199
  });
37631
38200
  }
@@ -37879,11 +38448,11 @@ async function buildReadyWebGPU(rhiDevice, rendererScope, getShader, gpuStore, a
37879
38448
  bloomBrightPipelineHandle,
37880
38449
  () => void 0
37881
38450
  );
37882
- } catch (err53) {
37883
- if (err53 instanceof PipelineSpecError) throw err53;
38451
+ } catch (err54) {
38452
+ if (err54 instanceof PipelineSpecError) throw err54;
37884
38453
  throw new PipelineSpecError({
37885
38454
  code: "pipeline-build-failed",
37886
- detail: { cause: err53 },
38455
+ detail: { cause: err54 },
37887
38456
  hint: "createRenderPipeline (bloom-bright fullscreen) failed; inspect gpuMessage"
37888
38457
  });
37889
38458
  }
@@ -37980,11 +38549,11 @@ async function buildReadyWebGPU(rhiDevice, rendererScope, getShader, gpuStore, a
37980
38549
  bloomBlurHPipelineHandle,
37981
38550
  () => void 0
37982
38551
  );
37983
- } catch (err53) {
37984
- if (err53 instanceof PipelineSpecError) throw err53;
38552
+ } catch (err54) {
38553
+ if (err54 instanceof PipelineSpecError) throw err54;
37985
38554
  throw new PipelineSpecError({
37986
38555
  code: "pipeline-build-failed",
37987
- detail: { cause: err53 },
38556
+ detail: { cause: err54 },
37988
38557
  hint: "createRenderPipeline (bloom-blur-h fullscreen) failed; inspect gpuMessage"
37989
38558
  });
37990
38559
  }
@@ -38101,11 +38670,11 @@ async function buildReadyWebGPU(rhiDevice, rendererScope, getShader, gpuStore, a
38101
38670
  bloomCompositePipelineHandle,
38102
38671
  () => void 0
38103
38672
  );
38104
- } catch (err53) {
38105
- if (err53 instanceof PipelineSpecError) throw err53;
38673
+ } catch (err54) {
38674
+ if (err54 instanceof PipelineSpecError) throw err54;
38106
38675
  throw new PipelineSpecError({
38107
38676
  code: "pipeline-build-failed",
38108
- detail: { cause: err53 },
38677
+ detail: { cause: err54 },
38109
38678
  hint: "createRenderPipeline (bloom-composite fullscreen) failed; inspect gpuMessage"
38110
38679
  });
38111
38680
  }
@@ -38395,11 +38964,11 @@ async function buildReadyWebGPU(rhiDevice, rendererScope, getShader, gpuStore, a
38395
38964
  pipelineCache,
38396
38965
  { ...baseModules, fragmentEntryPoint: "fs_ssao_calc" }
38397
38966
  );
38398
- } catch (err53) {
38399
- if (err53 instanceof PipelineSpecError) throw err53;
38967
+ } catch (err54) {
38968
+ if (err54 instanceof PipelineSpecError) throw err54;
38400
38969
  throw new PipelineSpecError({
38401
38970
  code: "pipeline-build-failed",
38402
- detail: { cause: err53 },
38971
+ detail: { cause: err54 },
38403
38972
  hint: "createRenderPipeline (ssao-calc fullscreen) failed; inspect gpuMessage"
38404
38973
  });
38405
38974
  }
@@ -38430,11 +38999,11 @@ async function buildReadyWebGPU(rhiDevice, rendererScope, getShader, gpuStore, a
38430
38999
  pipelineCache,
38431
39000
  { ...baseModules, fragmentEntryPoint: "fs_ssao_blur" }
38432
39001
  );
38433
- } catch (err53) {
38434
- if (err53 instanceof PipelineSpecError) throw err53;
39002
+ } catch (err54) {
39003
+ if (err54 instanceof PipelineSpecError) throw err54;
38435
39004
  throw new PipelineSpecError({
38436
39005
  code: "pipeline-build-failed",
38437
- detail: { cause: err53 },
39006
+ detail: { cause: err54 },
38438
39007
  hint: "createRenderPipeline (ssao-blur fullscreen) failed; inspect gpuMessage"
38439
39008
  });
38440
39009
  }
@@ -38677,8 +39246,8 @@ async function tryCreateWebGPURenderer(canvas, options, pack, bundler, createRen
38677
39246
  if (pack._internal_getRawDevice && pack.translateErrorEventToRhiError) {
38678
39247
  const backendDevice = pack._internal_getRawDevice(device);
38679
39248
  if (backendDevice && typeof backendDevice === "object") {
38680
- const target4 = backendDevice;
38681
- target4.onuncapturederror = (event) => {
39249
+ const target5 = backendDevice;
39250
+ target5.onuncapturederror = (event) => {
38682
39251
  const translated = pack.translateErrorEventToRhiError?.(event);
38683
39252
  if (translated && !translated.ok) errorRegistry.fire(translated.error);
38684
39253
  };
@@ -39165,7 +39734,7 @@ async function makeWebGPURenderer(internals) {
39165
39734
  rendererId: /* @__PURE__ */ Symbol("renderer"),
39166
39735
  getGeneration: () => renderTargetGeneration,
39167
39736
  getDevice: () => renderTargetDevice,
39168
- canPromoteTarget: (target4) => renderSystemForTargetPromotion?.isCubeCapturePending(target4) !== true
39737
+ canPromoteTarget: (target5) => renderSystemForTargetPromotion?.isCubeCapturePending(target5) !== true
39169
39738
  });
39170
39739
  const metrics = createEngineMetrics();
39171
39740
  let extendedLightingState = createExtendedLightingState(activeDeviceScope.generation);
@@ -39631,9 +40200,8 @@ async function makeWebGPURenderer(internals) {
39631
40200
  };
39632
40201
  extendedLightingState = promoteExtendedLightingCandidate(extendedLightingState, candidate);
39633
40202
  };
39634
- let tonemapRegistered = false;
39635
- let fxaaRegistered = false;
39636
- let temporalPostProcessesRegistered = false;
40203
+ let tonemapRegistered = false, fxaaRegistered = false;
40204
+ let temporalPostProcessesRegistered = false, depthOfFieldRegistered = false;
39637
40205
  const buildPipeline = (scope = activeDeviceScope, device = currentBuildDevice(), residencyStore = gpuStore) => buildReadyWebGPU(
39638
40206
  device,
39639
40207
  scope,
@@ -39648,7 +40216,6 @@ async function makeWebGPURenderer(internals) {
39648
40216
  ),
39649
40217
  materialShaderUvSetCounts.get("forgeax::default-standard-pbr") ?? 0,
39650
40218
  requiredFullscreenPostProcesses,
39651
- // Publish growth and capacity together for the active or candidate device.
39652
40219
  (hook, state) => {
39653
40220
  if (candidateBuildState !== void 0) {
39654
40221
  candidateBuildState.growMeshSsbo = hook;
@@ -39658,12 +40225,10 @@ async function makeWebGPURenderer(internals) {
39658
40225
  internals.meshSsboState = state;
39659
40226
  }
39660
40227
  },
39661
- // Both module adapters consume the generation's eager shader cache.
39662
40228
  (label, module) => {
39663
40229
  getShaderModuleAdapter().seedModule(label, module);
39664
40230
  getImmediateShaderModuleAdapter().seedModule(label, module);
39665
40231
  },
39666
- // Prewarm only the active build generation's material pipeline cache.
39667
40232
  (key, pso, group2Contract) => {
39668
40233
  const pipelineCache = currentPipelineCacheState().materialShaderPipelineCache;
39669
40234
  if (!pipelineCache.has(key)) {
@@ -39671,7 +40236,6 @@ async function makeWebGPURenderer(internals) {
39671
40236
  }
39672
40237
  materialShaderPipelineGroup2Contracts.set(pso, group2Contract);
39673
40238
  },
39674
- // Register the output transform after manifest loading, once RenderSystem exists.
39675
40239
  (source) => {
39676
40240
  if (candidateBuildState !== void 0 || tonemapRegistered) return;
39677
40241
  renderSystem.registerBuiltinPostProcess(STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, {
@@ -39708,6 +40272,11 @@ async function makeWebGPURenderer(internals) {
39708
40272
  }
39709
40273
  temporalPostProcessesRegistered = true;
39710
40274
  },
40275
+ (entries) => {
40276
+ if (candidateBuildState !== void 0 || depthOfFieldRegistered) return;
40277
+ registerDepthOfFieldBuiltins(renderSystem, entries);
40278
+ depthOfFieldRegistered = true;
40279
+ },
39711
40280
  (sources) => {
39712
40281
  internals.volumetricFogShaders = sources;
39713
40282
  },
@@ -40353,7 +40922,7 @@ async function makeWebGPURenderer(internals) {
40353
40922
  set gpuPassTimingBeginReason(reason2) {
40354
40923
  internals.gpuPassTimingBeginReason = reason2;
40355
40924
  },
40356
- getRenderTargetPhysical: (target4) => renderTargetHost.getPhysicalTarget(target4),
40925
+ getRenderTargetPhysical: (target5) => renderTargetHost.getPhysicalTarget(target5),
40357
40926
  resolveRenderTargetTextureSource: (source) => renderTargetHost.resolveRenderTargetTextureSource(source),
40358
40927
  encodeRenderTargetReadbacks: (encoder, faces) => renderTargetHost.encodePendingReadbacks(encoder, faces),
40359
40928
  get volumetricFogShaders() {
@@ -40557,10 +41126,10 @@ async function makeWebGPURenderer(internals) {
40557
41126
  },
40558
41127
  ...dynamicGeometryHost,
40559
41128
  createRenderTarget: (descriptor) => renderTargetHost.createRenderTarget(descriptor),
40560
- resizeRenderTarget: (target4, descriptor) => renderTargetHost.resizeRenderTarget(target4, descriptor),
40561
- createRenderTargetTextureSource: (target4, options) => renderTargetHost.createRenderTargetTextureSource(target4, options),
40562
- requestTargetReadback: (target4, request) => renderTargetHost.requestTargetReadback(target4, request),
40563
- destroyRenderTarget: (target4) => renderTargetHost.destroyRenderTarget(target4),
41129
+ resizeRenderTarget: (target5, descriptor) => renderTargetHost.resizeRenderTarget(target5, descriptor),
41130
+ createRenderTargetTextureSource: (target5, options) => renderTargetHost.createRenderTargetTextureSource(target5, options),
41131
+ requestTargetReadback: (target5, request) => renderTargetHost.requestTargetReadback(target5, request),
41132
+ destroyRenderTarget: (target5) => renderTargetHost.destroyRenderTarget(target5),
40564
41133
  setProfile(profile) {
40565
41134
  const invalid6 = validateRenderProfile(profile);
40566
41135
  if (invalid6 !== void 0) {
@@ -40678,6 +41247,7 @@ async function makeWebGPURenderer(internals) {
40678
41247
  directionalShadow,
40679
41248
  ...renderSystem.temporalTargetInspection === void 0 ? {} : { temporalTarget: Object.freeze(renderSystem.temporalTargetInspection) },
40680
41249
  ...renderSystem.motionBlurInspection === void 0 ? {} : { motionBlur: Object.freeze(renderSystem.motionBlurInspection) },
41250
+ ...dofInspection(renderSystem.depthOfFieldInspection),
40681
41251
  ...renderSystem.lodOcclusionInspection === void 0 ? {} : { lodOcclusion: Object.freeze(renderSystem.lodOcclusionInspection) },
40682
41252
  ...renderSystem.transmission === void 0 ? {} : { transmission: renderSystem.transmission },
40683
41253
  ...standardLighting === void 0 ? {} : { standardLighting: Object.freeze({ ...standardLighting }) },