@forgeax/engine-render 0.1.35 → 0.1.37

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 (101) hide show
  1. package/README.md +28 -0
  2. package/dist/assembly/host-contract.d.ts +2 -2
  3. package/dist/assembly/host-contract.d.ts.map +1 -1
  4. package/dist/assembly/webgpu-vertex-layouts.d.ts.map +1 -1
  5. package/dist/{chunk-MZ4C7EHF.mjs → chunk-3F5XYSN3.mjs} +5 -5
  6. package/dist/{chunk-MZ4C7EHF.mjs.map → chunk-3F5XYSN3.mjs.map} +1 -1
  7. package/dist/{chunk-G6HDNGY7.mjs → chunk-3O2BBKEL.mjs} +24 -230
  8. package/dist/chunk-3O2BBKEL.mjs.map +1 -0
  9. package/dist/{chunk-MXTWKZO4.mjs → chunk-ARLAEJ45.mjs} +225 -4
  10. package/dist/chunk-ARLAEJ45.mjs.map +1 -0
  11. package/dist/{chunk-3XUBWRY2.mjs → chunk-E4NJYUJ2.mjs} +4 -4
  12. package/dist/{chunk-3XUBWRY2.mjs.map → chunk-E4NJYUJ2.mjs.map} +1 -1
  13. package/dist/{chunk-LM5IE7GF.mjs → chunk-N7NVXQWI.mjs} +3 -3
  14. package/dist/{chunk-LM5IE7GF.mjs.map → chunk-N7NVXQWI.mjs.map} +1 -1
  15. package/dist/{chunk-SGPUJW3F.mjs → chunk-NMSOOXBB.mjs} +3 -3
  16. package/dist/{chunk-SGPUJW3F.mjs.map → chunk-NMSOOXBB.mjs.map} +1 -1
  17. package/dist/{chunk-LNIUIKQ7.mjs → chunk-SJIPVWNB.mjs} +79 -21
  18. package/dist/chunk-SJIPVWNB.mjs.map +1 -0
  19. package/dist/construct-renderer.mjs +141 -74
  20. package/dist/construct-renderer.mjs.map +1 -1
  21. package/dist/device/device-scope.d.ts.map +1 -1
  22. package/dist/features/particle-mesh-layout.d.ts +19 -0
  23. package/dist/features/particle-mesh-layout.d.ts.map +1 -0
  24. package/dist/features/types.d.ts +5 -1
  25. package/dist/features/types.d.ts.map +1 -1
  26. package/dist/gpu-driven/production-raster.d.ts +1 -1
  27. package/dist/gpu-driven/production-raster.d.ts.map +1 -1
  28. package/dist/gpu-driven/shadow-views.d.ts +1 -1
  29. package/dist/gpu-driven/shadow-views.d.ts.map +1 -1
  30. package/dist/gpu-driven/view-gpu.d.ts +1 -1
  31. package/dist/gpu-driven/view-gpu.d.ts.map +1 -1
  32. package/dist/ibl/IblPipelineCache.d.ts.map +1 -1
  33. package/dist/index.mjs +48 -36
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/internal.mjs +5 -5
  36. package/dist/pbr-pipeline.d.ts.map +1 -1
  37. package/dist/publication/publisher.d.ts +1 -0
  38. package/dist/publication/publisher.d.ts.map +1 -1
  39. package/dist/record/frame.d.ts.map +1 -1
  40. package/dist/record/prepared-material-bindings.d.ts +1 -2
  41. package/dist/record/prepared-material-bindings.d.ts.map +1 -1
  42. package/dist/record/render-context.d.ts +2 -0
  43. package/dist/record/render-context.d.ts.map +1 -1
  44. package/dist/record/shadow-pass.d.ts +2 -2
  45. package/dist/record/shadow-pass.d.ts.map +1 -1
  46. package/dist/record/typed-frame-graph.d.ts.map +1 -1
  47. package/dist/recovery/render-system-candidate.d.ts +1 -8
  48. package/dist/recovery/render-system-candidate.d.ts.map +1 -1
  49. package/dist/render-contract.d.ts +2 -2
  50. package/dist/render-contract.d.ts.map +1 -1
  51. package/dist/render-system-extract-tail.d.ts.map +1 -1
  52. package/dist/render-system-extract.d.ts.map +1 -1
  53. package/dist/render-system.d.ts +2 -1
  54. package/dist/render-system.d.ts.map +1 -1
  55. package/dist/scene/render-scene.d.ts +2 -1
  56. package/dist/scene/render-scene.d.ts.map +1 -1
  57. package/dist/temporal/index.mjs +4 -4
  58. package/dist/typed-shadow-passes.d.ts.map +1 -1
  59. package/package.json +21 -21
  60. package/src/__tests__/device-scope-lifecycle.unit.test.ts +26 -0
  61. package/src/__tests__/gpu-driven-production.integration.test.ts +41 -1
  62. package/src/__tests__/gpu-driven-shadow-views.unit.test.ts +23 -0
  63. package/src/__tests__/ibl/precompute-submission.unit.test.ts +123 -0
  64. package/src/__tests__/ibl-residency-publication.unit.test.ts +0 -16
  65. package/src/__tests__/material-vertex-texture.browser.test.ts +7 -0
  66. package/src/__tests__/material-vertex-texture.dawn.test.ts +7 -0
  67. package/src/__tests__/material-vertex-texture.fixture.ts +31 -0
  68. package/src/__tests__/recovery-candidate-prepare.contract.test.ts +5 -0
  69. package/src/__tests__/renderer-factory-material-contract.unit.test.ts +106 -4
  70. package/src/__tests__/runtime-material-program.integration.test.ts +79 -0
  71. package/src/__tests__/vertex-layouts-ssot.unit.test.ts +23 -3
  72. package/src/assembly/host-contract.ts +2 -2
  73. package/src/assembly/webgpu-renderer.ts +12 -9
  74. package/src/assembly/webgpu-vertex-layouts.ts +2 -9
  75. package/src/device/device-scope.ts +3 -0
  76. package/src/features/particle-mesh-layout.ts +25 -0
  77. package/src/features/types.ts +5 -1
  78. package/src/gpu-driven/production-raster.ts +23 -6
  79. package/src/gpu-driven/shadow-views.ts +27 -2
  80. package/src/gpu-driven/view-gpu.ts +5 -0
  81. package/src/ibl/IblPipelineCache.ts +4 -3
  82. package/src/pbr-pipeline.ts +4 -1
  83. package/src/publication/__tests__/features.integration.test.ts +51 -0
  84. package/src/publication/__tests__/publication.integration.test.ts +59 -0
  85. package/src/publication/publisher.ts +56 -29
  86. package/src/record/__tests__/prepared-runtime-material.integration.test.ts +134 -0
  87. package/src/record/frame.ts +45 -6
  88. package/src/record/prepared-material-bindings.ts +11 -37
  89. package/src/record/render-context.ts +2 -0
  90. package/src/record/shadow-pass.ts +65 -4
  91. package/src/record/typed-frame-graph.ts +5 -1
  92. package/src/recovery/render-system-candidate.ts +1 -9
  93. package/src/render-contract.ts +2 -2
  94. package/src/render-system-extract-tail.ts +15 -6
  95. package/src/render-system-extract.ts +9 -2
  96. package/src/render-system.ts +2 -3
  97. package/src/scene/render-scene.ts +4 -2
  98. package/src/typed-shadow-passes.ts +36 -5
  99. package/dist/chunk-G6HDNGY7.mjs.map +0 -1
  100. package/dist/chunk-LNIUIKQ7.mjs.map +0 -1
  101. package/dist/chunk-MXTWKZO4.mjs.map +0 -1
@@ -1,17 +1,17 @@
1
- import { RenderPublicationError, BARREL_DISTORTION_FEATURE_IDENTITY, createBarrelDistortionRenderFeature, createRenderTargetHost, RenderPublicationTargetReceiver, registerRenderSourceSystems, publicationFrameDependencies, publicationDependencies, inspectVolumetricFog, renderMaterialContext, resolveSsrAdmissionGeneration, inspectLodOcclusion, zeroSsrAdmissionWork, projectSsrSpatialInspection, createDynamicGeometryLifecycle, inspectReflectionFallback, admitReflectionProbe, DEFAULT_REFLECTION_PROBE_LIMITS, buildReflectionProbeTable, advanceProbeFilter, commitProbeFilterStep, resolveReflectionFallbackSource, deriveReflectionFallbackProjection, reflectionFallbackCoverage, reflectionFallbackSourceKey, reflectionFallbackProjectionSignature, createProbeFilterState, ReflectionProbeProjection, RENDERABLE_SOURCE_COMPONENTS, isRenderableMember, createRenderSourceState, createGlobalTransformChangeQuery, admitPointsLines, projectSsrDependencies, resolveShadowMapSize, resolveSpotShadowMapSize, admitSsrSpatial, acquireSwapChainTarget, BARREL_DISTORTION_POST_PROCESS_ID, graphExecutionPhase, inspectPointShadow, admitSingleLayerMediumSubmission, createCloudShadowProjection, CLOUD_LAYER_FEATURE_IDENTITY, ReadonlyDynamicInputPage, DynamicGeometryError, resolveDirectionalShadowAtlasGrid, sameCandidateCredential } from './chunk-MZ4C7EHF.mjs';
2
- import { createExtendedLightingState, promoteExtendedLightingCandidate, emptyBloomInspection, projectExtendedLightingInspection, OcclusionRenderRuntime, viewKey, primitiveKey, projectBarrelDistortionInspection, viewKeyId, primitiveKeyId, ProbeBlendSceneProjection, createSsrHistoryOwner, createSsrSpatialResources } from './chunk-3XUBWRY2.mjs';
3
- import { DEFAULT_DEPTH_OF_FIELD_PARAMS, extractFrames, projectMeshMaterialBindingObservation, resolveDepthOfFieldFrameParams, buildCubeCameraFaceViews, Instances, Visibility, SKYLIGHT_RECOVERY_FALLBACK, hasVolumetricFogCapability, packDepthOfFieldParams, InstanceBoundsCache, fingerprintNumericArray, Points, Lines, buildShadowFrusta, cloudShadowResolutionForQuality, CUBE_CAMERA_FACE_ORDER, createBarrelDistortionMapping, attachBarrelDistortionCameraFrame, MeshFilter, MAX_VOLUMETRIC_FOG_OWNERS, MeshRenderer, createCookieProjectionMatrixData } from './chunk-G6HDNGY7.mjs';
1
+ import { RenderPublicationError, BARREL_DISTORTION_FEATURE_IDENTITY, createBarrelDistortionRenderFeature, createRenderTargetHost, RenderPublicationTargetReceiver, registerRenderSourceSystems, publicationFrameDependencies, publicationDependencies, inspectVolumetricFog, renderMaterialContext, resolveSsrAdmissionGeneration, inspectLodOcclusion, zeroSsrAdmissionWork, projectSsrSpatialInspection, createDynamicGeometryLifecycle, inspectReflectionFallback, admitReflectionProbe, DEFAULT_REFLECTION_PROBE_LIMITS, buildReflectionProbeTable, advanceProbeFilter, commitProbeFilterStep, resolveReflectionFallbackSource, deriveReflectionFallbackProjection, reflectionFallbackCoverage, reflectionFallbackSourceKey, reflectionFallbackProjectionSignature, createProbeFilterState, ReflectionProbeProjection, RENDERABLE_SOURCE_COMPONENTS, isRenderableMember, createRenderSourceState, createGlobalTransformChangeQuery, admitPointsLines, projectSsrDependencies, resolveShadowMapSize, resolveSpotShadowMapSize, admitSsrSpatial, acquireSwapChainTarget, BARREL_DISTORTION_POST_PROCESS_ID, graphExecutionPhase, inspectPointShadow, admitSingleLayerMediumSubmission, createCloudShadowProjection, CLOUD_LAYER_FEATURE_IDENTITY, ReadonlyDynamicInputPage, DynamicGeometryError, resolveDirectionalShadowAtlasGrid, sameCandidateCredential } from './chunk-3F5XYSN3.mjs';
2
+ import { createExtendedLightingState, promoteExtendedLightingCandidate, emptyBloomInspection, projectExtendedLightingInspection, OcclusionRenderRuntime, viewKey, primitiveKey, projectBarrelDistortionInspection, viewKeyId, primitiveKeyId, ProbeBlendSceneProjection, createSsrHistoryOwner, createSsrSpatialResources } from './chunk-E4NJYUJ2.mjs';
3
+ import { DEFAULT_DEPTH_OF_FIELD_PARAMS, extractFrames, projectMeshMaterialBindingObservation, resolveDepthOfFieldFrameParams, buildCubeCameraFaceViews, Instances, Visibility, SKYLIGHT_RECOVERY_FALLBACK, hasVolumetricFogCapability, packDepthOfFieldParams, Points, Lines, buildShadowFrusta, cloudShadowResolutionForQuality, CUBE_CAMERA_FACE_ORDER, createBarrelDistortionMapping, attachBarrelDistortionCameraFrame, MeshFilter, MAX_VOLUMETRIC_FOG_OWNERS, MeshRenderer, createCookieProjectionMatrixData, internSharedRefFromGuid } from './chunk-3O2BBKEL.mjs';
4
4
  import { SpriteInstances } from './chunk-X2KA6WHM.mjs';
5
- import { GPU_SCENE_LAYOUTS, deviceOptionsForAdapter, PipelineSpecError, assertStorageBufferCap, STANDARD_PBR_REQUIRED_SAMPLED_TEXTURES, GpuBuffer, GpuTexture, deriveRenderDataTexture, deriveRenderDataMesh, deriveRenderDataCubemap, createIblPipelines, CUBEMAP_FACE_VERTICES, runIblPrecompute, SurfaceSubmissionObservationOwner, createClusterBinScratch, resetSsaoResources, resetHdrpBuffers, retireTemporalGpuState, PostProcessError, entryHasDepthRead, DEPTH_MIN_PARAMS_BYTE_SIZE, postProcessShaderModuleLabel, resolveSsaoParameters, buildPerFrameBindGroups, resolveMaterialSkylight, postProcessShaderEntrySignature, standardBloomAdmitted, setIblComposedShaders, POINTS_LINES_MATERIAL_SHADER_ID, selectStandardPbrTransmissionPrewarmVariants, selectHdrpPbrPrewarmVariants, prewarmMaterialShaderVariants, selectProbePrewarmVariants, createHdrpClusterMembershipBindGroupLayoutDescriptor, createSkylightFallback, buildSpecConstTable, buildLinearLdrMaterialSpecTable, getOrBuildPipeline, cacheKeyOf, HDR_COLOR_ATTACHMENT_FORMAT, 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, ensureProbeBlendRecordBuffer, deriveRenderExtent, writeSpotModifierTextures, writeHdrpClusterAndSsaoBuffers, resolveSkyboxActive, computeSplitLdrSprite, writeViewUbo, writePointsLinesViewUbo, writeShadowCasterUniforms, uploadMeshSsboBatch, passKindPolicyTable, colorFormatsForPassKind, GPU_DRIVEN_VIEW_WGSL, selectGpuDrivenSceneIndexVariant, selectSkinPrewarmVariants, transmissionBackdropAvailable, VIEW_UBO_BYTES, POINTS_LINES_VIEW_BUFFER_SIZE, SHADOW_CASTER_BUFFER_SIZE, FALLBACK_BYTES_PER_ROW, MIPMAP_PREWARM_FORMATS, getIblProbeBackgroundSource, OcclusionConfidenceScheduler, shouldIssueRetest, selectGpuLodLane, ShadowViewStatePool, GpuDrivenView, shadowViewIdentityKey, combineGpuResourceAllocationInspections, inspectResourceClassSplits, createPointsLinesLaneContract, foldDispatchBuckets, CUBE_CAPTURE_VIEW_SLOT_BASE, variantSetFromDefines, resolveReflectionProbeBinding, cleanPerEntityCache, ensureMeshSsboCapacity, buildFoldDispatchPlan, evaluateFoldBucketUniformCap, incrementFoldedDrawsMetric, writePbrMaterialUboPayload, applyParamSnapshotToUbo, applyMaterialTextureUvScales, residentTextureView, detectNineSliceScaleTooSmall, DEPTH_TEXTURE_FORMAT, PREFILTER_SIZE, gpuSceneFieldOffset, projectedHeightForCandidate, geometryRenderStateForTopology, packInstanceStorageBuffer, GpuResourceAllocationLedger, MESH_PER_ENTITY_STRIDE, MESH_SSBO_BYTES, standardTopologyVariantSet, resolveGeometryInstanceBuffer, buildFullscreenPostProcessPass, getTemporalGpuState, getTemporalParamsBuffer, getTemporalBindGroupResources, TEMPORAL_HISTORY_FORMATS, createRenderPipelineTarget, encodeMainPass, abortTemporalGpuSubmit, commitTemporalGpuSubmit, retireTemporalGpuStateAfterFence, hasPendingTemporalGpuSubmit, importRenderPipelineSurface, renderExtentSize, DEFERRED_COLOR_FORMATS, aggregateTemporalDemand, standardTemporalLaneAdmission, addTypedScenePass, addTypedSsaoPasses, addTypedSkyboxPass, renderPipelineCloudHistoryTargets, createStandardSceneDataTarget, addStandardSceneDataPass, VIEW_UNIFORM_BYTES, addTypedFrameObservationPass, addReflectionFallbackObservationPass, selectLod, temporalReadIndex, temporalWriteIndex, CLOUD_HISTORY_FORMATS, prepareMaterialSkylight, BYTES_PER_DIRECT_LIGHT_SLOT, shadowViewRasterAccesses, encodeDirectionalShadowPass, encodePointShadowPass, encodeSpotShadowPass, getOrCreateFromChain, addTypedFullscreenPass, resolveOutputDither, addTypedTemporalResolvePass, addTypedBloomPasses, addTypedOutputTransformPass, addTypedCompositePostEffects, geometryRenderStateForPass, standardStorageVariantSet, getOrCreateHdrpBuffers, variantSetFromVertexLayoutProjection, createStandardSurfaceLightingBindGroup, BLOOM_DOWNSAMPLE_PARAMS_BYTES, BLOOM_UPSAMPLE_PARAMS_BYTES, BLOOM_COMPOSITE_PARAMS_BYTES, isTemporalFullscreenBinding, createFullscreenBindGroup, stageTemporalGpuSubmit, applyParamSchemaDefaultsToUbo, defaultViewForUserRegionField, assembleMaterialWithSkylightEntries, TYPED_BLOOM_PASS_NAMES } from './chunk-LNIUIKQ7.mjs';
6
- import { DEFAULT_STANDARD_PROFILE, DEFAULT_CLUSTER_GRID, selectSwapChainFormat, configureSurface, STANDARD_PIPELINE_ID, STANDARD_LIGHT_COUNTS, STANDARD_POST_STAGE_NAMES, createSceneDataCatalog, MATERIAL_PER_ENTITY_STRIDE, isSceneDataTarget, resolveSurfaceFormatPair, resolveSurfaceProfile, resolveVolumetricFogProfile, STANDARD_PBR_UBO_SIZE, SCENE_DATA_TEMPORAL_V1_SCHEMA } from './chunk-SGPUJW3F.mjs';
5
+ import { GPU_SCENE_LAYOUTS, deviceOptionsForAdapter, PipelineSpecError, assertStorageBufferCap, STANDARD_PBR_REQUIRED_SAMPLED_TEXTURES, GpuBuffer, GpuTexture, deriveRenderDataTexture, deriveRenderDataMesh, deriveRenderDataCubemap, createIblPipelines, CUBEMAP_FACE_VERTICES, runIblPrecompute, SurfaceSubmissionObservationOwner, createClusterBinScratch, resetSsaoResources, resetHdrpBuffers, retireTemporalGpuState, PostProcessError, entryHasDepthRead, DEPTH_MIN_PARAMS_BYTE_SIZE, postProcessShaderModuleLabel, resolveSsaoParameters, buildPerFrameBindGroups, resolveMaterialSkylight, postProcessShaderEntrySignature, standardBloomAdmitted, setIblComposedShaders, POINTS_LINES_MATERIAL_SHADER_ID, selectStandardPbrTransmissionPrewarmVariants, selectHdrpPbrPrewarmVariants, prewarmMaterialShaderVariants, selectProbePrewarmVariants, createHdrpClusterMembershipBindGroupLayoutDescriptor, createSkylightFallback, buildSpecConstTable, buildLinearLdrMaterialSpecTable, getOrBuildPipeline, cacheKeyOf, HDR_COLOR_ATTACHMENT_FORMAT, 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, ensureProbeBlendRecordBuffer, deriveRenderExtent, writeSpotModifierTextures, writeHdrpClusterAndSsaoBuffers, resolveSkyboxActive, computeSplitLdrSprite, writeViewUbo, writePointsLinesViewUbo, writeShadowCasterUniforms, uploadMeshSsboBatch, passKindPolicyTable, colorFormatsForPassKind, GPU_DRIVEN_VIEW_WGSL, selectGpuDrivenSceneIndexVariant, selectSkinPrewarmVariants, transmissionBackdropAvailable, VIEW_UBO_BYTES, POINTS_LINES_VIEW_BUFFER_SIZE, SHADOW_CASTER_BUFFER_SIZE, FALLBACK_BYTES_PER_ROW, MIPMAP_PREWARM_FORMATS, getIblProbeBackgroundSource, OcclusionConfidenceScheduler, shouldIssueRetest, selectGpuLodLane, ShadowViewStatePool, GpuDrivenView, shadowViewIdentityKey, combineGpuResourceAllocationInspections, inspectResourceClassSplits, createPointsLinesLaneContract, foldDispatchBuckets, CUBE_CAPTURE_VIEW_SLOT_BASE, variantSetFromDefines, resolveReflectionProbeBinding, cleanPerEntityCache, ensureMeshSsboCapacity, buildFoldDispatchPlan, evaluateFoldBucketUniformCap, incrementFoldedDrawsMetric, writePbrMaterialUboPayload, applyParamSnapshotToUbo, applyMaterialTextureUvScales, residentTextureView, detectNineSliceScaleTooSmall, DEPTH_TEXTURE_FORMAT, PREFILTER_SIZE, gpuSceneFieldOffset, projectedHeightForCandidate, geometryRenderStateForTopology, packInstanceStorageBuffer, GpuResourceAllocationLedger, MESH_PER_ENTITY_STRIDE, MESH_SSBO_BYTES, standardTopologyVariantSet, resolveGeometryInstanceBuffer, buildFullscreenPostProcessPass, getTemporalGpuState, getTemporalParamsBuffer, getTemporalBindGroupResources, TEMPORAL_HISTORY_FORMATS, createRenderPipelineTarget, encodeMainPass, abortTemporalGpuSubmit, commitTemporalGpuSubmit, retireTemporalGpuStateAfterFence, hasPendingTemporalGpuSubmit, importRenderPipelineSurface, renderExtentSize, DEFERRED_COLOR_FORMATS, aggregateTemporalDemand, standardTemporalLaneAdmission, addTypedScenePass, addTypedSsaoPasses, addTypedSkyboxPass, renderPipelineCloudHistoryTargets, createStandardSceneDataTarget, addStandardSceneDataPass, VIEW_UNIFORM_BYTES, addTypedFrameObservationPass, addReflectionFallbackObservationPass, selectLod, temporalReadIndex, temporalWriteIndex, CLOUD_HISTORY_FORMATS, prepareMaterialSkylight, BYTES_PER_DIRECT_LIGHT_SLOT, shadowViewRasterAccesses, encodeDirectionalShadowPass, encodePointShadowPass, encodeSpotShadowPass, getOrCreateFromChain, addTypedFullscreenPass, resolveOutputDither, addTypedTemporalResolvePass, addTypedBloomPasses, addTypedOutputTransformPass, addTypedCompositePostEffects, geometryRenderStateForPass, standardStorageVariantSet, getOrCreateHdrpBuffers, variantSetFromVertexLayoutProjection, createStandardSurfaceLightingBindGroup, BLOOM_DOWNSAMPLE_PARAMS_BYTES, BLOOM_UPSAMPLE_PARAMS_BYTES, BLOOM_COMPOSITE_PARAMS_BYTES, isTemporalFullscreenBinding, createFullscreenBindGroup, stageTemporalGpuSubmit, applyParamSchemaDefaultsToUbo, defaultViewForUserRegionField, assembleMaterialWithSkylightEntries, TYPED_BLOOM_PASS_NAMES } from './chunk-SJIPVWNB.mjs';
6
+ import { DEFAULT_STANDARD_PROFILE, DEFAULT_CLUSTER_GRID, selectSwapChainFormat, configureSurface, STANDARD_PIPELINE_ID, STANDARD_LIGHT_COUNTS, STANDARD_POST_STAGE_NAMES, createSceneDataCatalog, MATERIAL_PER_ENTITY_STRIDE, isSceneDataTarget, resolveSurfaceFormatPair, resolveSurfaceProfile, resolveVolumetricFogProfile, STANDARD_PBR_UBO_SIZE, SCENE_DATA_TEMPORAL_V1_SCHEMA } from './chunk-NMSOOXBB.mjs';
7
7
  import { getTransparentSortConfig, TRANSPARENT_SORT_MODE_DISTANCE, TRANSPARENT_SORT_MODE_LAYER_Z, TRANSPARENT_SORT_MODE_LAYER_Y, TRANSPARENT_SORT_MODE_LAYER_YZ, SPRITE_PREMULTIPLIED_ALPHA_BLEND } from './chunk-XSFB7XXQ.mjs';
8
8
  import { createTemporalCoverage, PROBE_BLEND_RECORD_BYTE_SIZE } from './chunk-RIPAEGI6.mjs';
9
- import { RendererContractFailureError, RendererOperationError, MotionBlurValidationError, DeviceScope, SKIN_MATERIAL_SHADER_ID, STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, EXTENDED_LIGHTING_TOPOLOGY, FrameReceiptStaleError, getTextureIdentity, RenderFeatureStageFailedError, RenderFeatureCapabilityMissingError, deriveExtendedLightingCapability, GPU_TEXTURE_USAGE_TEXTURE_BINDING, GPU_TEXTURE_USAGE_COPY_DST, GPU_BUFFER_USAGE_VERTEX, GPU_BUFFER_USAGE_COPY_DST, GPU_BUFFER_USAGE_INDEX, IES_SLICE_WIDTH, IES_SLICE_HEIGHT, COOKIE_SLICE_SIZE, COOKIE_MATRIX_BYTES, RENDER_PHASE_CATALOG, InstanceProjectionStore, GPU_BUFFER_USAGE_UNIFORM, worldEntityKey, motionBlurTemporalDemand, createAutoExposureInspection, createHdrpBindGroupLayoutDescriptor, createHdrpSkinBindGroupLayoutDescriptor, GPU_BUFFER_USAGE_QUERY_RESOLVE, GPU_BUFFER_USAGE_COPY_SRC, GPU_BUFFER_USAGE_MAP_READ, RenderFeatureRegistrationConflictError, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING, GPU_TEXTURE_USAGE_COPY_SRC, createVisibilityBudget, gpuDrivenShadowDrawKey, EnvironmentGenerationFailedError, PointsLinesMaterialUnsupportedError, StandardProfileInvalidError, buildGpuDrivenDraws, TransmissionCapabilityMissingError, motionBlurSampleDelta, isMotionBlurIntervalValid, makeZeroCameraFallbackSnapshot, MOTION_BLUR_PARAMS_BYTE_SIZE, effectiveMotionBlurSampleCount, motionBlurExposureScale, SHADOW_ATLAS_DEFAULT_LAYERS, DEFAULT_MOTION_BLUR_PARAMS, FXAA_POST_PROCESS_ID, buildPbrPipelineLayouts, buildPbrSkinLayouts, buildGpuDrivenPbrInstancesBindGroupLayout, buildSurfaceDirectInstancesBindGroupLayout, buildGpuDrivenPbrPipelineLayout, buildGpuDrivenPbrSkinPipelineLayout, GPU_BUFFER_USAGE_STORAGE, resolvePipelineGroup2Contract, GPU_SHADER_STAGE_FRAGMENT, RenderTargetStateInvalidError, GpuDrivenPreparationError, isCanonicalStandardPbrMaterialShader, getOpaqueResourceIdentity, gpuDrivenDrawKey, gpuDrivenSourceDrawItemIndex, TemporalFrameSubmitError, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT, ObservationUnavailableError, RenderFeaturePreparationFailedError, AutoExposureInvalidParameterError, instanceCollectionCacheKey, validateGraphTargetCaptureReadback, isStandardPbrMaterialShader, buildBindGroupLayoutDescriptor, gpuDrivenMaterialArtifactKey, PointsLinesPrepareFailedError, validateMotionBlurParams, hasRequiredVertexInputs, SHADOW_ATLAS_DEFAULT_FACE_SIZE, resolveRenderTargetMaterialSource, buildPbrMaterialUserRegionEntries, extendedLightingSampledTextureCapacityAvailable, SceneDataUnavailableError, SkinPaletteOverflowError, GPU_TEXTURE_USAGE_STORAGE_BINDING, RenderFeatureDrawRecordingFailedError, GPU_SHADER_STAGE_VERTEX, PointShadowAtlasUninitializedError, SPRITE_PASS_PER_INSTANCE_REGION_VARIANT_SET, SHADOW_CASTER_SHADER_ID, shadowCasterVariantSet, RenderFeaturePreparedStateMismatchError, GPU_SHADER_STAGE_COMPUTE, RenderTargetOperationFailedError, LifecycleTransaction } from './chunk-MXTWKZO4.mjs';
9
+ import { RendererContractFailureError, RendererOperationError, MotionBlurValidationError, DeviceScope, SKIN_MATERIAL_SHADER_ID, STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, EXTENDED_LIGHTING_TOPOLOGY, FrameReceiptStaleError, getTextureIdentity, RenderFeatureStageFailedError, RenderFeatureCapabilityMissingError, deriveExtendedLightingCapability, GPU_TEXTURE_USAGE_TEXTURE_BINDING, GPU_TEXTURE_USAGE_COPY_DST, GPU_BUFFER_USAGE_VERTEX, GPU_BUFFER_USAGE_COPY_DST, GPU_BUFFER_USAGE_INDEX, IES_SLICE_WIDTH, IES_SLICE_HEIGHT, COOKIE_SLICE_SIZE, COOKIE_MATRIX_BYTES, RENDER_PHASE_CATALOG, InstanceProjectionStore, GPU_BUFFER_USAGE_UNIFORM, worldEntityKey, motionBlurTemporalDemand, createAutoExposureInspection, createHdrpBindGroupLayoutDescriptor, createHdrpSkinBindGroupLayoutDescriptor, GPU_BUFFER_USAGE_QUERY_RESOLVE, GPU_BUFFER_USAGE_COPY_SRC, GPU_BUFFER_USAGE_MAP_READ, RenderFeatureRegistrationConflictError, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING, GPU_TEXTURE_USAGE_COPY_SRC, createVisibilityBudget, gpuDrivenShadowDrawKey, EnvironmentGenerationFailedError, PointsLinesMaterialUnsupportedError, StandardProfileInvalidError, buildGpuDrivenDraws, TransmissionCapabilityMissingError, motionBlurSampleDelta, isMotionBlurIntervalValid, makeZeroCameraFallbackSnapshot, MOTION_BLUR_PARAMS_BYTE_SIZE, effectiveMotionBlurSampleCount, motionBlurExposureScale, SHADOW_ATLAS_DEFAULT_LAYERS, DEFAULT_MOTION_BLUR_PARAMS, FXAA_POST_PROCESS_ID, buildPbrPipelineLayouts, buildPbrSkinLayouts, buildGpuDrivenPbrInstancesBindGroupLayout, buildSurfaceDirectInstancesBindGroupLayout, buildGpuDrivenPbrPipelineLayout, buildGpuDrivenPbrSkinPipelineLayout, GPU_BUFFER_USAGE_STORAGE, resolvePipelineGroup2Contract, GPU_SHADER_STAGE_FRAGMENT, RenderTargetStateInvalidError, InstanceBoundsCache, fingerprintNumericArray, GpuDrivenPreparationError, isCanonicalStandardPbrMaterialShader, getOpaqueResourceIdentity, gpuDrivenDrawKey, gpuDrivenSourceDrawItemIndex, TemporalFrameSubmitError, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT, ObservationUnavailableError, RenderFeaturePreparationFailedError, AutoExposureInvalidParameterError, instanceCollectionCacheKey, validateGraphTargetCaptureReadback, isStandardPbrMaterialShader, buildBindGroupLayoutDescriptor, gpuDrivenMaterialArtifactKey, PointsLinesPrepareFailedError, validateMotionBlurParams, hasRequiredVertexInputs, SHADOW_ATLAS_DEFAULT_FACE_SIZE, resolveRenderTargetMaterialSource, buildPbrMaterialUserRegionEntries, extendedLightingSampledTextureCapacityAvailable, SceneDataUnavailableError, SkinPaletteOverflowError, GPU_TEXTURE_USAGE_STORAGE_BINDING, RenderFeatureDrawRecordingFailedError, GPU_SHADER_STAGE_VERTEX, PointShadowAtlasUninitializedError, SPRITE_PASS_PER_INSTANCE_REGION_VARIANT_SET, SHADOW_CASTER_SHADER_ID, shadowCasterVariantSet, RenderFeaturePreparedStateMismatchError, GPU_SHADER_STAGE_COMPUTE, RenderTargetOperationFailedError, LifecycleTransaction } from './chunk-ARLAEJ45.mjs';
10
10
  import { ok, err, RhiError, validateDrawArgs } from '@forgeax/engine-rhi';
11
11
  import { AssetRegistry, DynamicTextureStore, adaptDynamicTextureDevice, getOrCreateMipmapPipeline, prepareMipmaps, blitMipmapsSync, HANDLE_CUBE, HANDLE_TRIANGLE, HANDLE_QUAD, HANDLE_SPHERE, HANDLE_NINESLICE_QUAD, BuiltinAssetRegistry, RuntimeMaterialValue, RuntimeMeshVertices, resolveAssetHandle, numMipLevels, encodeMipmapLevel, MeshSsboCeilingReachedError, MeshSsboCapacityExceededError } from '@forgeax/engine-assets-runtime';
12
12
  import { audioLoader } from '@forgeax/engine-audio-webaudio';
13
13
  import { createRenderReadLease } from '@forgeax/engine-ecs/projection';
14
- import { buildMeshAttributeMapForUvSets, deriveVertexBufferLayout, DEFAULT_VERTEX_ATTRIBUTE_MAP, deriveVertexCount, deriveVertexLayoutProjection, SKIN_VERTEX_ATTRIBUTE_MAP, deriveVertexBufferLayoutFromProjection } from '@forgeax/engine-geometry';
14
+ import { deriveVertexLayoutProjection, buildMeshAttributeMapForUvSets, deriveVertexCount, DEFAULT_VERTEX_ATTRIBUTE_MAP, SKIN_VERTEX_ATTRIBUTE_MAP, deriveVertexBufferLayoutFromProjection, deriveVertexBufferLayout } from '@forgeax/engine-geometry';
15
15
  import { STANDARD_PIPELINE_PARAM_SCHEMA, createStandardPbrArtifactReceipt, SINGLE_LAYER_MEDIUM_RAW_DEPTH_WGSL, SINGLE_LAYER_MEDIUM_MSAA_PAIRED_COLOR_WGSL, SINGLE_LAYER_MEDIUM_MSAA_RAW_DEPTH_WGSL, ShaderCatalog, findVariantByKey, MaterialArtifactRegistry, ShaderRegistry, LTC_TABLES, standardPhysicalTextureFields, LTC_TABLE_HEIGHT, LTC_TABLE_WIDTH, DEFAULT_STANDARD_PBR_PARAM_SCHEMA, AUTO_EXPOSURE_METER_WGSL } from '@forgeax/engine-shader';
16
16
  import { AssetGuid } from '@forgeax/engine-pack/guid';
17
17
  import { derive, ok as ok$1, err as err$1, handleSlot, deriveTextureLayout, ASSET_ERROR_HINTS, countExtraUvSets, toShared, AssetError, RenderQueue, IMAGE_ERROR_HINTS, BUILTIN_BASE, materialValuesToLinearRuntime } from '@forgeax/engine-types';
@@ -6652,6 +6652,8 @@ function addTypedShadowPasses(graph, topology, projectGpuDrivenShadowOrFeatures,
6652
6652
  index: cascade
6653
6653
  });
6654
6654
  if (shadowProjection !== void 0 && !shadowProjection.ok) return shadowProjection;
6655
+ let forceRasterPending = true;
6656
+ let forceRasterEncodePending = false;
6655
6657
  const added = recordShadowPass(
6656
6658
  graph,
6657
6659
  `shadowCascade${cascade}`,
@@ -6667,9 +6669,18 @@ function addTypedShadowPasses(graph, topology, projectGpuDrivenShadowOrFeatures,
6667
6669
  w: mapSize,
6668
6670
  h: mapSize
6669
6671
  },
6670
- shadowFeatures === void 0 ? void 0 : (view) => shadowFeatures.encode(pass, frame, resources, view)
6672
+ shadowFeatures === void 0 ? void 0 : (view) => shadowFeatures.encode(pass, frame, resources, view),
6673
+ forceRasterEncodePending
6671
6674
  ),
6672
- (frame) => shadowFeatures !== void 0 || !shadowViewCacheReuse(frame, { kind: "directional", index: cascade }),
6675
+ (frame) => {
6676
+ forceRasterEncodePending = false;
6677
+ if (forceRasterPending) {
6678
+ forceRasterPending = false;
6679
+ forceRasterEncodePending = true;
6680
+ return true;
6681
+ }
6682
+ return shadowFeatures !== void 0 || !shadowViewCacheReuse(frame, { kind: "directional", index: cascade });
6683
+ },
6673
6684
  [
6674
6685
  ...shadowProjection?.ok === true && shadowProjection.value?.graphResources !== void 0 ? shadowViewRasterAccesses(shadowProjection.value.graphResources) : [],
6675
6686
  ...shadowFeatures?.accesses ?? []
@@ -6732,6 +6743,7 @@ function addTypedShadowPasses(graph, topology, projectGpuDrivenShadowOrFeatures,
6732
6743
  face
6733
6744
  });
6734
6745
  if (shadowProjection !== void 0 && !shadowProjection.ok) return shadowProjection;
6746
+ let forceRasterPending = true;
6735
6747
  const identity = { kind: "point", index: pointIndex, face };
6736
6748
  const cacheReuse = (frame) => shadowViewCacheReuse(frame, identity);
6737
6749
  const faceView = graph.view(texture.value, {
@@ -6756,7 +6768,13 @@ function addTypedShadowPasses(graph, topology, projectGpuDrivenShadowOrFeatures,
6756
6768
  face,
6757
6769
  shadowFeatures === void 0 ? void 0 : (view) => shadowFeatures.encode(pass, frame, resources, view)
6758
6770
  ),
6759
- (frame) => shadowFeatures !== void 0 || !cacheReuse(frame),
6771
+ (frame) => {
6772
+ if (forceRasterPending) {
6773
+ forceRasterPending = false;
6774
+ return true;
6775
+ }
6776
+ return shadowFeatures !== void 0 || !cacheReuse(frame);
6777
+ },
6760
6778
  [
6761
6779
  ...shadowProjection?.ok === true && shadowProjection.value?.graphResources !== void 0 ? shadowViewRasterAccesses(shadowProjection.value.graphResources) : [],
6762
6780
  ...shadowFeatures?.accesses ?? []
@@ -6774,6 +6792,7 @@ function addTypedShadowPasses(graph, topology, projectGpuDrivenShadowOrFeatures,
6774
6792
  for (let spotIndex = 0; spotIndex < Math.max(1, topology.shadow.spotCount); spotIndex += 1) {
6775
6793
  const shadowProjection = projectGpuDrivenShadow?.({ kind: "spot", index: spotIndex });
6776
6794
  if (shadowProjection !== void 0 && !shadowProjection.ok) return shadowProjection;
6795
+ let forceRasterPending = true;
6777
6796
  const identity = { kind: "spot", index: spotIndex };
6778
6797
  const cacheReuse = (frame) => shadowViewCacheReuse(frame, identity);
6779
6798
  const added = recordShadowPass(
@@ -6787,7 +6806,13 @@ function addTypedShadowPasses(graph, topology, projectGpuDrivenShadowOrFeatures,
6787
6806
  spotIndex,
6788
6807
  shadowFeatures === void 0 ? void 0 : (view) => shadowFeatures.encode(pass, frame, resources, view)
6789
6808
  ),
6790
- (frame) => shadowFeatures !== void 0 || !cacheReuse(frame),
6809
+ (frame) => {
6810
+ if (forceRasterPending) {
6811
+ forceRasterPending = false;
6812
+ return true;
6813
+ }
6814
+ return shadowFeatures !== void 0 || !cacheReuse(frame);
6815
+ },
6791
6816
  [
6792
6817
  ...shadowProjection?.ok === true && shadowProjection.value?.graphResources !== void 0 ? shadowViewRasterAccesses(shadowProjection.value.graphResources) : [],
6793
6818
  ...shadowFeatures?.accesses ?? []
@@ -15744,6 +15769,13 @@ function materialArtifactSignature(artifacts, rigidFallback, skinFallback) {
15744
15769
  ]
15745
15770
  });
15746
15771
  }
15772
+ function sameValidatedSourceSequence(expected, actual) {
15773
+ if (expected.length !== actual.length) return false;
15774
+ for (let index = 0; index < expected.length; index += 1) {
15775
+ if (expected[index] !== actual[index]?.source) return false;
15776
+ }
15777
+ return true;
15778
+ }
15747
15779
  function sameIdentitySequence(expected, actual) {
15748
15780
  if (expected.length !== actual.length) return false;
15749
15781
  for (let index = 0; index < expected.length; index += 1) {
@@ -16560,7 +16592,14 @@ var GpuDrivenProduction = class _GpuDrivenProduction {
16560
16592
  };
16561
16593
  }
16562
16594
  const shadowTopologySignature = () => this.shadowViews?.inspect().map(
16563
- (entry) => `${shadowViewIdentityKey(entry.identity)}:${entry.cache}:${entry.generation}:${entry.sourceRevision}:${entry.resourceGeneration}`
16595
+ (entry) => (
16596
+ // Cache decisions and logical update generations are frame-local
16597
+ // producer state. They must not feed the compiled graph key: a
16598
+ // graph replacement may intentionally invalidate a shadow view
16599
+ // once without creating a graph-rebuild feedback loop. Resource
16600
+ // and source-plan generations remain real graph dependencies.
16601
+ `${shadowViewIdentityKey(entry.identity)}:${entry.sourceRevision}:${entry.resourceGeneration}`
16602
+ )
16564
16603
  ).join("|") ?? "";
16565
16604
  const production = this;
16566
16605
  const surfaceDynamicInputForCommit = this.surfaceSubmission !== void 0 && input.surfaceDynamicInput !== void 0 ? {
@@ -16661,10 +16700,10 @@ var GpuDrivenProduction = class _GpuDrivenProduction {
16661
16700
  frameNumber
16662
16701
  )
16663
16702
  },
16664
- projectShadow: (graph, identity) => {
16703
+ projectShadow: (graph, identity, forceCompute = false) => {
16665
16704
  if (!shadowViewPool.isActive(identity) || shadowViewPool.submission(identity) === void 0)
16666
16705
  return ok(void 0);
16667
- return shadowViewPool.project(graph, identity);
16706
+ return shadowViewPool.project(graph, identity, forceCompute);
16668
16707
  },
16669
16708
  updateShadowViews: (views) => shadowFiltered.plan.batches.length > 0 ? this.updateShadowViews(
16670
16709
  views,
@@ -17548,7 +17587,7 @@ var GpuDrivenProduction = class _GpuDrivenProduction {
17548
17587
  }
17549
17588
  recordCpuValidation(validated, gpuOwnedDrawKeys, cacheKey, worldKeys) {
17550
17589
  const cached = this.cpuValidationTelemetryCache;
17551
- if (cacheKey !== void 0 && cached !== void 0 && cached.cacheKey === cacheKey && cached.validated === validated && cached.gpuOwnedDrawKeys === gpuOwnedDrawKeys && cached.worldKeys === worldKeys) {
17590
+ if (cacheKey !== void 0 && cached !== void 0 && cached.cacheKey === cacheKey && sameValidatedSourceSequence(cached.validatedSources, validated) && cached.gpuOwnedDrawKeys === gpuOwnedDrawKeys && cached.worldKeys === worldKeys) {
17552
17591
  this.applyCpuValidationTelemetry(cached);
17553
17592
  this.cpuValidationCacheHits += 1;
17554
17593
  return;
@@ -17622,7 +17661,7 @@ var GpuDrivenProduction = class _GpuDrivenProduction {
17622
17661
  if (cacheKey !== void 0) {
17623
17662
  this.cpuValidationTelemetryCache = {
17624
17663
  cacheKey,
17625
- validated,
17664
+ validatedSources: validated.map((row) => row.source),
17626
17665
  gpuOwnedDrawKeys,
17627
17666
  worldKeys,
17628
17667
  gpuOwnedDrawCount: this.gpuOwnedDrawItems,
@@ -23889,7 +23928,13 @@ function ensureCompiledFrameGraph(internals, frameState, pipelineState, camera,
23889
23928
  );
23890
23929
  },
23891
23930
  ...gpuDriven?.projectShadow === void 0 ? {} : {
23892
- projectGpuDrivenShadow: (identity) => gpuDriven.projectShadow?.(builder, identity) ?? ok$1(void 0)
23931
+ projectGpuDrivenShadow: (identity) => (
23932
+ // A newly compiled graph must include the shadow compute passes
23933
+ // even when the producer cache hit. The graph owns its pass
23934
+ // list; importing only the cached view resources would reuse
23935
+ // stale indirect arguments after a topology replacement.
23936
+ gpuDriven.projectShadow?.(builder, identity, true) ?? ok$1(void 0)
23937
+ )
23893
23938
  },
23894
23939
  contributeShadowFeatures: () => featureShadows ??= projectRenderFeatureShadows(
23895
23940
  builder,
@@ -25088,8 +25133,32 @@ function runRecordProfilePhase(runner, phase, action) {
25088
25133
  function shadowPlanes(matrix) {
25089
25134
  return frustum.fromViewProjection(frustum.create(), matrix);
25090
25135
  }
25091
- function shadowViewToken(matrix) {
25092
- return Array.from(matrix).join(",");
25136
+ function shadowViewPlanesByView(lights) {
25137
+ const views = /* @__PURE__ */ new Map();
25138
+ for (const [index, matrix] of (lights.lightViewProj ?? []).entries()) {
25139
+ views.set(shadowViewIdentityKey({ kind: "directional", index }), shadowPlanes(matrix));
25140
+ }
25141
+ for (const [index, point] of lights.pointShadow.entries()) {
25142
+ for (let face = 0; face < 6; face += 1) {
25143
+ views.set(
25144
+ shadowViewIdentityKey({ kind: "point", index, face }),
25145
+ shadowPlanes(point.shadowMatrices.subarray(face * 16, face * 16 + 16))
25146
+ );
25147
+ }
25148
+ }
25149
+ let spotIndex = 0;
25150
+ for (const spot of lights.spot) {
25151
+ if (spot.lightViewProj === void 0) continue;
25152
+ views.set(
25153
+ shadowViewIdentityKey({ kind: "spot", index: spotIndex }),
25154
+ shadowPlanes(spot.lightViewProj)
25155
+ );
25156
+ spotIndex += 1;
25157
+ }
25158
+ return views;
25159
+ }
25160
+ function shadowViewToken(matrix, targetSize, graphGeneration) {
25161
+ return `${Array.from(matrix).join(",")}|target:${targetSize}|graph:${graphGeneration}`;
25093
25162
  }
25094
25163
  function halfFloatToNumber(bits) {
25095
25164
  const sign = (bits & 32768) === 0 ? 1 : -1;
@@ -25991,7 +26060,7 @@ function recordFrame(internals, world, cameras, lights, renderables, transparent
25991
26060
  shadowViews.push({
25992
26061
  identity: { kind: "directional", index },
25993
26062
  planes: shadowPlanes(matrix),
25994
- cacheToken: `${shadowViewToken(matrix)}|target:${graphShadowMapSize}:${frameState.graphGeneration}`
26063
+ cacheToken: shadowViewToken(matrix, graphShadowMapSize, frameState.graphGeneration)
25995
26064
  });
25996
26065
  }
25997
26066
  for (const [index, point] of lights.pointShadow.entries()) {
@@ -26000,7 +26069,7 @@ function recordFrame(internals, world, cameras, lights, renderables, transparent
26000
26069
  shadowViews.push({
26001
26070
  identity: { kind: "point", index, face },
26002
26071
  planes: shadowPlanes(matrix),
26003
- cacheToken: `${shadowViewToken(matrix)}|target:${graphShadowMapSize}:${frameState.graphGeneration}`
26072
+ cacheToken: shadowViewToken(matrix, graphShadowMapSize, frameState.graphGeneration)
26004
26073
  });
26005
26074
  }
26006
26075
  }
@@ -26010,7 +26079,11 @@ function recordFrame(internals, world, cameras, lights, renderables, transparent
26010
26079
  shadowViews.push({
26011
26080
  identity: { kind: "spot", index: shadowSpotIndex },
26012
26081
  planes: shadowPlanes(spot.lightViewProj),
26013
- cacheToken: `${shadowViewToken(spot.lightViewProj)}|target:${graphShadowMapSize}:${frameState.graphGeneration}`
26082
+ cacheToken: shadowViewToken(
26083
+ spot.lightViewProj,
26084
+ graphShadowMapSize,
26085
+ frameState.graphGeneration
26086
+ )
26014
26087
  });
26015
26088
  shadowSpotIndex += 1;
26016
26089
  }
@@ -26564,6 +26637,7 @@ function recordFrame(internals, world, cameras, lights, renderables, transparent
26564
26637
  gpuDrivenShadowDrawKeysByView: rasterGpuDriven.shadowDrawKeysByView
26565
26638
  }
26566
26639
  },
26640
+ shadowViewPlanesByView: shadowViewPlanesByView(lights),
26567
26641
  ...frameGpuDriven?.scene === void 0 ? {} : { gpuDrivenSceneMaterialBuffer: frameGpuDriven.scene.scene.materialBuffer },
26568
26642
  ...cubeCapture?.reflectionProbes === void 0 ? {} : { reflectionProbes: cubeCapture.reflectionProbes },
26569
26643
  ...cubeCapture?.captureDispatch === void 0 ? {} : { captureDispatch: cubeCapture.captureDispatch },
@@ -29844,34 +29918,25 @@ function createPreparedResolverCaches() {
29844
29918
  preparedMaterialPipelineShaders: /* @__PURE__ */ new WeakMap(),
29845
29919
  preparedGroup0Pipelines: /* @__PURE__ */ new WeakSet(),
29846
29920
  preparedViewOnlyPipelines: /* @__PURE__ */ new WeakSet(),
29847
- preparedRenderMaterialPipelines: /* @__PURE__ */ new WeakSet(),
29848
- preparedAssetHandles: /* @__PURE__ */ new WeakMap()
29921
+ preparedRenderMaterialPipelines: /* @__PURE__ */ new WeakSet()
29849
29922
  };
29850
29923
  }
29851
- function preparedHandle(runtime, caches, world, guid, brand) {
29852
- let handles = caches.preparedAssetHandles.get(world);
29853
- if (handles === void 0) {
29854
- handles = /* @__PURE__ */ new Map();
29855
- caches.preparedAssetHandles.set(world, handles);
29856
- }
29857
- const key = `${brand}:${guid.toLowerCase()}`;
29858
- const cached = handles.get(key);
29859
- if (cached !== void 0) return cached;
29924
+ function preparedHandle(runtime, world, guid, brand) {
29860
29925
  if ("resolveAsset" in world)
29861
29926
  return world.handleForGuid(guid);
29862
- const asset = runtime.assets.lookup(guid);
29863
- if (asset === void 0) return void 0;
29864
- const handle = world.allocSharedRef(brand, asset);
29865
- handles.set(key, handle);
29866
- return handle;
29927
+ return internSharedRefFromGuid(world, runtime.assets, guid, brand);
29867
29928
  }
29868
- function preparedMaterialBindings(runtime, caches, worlds, materialShaderId, worldIndex, materialGuid, layout, skylightResources) {
29929
+ function preparedMaterialBindings(runtime, worlds, materialShaderId, worldIndex, materialGuid, layout, skylightResources) {
29869
29930
  const world = worlds[worldIndex];
29870
- const material = world === void 0 ? void 0 : renderAssetByGuid(world, runtime.assets, materialGuid);
29931
+ const handle = world === void 0 ? void 0 : preparedHandle(runtime, world, materialGuid, "MaterialAsset");
29871
29932
  const pipelineState = runtime.getPipelineState();
29872
- if (world === void 0 || material?.kind !== "material" || pipelineState === null) {
29933
+ if (world === void 0 || handle === void 0 || pipelineState === null) {
29873
29934
  return err(new Error("prepared material asset is unavailable"));
29874
29935
  }
29936
+ const resolved2 = resolveAssetHandle(world, handle);
29937
+ if (!resolved2.ok) return resolved2;
29938
+ const material = resolved2.value;
29939
+ if (material.kind !== "material") return err(new Error("prepared material asset is unavailable"));
29875
29940
  const schema = runtime.getParamSchema?.(materialShaderId) ?? [];
29876
29941
  const values = materialValuesToLinearRuntime(
29877
29942
  material.values,
@@ -29911,32 +29976,20 @@ function preparedMaterialBindings(runtime, caches, worlds, materialShaderId, wor
29911
29976
  const textureValue = typeof value === "object" && value !== null && "texture" in value ? value : void 0;
29912
29977
  let sampler = pipelineState.defaultSampler;
29913
29978
  if (textureValue?.sampler !== void 0) {
29914
- const handle = preparedHandle(
29915
- runtime,
29916
- caches,
29917
- world,
29918
- String(textureValue.sampler),
29919
- "SamplerAsset"
29920
- );
29921
- if (handle !== void 0) {
29922
- const asset = resolveAssetHandle(world, handle);
29979
+ const handle2 = preparedHandle(runtime, world, String(textureValue.sampler), "SamplerAsset");
29980
+ if (handle2 !== void 0) {
29981
+ const asset = resolveAssetHandle(world, handle2);
29923
29982
  if (asset.ok) {
29924
- const resident = runtime.gpuStore.ensureSamplerResident(handle, asset.value, world);
29983
+ const resident = runtime.gpuStore.ensureSamplerResident(handle2, asset.value, world);
29925
29984
  if (resident.ok) sampler = resident.value;
29926
29985
  }
29927
29986
  }
29928
29987
  }
29929
29988
  let view = defaultViewForUserRegionField(field, pipelineState, schema);
29930
29989
  if (textureValue !== void 0) {
29931
- const handle = preparedHandle(
29932
- runtime,
29933
- caches,
29934
- world,
29935
- String(textureValue.texture),
29936
- "TextureAsset"
29937
- );
29938
- if (handle !== void 0) {
29939
- view = residentTextureView(world, runtime.gpuStore, runtime, handle) ?? view;
29990
+ const handle2 = preparedHandle(runtime, world, String(textureValue.texture), "TextureAsset");
29991
+ if (handle2 !== void 0) {
29992
+ view = residentTextureView(world, runtime.gpuStore, runtime, handle2) ?? view;
29940
29993
  }
29941
29994
  }
29942
29995
  textureResources.push({ sampler, view });
@@ -33550,7 +33603,8 @@ var PersistentRenderScene = class {
33550
33603
  /** Read existing culling bounds; never expose cached mutable arrays. */
33551
33604
  bounds(world, entity) {
33552
33605
  const entry = this.composition;
33553
- const worldId = entry?.worlds.indexOf(world) ?? -1;
33606
+ const identity = "source" in world ? `${world.source}:${world.epoch}` : world.identity;
33607
+ const worldId = entry?.worlds.findIndex((source) => source.identity === identity) ?? -1;
33554
33608
  if (entry === void 0 || worldId < 0) return void 0;
33555
33609
  const slot = entry.projection.slot(worldId, entity);
33556
33610
  if (slot === void 0) return void 0;
@@ -35214,7 +35268,6 @@ function createRenderSystem(internals) {
35214
35268
  if (group === 1 && layout !== void 0 && materialShaderId !== void 0 && typeof material === "object" && material !== null && "world" in material && "guid" in material && typeof material.world === "number" && typeof material.guid === "string") {
35215
35269
  return preparedMaterialBindings(
35216
35270
  runtime,
35217
- caches,
35218
35271
  worlds,
35219
35272
  materialShaderId,
35220
35273
  material.world,
@@ -44332,6 +44385,28 @@ function createRendererObservationCaptureOwner(fireError) {
44332
44385
  };
44333
44386
  return owner;
44334
44387
  }
44388
+ var PARTICLE_MESH_DEFAULTS = {
44389
+ position: [0, 0, 0],
44390
+ normal: [0, 0, 1],
44391
+ uv: [0, 0],
44392
+ tangent: [1, 0, 0, 1],
44393
+ uv1: [0, 0],
44394
+ color: [1, 1, 1, 1]
44395
+ };
44396
+ var PARTICLE_MESH_GEOMETRY = deriveVertexLayoutProjection(
44397
+ Object.fromEntries(Object.keys(PARTICLE_MESH_DEFAULTS).map((key) => [key, new Float32Array()]))
44398
+ );
44399
+ var PARTICLE_MESH_VERTEX_BUFFER = {
44400
+ arrayStride: PARTICLE_MESH_GEOMETRY.arrayStride,
44401
+ stepMode: "vertex",
44402
+ attributes: PARTICLE_MESH_GEOMETRY.attributes.map(({ key, shaderLocation, offset: offset2, format }) => ({
44403
+ shaderLocation: key === "color" ? 14 : key === "uv1" ? 15 : shaderLocation,
44404
+ offset: offset2,
44405
+ format
44406
+ }))
44407
+ };
44408
+
44409
+ // src/assembly/webgpu-vertex-layouts.ts
44335
44410
  var FLOAT32_COMPONENT_COUNT = {
44336
44411
  float32x2: 2,
44337
44412
  float32x3: 3,
@@ -44398,13 +44473,6 @@ var MESH_GEOMETRY_MATERIAL_INSTANCE_SPEC = {
44398
44473
  };
44399
44474
  var PREPARED_INSTANCE_VERTEX_ATTRS = buildMeshAttributeMapForUvSets(2);
44400
44475
  var PREPARED_MATERIAL_INSTANCE_VERTEX_ATTRS = SKIN_VERTEX_ATTRIBUTE_MAP;
44401
- function canonicalMeshVertexBufferLayout() {
44402
- const [buffer] = toGpuVertexBufferLayouts(deriveVertexBufferLayout(DEFAULT_VERTEX_ATTRIBUTE_MAP));
44403
- if (buffer === void 0) {
44404
- throw new Error("The canonical mesh vertex layout must contain one vertex buffer");
44405
- }
44406
- return { ...buffer, stepMode: "vertex" };
44407
- }
44408
44476
  var POSITION_SIZE_COLOR_INSTANCE_VERTEX_BUFFERS = [
44409
44477
  defineFeatureVertexBuffer(POSITION_SIZE_COLOR_INSTANCE_SPEC)
44410
44478
  ];
@@ -44415,7 +44483,7 @@ var TOPOLOGY_SEGMENT_INSTANCE_VERTEX_BUFFERS = [
44415
44483
  defineFeatureVertexBuffer(TOPOLOGY_SEGMENT_INSTANCE_SPEC)
44416
44484
  ];
44417
44485
  var MESH_GEOMETRY_MATERIAL_INSTANCE_VERTEX_BUFFERS = [
44418
- canonicalMeshVertexBufferLayout(),
44486
+ PARTICLE_MESH_VERTEX_BUFFER,
44419
44487
  defineFeatureVertexBuffer(MESH_GEOMETRY_MATERIAL_INSTANCE_SPEC)
44420
44488
  ];
44421
44489
  var PREPARED_MATERIAL_VERTEX_LAYOUTS = /* @__PURE__ */ new Set([
@@ -44727,11 +44795,10 @@ async function makeWebGPURenderer(internals) {
44727
44795
  const getShader = () => {
44728
44796
  const state = candidateShaderState ?? activeShaderState;
44729
44797
  if (state.shaderInstance === null) {
44730
- const bundler = internals.bundler;
44731
- const explicitUrl = bundler?.shaderManifestUrl;
44732
- state.shaderInstance = new ShaderCatalog({
44798
+ const activeCatalog = activeShaderState.shaderInstance;
44799
+ state.shaderInstance = state === candidateShaderState && activeCatalog !== null ? activeCatalog.forkForDevice(getShaderModuleAdapter()) : new ShaderCatalog({
44733
44800
  device: getShaderModuleAdapter(),
44734
- manifestUrl: bundler !== void 0 && "shaderManifestUrl" in bundler ? explicitUrl : "/shaders/manifest.json"
44801
+ manifestUrl: internals.bundler !== void 0 && "shaderManifestUrl" in internals.bundler ? internals.bundler.shaderManifestUrl : "/shaders/manifest.json"
44735
44802
  });
44736
44803
  }
44737
44804
  return state.shaderInstance;