@forgeax/engine-render 0.1.35 → 0.1.36

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 (87) hide show
  1. package/README.md +17 -0
  2. package/dist/assembly/webgpu-vertex-layouts.d.ts.map +1 -1
  3. package/dist/{chunk-MXTWKZO4.mjs → chunk-2OZAS3WU.mjs} +225 -4
  4. package/dist/chunk-2OZAS3WU.mjs.map +1 -0
  5. package/dist/{chunk-G6HDNGY7.mjs → chunk-BZQ4CDRF.mjs} +24 -230
  6. package/dist/chunk-BZQ4CDRF.mjs.map +1 -0
  7. package/dist/{chunk-LNIUIKQ7.mjs → chunk-CJOV2XLO.mjs} +77 -19
  8. package/dist/chunk-CJOV2XLO.mjs.map +1 -0
  9. package/dist/{chunk-3XUBWRY2.mjs → chunk-D6WSBXJ2.mjs} +4 -4
  10. package/dist/{chunk-3XUBWRY2.mjs.map → chunk-D6WSBXJ2.mjs.map} +1 -1
  11. package/dist/{chunk-LM5IE7GF.mjs → chunk-DRF6OULX.mjs} +3 -3
  12. package/dist/{chunk-LM5IE7GF.mjs.map → chunk-DRF6OULX.mjs.map} +1 -1
  13. package/dist/{chunk-SGPUJW3F.mjs → chunk-OB5WAFYH.mjs} +3 -3
  14. package/dist/{chunk-SGPUJW3F.mjs.map → chunk-OB5WAFYH.mjs.map} +1 -1
  15. package/dist/{chunk-MZ4C7EHF.mjs → chunk-OEYKKMXG.mjs} +5 -5
  16. package/dist/{chunk-MZ4C7EHF.mjs.map → chunk-OEYKKMXG.mjs.map} +1 -1
  17. package/dist/construct-renderer.mjs +130 -71
  18. package/dist/construct-renderer.mjs.map +1 -1
  19. package/dist/device/device-scope.d.ts.map +1 -1
  20. package/dist/features/particle-mesh-layout.d.ts +19 -0
  21. package/dist/features/particle-mesh-layout.d.ts.map +1 -0
  22. package/dist/features/types.d.ts +5 -1
  23. package/dist/features/types.d.ts.map +1 -1
  24. package/dist/gpu-driven/production-raster.d.ts +1 -1
  25. package/dist/gpu-driven/production-raster.d.ts.map +1 -1
  26. package/dist/gpu-driven/shadow-views.d.ts +1 -1
  27. package/dist/gpu-driven/shadow-views.d.ts.map +1 -1
  28. package/dist/gpu-driven/view-gpu.d.ts +1 -1
  29. package/dist/gpu-driven/view-gpu.d.ts.map +1 -1
  30. package/dist/index.mjs +48 -36
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/internal.mjs +5 -5
  33. package/dist/pbr-pipeline.d.ts.map +1 -1
  34. package/dist/publication/publisher.d.ts +1 -0
  35. package/dist/publication/publisher.d.ts.map +1 -1
  36. package/dist/record/frame.d.ts.map +1 -1
  37. package/dist/record/prepared-material-bindings.d.ts +1 -2
  38. package/dist/record/prepared-material-bindings.d.ts.map +1 -1
  39. package/dist/record/render-context.d.ts +2 -0
  40. package/dist/record/render-context.d.ts.map +1 -1
  41. package/dist/record/shadow-pass.d.ts +2 -2
  42. package/dist/record/shadow-pass.d.ts.map +1 -1
  43. package/dist/record/typed-frame-graph.d.ts.map +1 -1
  44. package/dist/recovery/render-system-candidate.d.ts +1 -8
  45. package/dist/recovery/render-system-candidate.d.ts.map +1 -1
  46. package/dist/render-system-extract-tail.d.ts.map +1 -1
  47. package/dist/render-system-extract.d.ts.map +1 -1
  48. package/dist/render-system.d.ts.map +1 -1
  49. package/dist/temporal/index.mjs +4 -4
  50. package/dist/typed-shadow-passes.d.ts.map +1 -1
  51. package/package.json +21 -21
  52. package/src/__tests__/device-scope-lifecycle.unit.test.ts +26 -0
  53. package/src/__tests__/gpu-driven-production.integration.test.ts +18 -1
  54. package/src/__tests__/gpu-driven-shadow-views.unit.test.ts +23 -0
  55. package/src/__tests__/material-vertex-texture.browser.test.ts +7 -0
  56. package/src/__tests__/material-vertex-texture.dawn.test.ts +7 -0
  57. package/src/__tests__/material-vertex-texture.fixture.ts +31 -0
  58. package/src/__tests__/recovery-candidate-prepare.contract.test.ts +5 -0
  59. package/src/__tests__/renderer-factory-material-contract.unit.test.ts +106 -4
  60. package/src/__tests__/runtime-material-program.integration.test.ts +79 -0
  61. package/src/__tests__/vertex-layouts-ssot.unit.test.ts +23 -3
  62. package/src/assembly/webgpu-renderer.ts +12 -9
  63. package/src/assembly/webgpu-vertex-layouts.ts +2 -9
  64. package/src/device/device-scope.ts +3 -0
  65. package/src/features/particle-mesh-layout.ts +25 -0
  66. package/src/features/types.ts +5 -1
  67. package/src/gpu-driven/production-raster.ts +9 -3
  68. package/src/gpu-driven/shadow-views.ts +27 -2
  69. package/src/gpu-driven/view-gpu.ts +5 -0
  70. package/src/pbr-pipeline.ts +4 -1
  71. package/src/publication/__tests__/features.integration.test.ts +51 -0
  72. package/src/publication/__tests__/publication.integration.test.ts +45 -0
  73. package/src/publication/publisher.ts +56 -29
  74. package/src/record/__tests__/prepared-runtime-material.integration.test.ts +134 -0
  75. package/src/record/frame.ts +45 -6
  76. package/src/record/prepared-material-bindings.ts +11 -37
  77. package/src/record/render-context.ts +2 -0
  78. package/src/record/shadow-pass.ts +65 -4
  79. package/src/record/typed-frame-graph.ts +5 -1
  80. package/src/recovery/render-system-candidate.ts +1 -9
  81. package/src/render-system-extract-tail.ts +15 -6
  82. package/src/render-system-extract.ts +9 -2
  83. package/src/render-system.ts +0 -1
  84. package/src/typed-shadow-passes.ts +36 -5
  85. package/dist/chunk-G6HDNGY7.mjs.map +0 -1
  86. package/dist/chunk-LNIUIKQ7.mjs.map +0 -1
  87. 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-OEYKKMXG.mjs';
2
+ import { createExtendedLightingState, promoteExtendedLightingCandidate, emptyBloomInspection, projectExtendedLightingInspection, OcclusionRenderRuntime, viewKey, primitiveKey, projectBarrelDistortionInspection, viewKeyId, primitiveKeyId, ProbeBlendSceneProjection, createSsrHistoryOwner, createSsrSpatialResources } from './chunk-D6WSBXJ2.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-BZQ4CDRF.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-CJOV2XLO.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-OB5WAFYH.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-2OZAS3WU.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 ?? []
@@ -16560,7 +16585,14 @@ var GpuDrivenProduction = class _GpuDrivenProduction {
16560
16585
  };
16561
16586
  }
16562
16587
  const shadowTopologySignature = () => this.shadowViews?.inspect().map(
16563
- (entry) => `${shadowViewIdentityKey(entry.identity)}:${entry.cache}:${entry.generation}:${entry.sourceRevision}:${entry.resourceGeneration}`
16588
+ (entry) => (
16589
+ // Cache decisions and logical update generations are frame-local
16590
+ // producer state. They must not feed the compiled graph key: a
16591
+ // graph replacement may intentionally invalidate a shadow view
16592
+ // once without creating a graph-rebuild feedback loop. Resource
16593
+ // and source-plan generations remain real graph dependencies.
16594
+ `${shadowViewIdentityKey(entry.identity)}:${entry.sourceRevision}:${entry.resourceGeneration}`
16595
+ )
16564
16596
  ).join("|") ?? "";
16565
16597
  const production = this;
16566
16598
  const surfaceDynamicInputForCommit = this.surfaceSubmission !== void 0 && input.surfaceDynamicInput !== void 0 ? {
@@ -16661,10 +16693,10 @@ var GpuDrivenProduction = class _GpuDrivenProduction {
16661
16693
  frameNumber
16662
16694
  )
16663
16695
  },
16664
- projectShadow: (graph, identity) => {
16696
+ projectShadow: (graph, identity, forceCompute = false) => {
16665
16697
  if (!shadowViewPool.isActive(identity) || shadowViewPool.submission(identity) === void 0)
16666
16698
  return ok(void 0);
16667
- return shadowViewPool.project(graph, identity);
16699
+ return shadowViewPool.project(graph, identity, forceCompute);
16668
16700
  },
16669
16701
  updateShadowViews: (views) => shadowFiltered.plan.batches.length > 0 ? this.updateShadowViews(
16670
16702
  views,
@@ -23889,7 +23921,13 @@ function ensureCompiledFrameGraph(internals, frameState, pipelineState, camera,
23889
23921
  );
23890
23922
  },
23891
23923
  ...gpuDriven?.projectShadow === void 0 ? {} : {
23892
- projectGpuDrivenShadow: (identity) => gpuDriven.projectShadow?.(builder, identity) ?? ok$1(void 0)
23924
+ projectGpuDrivenShadow: (identity) => (
23925
+ // A newly compiled graph must include the shadow compute passes
23926
+ // even when the producer cache hit. The graph owns its pass
23927
+ // list; importing only the cached view resources would reuse
23928
+ // stale indirect arguments after a topology replacement.
23929
+ gpuDriven.projectShadow?.(builder, identity, true) ?? ok$1(void 0)
23930
+ )
23893
23931
  },
23894
23932
  contributeShadowFeatures: () => featureShadows ??= projectRenderFeatureShadows(
23895
23933
  builder,
@@ -25088,8 +25126,32 @@ function runRecordProfilePhase(runner, phase, action) {
25088
25126
  function shadowPlanes(matrix) {
25089
25127
  return frustum.fromViewProjection(frustum.create(), matrix);
25090
25128
  }
25091
- function shadowViewToken(matrix) {
25092
- return Array.from(matrix).join(",");
25129
+ function shadowViewPlanesByView(lights) {
25130
+ const views = /* @__PURE__ */ new Map();
25131
+ for (const [index, matrix] of (lights.lightViewProj ?? []).entries()) {
25132
+ views.set(shadowViewIdentityKey({ kind: "directional", index }), shadowPlanes(matrix));
25133
+ }
25134
+ for (const [index, point] of lights.pointShadow.entries()) {
25135
+ for (let face = 0; face < 6; face += 1) {
25136
+ views.set(
25137
+ shadowViewIdentityKey({ kind: "point", index, face }),
25138
+ shadowPlanes(point.shadowMatrices.subarray(face * 16, face * 16 + 16))
25139
+ );
25140
+ }
25141
+ }
25142
+ let spotIndex = 0;
25143
+ for (const spot of lights.spot) {
25144
+ if (spot.lightViewProj === void 0) continue;
25145
+ views.set(
25146
+ shadowViewIdentityKey({ kind: "spot", index: spotIndex }),
25147
+ shadowPlanes(spot.lightViewProj)
25148
+ );
25149
+ spotIndex += 1;
25150
+ }
25151
+ return views;
25152
+ }
25153
+ function shadowViewToken(matrix, targetSize, graphGeneration) {
25154
+ return `${Array.from(matrix).join(",")}|target:${targetSize}|graph:${graphGeneration}`;
25093
25155
  }
25094
25156
  function halfFloatToNumber(bits) {
25095
25157
  const sign = (bits & 32768) === 0 ? 1 : -1;
@@ -25991,7 +26053,7 @@ function recordFrame(internals, world, cameras, lights, renderables, transparent
25991
26053
  shadowViews.push({
25992
26054
  identity: { kind: "directional", index },
25993
26055
  planes: shadowPlanes(matrix),
25994
- cacheToken: `${shadowViewToken(matrix)}|target:${graphShadowMapSize}:${frameState.graphGeneration}`
26056
+ cacheToken: shadowViewToken(matrix, graphShadowMapSize, frameState.graphGeneration)
25995
26057
  });
25996
26058
  }
25997
26059
  for (const [index, point] of lights.pointShadow.entries()) {
@@ -26000,7 +26062,7 @@ function recordFrame(internals, world, cameras, lights, renderables, transparent
26000
26062
  shadowViews.push({
26001
26063
  identity: { kind: "point", index, face },
26002
26064
  planes: shadowPlanes(matrix),
26003
- cacheToken: `${shadowViewToken(matrix)}|target:${graphShadowMapSize}:${frameState.graphGeneration}`
26065
+ cacheToken: shadowViewToken(matrix, graphShadowMapSize, frameState.graphGeneration)
26004
26066
  });
26005
26067
  }
26006
26068
  }
@@ -26010,7 +26072,11 @@ function recordFrame(internals, world, cameras, lights, renderables, transparent
26010
26072
  shadowViews.push({
26011
26073
  identity: { kind: "spot", index: shadowSpotIndex },
26012
26074
  planes: shadowPlanes(spot.lightViewProj),
26013
- cacheToken: `${shadowViewToken(spot.lightViewProj)}|target:${graphShadowMapSize}:${frameState.graphGeneration}`
26075
+ cacheToken: shadowViewToken(
26076
+ spot.lightViewProj,
26077
+ graphShadowMapSize,
26078
+ frameState.graphGeneration
26079
+ )
26014
26080
  });
26015
26081
  shadowSpotIndex += 1;
26016
26082
  }
@@ -26564,6 +26630,7 @@ function recordFrame(internals, world, cameras, lights, renderables, transparent
26564
26630
  gpuDrivenShadowDrawKeysByView: rasterGpuDriven.shadowDrawKeysByView
26565
26631
  }
26566
26632
  },
26633
+ shadowViewPlanesByView: shadowViewPlanesByView(lights),
26567
26634
  ...frameGpuDriven?.scene === void 0 ? {} : { gpuDrivenSceneMaterialBuffer: frameGpuDriven.scene.scene.materialBuffer },
26568
26635
  ...cubeCapture?.reflectionProbes === void 0 ? {} : { reflectionProbes: cubeCapture.reflectionProbes },
26569
26636
  ...cubeCapture?.captureDispatch === void 0 ? {} : { captureDispatch: cubeCapture.captureDispatch },
@@ -29844,34 +29911,25 @@ function createPreparedResolverCaches() {
29844
29911
  preparedMaterialPipelineShaders: /* @__PURE__ */ new WeakMap(),
29845
29912
  preparedGroup0Pipelines: /* @__PURE__ */ new WeakSet(),
29846
29913
  preparedViewOnlyPipelines: /* @__PURE__ */ new WeakSet(),
29847
- preparedRenderMaterialPipelines: /* @__PURE__ */ new WeakSet(),
29848
- preparedAssetHandles: /* @__PURE__ */ new WeakMap()
29914
+ preparedRenderMaterialPipelines: /* @__PURE__ */ new WeakSet()
29849
29915
  };
29850
29916
  }
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;
29917
+ function preparedHandle(runtime, world, guid, brand) {
29860
29918
  if ("resolveAsset" in world)
29861
29919
  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;
29920
+ return internSharedRefFromGuid(world, runtime.assets, guid, brand);
29867
29921
  }
29868
- function preparedMaterialBindings(runtime, caches, worlds, materialShaderId, worldIndex, materialGuid, layout, skylightResources) {
29922
+ function preparedMaterialBindings(runtime, worlds, materialShaderId, worldIndex, materialGuid, layout, skylightResources) {
29869
29923
  const world = worlds[worldIndex];
29870
- const material = world === void 0 ? void 0 : renderAssetByGuid(world, runtime.assets, materialGuid);
29924
+ const handle = world === void 0 ? void 0 : preparedHandle(runtime, world, materialGuid, "MaterialAsset");
29871
29925
  const pipelineState = runtime.getPipelineState();
29872
- if (world === void 0 || material?.kind !== "material" || pipelineState === null) {
29926
+ if (world === void 0 || handle === void 0 || pipelineState === null) {
29873
29927
  return err(new Error("prepared material asset is unavailable"));
29874
29928
  }
29929
+ const resolved2 = resolveAssetHandle(world, handle);
29930
+ if (!resolved2.ok) return resolved2;
29931
+ const material = resolved2.value;
29932
+ if (material.kind !== "material") return err(new Error("prepared material asset is unavailable"));
29875
29933
  const schema = runtime.getParamSchema?.(materialShaderId) ?? [];
29876
29934
  const values = materialValuesToLinearRuntime(
29877
29935
  material.values,
@@ -29911,32 +29969,20 @@ function preparedMaterialBindings(runtime, caches, worlds, materialShaderId, wor
29911
29969
  const textureValue = typeof value === "object" && value !== null && "texture" in value ? value : void 0;
29912
29970
  let sampler = pipelineState.defaultSampler;
29913
29971
  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);
29972
+ const handle2 = preparedHandle(runtime, world, String(textureValue.sampler), "SamplerAsset");
29973
+ if (handle2 !== void 0) {
29974
+ const asset = resolveAssetHandle(world, handle2);
29923
29975
  if (asset.ok) {
29924
- const resident = runtime.gpuStore.ensureSamplerResident(handle, asset.value, world);
29976
+ const resident = runtime.gpuStore.ensureSamplerResident(handle2, asset.value, world);
29925
29977
  if (resident.ok) sampler = resident.value;
29926
29978
  }
29927
29979
  }
29928
29980
  }
29929
29981
  let view = defaultViewForUserRegionField(field, pipelineState, schema);
29930
29982
  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;
29983
+ const handle2 = preparedHandle(runtime, world, String(textureValue.texture), "TextureAsset");
29984
+ if (handle2 !== void 0) {
29985
+ view = residentTextureView(world, runtime.gpuStore, runtime, handle2) ?? view;
29940
29986
  }
29941
29987
  }
29942
29988
  textureResources.push({ sampler, view });
@@ -35214,7 +35260,6 @@ function createRenderSystem(internals) {
35214
35260
  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
35261
  return preparedMaterialBindings(
35216
35262
  runtime,
35217
- caches,
35218
35263
  worlds,
35219
35264
  materialShaderId,
35220
35265
  material.world,
@@ -44332,6 +44377,28 @@ function createRendererObservationCaptureOwner(fireError) {
44332
44377
  };
44333
44378
  return owner;
44334
44379
  }
44380
+ var PARTICLE_MESH_DEFAULTS = {
44381
+ position: [0, 0, 0],
44382
+ normal: [0, 0, 1],
44383
+ uv: [0, 0],
44384
+ tangent: [1, 0, 0, 1],
44385
+ uv1: [0, 0],
44386
+ color: [1, 1, 1, 1]
44387
+ };
44388
+ var PARTICLE_MESH_GEOMETRY = deriveVertexLayoutProjection(
44389
+ Object.fromEntries(Object.keys(PARTICLE_MESH_DEFAULTS).map((key) => [key, new Float32Array()]))
44390
+ );
44391
+ var PARTICLE_MESH_VERTEX_BUFFER = {
44392
+ arrayStride: PARTICLE_MESH_GEOMETRY.arrayStride,
44393
+ stepMode: "vertex",
44394
+ attributes: PARTICLE_MESH_GEOMETRY.attributes.map(({ key, shaderLocation, offset: offset2, format }) => ({
44395
+ shaderLocation: key === "color" ? 14 : key === "uv1" ? 15 : shaderLocation,
44396
+ offset: offset2,
44397
+ format
44398
+ }))
44399
+ };
44400
+
44401
+ // src/assembly/webgpu-vertex-layouts.ts
44335
44402
  var FLOAT32_COMPONENT_COUNT = {
44336
44403
  float32x2: 2,
44337
44404
  float32x3: 3,
@@ -44398,13 +44465,6 @@ var MESH_GEOMETRY_MATERIAL_INSTANCE_SPEC = {
44398
44465
  };
44399
44466
  var PREPARED_INSTANCE_VERTEX_ATTRS = buildMeshAttributeMapForUvSets(2);
44400
44467
  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
44468
  var POSITION_SIZE_COLOR_INSTANCE_VERTEX_BUFFERS = [
44409
44469
  defineFeatureVertexBuffer(POSITION_SIZE_COLOR_INSTANCE_SPEC)
44410
44470
  ];
@@ -44415,7 +44475,7 @@ var TOPOLOGY_SEGMENT_INSTANCE_VERTEX_BUFFERS = [
44415
44475
  defineFeatureVertexBuffer(TOPOLOGY_SEGMENT_INSTANCE_SPEC)
44416
44476
  ];
44417
44477
  var MESH_GEOMETRY_MATERIAL_INSTANCE_VERTEX_BUFFERS = [
44418
- canonicalMeshVertexBufferLayout(),
44478
+ PARTICLE_MESH_VERTEX_BUFFER,
44419
44479
  defineFeatureVertexBuffer(MESH_GEOMETRY_MATERIAL_INSTANCE_SPEC)
44420
44480
  ];
44421
44481
  var PREPARED_MATERIAL_VERTEX_LAYOUTS = /* @__PURE__ */ new Set([
@@ -44727,11 +44787,10 @@ async function makeWebGPURenderer(internals) {
44727
44787
  const getShader = () => {
44728
44788
  const state = candidateShaderState ?? activeShaderState;
44729
44789
  if (state.shaderInstance === null) {
44730
- const bundler = internals.bundler;
44731
- const explicitUrl = bundler?.shaderManifestUrl;
44732
- state.shaderInstance = new ShaderCatalog({
44790
+ const activeCatalog = activeShaderState.shaderInstance;
44791
+ state.shaderInstance = state === candidateShaderState && activeCatalog !== null ? activeCatalog.forkForDevice(getShaderModuleAdapter()) : new ShaderCatalog({
44733
44792
  device: getShaderModuleAdapter(),
44734
- manifestUrl: bundler !== void 0 && "shaderManifestUrl" in bundler ? explicitUrl : "/shaders/manifest.json"
44793
+ manifestUrl: internals.bundler !== void 0 && "shaderManifestUrl" in internals.bundler ? internals.bundler.shaderManifestUrl : "/shaders/manifest.json"
44735
44794
  });
44736
44795
  }
44737
44796
  return state.shaderInstance;