@forgeax/engine-render 0.1.29 → 0.1.31
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.
- package/README.md +248 -21
- package/dist/assembly/atmosphere-shader-prewarm.d.ts +1 -1
- package/dist/assembly/atmosphere-shader-prewarm.d.ts.map +1 -1
- package/dist/assembly/device-feature-admission.d.ts +4 -3
- package/dist/assembly/device-feature-admission.d.ts.map +1 -1
- package/dist/assembly/dynamic-geometry-host.d.ts +6 -0
- package/dist/assembly/dynamic-geometry-host.d.ts.map +1 -1
- package/dist/assembly/host-contract.d.ts +6 -0
- package/dist/assembly/host-contract.d.ts.map +1 -1
- package/dist/assembly/material/assembly.d.ts +26 -3
- package/dist/assembly/material/assembly.d.ts.map +1 -1
- package/dist/assembly/material/pipeline-helpers.d.ts +24 -0
- package/dist/assembly/material/pipeline-helpers.d.ts.map +1 -0
- package/dist/assembly/material-shader-policy.d.ts.map +1 -1
- package/dist/assembly/recovery/device-loss-fanout.d.ts.map +1 -1
- package/dist/assembly/recovery/recovery-attempt.d.ts +1 -6
- package/dist/assembly/recovery/recovery-attempt.d.ts.map +1 -1
- package/dist/assembly/recovery/renderer-recover.d.ts +1 -0
- package/dist/assembly/recovery/renderer-recover.d.ts.map +1 -1
- package/dist/assembly/renderer-facade.d.ts.map +1 -1
- package/dist/assembly/shader-prewarm-policy.d.ts +1 -1
- package/dist/assembly/shader-prewarm-policy.d.ts.map +1 -1
- package/dist/assembly/webgpu-ready.d.ts +1 -1
- package/dist/assembly/webgpu-ready.d.ts.map +1 -1
- package/dist/assembly/webgpu-renderer.d.ts.map +1 -1
- package/dist/capture/scene-projection.d.ts +41 -0
- package/dist/capture/scene-projection.d.ts.map +1 -0
- package/dist/{chunk-BQVQOQJH.mjs → chunk-7MQ3XBSP.mjs} +20 -14
- package/dist/chunk-7MQ3XBSP.mjs.map +1 -0
- package/dist/{chunk-S4DNKQYQ.mjs → chunk-C3DDSXYK.mjs} +86 -33
- package/dist/chunk-C3DDSXYK.mjs.map +1 -0
- package/dist/{chunk-BTWH7BP4.mjs → chunk-FUUO4UND.mjs} +73 -29
- package/dist/chunk-FUUO4UND.mjs.map +1 -0
- package/dist/{chunk-NRNXBLIJ.mjs → chunk-JRBDO2KB.mjs} +46 -6
- package/dist/chunk-JRBDO2KB.mjs.map +1 -0
- package/dist/{chunk-NICXSHAT.mjs → chunk-MDQJPY3T.mjs} +8 -6
- package/dist/chunk-MDQJPY3T.mjs.map +1 -0
- package/dist/{chunk-JQTSEI3Z.mjs → chunk-NO4WZCAH.mjs} +3 -3
- package/dist/chunk-NO4WZCAH.mjs.map +1 -0
- package/dist/{chunk-FUODTTIA.mjs → chunk-PSEQ6QPH.mjs} +621 -108
- package/dist/chunk-PSEQ6QPH.mjs.map +1 -0
- package/dist/{chunk-33XZFTQU.mjs → chunk-S5UE2T5P.mjs} +48 -6
- package/dist/chunk-S5UE2T5P.mjs.map +1 -0
- package/dist/components/directional-light.d.ts +2 -2
- package/dist/components/dynamic-resolution.d.ts +15 -0
- package/dist/components/dynamic-resolution.d.ts.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/light-helpers.d.ts.map +1 -1
- package/dist/components/reflection-probe.d.ts +1 -0
- package/dist/components/reflection-probe.d.ts.map +1 -1
- package/dist/components/skylight.d.ts +4 -1
- package/dist/components/skylight.d.ts.map +1 -1
- package/dist/construct-renderer.mjs +2172 -796
- package/dist/construct-renderer.mjs.map +1 -1
- package/dist/device/device-scope.d.ts +2 -0
- package/dist/device/device-scope.d.ts.map +1 -1
- package/dist/device/gpu-residency.d.ts +2 -2
- package/dist/device/gpu-residency.d.ts.map +1 -1
- package/dist/dynamic-geometry.d.ts.map +1 -1
- package/dist/environment/background.d.ts +3 -2
- package/dist/environment/background.d.ts.map +1 -1
- package/dist/environment/ibl.d.ts +11 -0
- package/dist/environment/ibl.d.ts.map +1 -0
- package/dist/environment/storage.d.ts +14 -0
- package/dist/environment/storage.d.ts.map +1 -0
- package/dist/errors/gpu-driven.d.ts +2 -2
- package/dist/errors/gpu-driven.d.ts.map +1 -1
- package/dist/errors/render.d.ts +35 -1
- package/dist/errors/render.d.ts.map +1 -1
- package/dist/extract/camera.d.ts.map +1 -1
- package/dist/extract/contracts.d.ts +7 -0
- package/dist/extract/contracts.d.ts.map +1 -1
- package/dist/extract/gpu-driven.d.ts +18 -1
- package/dist/extract/gpu-driven.d.ts.map +1 -1
- package/dist/gpu-driven/batch-topology.d.ts.map +1 -1
- package/dist/gpu-driven/material-artifacts.d.ts +24 -0
- package/dist/gpu-driven/material-artifacts.d.ts.map +1 -0
- package/dist/gpu-driven/material-bindings.d.ts +7 -0
- package/dist/gpu-driven/material-bindings.d.ts.map +1 -0
- package/dist/gpu-driven/prepared-draw.d.ts +2 -0
- package/dist/gpu-driven/prepared-draw.d.ts.map +1 -1
- package/dist/gpu-driven/production-raster.d.ts +27 -6
- package/dist/gpu-driven/production-raster.d.ts.map +1 -1
- package/dist/gpu-resource.d.ts +5 -2
- package/dist/gpu-resource.d.ts.map +1 -1
- package/dist/gpu-scene-schema.d.ts.map +1 -1
- package/dist/gpu-scene.d.ts.map +1 -1
- package/dist/hdrp-buffers.d.ts +3 -0
- package/dist/hdrp-buffers.d.ts.map +1 -1
- package/dist/ibl/IblPipelineCache.d.ts +2 -0
- package/dist/ibl/IblPipelineCache.d.ts.map +1 -1
- package/dist/ibl/skylight-bind-group.d.ts +3 -1
- package/dist/ibl/skylight-bind-group.d.ts.map +1 -1
- package/dist/index.d.ts +83 -81
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +7 -5
- package/dist/index.mjs.map +1 -1
- package/dist/inspection-types.d.ts +16 -1
- package/dist/inspection-types.d.ts.map +1 -1
- package/dist/internal.mjs +6 -6
- package/dist/material-row.d.ts +10 -0
- package/dist/material-row.d.ts.map +1 -1
- package/dist/pbr-pipeline.d.ts +3 -1
- package/dist/pbr-pipeline.d.ts.map +1 -1
- package/dist/pipeline/render-extent.d.ts +51 -0
- package/dist/pipeline/render-extent.d.ts.map +1 -0
- package/dist/pipeline/standard-build-context.d.ts +7 -0
- package/dist/pipeline/standard-build-context.d.ts.map +1 -0
- package/dist/pipeline/standard-forward-lane.d.ts +3 -2
- package/dist/pipeline/standard-forward-lane.d.ts.map +1 -1
- package/dist/pipeline/standard-pipeline.d.ts.map +1 -1
- package/dist/pipeline/standard-post.d.ts +1 -1
- package/dist/pipeline/standard-post.d.ts.map +1 -1
- package/dist/pipeline/standard-profile.d.ts +2 -1
- package/dist/pipeline/standard-profile.d.ts.map +1 -1
- package/dist/pipeline-builder.d.ts +3 -1
- package/dist/pipeline-builder.d.ts.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/post-process-errors.d.ts +9 -2
- package/dist/post-process-errors.d.ts.map +1 -1
- package/dist/prepare/extended-lighting/resources.d.ts +3 -3
- package/dist/record/frame-lighting.d.ts.map +1 -1
- package/dist/record/frame-snapshot.d.ts +3 -8
- package/dist/record/frame-snapshot.d.ts.map +1 -1
- package/dist/record/frame.d.ts +3 -2
- package/dist/record/frame.d.ts.map +1 -1
- package/dist/record/main-pass-geometry.d.ts +7 -2
- package/dist/record/main-pass-geometry.d.ts.map +1 -1
- package/dist/record/main-pass-material.d.ts +6 -3
- package/dist/record/main-pass-material.d.ts.map +1 -1
- package/dist/record/main-pass.d.ts +2 -0
- package/dist/record/main-pass.d.ts.map +1 -1
- package/dist/record/prepared-material-bindings.d.ts.map +1 -1
- package/dist/record/recovery-pipeline.d.ts +9 -1
- package/dist/record/recovery-pipeline.d.ts.map +1 -1
- package/dist/record/render-context.d.ts +34 -3
- package/dist/record/render-context.d.ts.map +1 -1
- package/dist/record/shadow-pass.d.ts +2 -2
- package/dist/record/shadow-pass.d.ts.map +1 -1
- package/dist/record/typed-frame-graph.d.ts +5 -2
- package/dist/record/typed-frame-graph.d.ts.map +1 -1
- package/dist/recovery/render-system-candidate.d.ts.map +1 -1
- package/dist/reflection/background.d.ts +14 -0
- package/dist/reflection/background.d.ts.map +1 -0
- package/dist/reflection/filter.d.ts.map +1 -1
- package/dist/reflection/projection.d.ts +1 -0
- package/dist/reflection/projection.d.ts.map +1 -1
- package/dist/reflection/record-owner.d.ts +4 -2
- package/dist/reflection/record-owner.d.ts.map +1 -1
- package/dist/render-contract.d.ts +47 -32
- package/dist/render-contract.d.ts.map +1 -1
- package/dist/render-graph-primitives.d.ts.map +1 -1
- package/dist/render-pipeline.d.ts +17 -1
- package/dist/render-pipeline.d.ts.map +1 -1
- package/dist/render-system-extract-tail.d.ts +9 -2
- package/dist/render-system-extract-tail.d.ts.map +1 -1
- package/dist/render-system-extract.d.ts +29 -2
- package/dist/render-system-extract.d.ts.map +1 -1
- package/dist/render-system.d.ts.map +1 -1
- package/dist/scene/render-scene.d.ts +2 -0
- package/dist/scene/render-scene.d.ts.map +1 -1
- package/dist/ssao-config.d.ts +8 -6
- package/dist/ssao-config.d.ts.map +1 -1
- package/dist/ssr/graph.d.ts.map +1 -1
- package/dist/temporal/gpu.d.ts.map +1 -1
- package/dist/temporal/index.mjs +5 -5
- package/dist/temporal/standard-scene-data.d.ts +2 -1
- package/dist/temporal/standard-scene-data.d.ts.map +1 -1
- package/dist/temporal/target-coverage-attachment.d.ts +15 -0
- package/dist/temporal/target-coverage-attachment.d.ts.map +1 -0
- package/dist/temporal/temporal-view.d.ts +6 -2
- package/dist/temporal/temporal-view.d.ts.map +1 -1
- package/dist/temporal/view.d.ts +6 -0
- package/dist/temporal/view.d.ts.map +1 -1
- package/dist/typed-render-graph-primitives.d.ts +6 -0
- package/dist/typed-render-graph-primitives.d.ts.map +1 -1
- package/dist/volume/component.d.ts +1 -0
- package/dist/volume/component.d.ts.map +1 -1
- package/package.json +21 -21
- package/src/__tests__/capture-scene-projection.unit.test.ts +24 -0
- package/src/__tests__/device-feature-admission.unit.test.ts +15 -24
- package/src/__tests__/device-loss-fanout.unit.test.ts +43 -0
- package/src/__tests__/dynamic-geometry-batch.unit.test.ts +157 -0
- package/src/__tests__/dynamic-geometry.unit.test.ts +36 -0
- package/src/__tests__/dynamic-resolution-plugin.integration.test.ts +81 -0
- package/src/__tests__/factory-contract.integration.test.ts +164 -1
- package/src/__tests__/frame-observation.contract.test.ts +21 -0
- package/src/__tests__/gpu-driven-baseline.characterization.test.ts +1 -1
- package/src/__tests__/gpu-driven-batch-topology-pbr.unit.test.ts +20 -1
- package/src/__tests__/gpu-driven-lod-cache.unit.test.ts +0 -3
- package/src/__tests__/gpu-driven-mesh-world-identity.unit.test.ts +0 -3
- package/src/__tests__/gpu-driven-pbr.dawn.test.ts +11 -6
- package/src/__tests__/gpu-driven-production.integration.test.ts +13 -25
- package/src/__tests__/gpu-driven-view.unit.test.ts +1 -0
- package/src/__tests__/gpu-pass-timing-browser-runner.ts +15 -0
- package/src/__tests__/gpu-pass-timing.browser.test.ts +14 -1
- package/src/__tests__/gpu-resource-scope.unit.test.ts +71 -0
- package/src/__tests__/gpu-scene.unit.test.ts +55 -1
- package/src/__tests__/materials-standard-contract.unit.test.ts +5 -1
- package/src/__tests__/mesh-submission-lifetime.unit.test.ts +8 -0
- package/src/__tests__/morph-neutral-admission.unit.test.ts +19 -0
- package/src/__tests__/physical-clearcoat.integration.test.ts +6 -1
- package/src/__tests__/post-process-error-policy-owner.unit.test.ts +6 -5
- package/src/__tests__/prepared-gpu-driven-pbr.integration.test.ts +216 -5
- package/src/__tests__/reflection-fallback-async-publication.unit.test.ts +68 -1
- package/src/__tests__/reflection-probe-authoring.unit.test.ts +12 -10
- package/src/__tests__/reflection-probe-box.dawn.test.ts +71 -0
- package/src/__tests__/reflection-probe-filter.unit.test.ts +9 -0
- package/src/__tests__/reflection-probe-orientation.dawn.test.ts +294 -0
- package/src/__tests__/reflection-probe-record-owner.characterization.unit.test.ts +5 -15
- package/src/__tests__/reflection-probe-updates.unit.test.ts +129 -0
- package/src/__tests__/render-error-code-owner.test-d.ts +3 -0
- package/src/__tests__/render-error-detail-ssot.test-d.ts +5 -1
- package/src/__tests__/render-extent.unit.test.ts +63 -0
- package/src/__tests__/render-scene-projection.unit.test.ts +3 -2
- package/src/__tests__/renderer-factory-material-contract.unit.test.ts +173 -9
- package/src/__tests__/shader-manifest-fixture.ts +6 -0
- package/src/__tests__/skinned-shadow-caster.test.ts +8 -1
- package/src/__tests__/specular-environment-scale.dawn.test.ts +4 -2
- package/src/__tests__/ssao-config.unit.test.ts +7 -0
- package/src/__tests__/ssao-surface.dawn.test.ts +252 -0
- package/src/__tests__/ssr-cube-silhouette.dawn.test.ts +270 -0
- package/src/__tests__/ssr-gpu-dispatch.browser.test.ts +51 -43
- package/src/__tests__/ssr-gpu-dispatch.dawn.test.ts +4 -0
- package/src/__tests__/ssr-gpu-dispatch.ts +10 -5
- package/src/__tests__/ssr-graph-topology.unit.test.ts +2 -2
- package/src/__tests__/ssr-hiz.browser.test.ts +1 -1
- package/src/__tests__/ssr-hiz.dawn.test.ts +1 -1
- package/src/__tests__/ssr-spatial.integration.test.ts +1 -1
- package/src/__tests__/standard-cluster-variant-resolution.unit.test.ts +40 -0
- package/src/__tests__/standard-pbr-artifact-assembly.unit.test.ts +238 -1
- package/src/__tests__/standard-profile-oracle.unit.test.ts +27 -0
- package/src/__tests__/taa-coverage-edge.dawn.test.ts +6 -0
- package/src/__tests__/taa-neighborhood-equivalence.dawn.test.ts +5 -1
- package/src/__tests__/taa-stability-feedback.ts +1 -0
- package/src/__tests__/temporal-reset-matrix.unit.test.ts +2 -2
- package/src/__tests__/temporal-view.unit.test.ts +17 -0
- package/src/__tests__/transmission-prewarm.unit.test.ts +57 -0
- package/src/__tests__/volumetric-fog-stage-readback.dawn.test.ts +62 -13
- package/src/__tests__/volumetric-fog-topology.unit.test.ts +7 -7
- package/src/assembly/atmosphere-shader-prewarm.ts +3 -2
- package/src/assembly/device-feature-admission.ts +9 -4
- package/src/assembly/dynamic-geometry-host.ts +236 -163
- package/src/assembly/host-contract.ts +9 -0
- package/src/assembly/material/assembly.ts +350 -6
- package/src/assembly/material/pipeline-helpers.ts +100 -0
- package/src/assembly/material-shader-policy.ts +39 -18
- package/src/assembly/recovery/device-loss-fanout.ts +5 -0
- package/src/assembly/recovery/recovery-attempt.ts +2 -29
- package/src/assembly/recovery/renderer-recover.ts +6 -9
- package/src/assembly/renderer-facade.ts +22 -1
- package/src/assembly/shader-prewarm-policy.ts +14 -1
- package/src/assembly/webgpu-ready.ts +28 -19
- package/src/assembly/webgpu-renderer.ts +95 -95
- package/src/capture/scene-projection.ts +37 -0
- package/src/components/__tests__/dynamic-resolution-schema.unit.test.ts +65 -0
- package/src/components/__tests__/light-radius.integration.test.ts +59 -0
- package/src/components/directional-light.ts +3 -3
- package/src/components/dynamic-resolution.ts +67 -0
- package/src/components/index.ts +1 -0
- package/src/components/light-helpers.ts +6 -1
- package/src/components/reflection-probe.ts +1 -0
- package/src/components/skylight.ts +4 -1
- package/src/device/device-scope.ts +13 -7
- package/src/device/gpu-residency.ts +11 -11
- package/src/dynamic-geometry.ts +13 -8
- package/src/environment/background.ts +30 -12
- package/src/environment/ibl.ts +211 -0
- package/src/environment/storage.ts +63 -0
- package/src/errors/gpu-driven.ts +10 -3
- package/src/errors/render.ts +64 -0
- package/src/extract/camera.ts +12 -1
- package/src/extract/contracts.ts +10 -0
- package/src/extract/gpu-driven.ts +72 -17
- package/src/gpu-driven/batch-topology.ts +33 -11
- package/src/gpu-driven/material-artifacts.ts +179 -0
- package/src/gpu-driven/material-bindings.ts +41 -0
- package/src/gpu-driven/prepared-draw.ts +13 -2
- package/src/gpu-driven/production-raster.ts +681 -164
- package/src/gpu-resource.ts +21 -2
- package/src/gpu-scene-schema.ts +11 -2
- package/src/gpu-scene.ts +14 -3
- package/src/hdrp-buffers.ts +69 -0
- package/src/ibl/IblPipelineCache.ts +5 -0
- package/src/ibl/skylight-bind-group.ts +27 -17
- package/src/index.ts +92 -81
- package/src/inspection-types.ts +16 -1
- package/src/material-row.ts +60 -11
- package/src/pbr-pipeline.ts +13 -2
- package/src/pipeline/render-extent.ts +111 -0
- package/src/pipeline/standard-build-context.ts +7 -0
- package/src/pipeline/standard-forward-lane.ts +41 -24
- package/src/pipeline/standard-pipeline.ts +47 -18
- package/src/pipeline/standard-post.ts +4 -0
- package/src/pipeline/standard-profile.ts +2 -1
- package/src/pipeline-builder.ts +12 -3
- package/src/plugin.ts +4 -0
- package/src/post-process-errors.ts +26 -18
- package/src/prepare/__tests__/extended-lighting-capability.unit.test.ts +2 -2
- package/src/prepare/extended-lighting/resources.ts +3 -3
- package/src/record/__tests__/main-pass-geometry.unit.test.ts +68 -0
- package/src/record/__tests__/material-bg-cache.unit.test.ts +45 -0
- package/src/record/__tests__/material-slot-plan.unit.test.ts +9 -0
- package/src/record/__tests__/recovery-pipeline.unit.test.ts +47 -1
- package/src/record/__tests__/sprite-material-abi.unit.test.ts +7 -3
- package/src/record/__tests__/temporal-payload.unit.test.ts +2 -0
- package/src/record/frame-lighting.ts +3 -1
- package/src/record/frame-snapshot.ts +13 -11
- package/src/record/frame.ts +150 -74
- package/src/record/main-pass-geometry.ts +60 -9
- package/src/record/main-pass-material.ts +47 -19
- package/src/record/main-pass.ts +63 -4
- package/src/record/prepared-material-bindings.ts +4 -0
- package/src/record/recovery-pipeline.ts +56 -0
- package/src/record/render-context.ts +34 -3
- package/src/record/shadow-pass.ts +187 -50
- package/src/record/typed-frame-graph.ts +60 -3
- package/src/record/view-ubo.ts +1 -1
- package/src/recovery/render-system-candidate.ts +54 -11
- package/src/reflection/background.ts +151 -0
- package/src/reflection/filter.ts +3 -0
- package/src/reflection/projection.ts +16 -6
- package/src/reflection/record-owner.ts +282 -86
- package/src/render-contract.ts +50 -32
- package/src/render-graph-primitives.ts +28 -3
- package/src/render-pipeline.ts +20 -1
- package/src/render-system-extract-tail.ts +23 -3
- package/src/render-system-extract.ts +127 -42
- package/src/render-system.ts +35 -7
- package/src/scene/render-scene.ts +8 -0
- package/src/ssao-config.ts +25 -8
- package/src/ssr/graph.ts +78 -58
- package/src/temporal/gpu.ts +5 -0
- package/src/temporal/standard-scene-data.ts +7 -1
- package/src/temporal/target-coverage-attachment.ts +72 -0
- package/src/temporal/temporal-view.ts +10 -4
- package/src/temporal/view.ts +12 -2
- package/src/transmission/__tests__/standard-transmission.dawn.test.ts +24 -9
- package/src/typed-render-graph-primitives.ts +38 -0
- package/src/volume/component.ts +1 -0
- package/src/volume/passes.ts +3 -3
- package/dist/chunk-33XZFTQU.mjs.map +0 -1
- package/dist/chunk-BQVQOQJH.mjs.map +0 -1
- package/dist/chunk-BTWH7BP4.mjs.map +0 -1
- package/dist/chunk-FUODTTIA.mjs.map +0 -1
- package/dist/chunk-JQTSEI3Z.mjs.map +0 -1
- package/dist/chunk-NICXSHAT.mjs.map +0 -1
- package/dist/chunk-NRNXBLIJ.mjs.map +0 -1
- package/dist/chunk-S4DNKQYQ.mjs.map +0 -1
|
@@ -1,18 +1,52 @@
|
|
|
1
1
|
import { TRANSPARENT_SORT_MODE_LAYER_Z, TRANSPARENT_SORT_MODE_LAYER_Y } from './chunk-RXZ3RGOU.mjs';
|
|
2
|
-
import { DEFAULT_CLUSTER_GRID, DEFAULT_STANDARD_PROFILE, createIblKernelCache, MAX_LIGHTS, CLUSTER_GRID_STRIDE_U32, LIGHT_INDEX_LIST_CAPACITY, createStandardClusterLayout } from './chunk-
|
|
2
|
+
import { DEFAULT_CLUSTER_GRID, DEFAULT_STANDARD_PROFILE, createIblKernelCache, MAX_LIGHTS, CLUSTER_GRID_STRIDE_U32, LIGHT_INDEX_LIST_CAPACITY, createStandardClusterLayout } from './chunk-NO4WZCAH.mjs';
|
|
3
3
|
import { SPRITE_PREMULTIPLIED_ALPHA_BLEND } from './chunk-BLXGONR2.mjs';
|
|
4
|
-
import { GPU_SHADER_STAGE_COMPUTE, GPU_BUFFER_USAGE_STORAGE, GPU_BUFFER_USAGE_COPY_DST, GPU_BUFFER_USAGE_UNIFORM, createHdrpBindGroupLayoutDescriptor, COOKIE_MATRIX_BYTES, IES_SLICE_WIDTH, IES_SLICE_HEIGHT, COOKIE_SLICE_SIZE, GPU_SHADER_STAGE_VERTEX, GPU_SHADER_STAGE_FRAGMENT, GPU_BUFFER_USAGE_INDEX, GPU_BUFFER_USAGE_VERTEX, isStandardPbrMaterialShader, GPU_BUFFER_USAGE_MAP_READ, pbrSkinMeshDynamicOffsets, instanceCollectionCacheKey, worldEntityKey, gpuDrivenShadowDrawKey, SHADOW_CASTER_SHADER_ID, shadowCasterVariantSet, buildPbrMaterialUserRegionEntries, buildBindGroupLayoutDescriptor, GPU_BUFFER_USAGE_COPY_SRC, GPU_BUFFER_USAGE_INDIRECT, gpuDrivenSourceDrawItemIndex, matchPass, createPbrSkinMeshBindGroupEntries, physicalTextureFields, isCanonicalStandardPbrMaterialShader, getOpaqueResourceIdentity, resolveRenderTargetMaterialSource, SPRITE_PASS_PER_INSTANCE_REGION_VARIANT_SET, isStandardPbrSkinMaterialShader, SKIN_MATERIAL_SHADER_ID, PROBE_BLEND_RECORD_BYTE_SIZE, gpuDrivenDrawKey, probeBlendRecordOffset, PROBE_BLEND_RECORD_STRIDE, materialBindGroupLayoutIdentity } from './chunk-
|
|
5
|
-
import { GPU_TEXTURE_USAGE_RENDER_ATTACHMENT, GPU_TEXTURE_USAGE_COPY_SRC, VertexColorVariantConflictError, EquirectProjectionFailedError, SHADOW_ATLAS_DEFAULT_LAYERS, SHADOW_ATLAS_DEFAULT_FACE_SIZE, ShadowAtlas, PointShadowAtlasUninitializedError, PointShadowAtlasBoundsViolationError, StandardClusterTransportUnavailableError, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING, GPU_TEXTURE_USAGE_COPY_DST, GPU_TEXTURE_USAGE_TEXTURE_BINDING, createVisibilityBudget, instanceUploadRangesForResident, STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, StandardLightBudgetExceededError, RendererOperationError, VideoUploadUnsupportedError, StandardClusterIndexOverflowError, FXAA_POST_PROCESS_ID } from './chunk-
|
|
4
|
+
import { GPU_SHADER_STAGE_COMPUTE, GPU_BUFFER_USAGE_STORAGE, GPU_BUFFER_USAGE_COPY_DST, GPU_BUFFER_USAGE_UNIFORM, createHdrpBindGroupLayoutDescriptor, COOKIE_MATRIX_BYTES, IES_SLICE_WIDTH, IES_SLICE_HEIGHT, COOKIE_SLICE_SIZE, GPU_SHADER_STAGE_VERTEX, GPU_SHADER_STAGE_FRAGMENT, GPU_BUFFER_USAGE_INDEX, GPU_BUFFER_USAGE_VERTEX, isStandardPbrMaterialShader, GPU_BUFFER_USAGE_MAP_READ, pbrSkinMeshDynamicOffsets, instanceCollectionCacheKey, worldEntityKey, gpuDrivenShadowDrawKey, SHADOW_CASTER_SHADER_ID, shadowCasterVariantSet, buildPbrMaterialUserRegionEntries, buildBindGroupLayoutDescriptor, GPU_BUFFER_USAGE_COPY_SRC, GPU_BUFFER_USAGE_INDIRECT, EXTENDED_LIGHTING_REQUIRED_SAMPLED_TEXTURES, gpuDrivenSourceDrawItemIndex, matchPass, createPbrSkinMeshBindGroupEntries, physicalTextureFields, isCanonicalStandardPbrMaterialShader, getOpaqueResourceIdentity, resolveRenderTargetMaterialSource, SPRITE_PASS_PER_INSTANCE_REGION_VARIANT_SET, isStandardPbrSkinMaterialShader, SKIN_MATERIAL_SHADER_ID, PROBE_BLEND_RECORD_BYTE_SIZE, gpuDrivenDrawKey, probeBlendRecordOffset, PROBE_BLEND_RECORD_STRIDE, materialBindGroupLayoutIdentity } from './chunk-FUUO4UND.mjs';
|
|
5
|
+
import { GPU_TEXTURE_USAGE_RENDER_ATTACHMENT, GPU_TEXTURE_USAGE_COPY_SRC, VertexColorVariantConflictError, EquirectProjectionFailedError, SHADOW_ATLAS_DEFAULT_LAYERS, SHADOW_ATLAS_DEFAULT_FACE_SIZE, ShadowAtlas, PointShadowAtlasUninitializedError, PointShadowAtlasBoundsViolationError, StandardClusterTransportUnavailableError, GPU_TEXTURE_USAGE_RENDER_ATTACHMENT_AND_TEXTURE_BINDING, GPU_TEXTURE_USAGE_COPY_DST, GPU_TEXTURE_USAGE_TEXTURE_BINDING, createVisibilityBudget, instanceUploadRangesForResident, STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, StandardLightBudgetExceededError, RendererOperationError, VideoUploadUnsupportedError, StandardClusterIndexOverflowError, FXAA_POST_PROCESS_ID } from './chunk-JRBDO2KB.mjs';
|
|
6
6
|
import { derive, ok, err as err$1, toShared, ASSET_ERROR_HINTS, deriveTextureLayout, handleSlot, resolveMaterialTextureCoordinates, KNOWN_PASS_KINDS } from '@forgeax/engine-types';
|
|
7
7
|
import { ok as ok$1, err, RhiError } from '@forgeax/engine-rhi';
|
|
8
8
|
import { mat3, vec3, mat4 } from '@forgeax/engine-math';
|
|
9
9
|
import { deriveVertexLayoutProjection, DEFAULT_VERTEX_ATTRIBUTE_MAP, deriveVertexBufferLayout, deriveVertexBufferLayoutFromProjection } from '@forgeax/engine-geometry';
|
|
10
10
|
import { resolveAssetHandle } from '@forgeax/engine-assets-runtime';
|
|
11
11
|
import { probeVideoHighPerfUpload, VIDEO_ELEMENT_PROVIDER_KEY } from '@forgeax/engine-graphics-extras';
|
|
12
|
-
import { DEFAULT_STANDARD_PBR_PARAM_SCHEMA, STANDARD_PIPELINE_PARAM_SCHEMA, DEFAULT_MSDF_TEXT_PARAM_SCHEMA, DEFAULT_SPRITE_PARAM_SCHEMA, DEFAULT_UNLIT_PARAM_SCHEMA, STANDARD_PHYSICAL_TEXTURE_FIELDS, STANDARD_TEXTURE_MASK_OVERRIDE } from '@forgeax/engine-shader';
|
|
12
|
+
import { DEFAULT_STANDARD_PBR_PARAM_SCHEMA, STANDARD_PIPELINE_PARAM_SCHEMA, GPU_DRIVEN_MATERIAL_ROW_BYTES, findVariantByKey, DEFAULT_MSDF_TEXT_PARAM_SCHEMA, DEFAULT_SPRITE_PARAM_SCHEMA, DEFAULT_UNLIT_PARAM_SCHEMA, STANDARD_PHYSICAL_TEXTURE_FIELDS, STANDARD_TEXTURE_MASK_OVERRIDE } from '@forgeax/engine-shader';
|
|
13
13
|
import { isCompressedFormat, bytesPerRow, blockParamsForFormat } from '@forgeax/engine-codec';
|
|
14
14
|
import { RenderGraphError } from '@forgeax/engine-render-graph';
|
|
15
15
|
|
|
16
|
+
// src/pipeline/render-extent.ts
|
|
17
|
+
function renderExtentSize(extent, domain) {
|
|
18
|
+
if (domain === "internal") {
|
|
19
|
+
return { width: extent.internalWidth, height: extent.internalHeight };
|
|
20
|
+
}
|
|
21
|
+
return { width: extent.outputWidth, height: extent.outputHeight };
|
|
22
|
+
}
|
|
23
|
+
var MIN_SCALE = 0.5;
|
|
24
|
+
var MAX_SCALE = 1;
|
|
25
|
+
var SCALE_STEPS = 32;
|
|
26
|
+
var AXIS_ALIGNMENT = 8;
|
|
27
|
+
function alignedAxis(output, scale) {
|
|
28
|
+
return Math.max(AXIS_ALIGNMENT, Math.floor(output * scale / AXIS_ALIGNMENT) * AXIS_ALIGNMENT);
|
|
29
|
+
}
|
|
30
|
+
function finiteDimension(value) {
|
|
31
|
+
return Math.max(1, Math.floor(value));
|
|
32
|
+
}
|
|
33
|
+
function deriveRenderExtent(input) {
|
|
34
|
+
const outputWidth = finiteDimension(input.outputWidth);
|
|
35
|
+
const outputHeight = finiteDimension(input.outputHeight);
|
|
36
|
+
const clamped = Math.min(MAX_SCALE, Math.max(MIN_SCALE, input.requestedScale));
|
|
37
|
+
const scale = Math.round(clamped * SCALE_STEPS) / SCALE_STEPS;
|
|
38
|
+
const nativeSurface = outputWidth < AXIS_ALIGNMENT || outputHeight < AXIS_ALIGNMENT;
|
|
39
|
+
const internalWidth = nativeSurface ? outputWidth : alignedAxis(outputWidth, scale);
|
|
40
|
+
const internalHeight = nativeSurface ? outputHeight : alignedAxis(outputHeight, scale);
|
|
41
|
+
return Object.freeze({
|
|
42
|
+
outputWidth,
|
|
43
|
+
outputHeight,
|
|
44
|
+
internalWidth,
|
|
45
|
+
internalHeight,
|
|
46
|
+
scale: nativeSurface ? 1 : scale,
|
|
47
|
+
generation: input.generation
|
|
48
|
+
});
|
|
49
|
+
}
|
|
16
50
|
function resolveOutputDither(config) {
|
|
17
51
|
return config?.outputDither ?? true;
|
|
18
52
|
}
|
|
@@ -864,6 +898,40 @@ function getOrCreateFromChain(root, handles, variant, factory, counts) {
|
|
|
864
898
|
leaf.set(variant, bg);
|
|
865
899
|
return bg;
|
|
866
900
|
}
|
|
901
|
+
function getOrCreateFromChainResult(root, handles, variant, factory, counts) {
|
|
902
|
+
let node = root;
|
|
903
|
+
for (const h of handles) {
|
|
904
|
+
let next = node.get(h);
|
|
905
|
+
if (next === void 0) {
|
|
906
|
+
next = /* @__PURE__ */ new WeakMap();
|
|
907
|
+
node.set(h, next);
|
|
908
|
+
}
|
|
909
|
+
node = next;
|
|
910
|
+
}
|
|
911
|
+
let leaf = node.get(BIND_GROUP_CHAIN_LEAF_KEY);
|
|
912
|
+
if (leaf === void 0) {
|
|
913
|
+
leaf = /* @__PURE__ */ new Map();
|
|
914
|
+
node.set(BIND_GROUP_CHAIN_LEAF_KEY, leaf);
|
|
915
|
+
}
|
|
916
|
+
const hit = leaf.get(variant);
|
|
917
|
+
if (hit !== void 0) return ok(hit);
|
|
918
|
+
const created = factory();
|
|
919
|
+
if (!created.ok) return created;
|
|
920
|
+
counts.createBindGroup += 1;
|
|
921
|
+
counts.keys.push(variant);
|
|
922
|
+
leaf.set(variant, created.value);
|
|
923
|
+
return created;
|
|
924
|
+
}
|
|
925
|
+
function findFromChain(root, handles, variant) {
|
|
926
|
+
let node = root;
|
|
927
|
+
for (const handle of handles) {
|
|
928
|
+
const next = node.get(handle);
|
|
929
|
+
if (next === void 0) return void 0;
|
|
930
|
+
node = next;
|
|
931
|
+
}
|
|
932
|
+
const leaf = node.get(BIND_GROUP_CHAIN_LEAF_KEY);
|
|
933
|
+
return leaf?.get(variant);
|
|
934
|
+
}
|
|
867
935
|
function getOrCreatePerEntity(outerMap, outerKey, handles, variant, factory, counts) {
|
|
868
936
|
let inner = outerMap.get(outerKey);
|
|
869
937
|
if (inner === void 0) {
|
|
@@ -1536,6 +1604,52 @@ function standardLightingEntries(hdrpBuffers, ssaoTexView, ssaoSampler) {
|
|
|
1536
1604
|
}
|
|
1537
1605
|
];
|
|
1538
1606
|
}
|
|
1607
|
+
var sceneLightingBindings = /* @__PURE__ */ new WeakMap();
|
|
1608
|
+
function createGpuDrivenLightingBindGroup(runtime, buffers, layout, binding, ssaoView) {
|
|
1609
|
+
const fallback = getOrCreateSsaoFallbackTexture(runtime);
|
|
1610
|
+
if (fallback === null) return null;
|
|
1611
|
+
const ssao = ssaoView ?? fallback.view;
|
|
1612
|
+
let cache3 = sceneLightingBindings.get(buffers);
|
|
1613
|
+
if (cache3 === void 0) {
|
|
1614
|
+
cache3 = /* @__PURE__ */ new WeakMap();
|
|
1615
|
+
sceneLightingBindings.set(buffers, cache3);
|
|
1616
|
+
}
|
|
1617
|
+
const cached = cache3.get(binding.meshBuffer);
|
|
1618
|
+
if (cached?.layout === layout && cached.palette === binding.paletteBuffer && cached.ssao === ssao)
|
|
1619
|
+
return cached.bindGroup;
|
|
1620
|
+
const result = runtime.device.createBindGroup({
|
|
1621
|
+
label: "gpu-driven-scene-lighting",
|
|
1622
|
+
layout,
|
|
1623
|
+
entries: [
|
|
1624
|
+
{
|
|
1625
|
+
binding: 0,
|
|
1626
|
+
resource: {
|
|
1627
|
+
kind: "buffer",
|
|
1628
|
+
value: { buffer: binding.meshBuffer, size: binding.meshBytes }
|
|
1629
|
+
}
|
|
1630
|
+
},
|
|
1631
|
+
...binding.paletteBuffer === void 0 ? [] : [1, 2].map((index) => ({
|
|
1632
|
+
binding: index,
|
|
1633
|
+
resource: {
|
|
1634
|
+
kind: "buffer",
|
|
1635
|
+
value: { buffer: binding.paletteBuffer }
|
|
1636
|
+
}
|
|
1637
|
+
})),
|
|
1638
|
+
...standardLightingEntries(buffers, ssao, fallback.sampler)
|
|
1639
|
+
]
|
|
1640
|
+
});
|
|
1641
|
+
if (!result.ok) {
|
|
1642
|
+
runtime.errorRegistry.fire(result.error);
|
|
1643
|
+
return null;
|
|
1644
|
+
}
|
|
1645
|
+
cache3.set(binding.meshBuffer, {
|
|
1646
|
+
layout,
|
|
1647
|
+
palette: binding.paletteBuffer,
|
|
1648
|
+
ssao,
|
|
1649
|
+
bindGroup: result.value
|
|
1650
|
+
});
|
|
1651
|
+
return result.value;
|
|
1652
|
+
}
|
|
1539
1653
|
function createStandardSurfaceLightingBindGroup(runtime, layout, grid, ssaoOptions = { enabled: false }) {
|
|
1540
1654
|
const buffers = getOrCreateHdrpBuffers(runtime, grid);
|
|
1541
1655
|
const fallback = getOrCreateSsaoFallbackTexture(runtime);
|
|
@@ -2124,7 +2238,7 @@ var POST_PROCESS_POLICY = {
|
|
|
2124
2238
|
},
|
|
2125
2239
|
"post-process-not-found": {
|
|
2126
2240
|
expected: "typed fullscreen plan references a registered post-process id",
|
|
2127
|
-
hint: (detail) => `no post-process is registered for id '${detail.id}'.
|
|
2241
|
+
hint: (detail) => `no post-process is registered for id '${detail.id}'. For Engine-owned effects, rebuild the shader manifest with that Engine entry enabled. For custom effects, register '${detail.id}' with the feature host ({source, reads?}), then reference it from a typed fullscreen RenderFeaturePlan.`
|
|
2128
2242
|
},
|
|
2129
2243
|
"fullscreen-input-not-found": {
|
|
2130
2244
|
expected: "reads key must be a graph-declared colorTarget with TEXTURE_BINDING",
|
|
@@ -2133,6 +2247,10 @@ var POST_PROCESS_POLICY = {
|
|
|
2133
2247
|
return `fullscreen pass '${d.passName}' references reads key '${d.readsKey}' but that key is not declared as a graph color target, or the target is not sampleable as a texture. First declare graph color target '${d.readsKey}' with its format and size (or check spelling) before the typed fullscreen pass '${d.passName}' reads it. If '${d.readsKey}' is a depth target, ensure it has TEXTURE_BINDING usage (0x04) and is declared via graph.addColorTarget. Consider switching pipeline if your pipeline does not expose a sampleable depth target.`;
|
|
2134
2248
|
}
|
|
2135
2249
|
},
|
|
2250
|
+
"ssao-parameter-invalid": {
|
|
2251
|
+
expected: "finite non-negative SSAO intensity and low, medium, or high quality",
|
|
2252
|
+
hint: () => "Set ssao.intensity to a finite non-negative value and ssao.quality to low, medium, or high."
|
|
2253
|
+
},
|
|
2136
2254
|
"ssao-radius-non-positive": {
|
|
2137
2255
|
expected: "SSAO radius must be > 0",
|
|
2138
2256
|
hint: (detail) => {
|
|
@@ -2184,16 +2302,18 @@ var PostProcessError = PostProcessErrorClass;
|
|
|
2184
2302
|
var SSAO_DEFAULT_RADIUS = 0.5;
|
|
2185
2303
|
var SSAO_DEFAULT_BIAS = 0.025;
|
|
2186
2304
|
var SSAO_DEFAULT_INTENSITY = 1;
|
|
2305
|
+
var SSAO_SAMPLE_COUNTS = { low: 16, medium: 32, high: 64 };
|
|
2187
2306
|
function getSsaoParameters(config) {
|
|
2188
2307
|
return {
|
|
2189
2308
|
radius: config?.radius ?? SSAO_DEFAULT_RADIUS,
|
|
2190
2309
|
bias: config?.bias ?? SSAO_DEFAULT_BIAS,
|
|
2191
|
-
intensity: config?.intensity ?? SSAO_DEFAULT_INTENSITY
|
|
2310
|
+
intensity: config?.intensity ?? SSAO_DEFAULT_INTENSITY,
|
|
2311
|
+
quality: config?.quality ?? "high"
|
|
2192
2312
|
};
|
|
2193
2313
|
}
|
|
2194
2314
|
function resolveSsaoParameters(config) {
|
|
2195
2315
|
const resolved = getSsaoParameters(config);
|
|
2196
|
-
if (resolved.radius <= 0) {
|
|
2316
|
+
if (!Number.isFinite(resolved.radius) || resolved.radius <= 0) {
|
|
2197
2317
|
return err$1(
|
|
2198
2318
|
new PostProcessError({
|
|
2199
2319
|
code: "ssao-radius-non-positive",
|
|
@@ -2201,7 +2321,7 @@ function resolveSsaoParameters(config) {
|
|
|
2201
2321
|
})
|
|
2202
2322
|
);
|
|
2203
2323
|
}
|
|
2204
|
-
if (resolved.bias < 0) {
|
|
2324
|
+
if (!Number.isFinite(resolved.bias) || resolved.bias < 0) {
|
|
2205
2325
|
return err$1(
|
|
2206
2326
|
new PostProcessError({
|
|
2207
2327
|
code: "ssao-bias-negative",
|
|
@@ -2209,6 +2329,15 @@ function resolveSsaoParameters(config) {
|
|
|
2209
2329
|
})
|
|
2210
2330
|
);
|
|
2211
2331
|
}
|
|
2332
|
+
if (!Number.isFinite(resolved.intensity) || resolved.intensity < 0 || !Object.hasOwn(SSAO_SAMPLE_COUNTS, resolved.quality)) {
|
|
2333
|
+
const paramName = !Number.isFinite(resolved.intensity) || resolved.intensity < 0 ? "intensity" : "quality";
|
|
2334
|
+
return err$1(
|
|
2335
|
+
new PostProcessError({
|
|
2336
|
+
code: "ssao-parameter-invalid",
|
|
2337
|
+
detail: { paramName, value: resolved[paramName] }
|
|
2338
|
+
})
|
|
2339
|
+
);
|
|
2340
|
+
}
|
|
2212
2341
|
return ok(resolved);
|
|
2213
2342
|
}
|
|
2214
2343
|
function variantSetFromDefines(defines) {
|
|
@@ -2436,7 +2565,7 @@ function writeViewUbo(queue, viewUniformBuffer, camera, light, lights, spotShado
|
|
|
2436
2565
|
}
|
|
2437
2566
|
viewPayload[124] = lights.cascadeCount ?? 0;
|
|
2438
2567
|
viewPayload[125] = lights.cascadeBlend ?? 0;
|
|
2439
|
-
viewPayload[126] = lights.depthBias ??
|
|
2568
|
+
viewPayload[126] = lights.depthBias ?? 1e-5;
|
|
2440
2569
|
viewPayload[127] = lights.normalBias ?? 0.05;
|
|
2441
2570
|
const filterCarrier = directionalShadowFilterCarrier(lights.directionalShadowQuality);
|
|
2442
2571
|
viewPayload[128] = filterCarrier[0] ?? 0;
|
|
@@ -3177,6 +3306,7 @@ function writeHdrpClusterAndSsaoBuffers(internals, frameState, camera, prepared,
|
|
|
3177
3306
|
profilePhase,
|
|
3178
3307
|
"record/scene-state/hdrp-cluster/buffer-upload",
|
|
3179
3308
|
() => {
|
|
3309
|
+
if (frameState.installedPipelineConfig?.ssao?.enabled !== true) return ok(void 0);
|
|
3180
3310
|
const ssaoBufs = getOrCreateSsaoBuffers(internals);
|
|
3181
3311
|
if (ssaoBufs === null) return ok(void 0);
|
|
3182
3312
|
const sProj = computeProjectionMatrix(camera);
|
|
@@ -3194,6 +3324,7 @@ function writeHdrpClusterAndSsaoBuffers(internals, frameState, camera, prepared,
|
|
|
3194
3324
|
ssaoUniformPayload[48] = parameters.intensity;
|
|
3195
3325
|
ssaoUniformPayload[49] = parameters.radius;
|
|
3196
3326
|
ssaoUniformPayload[50] = parameters.bias;
|
|
3327
|
+
ssaoUniformPayload[51] = SSAO_SAMPLE_COUNTS[parameters.quality];
|
|
3197
3328
|
const ssaoUniformRes = internals.device.queue.writeBuffer(
|
|
3198
3329
|
ssaoBufs.uniformBuffer,
|
|
3199
3330
|
0,
|
|
@@ -3240,6 +3371,9 @@ function getOrCreateIblCache(scope) {
|
|
|
3240
3371
|
return cache3;
|
|
3241
3372
|
}
|
|
3242
3373
|
var iblComposedShadersCache;
|
|
3374
|
+
function getIblProbeBackgroundSource() {
|
|
3375
|
+
return iblComposedShadersCache?.probeBackground;
|
|
3376
|
+
}
|
|
3243
3377
|
function setIblComposedShaders(sources) {
|
|
3244
3378
|
iblComposedShadersCache = sources;
|
|
3245
3379
|
}
|
|
@@ -4079,9 +4213,16 @@ var GpuBuffer = class {
|
|
|
4079
4213
|
// BUFFER_META_MAP. This local flag is a derived view written only on
|
|
4080
4214
|
// the success branch of `device.destroyBuffer(...)`; charter §F1.
|
|
4081
4215
|
destroyed = false;
|
|
4082
|
-
|
|
4216
|
+
releaseScope;
|
|
4217
|
+
constructor(device, handle, scope) {
|
|
4083
4218
|
this.device = device;
|
|
4084
4219
|
this.handle = handle;
|
|
4220
|
+
if (scope !== void 0) {
|
|
4221
|
+
const ref = scope._adopt("buffer", this, (value) => {
|
|
4222
|
+
if (!value.isDestroyed) value.destroy();
|
|
4223
|
+
});
|
|
4224
|
+
this.releaseScope = () => scope._release(ref);
|
|
4225
|
+
}
|
|
4085
4226
|
}
|
|
4086
4227
|
get isDestroyed() {
|
|
4087
4228
|
return this.destroyed;
|
|
@@ -4096,6 +4237,8 @@ var GpuBuffer = class {
|
|
|
4096
4237
|
const r = this.device.destroyBuffer(this.handle);
|
|
4097
4238
|
if (r.ok) {
|
|
4098
4239
|
this.destroyed = true;
|
|
4240
|
+
this.releaseScope?.();
|
|
4241
|
+
this.releaseScope = void 0;
|
|
4099
4242
|
}
|
|
4100
4243
|
return r;
|
|
4101
4244
|
}
|
|
@@ -4104,9 +4247,16 @@ var GpuTexture = class {
|
|
|
4104
4247
|
device;
|
|
4105
4248
|
handle;
|
|
4106
4249
|
destroyed = false;
|
|
4107
|
-
|
|
4250
|
+
releaseScope;
|
|
4251
|
+
constructor(device, handle, scope) {
|
|
4108
4252
|
this.device = device;
|
|
4109
4253
|
this.handle = handle;
|
|
4254
|
+
if (scope !== void 0) {
|
|
4255
|
+
const ref = scope._adopt("texture", this, (value) => {
|
|
4256
|
+
if (!value.isDestroyed) value.destroy();
|
|
4257
|
+
});
|
|
4258
|
+
this.releaseScope = () => scope._release(ref);
|
|
4259
|
+
}
|
|
4110
4260
|
}
|
|
4111
4261
|
get isDestroyed() {
|
|
4112
4262
|
return this.destroyed;
|
|
@@ -4119,10 +4269,117 @@ var GpuTexture = class {
|
|
|
4119
4269
|
const r = this.device.destroyTexture(this.handle);
|
|
4120
4270
|
if (r.ok) {
|
|
4121
4271
|
this.destroyed = true;
|
|
4272
|
+
this.releaseScope?.();
|
|
4273
|
+
this.releaseScope = void 0;
|
|
4122
4274
|
}
|
|
4123
4275
|
return r;
|
|
4124
4276
|
}
|
|
4125
4277
|
};
|
|
4278
|
+
var STANDARD_PBR_REQUIRED_SAMPLED_TEXTURES = 18;
|
|
4279
|
+
function isOrdinaryMaterialVariant(variant) {
|
|
4280
|
+
return variant.defines.COVERAGE_ONLY !== true;
|
|
4281
|
+
}
|
|
4282
|
+
function selectHdrpPbrPrewarmVariants(manifestEntry, storageBufferCapable, extendedLightingShaderAvailableOrTransmissionCapable = true, transmissionCapable = true, directionalPcssAvailable = true, projectorAvailable = true) {
|
|
4283
|
+
const variants = manifestEntry?.variants ?? [];
|
|
4284
|
+
const hasExtendedLightingAxis = variants.some(
|
|
4285
|
+
(variant) => "EXTENDED_LIGHTING_AVAILABLE" in variant.defines
|
|
4286
|
+
);
|
|
4287
|
+
const extendedLightingShaderAvailable = hasExtendedLightingAxis ? extendedLightingShaderAvailableOrTransmissionCapable : true;
|
|
4288
|
+
const effectiveTransmissionCapable = hasExtendedLightingAxis ? transmissionCapable : extendedLightingShaderAvailableOrTransmissionCapable;
|
|
4289
|
+
if (!storageBufferCapable) return [];
|
|
4290
|
+
return variants.filter(
|
|
4291
|
+
(variant) => isOrdinaryMaterialVariant(variant) && variant.defines.STORAGE_BUFFER_AVAILABLE === storageBufferCapable && (!("EXTENDED_LIGHTING_AVAILABLE" in variant.defines) || variant.defines.EXTENDED_LIGHTING_AVAILABLE === extendedLightingShaderAvailable) && variant.defines.CLUSTER_FORWARD_AVAILABLE === true && (!("DIRECTIONAL_PCSS_AVAILABLE" in variant.defines) || variant.defines.DIRECTIONAL_PCSS_AVAILABLE === directionalPcssAvailable) && (!("PROJECTOR_AVAILABLE" in variant.defines) || variant.defines.PROJECTOR_AVAILABLE === projectorAvailable) && variant.defines.PROBE_BLEND_AVAILABLE !== true && (effectiveTransmissionCapable || variant.defines.TRANSMISSION_AVAILABLE !== true)
|
|
4292
|
+
) ?? [];
|
|
4293
|
+
}
|
|
4294
|
+
function selectSkinPrewarmVariants(manifestEntry, storageBufferCapable) {
|
|
4295
|
+
return manifestEntry?.variants.filter(
|
|
4296
|
+
(variant) => isOrdinaryMaterialVariant(variant) && variant.defines.STORAGE_BUFFER_AVAILABLE === storageBufferCapable && (storageBufferCapable || variant.defines.CLUSTER_FORWARD_AVAILABLE !== true) && variant.defines.PROBE_BLEND_AVAILABLE !== true
|
|
4297
|
+
) ?? [];
|
|
4298
|
+
}
|
|
4299
|
+
function selectGpuDrivenSceneIndexVariant(manifestEntry, extendedLightingAvailable, directionalPcssAvailable, projectorAvailable, vertexColorAvailable = false) {
|
|
4300
|
+
return manifestEntry?.variants.find(
|
|
4301
|
+
(variant) => isOrdinaryMaterialVariant(variant) && variant.defines.STORAGE_BUFFER_AVAILABLE === true && variant.defines.GPU_DRIVEN_SCENE_INDEX_AVAILABLE === true && (!("CLUSTER_FORWARD_AVAILABLE" in variant.defines) || variant.defines.CLUSTER_FORWARD_AVAILABLE === false) && variant.defines.VERTEX_COLOR_AVAILABLE === true === vertexColorAvailable && (!("PROBE_BLEND_AVAILABLE" in variant.defines) || variant.defines.PROBE_BLEND_AVAILABLE === false) && (!("EXTENDED_LIGHTING_AVAILABLE" in variant.defines) || variant.defines.EXTENDED_LIGHTING_AVAILABLE === extendedLightingAvailable) && (!("DIRECTIONAL_PCSS_AVAILABLE" in variant.defines) || variant.defines.DIRECTIONAL_PCSS_AVAILABLE === directionalPcssAvailable) && (!("PROJECTOR_AVAILABLE" in variant.defines) || variant.defines.PROJECTOR_AVAILABLE === projectorAvailable) && (!("REFLECTION_FALLBACK_AVAILABLE" in variant.defines) || variant.defines.REFLECTION_FALLBACK_AVAILABLE === false) && (!("TRANSMISSION_AVAILABLE" in variant.defines) || variant.defines.TRANSMISSION_AVAILABLE === false)
|
|
4302
|
+
);
|
|
4303
|
+
}
|
|
4304
|
+
function selectProbePrewarmVariants(manifestEntry, storageBufferCapable, extendedLightingShaderAvailable = true, transmissionCapable = true, directionalPcssAvailable = true, projectorAvailable = true, webgl2Downlevel = false) {
|
|
4305
|
+
if (!storageBufferCapable) return [];
|
|
4306
|
+
return manifestEntry?.variants.filter((variant) => {
|
|
4307
|
+
const defines = variant.defines;
|
|
4308
|
+
return isOrdinaryMaterialVariant(variant) && defines.PROBE_BLEND_AVAILABLE === true && defines.STORAGE_BUFFER_AVAILABLE === storageBufferCapable && (!("WEBGL2_COMPAT" in defines) || defines.WEBGL2_COMPAT === webgl2Downlevel) && (!("EXTENDED_LIGHTING_AVAILABLE" in defines) || defines.EXTENDED_LIGHTING_AVAILABLE === extendedLightingShaderAvailable) && (!("DIRECTIONAL_PCSS_AVAILABLE" in defines) || defines.DIRECTIONAL_PCSS_AVAILABLE === directionalPcssAvailable) && (!("PROJECTOR_AVAILABLE" in defines) || defines.PROJECTOR_AVAILABLE === projectorAvailable) && (transmissionCapable || defines.TRANSMISSION_AVAILABLE !== true);
|
|
4309
|
+
}) ?? [];
|
|
4310
|
+
}
|
|
4311
|
+
async function prewarmMaterialShaderVariants(variants, prewarmedModules, compile, seed) {
|
|
4312
|
+
for (const variant of variants) {
|
|
4313
|
+
const moduleLabel = `module-forgeax::default-standard-pbr#${variant.definesKey}`;
|
|
4314
|
+
let module = prewarmedModules.get(variant.composedWgsl);
|
|
4315
|
+
if (module === void 0) {
|
|
4316
|
+
const result = await compile(variant, moduleLabel);
|
|
4317
|
+
if (!result.ok) throw result.error;
|
|
4318
|
+
module = result.value;
|
|
4319
|
+
prewarmedModules.set(variant.composedWgsl, module);
|
|
4320
|
+
}
|
|
4321
|
+
seed(moduleLabel, module);
|
|
4322
|
+
}
|
|
4323
|
+
}
|
|
4324
|
+
function selectStandardPbrTransmissionPrewarmVariants(manifestEntry, storageBufferCapable, directionalPcssAvailable = true, projectorAvailable = true, extendedLightingShaderAvailable = true) {
|
|
4325
|
+
if (manifestEntry === void 0) {
|
|
4326
|
+
throw new Error("Standard material shader manifest row is missing");
|
|
4327
|
+
}
|
|
4328
|
+
const selected = [];
|
|
4329
|
+
for (const transmissionAvailable of [false, true]) {
|
|
4330
|
+
const declared = manifestEntry.variants.find(
|
|
4331
|
+
(variant) => isOrdinaryMaterialVariant(variant) && variant.defines.STORAGE_BUFFER_AVAILABLE === storageBufferCapable && variant.defines.CLUSTER_FORWARD_AVAILABLE === standardBootClusterAxis() && variant.defines.VERTEX_COLOR_AVAILABLE === false && (!("DIRECTIONAL_PCSS_AVAILABLE" in variant.defines) || variant.defines.DIRECTIONAL_PCSS_AVAILABLE === directionalPcssAvailable) && (!("PROJECTOR_AVAILABLE" in variant.defines) || variant.defines.PROJECTOR_AVAILABLE === projectorAvailable) && (!("EXTENDED_LIGHTING_AVAILABLE" in variant.defines) || variant.defines.EXTENDED_LIGHTING_AVAILABLE === extendedLightingShaderAvailable) && variant.defines.PROBE_BLEND_AVAILABLE !== true && variant.defines.TRANSMISSION_AVAILABLE === transmissionAvailable
|
|
4332
|
+
);
|
|
4333
|
+
if (declared === void 0) {
|
|
4334
|
+
throw new Error(
|
|
4335
|
+
`Standard material shader manifest lacks exact TRANSMISSION_AVAILABLE=${transmissionAvailable} prewarm variant`
|
|
4336
|
+
);
|
|
4337
|
+
}
|
|
4338
|
+
const exact = findVariantByKey(manifestEntry, declared.definesKey);
|
|
4339
|
+
if (exact === void 0) {
|
|
4340
|
+
throw new Error(
|
|
4341
|
+
`Standard material shader manifest exact lookup failed for TRANSMISSION_AVAILABLE=${transmissionAvailable}`
|
|
4342
|
+
);
|
|
4343
|
+
}
|
|
4344
|
+
selected.push(exact);
|
|
4345
|
+
}
|
|
4346
|
+
return selected;
|
|
4347
|
+
}
|
|
4348
|
+
function standardBootClusterAxis() {
|
|
4349
|
+
return false;
|
|
4350
|
+
}
|
|
4351
|
+
|
|
4352
|
+
// src/assembly/device-feature-admission.ts
|
|
4353
|
+
var COMPRESSION_FEATURES = [
|
|
4354
|
+
"texture-compression-bc",
|
|
4355
|
+
"texture-compression-etc2",
|
|
4356
|
+
"texture-compression-astc"
|
|
4357
|
+
];
|
|
4358
|
+
function transmissionBackdropAvailable(limit) {
|
|
4359
|
+
return limit === void 0 || limit >= STANDARD_PBR_REQUIRED_SAMPLED_TEXTURES;
|
|
4360
|
+
}
|
|
4361
|
+
var STANDARD_PHYSICAL_REQUIRED_SAMPLED_TEXTURES = 22;
|
|
4362
|
+
function deriveDeviceFeatureAdmission(adapter, options) {
|
|
4363
|
+
const requiredFeatures = COMPRESSION_FEATURES.filter((feature) => adapter.features.has(feature));
|
|
4364
|
+
const timestampRequested = options?.gpuPassTiming !== void 0 || options?.captureGpuTimings === true;
|
|
4365
|
+
if (timestampRequested && adapter.features.has("timestamp-query")) {
|
|
4366
|
+
requiredFeatures.push("timestamp-query");
|
|
4367
|
+
}
|
|
4368
|
+
const adapterSampledTextureLimit = adapter.limits?.maxSampledTexturesPerShaderStage ?? 0;
|
|
4369
|
+
const requiredSampledTextureLimit = adapterSampledTextureLimit >= STANDARD_PHYSICAL_REQUIRED_SAMPLED_TEXTURES ? STANDARD_PHYSICAL_REQUIRED_SAMPLED_TEXTURES : adapterSampledTextureLimit >= EXTENDED_LIGHTING_REQUIRED_SAMPLED_TEXTURES ? EXTENDED_LIGHTING_REQUIRED_SAMPLED_TEXTURES : adapterSampledTextureLimit >= STANDARD_PBR_REQUIRED_SAMPLED_TEXTURES ? STANDARD_PBR_REQUIRED_SAMPLED_TEXTURES : void 0;
|
|
4370
|
+
return {
|
|
4371
|
+
requiredFeatures,
|
|
4372
|
+
...requiredSampledTextureLimit === void 0 ? {} : {
|
|
4373
|
+
requiredLimits: {
|
|
4374
|
+
maxSampledTexturesPerShaderStage: requiredSampledTextureLimit
|
|
4375
|
+
}
|
|
4376
|
+
}
|
|
4377
|
+
};
|
|
4378
|
+
}
|
|
4379
|
+
function deviceOptionsForAdapter(adapter, options) {
|
|
4380
|
+
const admission = deriveDeviceFeatureAdmission(adapter, options);
|
|
4381
|
+
return admission.requiredFeatures.length === 0 && admission.requiredLimits === void 0 ? void 0 : admission;
|
|
4382
|
+
}
|
|
4126
4383
|
|
|
4127
4384
|
// src/ibl/skylight-bind-group.ts
|
|
4128
4385
|
var FALLBACK_BYTES_PER_ROW = 256;
|
|
@@ -4162,16 +4419,17 @@ function assembleMaterialWithSkylightEntries(materialEntries, skylight, transmis
|
|
|
4162
4419
|
const transmissionSampler = transmission?.sampler ?? skylight.irradianceSampler;
|
|
4163
4420
|
const transmissionView = transmission?.backdropView ?? skylight.brdfLutView;
|
|
4164
4421
|
const transmissionStart = result.length;
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4422
|
+
if (transmission !== null)
|
|
4423
|
+
result.push(
|
|
4424
|
+
{
|
|
4425
|
+
binding: transmissionStart,
|
|
4426
|
+
resource: { kind: "sampler", value: transmissionSampler }
|
|
4427
|
+
},
|
|
4428
|
+
{
|
|
4429
|
+
binding: transmissionStart + 1,
|
|
4430
|
+
resource: { kind: "textureView", value: transmissionView }
|
|
4431
|
+
}
|
|
4432
|
+
);
|
|
4175
4433
|
const physicalStart = 26;
|
|
4176
4434
|
for (let index = 0; index < textureInjections.length; index += 1) {
|
|
4177
4435
|
const resource = textureInjections[index];
|
|
@@ -4188,6 +4446,13 @@ function assembleMaterialWithSkylightEntries(materialEntries, skylight, transmis
|
|
|
4188
4446
|
}
|
|
4189
4447
|
);
|
|
4190
4448
|
}
|
|
4449
|
+
result.push({
|
|
4450
|
+
binding: 47,
|
|
4451
|
+
resource: {
|
|
4452
|
+
kind: "textureView",
|
|
4453
|
+
value: skylight.skylightPrefilterView ?? skylight.prefilterView
|
|
4454
|
+
}
|
|
4455
|
+
});
|
|
4191
4456
|
return result;
|
|
4192
4457
|
}
|
|
4193
4458
|
function createSkylightFallback(device, queue) {
|
|
@@ -4305,7 +4570,7 @@ function createSkylightFallback(device, queue) {
|
|
|
4305
4570
|
const brdfLutView = brdfLutViewResult.value;
|
|
4306
4571
|
const intensityBufResult = device.createBuffer({
|
|
4307
4572
|
label: "skylight-fallback-intensity",
|
|
4308
|
-
size:
|
|
4573
|
+
size: 64,
|
|
4309
4574
|
usage: GPU_BUFFER_USAGE_UNIFORM | GPU_BUFFER_USAGE_COPY_DST
|
|
4310
4575
|
});
|
|
4311
4576
|
if (!intensityBufResult.ok) throw intensityBufResult.error;
|
|
@@ -4992,9 +5257,9 @@ function recordIblMaterialBinding(frameState, materialBgl, bindGroup, entries, i
|
|
|
4992
5257
|
errors: []
|
|
4993
5258
|
};
|
|
4994
5259
|
}
|
|
4995
|
-
function isMaterialBgAssemblyCacheHit(cached, material, materialBgl, materialBuffer, skylightResources, materialResourceEpoch, transmissionBackdropView) {
|
|
5260
|
+
function isMaterialBgAssemblyCacheHit(cached, material, materialBgl, materialBuffer, skylightResources, materialResourceEpoch, transmissionBackdropView, sceneMaterialBuffer) {
|
|
4996
5261
|
if (transmissionBackdropView != null) return false;
|
|
4997
|
-
return cached?.material === material && cached.materialResourceEpoch === materialResourceEpoch && cached.materialBgl === materialBgl && cached.materialBuffer === materialBuffer && cached.skylightResources.irradianceView === skylightResources.irradianceView && cached.skylightResources.irradianceSampler === skylightResources.irradianceSampler && cached.skylightResources.prefilterView === skylightResources.prefilterView && cached.skylightResources.prefilterSampler === skylightResources.prefilterSampler && cached.skylightResources.brdfLutView === skylightResources.brdfLutView && cached.skylightResources.brdfLutSampler === skylightResources.brdfLutSampler && cached.skylightResources.intensityBuffer === skylightResources.intensityBuffer;
|
|
5262
|
+
return cached?.material === material && cached.materialResourceEpoch === materialResourceEpoch && cached.materialBgl === materialBgl && cached.materialBuffer === materialBuffer && cached.sceneMaterialBuffer === sceneMaterialBuffer && cached.skylightResources.irradianceView === skylightResources.irradianceView && cached.skylightResources.irradianceSampler === skylightResources.irradianceSampler && cached.skylightResources.prefilterView === skylightResources.prefilterView && cached.skylightResources.skylightPrefilterView === skylightResources.skylightPrefilterView && cached.skylightResources.prefilterSampler === skylightResources.prefilterSampler && cached.skylightResources.brdfLutView === skylightResources.brdfLutView && cached.skylightResources.brdfLutSampler === skylightResources.brdfLutSampler && cached.skylightResources.intensityBuffer === skylightResources.intensityBuffer;
|
|
4998
5263
|
}
|
|
4999
5264
|
function buildPerSubmeshMaterialBg(deps, submeshMaterial, entityKey, materialWorld = deps.world, materialShaderId = submeshMaterial.materialShaderId) {
|
|
5000
5265
|
const {
|
|
@@ -5012,9 +5277,10 @@ function buildPerSubmeshMaterialBg(deps, submeshMaterial, entityKey, materialWor
|
|
|
5012
5277
|
bindGroupCounts,
|
|
5013
5278
|
frameState
|
|
5014
5279
|
} = deps;
|
|
5015
|
-
const
|
|
5280
|
+
const selectedProbe = resolveReflectionProbeResources?.(materialWorld, entityKey);
|
|
5281
|
+
const effectiveSkylightResources = selectedProbe?.resources ?? skylightResources;
|
|
5016
5282
|
const smMaterialHandle = submeshMaterial.materialHandle;
|
|
5017
|
-
const materialCacheKey = smMaterialHandle === void 0 ? void 0 : `${materialWorld.identity}:${smMaterialHandle}:${materialShaderId ?? ""}`;
|
|
5283
|
+
const materialCacheKey = smMaterialHandle === void 0 ? void 0 : `${materialWorld.identity}:${smMaterialHandle}:${materialShaderId ?? ""}:${selectedProbe?.probeIndex ?? "sky"}`;
|
|
5018
5284
|
const smHasVideoFields = (submeshMaterial.videoTextureFields?.size ?? 0) > 0;
|
|
5019
5285
|
const smShaderId = materialShaderId;
|
|
5020
5286
|
const smSchema = (smShaderId !== void 0 ? runtime.getParamSchema?.(smShaderId) : void 0) ?? submeshMaterial.materialParamSchema;
|
|
@@ -5024,6 +5290,7 @@ function buildPerSubmeshMaterialBg(deps, submeshMaterial, entityKey, materialWor
|
|
|
5024
5290
|
const physicalFields = standardMaterial && smSchema !== void 0 ? physicalTextureFields(smSchema) : [];
|
|
5025
5291
|
const smUserRegionFields = smPerShaderBgl === void 0 || isCanonicalStandardPbrMaterialShader(smShaderId) ? BUILTIN_USER_REGION_TEXTURE_FIELDS : userRegionTextureFieldOrder(smSchema).filter((field) => !physicalFields.includes(field));
|
|
5026
5292
|
const hasActiveTransmissionBackdrop = transmissionBackdropView != null;
|
|
5293
|
+
const sceneMaterialBuffer = runtime.device.caps.storageBuffer ? deps.sceneMaterialBuffer ?? pipelineState.meshStorageBuffer.buffer : void 0;
|
|
5027
5294
|
const diagnosticsEnabled = materialDiagnosticsEnabled();
|
|
5028
5295
|
if (smMaterialHandle !== void 0 && !smHasVideoFields && !hasActiveTransmissionBackdrop) {
|
|
5029
5296
|
const cached = materialCacheKey === void 0 ? void 0 : materialBgAssemblyCache.get(materialCacheKey);
|
|
@@ -5034,8 +5301,9 @@ function buildPerSubmeshMaterialBg(deps, submeshMaterial, entityKey, materialWor
|
|
|
5034
5301
|
pipelineState.materialUniformBuffer.buffer,
|
|
5035
5302
|
effectiveSkylightResources,
|
|
5036
5303
|
store.materialResourceEpoch,
|
|
5037
|
-
transmissionBackdropView
|
|
5038
|
-
|
|
5304
|
+
transmissionBackdropView,
|
|
5305
|
+
sceneMaterialBuffer
|
|
5306
|
+
)) {
|
|
5039
5307
|
if (diagnosticsEnabled) {
|
|
5040
5308
|
recordIblMaterialBinding(
|
|
5041
5309
|
frameState,
|
|
@@ -5044,31 +5312,34 @@ function buildPerSubmeshMaterialBg(deps, submeshMaterial, entityKey, materialWor
|
|
|
5044
5312
|
[
|
|
5045
5313
|
{
|
|
5046
5314
|
binding: 1 + smUserRegionFields.length * 2,
|
|
5047
|
-
resource: { kind: "textureView", value:
|
|
5315
|
+
resource: { kind: "textureView", value: effectiveSkylightResources.irradianceView }
|
|
5048
5316
|
},
|
|
5049
5317
|
{
|
|
5050
5318
|
binding: 2 + smUserRegionFields.length * 2,
|
|
5051
|
-
resource: { kind: "sampler", value:
|
|
5319
|
+
resource: { kind: "sampler", value: effectiveSkylightResources.irradianceSampler }
|
|
5052
5320
|
},
|
|
5053
5321
|
{
|
|
5054
5322
|
binding: 3 + smUserRegionFields.length * 2,
|
|
5055
|
-
resource: { kind: "textureView", value:
|
|
5323
|
+
resource: { kind: "textureView", value: effectiveSkylightResources.prefilterView }
|
|
5056
5324
|
},
|
|
5057
5325
|
{
|
|
5058
5326
|
binding: 4 + smUserRegionFields.length * 2,
|
|
5059
|
-
resource: { kind: "sampler", value:
|
|
5327
|
+
resource: { kind: "sampler", value: effectiveSkylightResources.prefilterSampler }
|
|
5060
5328
|
},
|
|
5061
5329
|
{
|
|
5062
5330
|
binding: 5 + smUserRegionFields.length * 2,
|
|
5063
|
-
resource: { kind: "textureView", value:
|
|
5331
|
+
resource: { kind: "textureView", value: effectiveSkylightResources.brdfLutView }
|
|
5064
5332
|
},
|
|
5065
5333
|
{
|
|
5066
5334
|
binding: 6 + smUserRegionFields.length * 2,
|
|
5067
|
-
resource: { kind: "sampler", value:
|
|
5335
|
+
resource: { kind: "sampler", value: effectiveSkylightResources.brdfLutSampler }
|
|
5068
5336
|
},
|
|
5069
5337
|
{
|
|
5070
5338
|
binding: 7 + smUserRegionFields.length * 2,
|
|
5071
|
-
resource: {
|
|
5339
|
+
resource: {
|
|
5340
|
+
kind: "buffer",
|
|
5341
|
+
value: { buffer: effectiveSkylightResources.intensityBuffer }
|
|
5342
|
+
}
|
|
5072
5343
|
}
|
|
5073
5344
|
],
|
|
5074
5345
|
1 + smUserRegionFields.length * 2,
|
|
@@ -5176,10 +5447,10 @@ function buildPerSubmeshMaterialBg(deps, submeshMaterial, entityKey, materialWor
|
|
|
5176
5447
|
const smMergedEntries = assembleMaterialWithSkylightEntries(
|
|
5177
5448
|
smBaseEntries,
|
|
5178
5449
|
effectiveSkylightResources,
|
|
5179
|
-
{
|
|
5450
|
+
transmissionBackdropAvailable(runtime.device.limits.maxSampledTexturesPerShaderStage) ? {
|
|
5180
5451
|
sampler: transmissionSampler,
|
|
5181
5452
|
...transmissionBackdropView === void 0 ? {} : { backdropView: transmissionBackdropView }
|
|
5182
|
-
},
|
|
5453
|
+
} : null,
|
|
5183
5454
|
physicalTextureInjections
|
|
5184
5455
|
);
|
|
5185
5456
|
if (runtime.device.caps.storageBuffer) {
|
|
@@ -5247,13 +5518,14 @@ function buildPerSubmeshMaterialBg(deps, submeshMaterial, entityKey, materialWor
|
|
|
5247
5518
|
"miss"
|
|
5248
5519
|
);
|
|
5249
5520
|
}
|
|
5250
|
-
if (smMaterialHandle !== void 0 && !smHasVideoFields && materialResourcesResident &&
|
|
5521
|
+
if (smMaterialHandle !== void 0 && !smHasVideoFields && materialResourcesResident && !hasActiveTransmissionBackdrop) {
|
|
5251
5522
|
if (materialCacheKey !== void 0) {
|
|
5252
5523
|
materialBgAssemblyCache.set(materialCacheKey, {
|
|
5253
5524
|
material: submeshMaterial,
|
|
5254
5525
|
materialResourceEpoch: store.materialResourceEpoch,
|
|
5255
5526
|
materialBgl: smMaterialBgl,
|
|
5256
5527
|
materialBuffer: pipelineState.materialUniformBuffer.buffer,
|
|
5528
|
+
...sceneMaterialBuffer === void 0 ? {} : { sceneMaterialBuffer },
|
|
5257
5529
|
skylightResources: effectiveSkylightResources,
|
|
5258
5530
|
bindGroup: smBindGroup
|
|
5259
5531
|
});
|
|
@@ -5262,7 +5534,7 @@ function buildPerSubmeshMaterialBg(deps, submeshMaterial, entityKey, materialWor
|
|
|
5262
5534
|
return smBindGroup;
|
|
5263
5535
|
}
|
|
5264
5536
|
var ZERO_SKYLIGHT_PAYLOAD = new Float32Array([0, 0, 0, 0, 0, 0, 0, 1]);
|
|
5265
|
-
function resolveMaterialSkylight(runtime, pipelineState, skylight, skylightCount) {
|
|
5537
|
+
function resolveMaterialSkylight(runtime, pipelineState, skylight, skylightCount, environmentIbl) {
|
|
5266
5538
|
const skylightFallback = pipelineState.skylightFallback;
|
|
5267
5539
|
if (skylightFallback === null) {
|
|
5268
5540
|
throw new RhiError({
|
|
@@ -5287,6 +5559,13 @@ function resolveMaterialSkylight(runtime, pipelineState, skylight, skylightCount
|
|
|
5287
5559
|
};
|
|
5288
5560
|
}
|
|
5289
5561
|
}
|
|
5562
|
+
if (environmentIbl !== void 0 && skylight !== void 0 && skylight.equirectHandle === 0) {
|
|
5563
|
+
activeViews = {
|
|
5564
|
+
irr: environmentIbl.irradiance,
|
|
5565
|
+
pref: environmentIbl.prefilter,
|
|
5566
|
+
brdf: activeViews?.brdf ?? skylightFallback.brdfLutView
|
|
5567
|
+
};
|
|
5568
|
+
}
|
|
5290
5569
|
const skylightResources = activeViews !== void 0 ? {
|
|
5291
5570
|
irradianceView: activeViews.irr,
|
|
5292
5571
|
irradianceSampler: skylightFallback.sampler,
|
|
@@ -5307,10 +5586,19 @@ function resolveMaterialSkylight(runtime, pipelineState, skylight, skylightCount
|
|
|
5307
5586
|
return { skylightResources, activeViews };
|
|
5308
5587
|
}
|
|
5309
5588
|
function prepareMaterialSkylight(c) {
|
|
5310
|
-
return resolveMaterialSkylight(
|
|
5589
|
+
return resolveMaterialSkylight(
|
|
5590
|
+
c.runtime,
|
|
5591
|
+
c.pipelineState,
|
|
5592
|
+
c.skylight,
|
|
5593
|
+
c.skylightCount,
|
|
5594
|
+
c.environmentIbl
|
|
5595
|
+
);
|
|
5311
5596
|
}
|
|
5312
5597
|
|
|
5313
5598
|
// src/record/main-pass-geometry.ts
|
|
5599
|
+
function sameOpaqueTemporalDraw(a, b) {
|
|
5600
|
+
return (isStandardPbrMaterialShader(a.materialShaderId) || a.tags.SurfaceKind === "standard" && b.tags.SurfaceKind === "standard" && a.tags.SurfaceModule === b.tags.SurfaceModule) && a.materialShaderId === b.materialShaderId && a.renderState?.blend === void 0 && b.renderState?.blend === void 0 && a.renderState?.stencil === void 0 && b.renderState?.stencil === void 0 && a.stencilReference === b.stencilReference && renderStateHash(a.renderState) === renderStateHash(b.renderState);
|
|
5601
|
+
}
|
|
5314
5602
|
function materialDiagnosticsEnabled2() {
|
|
5315
5603
|
if (typeof globalThis !== "object" || globalThis === null || !("process" in globalThis)) {
|
|
5316
5604
|
return false;
|
|
@@ -5318,6 +5606,14 @@ function materialDiagnosticsEnabled2() {
|
|
|
5318
5606
|
const processValue = globalThis.process;
|
|
5319
5607
|
return processValue?.env?.FORGEAX_MATERIAL_DIAGNOSTICS === "1";
|
|
5320
5608
|
}
|
|
5609
|
+
function variantSetForCoveragePass(variantSet, coverageOnly) {
|
|
5610
|
+
if (!coverageOnly) return variantSet;
|
|
5611
|
+
if (variantSet?.includes("COVERAGE_ONLY=")) return variantSet;
|
|
5612
|
+
return variantSet === void 0 || variantSet === "" ? "COVERAGE_ONLY=true" : `${variantSet}+COVERAGE_ONLY=true`;
|
|
5613
|
+
}
|
|
5614
|
+
function isHdrGeometryTarget(tonemapActive, colorFormatOverride) {
|
|
5615
|
+
return colorFormatOverride === void 0 ? tonemapActive : colorFormatOverride === "rgba16float";
|
|
5616
|
+
}
|
|
5321
5617
|
function gpuDrivenDrawIndicesBySubmesh(source, mesh) {
|
|
5322
5618
|
const draws = source.gpuDrivenDraws;
|
|
5323
5619
|
if (draws === void 0 || draws.length === 0) return /* @__PURE__ */ new Map();
|
|
@@ -5430,11 +5726,11 @@ function effectiveMaterialLayoutIdentity(materialShaderId, materialParamSchema)
|
|
|
5430
5726
|
}
|
|
5431
5727
|
return materialBindGroupLayoutIdentity(materialShaderId, materialParamSchema);
|
|
5432
5728
|
}
|
|
5433
|
-
function geometryRenderStateForPass(base, passKind) {
|
|
5729
|
+
function geometryRenderStateForPass(base, passKind, coverageOnly = false) {
|
|
5434
5730
|
if (passKind !== "temporal") return base;
|
|
5435
5731
|
return {
|
|
5436
5732
|
...base,
|
|
5437
|
-
depthWriteEnabled:
|
|
5733
|
+
depthWriteEnabled: coverageOnly,
|
|
5438
5734
|
depthCompare: "less-equal"
|
|
5439
5735
|
};
|
|
5440
5736
|
}
|
|
@@ -5477,7 +5773,7 @@ function recordPointsLinesDraw(pass, plan) {
|
|
|
5477
5773
|
}
|
|
5478
5774
|
pass.draw(plan.vertexCount, 1, 0, 0);
|
|
5479
5775
|
}
|
|
5480
|
-
function recordGeometryDraws(c, pass, matchedMaterials, materialSlotIndices, sampleCount, meshGroup2, meshBindGroup, resolveMaterialBindGroup, passKind = "forward", selectedDispatch, colorFormats = []) {
|
|
5776
|
+
function recordGeometryDraws(c, pass, matchedMaterials, materialSlotIndices, sampleCount, meshGroup2, meshBindGroup, resolveMaterialBindGroup, passKind = "forward", selectedDispatch, colorFormats = [], coverageOnly = false) {
|
|
5481
5777
|
const {
|
|
5482
5778
|
runtime,
|
|
5483
5779
|
pipelineState,
|
|
@@ -5500,12 +5796,14 @@ function recordGeometryDraws(c, pass, matchedMaterials, materialSlotIndices, sam
|
|
|
5500
5796
|
}
|
|
5501
5797
|
const passes = byMaterial.get(dispatch.materialHandle);
|
|
5502
5798
|
if (passes === void 0) byMaterial.set(dispatch.materialHandle, [dispatch]);
|
|
5503
|
-
else passes.
|
|
5799
|
+
else if (passKind !== "temporal" || !passes.some((previous) => sameOpaqueTemporalDraw(previous, dispatch)))
|
|
5800
|
+
passes.push(dispatch);
|
|
5504
5801
|
}
|
|
5505
5802
|
const diagnosticsEnabled = materialDiagnosticsEnabled2();
|
|
5506
5803
|
const colorFormatOverride = c.transparentColorFormat;
|
|
5507
5804
|
const clusteredLighting = c.standardLighting?.kind === "clustered";
|
|
5508
|
-
const isHdrTarget = tonemapActive
|
|
5805
|
+
const isHdrTarget = isHdrGeometryTarget(tonemapActive, colorFormatOverride);
|
|
5806
|
+
const withCoverageVariant = (variantSet) => variantSetForCoveragePass(variantSet, coverageOnly);
|
|
5509
5807
|
let lastVertexBuffer = null;
|
|
5510
5808
|
let lastIndexBuffer = null;
|
|
5511
5809
|
const bindingState = {
|
|
@@ -5531,18 +5829,19 @@ function recordGeometryDraws(c, pass, matchedMaterials, materialSlotIndices, sam
|
|
|
5531
5829
|
draw();
|
|
5532
5830
|
};
|
|
5533
5831
|
const resolveMaterialPipeline = (materialShaderId, renderState, topology, indexFormat, variantSet, colorFormat, layoutProjection, vertexEntry, fragmentEntry, textureMask) => {
|
|
5832
|
+
const pipelineVariantSet = withCoverageVariant(variantSet);
|
|
5534
5833
|
const reflectionFallbackFormats = materialShaderId === "forgeax::default-standard-pbr" && c.reflectionFallbackColorFormat !== void 0 ? passKind === "deferred" ? colorFormats.slice(1) : [c.reflectionFallbackColorFormat] : void 0;
|
|
5535
5834
|
const renderStateKey = renderStateHash(renderState);
|
|
5536
5835
|
const shaderLookupCache = materialPipelineLookupCache.get(materialShaderId);
|
|
5537
5836
|
const cachedLookups = shaderLookupCache?.get(renderStateKey);
|
|
5538
5837
|
if (cachedLookups !== void 0) {
|
|
5539
5838
|
for (const cached of cachedLookups) {
|
|
5540
|
-
if (cached.isHdrTarget === isHdrTarget && cached.renderStateKey === renderStateKey && cached.topology === topology && cached.indexFormat === indexFormat && cached.variantSet ===
|
|
5839
|
+
if (cached.isHdrTarget === isHdrTarget && cached.renderStateKey === renderStateKey && cached.topology === topology && cached.indexFormat === indexFormat && cached.variantSet === pipelineVariantSet && cached.vertexEntry === vertexEntry && cached.fragmentEntry === fragmentEntry && cached.textureMask === textureMask && cached.passKind === passKind && cached.layoutProjection.digest === layoutProjection.digest && cached.sampleCount === sampleCount && cached.colorFormatOverride === colorFormat && cached.additionalColorFormats?.join(",") === reflectionFallbackFormats?.join(",")) {
|
|
5541
5840
|
return cached.handle;
|
|
5542
5841
|
}
|
|
5543
5842
|
}
|
|
5544
5843
|
}
|
|
5545
|
-
const resolvedVariantSetResult = runtime.getMaterialArtifact?.(materialShaderId) !== void 0 ? { ok: true, value: void 0 } :
|
|
5844
|
+
const resolvedVariantSetResult = runtime.getMaterialArtifact?.(materialShaderId) !== void 0 ? { ok: true, value: void 0 } : pipelineVariantSet === void 0 && (materialShaderId === "forgeax::sprite" || materialShaderId === "forgeax::sprite-lit") ? { ok: true, value: void 0 } : variantSetFromVertexLayoutProjection(layoutProjection, pipelineVariantSet);
|
|
5546
5845
|
if (!resolvedVariantSetResult.ok) {
|
|
5547
5846
|
runtime.errorRegistry.fire(resolvedVariantSetResult.error);
|
|
5548
5847
|
return null;
|
|
@@ -5581,7 +5880,7 @@ function recordGeometryDraws(c, pass, matchedMaterials, materialSlotIndices, sam
|
|
|
5581
5880
|
renderStateKey,
|
|
5582
5881
|
topology,
|
|
5583
5882
|
indexFormat,
|
|
5584
|
-
variantSet,
|
|
5883
|
+
variantSet: pipelineVariantSet,
|
|
5585
5884
|
vertexEntry,
|
|
5586
5885
|
fragmentEntry,
|
|
5587
5886
|
passKind,
|
|
@@ -5721,7 +6020,7 @@ function recordGeometryDraws(c, pass, matchedMaterials, materialSlotIndices, sam
|
|
|
5721
6020
|
)
|
|
5722
6021
|
);
|
|
5723
6022
|
if (!skinVariantSetResult.ok) runtime.errorRegistry.fire(skinVariantSetResult.error);
|
|
5724
|
-
const skinVariantSet = skinVariantSetResult.ok ? skinVariantSetResult.value : void 0;
|
|
6023
|
+
const skinVariantSet = skinVariantSetResult.ok ? withCoverageVariant(skinVariantSetResult.value) : void 0;
|
|
5725
6024
|
const skinPsoProbe = skinResources !== null && skinVariantSetResult.ok ? runtime.getMaterialShaderPipeline?.(
|
|
5726
6025
|
SKIN_MATERIAL_SHADER_ID,
|
|
5727
6026
|
isHdrTarget,
|
|
@@ -5892,7 +6191,11 @@ function recordGeometryDraws(c, pass, matchedMaterials, materialSlotIndices, sam
|
|
|
5892
6191
|
cullMode: "none",
|
|
5893
6192
|
blend: selectedRenderState?.blend ?? SPRITE_PREMULTIPLIED_ALPHA_BLEND
|
|
5894
6193
|
} : geometryRenderStateForTopology(smTopology, selectedRenderState);
|
|
5895
|
-
const pipelineRenderState = geometryRenderStateForPass(
|
|
6194
|
+
const pipelineRenderState = geometryRenderStateForPass(
|
|
6195
|
+
basePipelineRenderState,
|
|
6196
|
+
passKind,
|
|
6197
|
+
coverageOnly
|
|
6198
|
+
);
|
|
5896
6199
|
let smPipelineHandle;
|
|
5897
6200
|
let materialGroup2Contract;
|
|
5898
6201
|
let materialPipelineEntry = null;
|
|
@@ -7192,7 +7495,13 @@ function deriveStandardMaterialFields() {
|
|
|
7192
7495
|
])
|
|
7193
7496
|
];
|
|
7194
7497
|
fields.sort((left, right) => left.offset - right.offset);
|
|
7195
|
-
return
|
|
7498
|
+
return [
|
|
7499
|
+
...fields.map(({ field }) => field),
|
|
7500
|
+
...Array.from(
|
|
7501
|
+
{ length: (GPU_DRIVEN_MATERIAL_ROW_BYTES - derived.totalBytes) / 16 },
|
|
7502
|
+
(_, index) => ({ name: `_gpuDrivenPadding${index}`, type: "vec4<f32>" })
|
|
7503
|
+
)
|
|
7504
|
+
];
|
|
7196
7505
|
}
|
|
7197
7506
|
var GPU_SCENE_SCHEMAS = Object.freeze({
|
|
7198
7507
|
lod: {
|
|
@@ -7365,6 +7674,15 @@ function buildBatchAlignedSubmission(source, candidatesByBatch) {
|
|
|
7365
7674
|
visibleCapacity: visibleBase
|
|
7366
7675
|
});
|
|
7367
7676
|
}
|
|
7677
|
+
function hasActiveAlphaMask(material, prepared) {
|
|
7678
|
+
const { cutoff, source } = prepared.alphaMask;
|
|
7679
|
+
if (cutoff.length === 0 || source.length === 0) return false;
|
|
7680
|
+
if (prepared.identity.material === "forgeax::default-standard-pbr" || prepared.identity.material === "forgeax::pbr-skin" || prepared.identity.material === "forgeax::default-standard-pbr-skin") {
|
|
7681
|
+
const value = material.paramSnapshot?.[cutoff];
|
|
7682
|
+
return typeof value === "number" && value > 0;
|
|
7683
|
+
}
|
|
7684
|
+
return true;
|
|
7685
|
+
}
|
|
7368
7686
|
function eligibleDraws(slot) {
|
|
7369
7687
|
const snapshot = slot.snapshot;
|
|
7370
7688
|
const draws = snapshot.gpuDrivenDraws;
|
|
@@ -7379,14 +7697,19 @@ function eligibleDraws(slot) {
|
|
|
7379
7697
|
const prepared = draw.prepared;
|
|
7380
7698
|
const material = snapshot.materials[draw.materialSlot] ?? snapshot.material;
|
|
7381
7699
|
if (prepared !== void 0) {
|
|
7382
|
-
const
|
|
7700
|
+
const materialIdentityMatches = material.materialShaderId === void 0 || prepared.identity.material === material.materialShaderId;
|
|
7383
7701
|
const isAlphaBlend = material.transparent === true || material.renderState?.blend !== void 0;
|
|
7384
7702
|
const cpuOnlyMaterialResources = (material.textureSources?.size ?? 0) > 0 || (material.videoTextureFields?.size ?? 0) > 0;
|
|
7385
7703
|
const skinReady = prepared.identity.deformation !== "skin" || snapshot.skin?.storageOrUniform === "storage" && snapshot.skin.customDataStart >= 0 && Number.isInteger(snapshot.skin.customDataStart) && hasFiniteOrderedBounds(snapshot.skin.bounds) && prepared.skinPaletteAddress !== void 0;
|
|
7386
|
-
if (!
|
|
7704
|
+
if (!materialIdentityMatches || isAlphaBlend || cpuOnlyMaterialResources || prepared.identity.deformation !== "rigid" && prepared.identity.deformation !== "skin" || !skinReady)
|
|
7387
7705
|
continue;
|
|
7388
|
-
const preparedIdentity =
|
|
7389
|
-
|
|
7706
|
+
const preparedIdentity = [
|
|
7707
|
+
prepared.identity.material,
|
|
7708
|
+
prepared.identity.geometry,
|
|
7709
|
+
prepared.identity.deformation,
|
|
7710
|
+
...prepared.receiptIdentity === void 0 ? [] : [prepared.receiptIdentity]
|
|
7711
|
+
].join("|");
|
|
7712
|
+
const admission = hasActiveAlphaMask(material, prepared) ? "alpha-mask" : "opaque";
|
|
7390
7713
|
result.push({
|
|
7391
7714
|
sourceDrawIndex: drawItemIndex,
|
|
7392
7715
|
key: {
|
|
@@ -9739,9 +10062,7 @@ function recordGpuDrivenShadowIndirect(pass, submission) {
|
|
|
9739
10062
|
pass.setVertexBuffer(0, raster.vertexBuffer);
|
|
9740
10063
|
currentVertex = raster.vertexBuffer;
|
|
9741
10064
|
}
|
|
9742
|
-
|
|
9743
|
-
pass.setBindGroup(1, raster.alphaMaskMaterialGroup, [0]);
|
|
9744
|
-
}
|
|
10065
|
+
pass.setBindGroup(1, raster.materialGroup, [0]);
|
|
9745
10066
|
if (raster.indexBuffer !== void 0) {
|
|
9746
10067
|
if (raster.indexFormat === void 0) {
|
|
9747
10068
|
throw new RhiError({
|
|
@@ -9868,12 +10189,12 @@ function validateShadowOwnership(c, identity, claimedKeys, recordedKeys) {
|
|
|
9868
10189
|
const overlap = [...claimed].filter((key) => recordedKeys.has(key));
|
|
9869
10190
|
const union = /* @__PURE__ */ new Set([...claimed, ...recordedKeys]);
|
|
9870
10191
|
const missing = [...expectedKeys].filter((key) => !union.has(key));
|
|
9871
|
-
const
|
|
9872
|
-
if (overlap.length === 0 && missing.length === 0 &&
|
|
10192
|
+
const unexpectedClaims = [...claimed].filter((key) => !expectedKeys.has(key));
|
|
10193
|
+
if (overlap.length === 0 && missing.length === 0 && unexpectedClaims.length === 0) return;
|
|
9873
10194
|
throw new RhiError({
|
|
9874
10195
|
code: "internal-error",
|
|
9875
10196
|
expected: `disjoint ShadowCaster ownership for ${shadowViewIdentityKey(identity)}`,
|
|
9876
|
-
hint: `claimed=${[...claimed].sort().join(",")} recorded=${[...recordedKeys].sort().join(",")} missing=${missing.sort().join(",")}
|
|
10197
|
+
hint: `claimed=${[...claimed].sort().join(",")} recorded=${[...recordedKeys].sort().join(",")} missing=${missing.sort().join(",")} unexpectedClaims=${unexpectedClaims.sort().join(",")}`
|
|
9877
10198
|
});
|
|
9878
10199
|
}
|
|
9879
10200
|
function hasUnclaimedShadowCasters(c, claimedKeys) {
|
|
@@ -9916,18 +10237,31 @@ function recordGpuDrivenShadowIfPublished(c, pass, identity) {
|
|
|
9916
10237
|
hint: "keep shadow batch scene rows aligned with the shared SubmissionPlan"
|
|
9917
10238
|
});
|
|
9918
10239
|
}
|
|
10240
|
+
const shadowArtifact = projection.shadowArtifact;
|
|
10241
|
+
const shadowReceipt = shadowArtifact.receipt;
|
|
10242
|
+
if (shadowReceipt === void 0) {
|
|
10243
|
+
throw new RhiError({
|
|
10244
|
+
code: "rhi-not-available",
|
|
10245
|
+
expected: `published shadow MaterialProgramAbi for batch ${batch.batchId}`,
|
|
10246
|
+
hint: "keep the shadow draw out of the capable lane until its producer receipt is ready"
|
|
10247
|
+
});
|
|
10248
|
+
}
|
|
10249
|
+
const shadowVariantSet = shadowArtifact.variantSet ?? (shadowArtifact.material === SHADOW_CASTER_SHADER_ID ? shadowCasterVariantSet(
|
|
10250
|
+
c.runtime.device.caps.storageBuffer,
|
|
10251
|
+
projection.deformation === "skin",
|
|
10252
|
+
true,
|
|
10253
|
+
batch.key.admission === "alpha-mask",
|
|
10254
|
+
projection.vertexColorAvailable
|
|
10255
|
+
) : void 0);
|
|
9919
10256
|
const pipeline = c.runtime.getMaterialShaderPipeline?.(
|
|
9920
|
-
|
|
10257
|
+
// A scene-index shadow artifact may retain the logical material id for
|
|
10258
|
+
// batching while its specialization key owns the actual WGSL module.
|
|
10259
|
+
shadowArtifact.specializationKey ?? shadowArtifact.material,
|
|
9921
10260
|
false,
|
|
9922
10261
|
shadowRasterState(void 0, identity.kind === "point"),
|
|
9923
10262
|
batch.key.topology,
|
|
9924
10263
|
batch.key.drawKind === "indexed" ? projection.mesh.indexFormat : void 0,
|
|
9925
|
-
|
|
9926
|
-
c.runtime.device.caps.storageBuffer,
|
|
9927
|
-
projection.deformation === "skin",
|
|
9928
|
-
true,
|
|
9929
|
-
batch.key.admission === "alpha-mask"
|
|
9930
|
-
),
|
|
10264
|
+
shadowVariantSet,
|
|
9931
10265
|
"shadow-caster",
|
|
9932
10266
|
void 0,
|
|
9933
10267
|
void 0,
|
|
@@ -9936,9 +10270,15 @@ function recordGpuDrivenShadowIfPublished(c, pass, identity) {
|
|
|
9936
10270
|
void 0,
|
|
9937
10271
|
void 0,
|
|
9938
10272
|
projection.mesh.layoutProjection,
|
|
9939
|
-
|
|
10273
|
+
// The shadow projection carries the producer-validated receipt. Select
|
|
10274
|
+
// the immediate module adapter so a newly loaded custom Surface cannot
|
|
10275
|
+
// lose its first capable shadow draw to async pre-bake warm-up.
|
|
10276
|
+
"immediate",
|
|
9940
10277
|
projection.deformation === "skin" ? "gpu-driven-skin" : "gpu-driven-pbr",
|
|
9941
|
-
|
|
10278
|
+
shadowReceipt.sceneIndexEntry,
|
|
10279
|
+
void 0,
|
|
10280
|
+
projection.shadowVertexEntry,
|
|
10281
|
+
projection.shadowFragmentEntry
|
|
9942
10282
|
);
|
|
9943
10283
|
if (pipeline === null || pipeline === void 0) {
|
|
9944
10284
|
throw new RhiError({
|
|
@@ -9954,12 +10294,20 @@ function recordGpuDrivenShadowIfPublished(c, pass, identity) {
|
|
|
9954
10294
|
hint: "keep the geometry residency and topology draw kind aligned before capable recording"
|
|
9955
10295
|
});
|
|
9956
10296
|
}
|
|
10297
|
+
const materialGroup = shadowArtifact.material !== SHADOW_CASTER_SHADER_ID ? ensureGpuDrivenCustomShadowMaterialBg(c, projection) : batch.key.admission === "alpha-mask" ? ensureGpuDrivenAlphaMaskMaterialBg(c, projection) : ensureSpotShadowMaterialBg(c);
|
|
10298
|
+
if (materialGroup === null) {
|
|
10299
|
+
throw new RhiError({
|
|
10300
|
+
code: "rhi-not-available",
|
|
10301
|
+
expected: "material resources for every GPU shadow batch",
|
|
10302
|
+
hint: "publish the shadow material binding before recording the indirect batch"
|
|
10303
|
+
});
|
|
10304
|
+
}
|
|
9957
10305
|
batches.set(batch.batchId, {
|
|
9958
10306
|
pipeline,
|
|
9959
10307
|
meshBindGroup: projection.meshBindGroup,
|
|
9960
10308
|
visibleBindGroup: projection.visibleBindGroup,
|
|
9961
10309
|
deformation: projection.deformation,
|
|
9962
|
-
|
|
10310
|
+
materialGroup,
|
|
9963
10311
|
vertexBuffer: projection.mesh.vertexBuffer.handle,
|
|
9964
10312
|
...batch.key.drawKind === "indexed" && projection.mesh.indexBuffer !== null ? {
|
|
9965
10313
|
indexBuffer: projection.mesh.indexBuffer.handle,
|
|
@@ -10629,7 +10977,10 @@ function recordShadowCasterDraws(c, shadowPass, shadowPipeline2, shadowMeshBindG
|
|
|
10629
10977
|
runtime.device.caps.storageBuffer,
|
|
10630
10978
|
skinned,
|
|
10631
10979
|
false,
|
|
10632
|
-
Number(shadowDispatch?.paramSnapshot?.alphaCutoff ?? 0) > 0
|
|
10980
|
+
Number(shadowDispatch?.paramSnapshot?.alphaCutoff ?? 0) > 0,
|
|
10981
|
+
entry.mesh.layoutProjection.attributes.some(
|
|
10982
|
+
(attribute) => attribute.key === "color"
|
|
10983
|
+
)
|
|
10633
10984
|
),
|
|
10634
10985
|
"shadow-caster",
|
|
10635
10986
|
void 0,
|
|
@@ -10733,9 +11084,23 @@ function recordShadowCasterDraws(c, shadowPass, shadowPipeline2, shadowMeshBindG
|
|
|
10733
11084
|
}
|
|
10734
11085
|
function ensureSpotShadowMaterialBg(c) {
|
|
10735
11086
|
const { runtime, frameState, pipelineState } = c;
|
|
10736
|
-
const cached = frameState.singletonMaterialCache.get("shadow-material-singleton");
|
|
10737
|
-
if (cached !== void 0) return cached;
|
|
10738
11087
|
const fb = pipelineState.skylightFallback;
|
|
11088
|
+
const sceneMaterialBuffer = c.gpuDrivenStandardPbrFrameResources?.sceneMaterialBuffer ?? pipelineState.meshStorageBuffer.buffer;
|
|
11089
|
+
const handles = [
|
|
11090
|
+
pipelineState.materialBindGroupLayout,
|
|
11091
|
+
pipelineState.materialUniformBuffer.buffer,
|
|
11092
|
+
pipelineState.defaultSampler,
|
|
11093
|
+
pipelineState.defaultNormalTextureView,
|
|
11094
|
+
pipelineState.fallbackTextureView,
|
|
11095
|
+
sceneMaterialBuffer,
|
|
11096
|
+
...fb === null ? [] : [fb]
|
|
11097
|
+
];
|
|
11098
|
+
const cached = findFromChain(
|
|
11099
|
+
frameState.shadowMaterialBindGroups,
|
|
11100
|
+
handles,
|
|
11101
|
+
"shadow-material-singleton"
|
|
11102
|
+
);
|
|
11103
|
+
if (cached !== void 0) return cached;
|
|
10739
11104
|
const fallbackEntries = buildPbrMaterialUserRegionEntries().map((entry) => {
|
|
10740
11105
|
if (entry.buffer !== void 0) {
|
|
10741
11106
|
return {
|
|
@@ -10764,36 +11129,43 @@ function ensureSpotShadowMaterialBg(c) {
|
|
|
10764
11129
|
}
|
|
10765
11130
|
};
|
|
10766
11131
|
});
|
|
10767
|
-
const merged = fb !== null ? assembleMaterialWithSkylightEntries(
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
|
|
11132
|
+
const merged = fb !== null ? assembleMaterialWithSkylightEntries(
|
|
11133
|
+
fallbackEntries,
|
|
11134
|
+
{
|
|
11135
|
+
irradianceView: fb.irradianceView,
|
|
11136
|
+
irradianceSampler: fb.sampler,
|
|
11137
|
+
prefilterView: fb.prefilterView,
|
|
11138
|
+
prefilterSampler: fb.sampler,
|
|
11139
|
+
brdfLutView: fb.brdfLutView,
|
|
11140
|
+
brdfLutSampler: fb.sampler,
|
|
11141
|
+
intensityBuffer: fb.intensityBuffer
|
|
11142
|
+
},
|
|
11143
|
+
transmissionBackdropAvailable(runtime.device.limits.maxSampledTexturesPerShaderStage) ? void 0 : null
|
|
11144
|
+
) : fallbackEntries;
|
|
10776
11145
|
if (runtime.device.caps.storageBuffer) {
|
|
10777
11146
|
merged.push({
|
|
10778
11147
|
binding: 46,
|
|
10779
11148
|
resource: {
|
|
10780
11149
|
kind: "buffer",
|
|
10781
|
-
value: { buffer:
|
|
11150
|
+
value: { buffer: sceneMaterialBuffer }
|
|
10782
11151
|
}
|
|
10783
11152
|
});
|
|
10784
11153
|
}
|
|
10785
|
-
const r =
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
|
|
10789
|
-
|
|
11154
|
+
const r = getOrCreateFromChainResult(
|
|
11155
|
+
frameState.shadowMaterialBindGroups,
|
|
11156
|
+
handles,
|
|
11157
|
+
"shadow-material-singleton",
|
|
11158
|
+
() => runtime.device.createBindGroup({
|
|
11159
|
+
label: "shadow-material-bg",
|
|
11160
|
+
layout: pipelineState.materialBindGroupLayout,
|
|
11161
|
+
entries: merged
|
|
11162
|
+
}),
|
|
11163
|
+
c.bindGroupCounts
|
|
11164
|
+
);
|
|
10790
11165
|
if (!r.ok) {
|
|
10791
11166
|
runtime.errorRegistry.fire(r.error);
|
|
10792
11167
|
return null;
|
|
10793
11168
|
}
|
|
10794
|
-
c.bindGroupCounts.createBindGroup += 1;
|
|
10795
|
-
c.bindGroupCounts.keys.push("shadow-material-singleton");
|
|
10796
|
-
frameState.singletonMaterialCache.set("shadow-material-singleton", r.value);
|
|
10797
11169
|
return r.value;
|
|
10798
11170
|
}
|
|
10799
11171
|
function ensureGpuDrivenAlphaMaskMaterialBg(c, projection) {
|
|
@@ -10805,9 +11177,6 @@ function ensureGpuDrivenAlphaMaskMaterialBg(c, projection) {
|
|
|
10805
11177
|
hint: "publish the receipt-derived scene material table before the capable shadow pass"
|
|
10806
11178
|
});
|
|
10807
11179
|
}
|
|
10808
|
-
const materialKey = `shadow-material-alpha:${projection.materialEntityKey}:${projection.material.materialHandle ?? -1}:${c.store.materialResourceEpoch}`;
|
|
10809
|
-
const cached = c.frameState.singletonMaterialCache.get(materialKey);
|
|
10810
|
-
if (cached !== void 0) return cached;
|
|
10811
11180
|
const fallback = c.pipelineState.skylightFallback;
|
|
10812
11181
|
if (fallback === null) {
|
|
10813
11182
|
throw new RhiError({
|
|
@@ -10845,7 +11214,56 @@ function ensureGpuDrivenAlphaMaskMaterialBg(c, projection) {
|
|
|
10845
11214
|
projection.materialEntityKey,
|
|
10846
11215
|
c.world
|
|
10847
11216
|
);
|
|
10848
|
-
|
|
11217
|
+
return bindGroup;
|
|
11218
|
+
}
|
|
11219
|
+
function ensureGpuDrivenCustomShadowMaterialBg(c, projection) {
|
|
11220
|
+
const shaderId = projection.shadowArtifact.material;
|
|
11221
|
+
const fallback = c.pipelineState.skylightFallback;
|
|
11222
|
+
if (fallback === null) {
|
|
11223
|
+
throw new RhiError({
|
|
11224
|
+
code: "rhi-not-available",
|
|
11225
|
+
expected: "skylight resources for custom shadow material binding",
|
|
11226
|
+
hint: "publish the custom material resource owner before recording the shadow lane"
|
|
11227
|
+
});
|
|
11228
|
+
}
|
|
11229
|
+
const sceneMaterialBuffer = c.gpuDrivenStandardPbrFrameResources?.sceneMaterialBuffer;
|
|
11230
|
+
if (sceneMaterialBuffer === void 0) {
|
|
11231
|
+
throw new RhiError({
|
|
11232
|
+
code: "rhi-not-available",
|
|
11233
|
+
expected: "producer-owned scene material buffer for custom shadow ABI",
|
|
11234
|
+
hint: "publish the selected shadow MaterialProgramAbi scene-index resource before recording"
|
|
11235
|
+
});
|
|
11236
|
+
}
|
|
11237
|
+
const skylightResources = {
|
|
11238
|
+
irradianceView: fallback.irradianceView,
|
|
11239
|
+
irradianceSampler: fallback.sampler,
|
|
11240
|
+
prefilterView: fallback.prefilterView,
|
|
11241
|
+
prefilterSampler: fallback.sampler,
|
|
11242
|
+
brdfLutView: fallback.brdfLutView,
|
|
11243
|
+
brdfLutSampler: fallback.sampler,
|
|
11244
|
+
intensityBuffer: fallback.intensityBuffer
|
|
11245
|
+
};
|
|
11246
|
+
const deps = {
|
|
11247
|
+
runtime: c.runtime,
|
|
11248
|
+
pipelineState: c.pipelineState,
|
|
11249
|
+
world: c.world,
|
|
11250
|
+
store: c.store,
|
|
11251
|
+
materialSlice: STANDARD_PBR_UBO_SIZE,
|
|
11252
|
+
videoHighPerfAvailable: false,
|
|
11253
|
+
skylightResources,
|
|
11254
|
+
materialBgShared: c.frameState.materialBgShared,
|
|
11255
|
+
materialBgAssemblyCache: c.materialBgAssemblyCache,
|
|
11256
|
+
bindGroupCounts: c.bindGroupCounts,
|
|
11257
|
+
frameState: c.frameState,
|
|
11258
|
+
sceneMaterialBuffer
|
|
11259
|
+
};
|
|
11260
|
+
const bindGroup = buildPerSubmeshMaterialBg(
|
|
11261
|
+
deps,
|
|
11262
|
+
projection.material,
|
|
11263
|
+
projection.materialEntityKey,
|
|
11264
|
+
c.world,
|
|
11265
|
+
shaderId
|
|
11266
|
+
);
|
|
10849
11267
|
return bindGroup;
|
|
10850
11268
|
}
|
|
10851
11269
|
|
|
@@ -11057,6 +11475,10 @@ function recordMainPass(c, selector, options, graphPass) {
|
|
|
11057
11475
|
errors: []
|
|
11058
11476
|
};
|
|
11059
11477
|
}
|
|
11478
|
+
const hasProbeBindings = (c.reflectionProbes?.table.rows.length ?? 0) > 0;
|
|
11479
|
+
const worldIndices = hasProbeBindings ? new Map(
|
|
11480
|
+
validatedOrdered.map((entry) => [entry.world ?? world, entry.source.worldId])
|
|
11481
|
+
) : void 0;
|
|
11060
11482
|
const perSubmeshMaterialBgDeps = {
|
|
11061
11483
|
runtime,
|
|
11062
11484
|
pipelineState,
|
|
@@ -11068,8 +11490,10 @@ function recordMainPass(c, selector, options, graphPass) {
|
|
|
11068
11490
|
resolveRenderTargetTextureSource: runtime.resolveRenderTargetTextureSource,
|
|
11069
11491
|
resolveReflectionProbeResources: (materialWorld, entityKey) => {
|
|
11070
11492
|
const reflectionProbes = c.reflectionProbes;
|
|
11071
|
-
if (reflectionProbes === void 0) return void 0;
|
|
11072
|
-
const selection = reflectionProbes.selections.get(
|
|
11493
|
+
if (reflectionProbes === void 0 || !hasProbeBindings) return void 0;
|
|
11494
|
+
const selection = reflectionProbes.selections.get(
|
|
11495
|
+
`${worldIndices?.get(materialWorld)}:${entityKey}`
|
|
11496
|
+
);
|
|
11073
11497
|
if (selection === void 0) return void 0;
|
|
11074
11498
|
const binding = resolveReflectionProbeBinding(selection, reflectionProbes.table);
|
|
11075
11499
|
if (binding.useSkylight || binding.probeIndex === void 0) return void 0;
|
|
@@ -11083,12 +11507,13 @@ function recordMainPass(c, selector, options, graphPass) {
|
|
|
11083
11507
|
irradianceView: skylightResources.irradianceView,
|
|
11084
11508
|
irradianceSampler: skylightResources.irradianceSampler,
|
|
11085
11509
|
prefilterView: row.filteredView,
|
|
11510
|
+
skylightPrefilterView: skylightResources.prefilterView,
|
|
11086
11511
|
prefilterSampler: row.sampler,
|
|
11087
11512
|
brdfLutView: skylightResources.brdfLutView,
|
|
11088
11513
|
brdfLutSampler: skylightResources.brdfLutSampler,
|
|
11089
11514
|
intensityBuffer: row.uniformBuffer
|
|
11090
11515
|
};
|
|
11091
|
-
return probeResources;
|
|
11516
|
+
return { resources: probeResources, probeIndex: row.index };
|
|
11092
11517
|
},
|
|
11093
11518
|
materialBgShared: frameState.materialBgShared,
|
|
11094
11519
|
materialBgAssemblyCache: c.materialBgAssemblyCache,
|
|
@@ -11119,19 +11544,53 @@ function recordMainPass(c, selector, options, graphPass) {
|
|
|
11119
11544
|
);
|
|
11120
11545
|
}
|
|
11121
11546
|
if (gpuDrivenStandardPbrFrameResources !== void 0) {
|
|
11547
|
+
gpuDrivenStandardPbrFrameResources.resolveClusteredMeshBindGroup = (binding) => {
|
|
11548
|
+
const buffers = getOrCreateHdrpBuffers(
|
|
11549
|
+
runtime,
|
|
11550
|
+
frameState.installedPipelineConfig?.clusterGrid
|
|
11551
|
+
);
|
|
11552
|
+
const layout = binding.paletteBuffer === void 0 ? pipelineState.hdrpMeshBindGroupLayout : pipelineState.hdrpSkinMeshBindGroupLayout;
|
|
11553
|
+
const group = buffers === null || layout == null ? null : createGpuDrivenLightingBindGroup(
|
|
11554
|
+
runtime,
|
|
11555
|
+
buffers,
|
|
11556
|
+
layout,
|
|
11557
|
+
binding,
|
|
11558
|
+
c.hdrpSsaoBlurredView
|
|
11559
|
+
);
|
|
11560
|
+
if (group === null)
|
|
11561
|
+
throw new RhiError({
|
|
11562
|
+
code: "rhi-not-available",
|
|
11563
|
+
expected: "scene-index clustered lighting binding",
|
|
11564
|
+
hint: "publish scene rows and the current lighting/AO resources before indirect drawing"
|
|
11565
|
+
});
|
|
11566
|
+
return group;
|
|
11567
|
+
};
|
|
11122
11568
|
gpuDrivenStandardPbrFrameResources.materialBindGroups.length = 0;
|
|
11123
11569
|
gpuDrivenStandardPbrFrameResources.materialBindGroups.push(...preparedMaterialBindGroups);
|
|
11570
|
+
gpuDrivenStandardPbrFrameResources.colorFormats = colorFormats;
|
|
11571
|
+
const selectedMaterialSlots = /* @__PURE__ */ new Set();
|
|
11572
|
+
if (matchedMaterials === null)
|
|
11573
|
+
delete gpuDrivenStandardPbrFrameResources.selectedMaterialSlots;
|
|
11574
|
+
else gpuDrivenStandardPbrFrameResources.selectedMaterialSlots = selectedMaterialSlots;
|
|
11124
11575
|
gpuDrivenStandardPbrFrameResources.materialSlotIndicesByEntity.clear();
|
|
11125
11576
|
for (let index = 0; index < validatedOrdered.length; index += 1) {
|
|
11126
11577
|
const entry = validatedOrdered[index];
|
|
11127
11578
|
if (entry === void 0) continue;
|
|
11579
|
+
const selected = matchedMaterials?.get(entry.renderableIndex);
|
|
11580
|
+
const materials = entry.source.materials.length > 0 ? entry.source.materials : [entry.source.material];
|
|
11581
|
+
for (let slot = 0; slot < materials.length; slot += 1) {
|
|
11582
|
+
const handle = materials[slot]?.materialHandle ?? -1;
|
|
11583
|
+
const globalSlot = materialSlotIndices[index]?.[slot];
|
|
11584
|
+
if (globalSlot !== void 0 && selected?.has(handle))
|
|
11585
|
+
selectedMaterialSlots.add(globalSlot);
|
|
11586
|
+
}
|
|
11128
11587
|
gpuDrivenStandardPbrFrameResources.materialSlotIndicesByEntity.set(
|
|
11129
11588
|
worldEntityKey(entry.source.worldId, entry.source.entityKey),
|
|
11130
11589
|
materialSlotIndices[index] ?? []
|
|
11131
11590
|
);
|
|
11132
11591
|
}
|
|
11133
11592
|
}
|
|
11134
|
-
const resolveMaterialBindGroup = (materialSlot, material, entityKey, materialWorld = world, materialShaderId = material.materialShaderId) => materialShaderId === material.materialShaderId && materialShaderId !== POINTS_LINES_MATERIAL_SHADER_ID ? preparedMaterialBindGroups[materialSlot] ?? buildPerSubmeshMaterialBg2(material, entityKey, materialWorld, materialShaderId) : buildPerSubmeshMaterialBg2(material, entityKey, materialWorld, materialShaderId);
|
|
11593
|
+
const resolveMaterialBindGroup = (materialSlot, material, entityKey, materialWorld = world, materialShaderId = material.materialShaderId) => !hasProbeBindings && materialShaderId === material.materialShaderId && materialShaderId !== POINTS_LINES_MATERIAL_SHADER_ID ? preparedMaterialBindGroups[materialSlot] ?? buildPerSubmeshMaterialBg2(material, entityKey, materialWorld, materialShaderId) : buildPerSubmeshMaterialBg2(material, entityKey, materialWorld, materialShaderId);
|
|
11135
11594
|
pass.setBindGroup(0, viewBindGroup, [viewBindGroupDynamicOffset, 0]);
|
|
11136
11595
|
const recordGeometry = () => {
|
|
11137
11596
|
recordGeometryDraws(
|
|
@@ -11145,7 +11604,8 @@ function recordMainPass(c, selector, options, graphPass) {
|
|
|
11145
11604
|
resolveMaterialBindGroup,
|
|
11146
11605
|
passKind,
|
|
11147
11606
|
selectedDispatch,
|
|
11148
|
-
colorFormats
|
|
11607
|
+
colorFormats,
|
|
11608
|
+
options?.coverageOnly ?? false
|
|
11149
11609
|
);
|
|
11150
11610
|
};
|
|
11151
11611
|
if (c.profilePhase === void 0) {
|
|
@@ -11847,6 +12307,12 @@ function ensureSsaoRecordCompanions(internals) {
|
|
|
11847
12307
|
function buildSsaoUniformPayload(internals) {
|
|
11848
12308
|
const { camera, frameState } = internals;
|
|
11849
12309
|
const sProj = computeProjectionMatrix(camera);
|
|
12310
|
+
if (camera.temporal?.currentJitterUv !== void 0) {
|
|
12311
|
+
const jitter = mat4.identity(mat4.create());
|
|
12312
|
+
jitter[12] = camera.temporal.currentJitterUv[0] * 2;
|
|
12313
|
+
jitter[13] = camera.temporal.currentJitterUv[1] * -2;
|
|
12314
|
+
mat4.multiply(sProj, jitter, sProj);
|
|
12315
|
+
}
|
|
11850
12316
|
const sView = computeViewMatrix(camera);
|
|
11851
12317
|
const invProj = mat4.create();
|
|
11852
12318
|
mat4.invert(invProj, sProj);
|
|
@@ -11861,12 +12327,25 @@ function buildSsaoUniformPayload(internals) {
|
|
|
11861
12327
|
out[48] = parameters.intensity;
|
|
11862
12328
|
out[49] = parameters.radius;
|
|
11863
12329
|
out[50] = parameters.bias;
|
|
12330
|
+
out[51] = SSAO_SAMPLE_COUNTS[parameters.quality];
|
|
11864
12331
|
return out;
|
|
11865
12332
|
}
|
|
11866
12333
|
function recordSsaoCalcPass(_c, resolveCtx, ssaoRawKey, gbuf0Key, hdrDepthKey, graphPass, graphViews) {
|
|
11867
12334
|
const { runtime, pipelineState, encoder } = _c;
|
|
11868
12335
|
const pp = pipelineState.perPassResources;
|
|
11869
|
-
if (
|
|
12336
|
+
if (runtime.device.caps.backendKind === "wgpu-webgl2") {
|
|
12337
|
+
throw new RhiError({
|
|
12338
|
+
code: "feature-not-enabled",
|
|
12339
|
+
expected: "SSAO raw depth sampling on a WebGPU-capable backend",
|
|
12340
|
+
hint: "use WebGPU for SSAO or disable StandardProfile.ssao on the GLES fallback"
|
|
12341
|
+
});
|
|
12342
|
+
}
|
|
12343
|
+
if (pp.ssaoCalcPipeline === null || pp.ssaoBgl === null) {
|
|
12344
|
+
throw new PostProcessError({
|
|
12345
|
+
code: "post-process-not-found",
|
|
12346
|
+
detail: { id: "forgeax::post::ssao-calc" }
|
|
12347
|
+
});
|
|
12348
|
+
}
|
|
11870
12349
|
if (graphViews === void 0 && (resolveCtx === void 0)) return;
|
|
11871
12350
|
const ssaoRawView = graphViews?.output ?? resolveCtx?.resolve(ssaoRawKey);
|
|
11872
12351
|
const gbuf0View = graphViews?.normal ?? (void 0);
|
|
@@ -11943,7 +12422,12 @@ function recordSsaoCalcPass(_c, resolveCtx, ssaoRawKey, gbuf0Key, hdrDepthKey, g
|
|
|
11943
12422
|
function recordSsaoBlurPass(_c, resolveCtx, ssaoBlurredKey, ssaoRawKey, gbuf0Key, hdrDepthKey, graphPass, graphViews) {
|
|
11944
12423
|
const { runtime, pipelineState, encoder } = _c;
|
|
11945
12424
|
const pp = pipelineState.perPassResources;
|
|
11946
|
-
if (pp.ssaoBlurPipeline === null || pp.ssaoBgl === null)
|
|
12425
|
+
if (pp.ssaoBlurPipeline === null || pp.ssaoBgl === null) {
|
|
12426
|
+
throw new PostProcessError({
|
|
12427
|
+
code: "post-process-not-found",
|
|
12428
|
+
detail: { id: "forgeax::post::ssao-blur" }
|
|
12429
|
+
});
|
|
12430
|
+
}
|
|
11947
12431
|
if (graphViews === void 0 && (resolveCtx === void 0))
|
|
11948
12432
|
return;
|
|
11949
12433
|
const ssaoBlurredView = graphViews?.output ?? resolveCtx?.resolve(ssaoBlurredKey);
|
|
@@ -12373,6 +12857,11 @@ function getTemporalBindGroupResources(state) {
|
|
|
12373
12857
|
binding: 10,
|
|
12374
12858
|
visibility: 2,
|
|
12375
12859
|
texture: { sampleType: "unfilterable-float", viewDimension: "2d" }
|
|
12860
|
+
},
|
|
12861
|
+
{
|
|
12862
|
+
binding: 11,
|
|
12863
|
+
visibility: 2,
|
|
12864
|
+
texture: { sampleType: "unfilterable-float", viewDimension: "2d" }
|
|
12376
12865
|
}
|
|
12377
12866
|
]
|
|
12378
12867
|
});
|
|
@@ -12605,6 +13094,10 @@ function addTypedScenePass(graph, options) {
|
|
|
12605
13094
|
usage: "sampled-read"
|
|
12606
13095
|
})),
|
|
12607
13096
|
...options.transmissionBackdrop === void 0 ? [] : [{ resource: options.transmissionBackdrop, usage: "sampled-read" }],
|
|
13097
|
+
...options.environment === void 0 ? [] : [options.environment.irradiance, options.environment.prefilter].map((resource) => ({
|
|
13098
|
+
resource,
|
|
13099
|
+
usage: "sampled-read"
|
|
13100
|
+
})),
|
|
12608
13101
|
...options.extraAccesses ?? [],
|
|
12609
13102
|
...options.gpuDriven?.accesses ?? []
|
|
12610
13103
|
];
|
|
@@ -12664,6 +13157,12 @@ function addTypedScenePass(graph, options) {
|
|
|
12664
13157
|
const activeOcclusion = options.occlusion;
|
|
12665
13158
|
const passContext = {
|
|
12666
13159
|
...internal,
|
|
13160
|
+
...options.environment === void 0 ? {} : {
|
|
13161
|
+
environmentIbl: {
|
|
13162
|
+
irradiance: resolvedView(resources, options.environment.irradiance),
|
|
13163
|
+
prefilter: resolvedView(resources, options.environment.prefilter)
|
|
13164
|
+
}
|
|
13165
|
+
},
|
|
12667
13166
|
...activeOcclusion === void 0 ? {} : { occlusion: activeOcclusion },
|
|
12668
13167
|
geometryColorView: colorViews[0] ?? null,
|
|
12669
13168
|
geometryDepthView: depthView,
|
|
@@ -12684,6 +13183,7 @@ function addTypedScenePass(graph, options) {
|
|
|
12684
13183
|
passKind: options.passKind ?? "forward",
|
|
12685
13184
|
...options.clearColor === void 0 ? {} : { clearColor: options.clearColor },
|
|
12686
13185
|
...options.recordMode === void 0 ? {} : { recordMode: options.recordMode },
|
|
13186
|
+
...options.coverageOnly === void 0 ? {} : { coverageOnly: options.coverageOnly },
|
|
12687
13187
|
...options.excludeSelector === void 0 ? {} : { excludeSelector: options.excludeSelector },
|
|
12688
13188
|
...options.includeSelector === void 0 ? {} : { includeSelector: options.includeSelector },
|
|
12689
13189
|
...options.transmissionBackdrop === void 0 ? {} : { transmissionBackdropView: transmissionBackdrop },
|
|
@@ -12869,6 +13369,8 @@ function addTypedTemporalResolvePass(graph, targets) {
|
|
|
12869
13369
|
accesses: [
|
|
12870
13370
|
{ resource: targets.scene.view, usage: "sampled-read" },
|
|
12871
13371
|
{ resource: targets.currentTemporal.view, usage: "sampled-read" },
|
|
13372
|
+
...targets.coverage === void 0 ? [] : [{ resource: targets.coverage.view, usage: "sampled-read" }],
|
|
13373
|
+
...targets.coverageDepth === void 0 ? [] : [{ resource: targets.coverageDepth.view, usage: "sampled-read" }],
|
|
12872
13374
|
{ resource: targets.historyColor.view, usage: "sampled-read" },
|
|
12873
13375
|
{ resource: targets.historyTemporal.view, usage: "sampled-read" },
|
|
12874
13376
|
{ resource: targets.historyStability.view, usage: "sampled-read" },
|
|
@@ -12925,6 +13427,7 @@ function addTypedTemporalResolvePass(graph, targets) {
|
|
|
12925
13427
|
words[2] = state.valid && (frame.camera.temporal?.historyValid ?? true) ? 1 : 0;
|
|
12926
13428
|
words[3] = frame.camera.temporal?.temporalFrameIndex ?? 0;
|
|
12927
13429
|
words[4] = Number(targets.secondaryReactivity !== void 0);
|
|
13430
|
+
words[5] = Number(targets.coverage !== void 0);
|
|
12928
13431
|
const written = frame.runtime.device.queue.writeBuffer(params, 0, new Uint8Array(payload));
|
|
12929
13432
|
if (!written.ok)
|
|
12930
13433
|
throwTemporalEncodeFailure("TAA resolve params upload succeeds", written.error);
|
|
@@ -12948,6 +13451,13 @@ function addTypedTemporalResolvePass(graph, targets) {
|
|
|
12948
13451
|
kind: "textureView",
|
|
12949
13452
|
value: targets.secondaryReactivity === void 0 ? currentTemporal : resolvedView(resources, targets.secondaryReactivity)
|
|
12950
13453
|
}
|
|
13454
|
+
},
|
|
13455
|
+
{
|
|
13456
|
+
binding: 11,
|
|
13457
|
+
resource: {
|
|
13458
|
+
kind: "textureView",
|
|
13459
|
+
value: targets.coverage === void 0 ? currentTemporal : resolvedView(resources, targets.coverage.view)
|
|
13460
|
+
}
|
|
12951
13461
|
}
|
|
12952
13462
|
]
|
|
12953
13463
|
});
|
|
@@ -13152,8 +13662,11 @@ var TEMPORAL_TARGET = {
|
|
|
13152
13662
|
size: "surface",
|
|
13153
13663
|
sampleCount: 1
|
|
13154
13664
|
};
|
|
13155
|
-
function createStandardSceneDataTarget(graph) {
|
|
13156
|
-
const temporal = createRenderPipelineTarget(graph, "standard-scene-temporal",
|
|
13665
|
+
function createStandardSceneDataTarget(graph, extent) {
|
|
13666
|
+
const temporal = createRenderPipelineTarget(graph, "standard-scene-temporal", {
|
|
13667
|
+
...TEMPORAL_TARGET,
|
|
13668
|
+
size: extent === void 0 ? TEMPORAL_TARGET.size : renderExtentSize(extent, "internal")
|
|
13669
|
+
});
|
|
13157
13670
|
return temporal.ok ? ok({ temporal: temporal.value }) : temporal;
|
|
13158
13671
|
}
|
|
13159
13672
|
function addStandardSceneDataPass(graph, target, depth) {
|
|
@@ -13187,6 +13700,6 @@ function addTaaResolvePass(graph, current, currentTemporal, previousColor, previ
|
|
|
13187
13700
|
});
|
|
13188
13701
|
}
|
|
13189
13702
|
|
|
13190
|
-
export { BYTES_PER_DIRECT_LIGHT_SLOT, BatchTopology, CAPTURE_VIEW_PROJS, CUBEMAP_FACE_VERTICES, CUBE_CAPTURE_VIEW_SLOT_BASE, DEFERRED_COLOR_FORMATS, DEPTH_MIN_PARAMS_BYTE_SIZE, FALLBACK_BYTES_PER_ROW, GPU_DRIVEN_VIEW_WGSL, GPU_SCENE_LAYOUTS, GpuBuffer, GpuDrivenView, GpuTexture, MATERIAL_PER_ENTITY_STRIDE, MESH_SSBO_BYTES, OcclusionConfidenceScheduler, POINTS_LINES_MATERIAL_SHADER_ID, POINTS_LINES_VIEW_BUFFER_SIZE, PREFILTER_MIP_LEVELS, PREFILTER_SIZE, PipelineSpecError, PostProcessError, REFLECTION_PROBE_VIEW_SLOT_BASE, SHADOW_CASTER_BUFFER_SIZE, STANDARD_PBR_UBO_SIZE, ShadowViewStatePool, TEMPORAL_HISTORY_FORMATS, TYPED_BLOOM_PASS_NAMES, VIEW_UNIFORM_BUFFER_SIZE, VIEW_UNIFORM_BYTES, VIEW_UNIFORM_SLOT_STRIDE, abortTemporalGpuSubmit, addReflectionFallbackObservationPass, addStandardSceneDataPass, addTaaResolvePass, addTypedBloomPasses, addTypedCompositePostEffects, addTypedFrameObservationPass, addTypedFullscreenPass, addTypedOutputTransformPass, addTypedScenePass, addTypedSkyboxPass, addTypedSsaoPasses, addTypedTemporalResolvePass, aggregateTemporalDemand, applyMaterialTextureUvScales, applyParamSchemaDefaultsToUbo, applyParamSnapshotToUbo, assembleMaterialWithSkylightEntries, assertStorageBufferCap, buildFoldDispatchPlan, buildFullscreenPostProcessPass, buildLinearLdrMaterialSpecTable, buildPerFrameBindGroups, buildSpecConstTable, cacheKeyOf, cleanPerEntityCache, colorFormatsForPassKind, commitTemporalGpuSubmit, computeProjectionMatrix, computeSplitLdrSprite, computeViewMatrix, configureSurface, createClusterBinScratch, createFullscreenBindGroup, createHdrpClusterMembershipBindGroupLayoutDescriptor, createIblPipelines, createPointsLinesLaneAdapter, createPointsLinesLaneContract, createRenderPipelineTarget, createSkylightFallback, createStandardSceneDataTarget, createStandardSurfaceLightingBindGroup, decideVisibility, defaultViewForUserRegionField, deriveRenderDataCubemap, deriveRenderDataMesh, deriveRenderDataTexture, describeTemporalDemand, detectNineSliceScaleTooSmall, driveLazyEquirectProjection, encodeDirectionalShadowPass, encodeMainPass, encodePointShadowPass, encodeSpotShadowPass, ensureMeshSsboCapacity, entryHasDepthRead, evaluateFoldBucketUniformCap, foldDispatchBuckets, geometryRenderStateForPass, geometryRenderStateForTopology, getOrBuildPipeline, getOrCreateFromChain, getOrCreateHdrpBuffers, getOrCreateIblCache, getTemporalBindGroupResources, getTemporalGpuState, getTemporalParamsBuffer, gpuSceneFieldOffset, hasPendingTemporalGpuSubmit, importRenderPipelineSurface, incrementFoldedDrawsMetric, isTemporalFullscreenBinding, packInstanceStorageBuffer, passKindPolicyTable, postProcessShaderEntrySignature, postProcessShaderModuleLabel, postProcessShaderPipelineLabel, prepareFrameLighting, projectedHeightForCandidate, resetHdrpBuffers, residentTextureView, resolveMaterialSkylight, resolveOutputDither, resolveSkyboxActive, resolveSsaoParameters, resolveSurfaceFormatPair, resolveSurfaceProfile, retireTemporalGpuState, retireTemporalGpuStateAfterFence, runIblPrecompute, selectGpuLodLane, selectLazyEquirectHandle, selectLod, selectSwapChainFormat, setIblComposedShaders, shadowViewIdentityKey, shadowViewRasterAccesses, shouldIssueRetest, standardStorageVariantSet, standardTemporalLaneAdmission, standardTemporalPostOrder, standardTopologyVariantSet, temporalReadIndex, temporalWriteIndex, uploadMeshSsboBatch, variantSetFromDefines, variantSetFromVertexLayoutProjection, warnMultiSkybox, warnMultiSkylight, warnZeroLightStandard, writeHdrpClusterAndSsaoBuffers, writePbrMaterialUboPayload, writePointsLinesViewUbo, writeShadowCasterUniforms, writeShadowParamsBuffer, writeSpotModifierTextures, writeViewUbo };
|
|
13191
|
-
//# sourceMappingURL=chunk-
|
|
13192
|
-
//# sourceMappingURL=chunk-
|
|
13703
|
+
export { BYTES_PER_DIRECT_LIGHT_SLOT, BatchTopology, CAPTURE_VIEW_PROJS, CUBEMAP_FACE_VERTICES, CUBE_CAPTURE_VIEW_SLOT_BASE, DEFERRED_COLOR_FORMATS, DEPTH_MIN_PARAMS_BYTE_SIZE, FALLBACK_BYTES_PER_ROW, GPU_DRIVEN_VIEW_WGSL, GPU_SCENE_LAYOUTS, GpuBuffer, GpuDrivenView, GpuTexture, MATERIAL_PER_ENTITY_STRIDE, MESH_SSBO_BYTES, OcclusionConfidenceScheduler, POINTS_LINES_MATERIAL_SHADER_ID, POINTS_LINES_VIEW_BUFFER_SIZE, PREFILTER_MIP_LEVELS, PREFILTER_SIZE, PipelineSpecError, PostProcessError, REFLECTION_PROBE_VIEW_SLOT_BASE, SHADOW_CASTER_BUFFER_SIZE, STANDARD_PBR_REQUIRED_SAMPLED_TEXTURES, STANDARD_PBR_UBO_SIZE, ShadowViewStatePool, TEMPORAL_HISTORY_FORMATS, TYPED_BLOOM_PASS_NAMES, VIEW_UNIFORM_BUFFER_SIZE, VIEW_UNIFORM_BYTES, VIEW_UNIFORM_SLOT_STRIDE, abortTemporalGpuSubmit, addReflectionFallbackObservationPass, addStandardSceneDataPass, addTaaResolvePass, addTypedBloomPasses, addTypedCompositePostEffects, addTypedFrameObservationPass, addTypedFullscreenPass, addTypedOutputTransformPass, addTypedScenePass, addTypedSkyboxPass, addTypedSsaoPasses, addTypedTemporalResolvePass, aggregateTemporalDemand, applyMaterialTextureUvScales, applyParamSchemaDefaultsToUbo, applyParamSnapshotToUbo, assembleMaterialWithSkylightEntries, assertStorageBufferCap, buildFoldDispatchPlan, buildFullscreenPostProcessPass, buildLinearLdrMaterialSpecTable, buildPerFrameBindGroups, buildSpecConstTable, cacheKeyOf, cleanPerEntityCache, colorFormatsForPassKind, commitTemporalGpuSubmit, computeProjectionMatrix, computeSplitLdrSprite, computeViewMatrix, configureSurface, createClusterBinScratch, createFullscreenBindGroup, createHdrpClusterMembershipBindGroupLayoutDescriptor, createIblPipelines, createPointsLinesLaneAdapter, createPointsLinesLaneContract, createRenderPipelineTarget, createSkylightFallback, createStandardSceneDataTarget, createStandardSurfaceLightingBindGroup, decideVisibility, defaultViewForUserRegionField, deriveRenderDataCubemap, deriveRenderDataMesh, deriveRenderDataTexture, deriveRenderExtent, describeTemporalDemand, detectNineSliceScaleTooSmall, deviceOptionsForAdapter, driveLazyEquirectProjection, encodeDirectionalShadowPass, encodeMainPass, encodePointShadowPass, encodeSpotShadowPass, ensureMeshSsboCapacity, entryHasDepthRead, evaluateFoldBucketUniformCap, foldDispatchBuckets, geometryRenderStateForPass, geometryRenderStateForTopology, getIblProbeBackgroundSource, getOrBuildPipeline, getOrCreateFromChain, getOrCreateHdrpBuffers, getOrCreateIblCache, getTemporalBindGroupResources, getTemporalGpuState, getTemporalParamsBuffer, gpuSceneFieldOffset, hasPendingTemporalGpuSubmit, importRenderPipelineSurface, incrementFoldedDrawsMetric, isTemporalFullscreenBinding, packInstanceStorageBuffer, passKindPolicyTable, postProcessShaderEntrySignature, postProcessShaderModuleLabel, postProcessShaderPipelineLabel, prepareFrameLighting, prepareMaterialSkylight, prewarmMaterialShaderVariants, projectedHeightForCandidate, renderExtentSize, resetHdrpBuffers, residentTextureView, resolveMaterialSkylight, resolveOutputDither, resolveReflectionProbeBinding, resolveSkyboxActive, resolveSsaoParameters, resolveSurfaceFormatPair, resolveSurfaceProfile, retireTemporalGpuState, retireTemporalGpuStateAfterFence, runIblPrecompute, selectGpuDrivenSceneIndexVariant, selectGpuLodLane, selectHdrpPbrPrewarmVariants, selectLazyEquirectHandle, selectLod, selectProbePrewarmVariants, selectSkinPrewarmVariants, selectStandardPbrTransmissionPrewarmVariants, selectSwapChainFormat, setIblComposedShaders, shadowViewIdentityKey, shadowViewRasterAccesses, shouldIssueRetest, standardStorageVariantSet, standardTemporalLaneAdmission, standardTemporalPostOrder, standardTopologyVariantSet, temporalReadIndex, temporalWriteIndex, transmissionBackdropAvailable, uploadMeshSsboBatch, variantSetFromDefines, variantSetFromVertexLayoutProjection, warnMultiSkybox, warnMultiSkylight, warnZeroLightStandard, writeHdrpClusterAndSsaoBuffers, writePbrMaterialUboPayload, writePointsLinesViewUbo, writeShadowCasterUniforms, writeShadowParamsBuffer, writeSpotModifierTextures, writeViewUbo };
|
|
13704
|
+
//# sourceMappingURL=chunk-PSEQ6QPH.mjs.map
|
|
13705
|
+
//# sourceMappingURL=chunk-PSEQ6QPH.mjs.map
|