@forgeax/engine-render 0.1.33 → 0.1.35
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 +1062 -127
- package/dist/assembly/backend-contract.d.ts +2 -0
- package/dist/assembly/backend-contract.d.ts.map +1 -1
- package/dist/assembly/barrel-distortion-inspection.d.ts +3 -0
- package/dist/assembly/barrel-distortion-inspection.d.ts.map +1 -0
- package/dist/assembly/canvas-draw-guard.d.ts +3 -0
- package/dist/assembly/canvas-draw-guard.d.ts.map +1 -0
- package/dist/assembly/cloud-shadow-entry.d.ts +4 -0
- package/dist/assembly/cloud-shadow-entry.d.ts.map +1 -0
- package/dist/assembly/device-feature-admission.d.ts +2 -2
- package/dist/assembly/dynamic-geometry-host.d.ts +4 -1
- package/dist/assembly/dynamic-geometry-host.d.ts.map +1 -1
- package/dist/assembly/dynamic-geometry-runtime.d.ts +1 -1
- package/dist/assembly/dynamic-geometry-runtime.d.ts.map +1 -1
- package/dist/assembly/factory.d.ts +1 -1
- package/dist/assembly/factory.d.ts.map +1 -1
- package/dist/assembly/host-contract.d.ts +6 -5
- package/dist/assembly/host-contract.d.ts.map +1 -1
- package/dist/assembly/material/assembly.d.ts.map +1 -1
- package/dist/assembly/material/pipeline-helpers.d.ts +5 -0
- package/dist/assembly/material/pipeline-helpers.d.ts.map +1 -1
- package/dist/assembly/material-shader-policy.d.ts +16 -2
- package/dist/assembly/material-shader-policy.d.ts.map +1 -1
- package/dist/assembly/material-shader-prewarm.d.ts.map +1 -1
- package/dist/assembly/recovery/device-loss-fanout.d.ts.map +1 -1
- package/dist/assembly/recovery/renderer-recover.d.ts +2 -0
- package/dist/assembly/recovery/renderer-recover.d.ts.map +1 -1
- package/dist/assembly/render-feature-post-processes.d.ts +6 -0
- package/dist/assembly/render-feature-post-processes.d.ts.map +1 -0
- package/dist/assembly/render-target-host.d.ts +5 -0
- package/dist/assembly/render-target-host.d.ts.map +1 -1
- package/dist/assembly/renderer-facade.d.ts.map +1 -1
- package/dist/assembly/renderer-feature-inspection.d.ts +1 -1
- package/dist/assembly/renderer-feature-inspection.d.ts.map +1 -1
- package/dist/assembly/renderer-frame-transaction.d.ts +12 -0
- package/dist/assembly/renderer-frame-transaction.d.ts.map +1 -1
- package/dist/assembly/renderer-inspection.d.ts +11 -0
- package/dist/assembly/renderer-inspection.d.ts.map +1 -1
- package/dist/assembly/webgpu-pbr-ready.d.ts +1 -0
- package/dist/assembly/webgpu-pbr-ready.d.ts.map +1 -1
- package/dist/assembly/webgpu-ready-per-pass.d.ts +39 -0
- package/dist/assembly/webgpu-ready-per-pass.d.ts.map +1 -0
- package/dist/assembly/webgpu-ready.d.ts +1 -1
- package/dist/assembly/webgpu-ready.d.ts.map +1 -1
- package/dist/assembly/webgpu-renderer-bootstrap.d.ts.map +1 -1
- package/dist/assembly/webgpu-renderer-observation-owner.d.ts +35 -0
- package/dist/assembly/webgpu-renderer-observation-owner.d.ts.map +1 -0
- package/dist/assembly/webgpu-renderer.d.ts +2 -1
- package/dist/assembly/webgpu-renderer.d.ts.map +1 -1
- package/dist/authoring.mjs +2 -4
- package/dist/authoring.mjs.map +1 -1
- package/dist/barrel-distortion.d.ts +47 -0
- package/dist/barrel-distortion.d.ts.map +1 -0
- package/dist/chunk-3XUBWRY2.mjs +1842 -0
- package/dist/chunk-3XUBWRY2.mjs.map +1 -0
- package/dist/{chunk-OO3DRYK7.mjs → chunk-G6HDNGY7.mjs} +2400 -1767
- package/dist/chunk-G6HDNGY7.mjs.map +1 -0
- package/dist/{chunk-ZDQWGQW7.mjs → chunk-LM5IE7GF.mjs} +4 -4
- package/dist/{chunk-ZDQWGQW7.mjs.map → chunk-LM5IE7GF.mjs.map} +1 -1
- package/dist/{chunk-VOZWDM3L.mjs → chunk-LNIUIKQ7.mjs} +1514 -498
- package/dist/chunk-LNIUIKQ7.mjs.map +1 -0
- package/dist/chunk-MXTWKZO4.mjs +3268 -0
- package/dist/chunk-MXTWKZO4.mjs.map +1 -0
- package/dist/chunk-MZ4C7EHF.mjs +6942 -0
- package/dist/chunk-MZ4C7EHF.mjs.map +1 -0
- package/dist/chunk-RIPAEGI6.mjs +48 -0
- package/dist/chunk-RIPAEGI6.mjs.map +1 -0
- package/dist/{chunk-LEAXOMYJ.mjs → chunk-SGPUJW3F.mjs} +117 -5
- package/dist/chunk-SGPUJW3F.mjs.map +1 -0
- package/dist/{chunk-PA5DRJNI.mjs → chunk-X2KA6WHM.mjs} +29 -4
- package/dist/chunk-X2KA6WHM.mjs.map +1 -0
- package/dist/{chunk-BLXGONR2.mjs → chunk-XSFB7XXQ.mjs} +51 -4
- package/dist/chunk-XSFB7XXQ.mjs.map +1 -0
- package/dist/cloud/density.d.ts +55 -0
- package/dist/cloud/density.d.ts.map +1 -0
- package/dist/cloud/extract.d.ts +25 -0
- package/dist/cloud/extract.d.ts.map +1 -0
- package/dist/cloud/feature.d.ts +57 -0
- package/dist/cloud/feature.d.ts.map +1 -0
- package/dist/cloud/frame-context.d.ts +8 -0
- package/dist/cloud/frame-context.d.ts.map +1 -0
- package/dist/cloud/inspection.d.ts +59 -0
- package/dist/cloud/inspection.d.ts.map +1 -0
- package/dist/cloud/optics.d.ts +56 -0
- package/dist/cloud/optics.d.ts.map +1 -0
- package/dist/cloud/parameters.d.ts +73 -0
- package/dist/cloud/parameters.d.ts.map +1 -0
- package/dist/cloud/resources.d.ts +60 -0
- package/dist/cloud/resources.d.ts.map +1 -0
- package/dist/cloud/shadow.d.ts +42 -0
- package/dist/cloud/shadow.d.ts.map +1 -0
- package/dist/cloud/temporal.d.ts +74 -0
- package/dist/cloud/temporal.d.ts.map +1 -0
- package/dist/components/barrel-distortion.d.ts +13 -0
- package/dist/components/barrel-distortion.d.ts.map +1 -0
- package/dist/components/cloud-layer.d.ts +29 -0
- package/dist/components/cloud-layer.d.ts.map +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/instances.d.ts +20 -6
- package/dist/components/instances.d.ts.map +1 -1
- package/dist/construct-renderer.d.ts +1 -1
- package/dist/construct-renderer.d.ts.map +1 -1
- package/dist/construct-renderer.mjs +8406 -5785
- package/dist/construct-renderer.mjs.map +1 -1
- package/dist/device/gpu-residency.d.ts +19 -19
- package/dist/device/gpu-residency.d.ts.map +1 -1
- package/dist/dynamic-geometry.d.ts +5 -1
- package/dist/dynamic-geometry.d.ts.map +1 -1
- package/dist/errors/cloud.d.ts +59 -0
- package/dist/errors/cloud.d.ts.map +1 -0
- package/dist/errors/render.d.ts +20 -5
- package/dist/errors/render.d.ts.map +1 -1
- package/dist/examples/single-layer-medium-surface.d.ts +47 -0
- package/dist/examples/single-layer-medium-surface.d.ts.map +1 -0
- package/dist/extract/camera.d.ts.map +1 -1
- package/dist/extract/contracts.d.ts +5 -1
- package/dist/extract/contracts.d.ts.map +1 -1
- package/dist/extract/material-context.d.ts +7 -0
- package/dist/extract/material-context.d.ts.map +1 -0
- package/dist/features/barrel-distortion.d.ts +29 -0
- package/dist/features/barrel-distortion.d.ts.map +1 -0
- package/dist/features/error-reporting.d.ts +6 -2
- package/dist/features/error-reporting.d.ts.map +1 -1
- package/dist/features/host.d.ts +15 -0
- package/dist/features/host.d.ts.map +1 -1
- package/dist/features/plan.d.ts +10 -0
- package/dist/features/plan.d.ts.map +1 -1
- package/dist/features/render-graph-contribution.d.ts +5 -0
- package/dist/features/render-graph-contribution.d.ts.map +1 -1
- package/dist/features/render-graph-raster.d.ts +1 -0
- package/dist/features/render-graph-raster.d.ts.map +1 -1
- package/dist/features/targets.d.ts +2 -0
- package/dist/features/targets.d.ts.map +1 -1
- package/dist/features/types.d.ts +48 -0
- package/dist/features/types.d.ts.map +1 -1
- package/dist/fullscreen-post-process-pass.d.ts +15 -7
- package/dist/fullscreen-post-process-pass.d.ts.map +1 -1
- package/dist/glyph-text-layout-system.d.ts +1 -1
- package/dist/glyph-text-layout-system.d.ts.map +1 -1
- package/dist/gpu-dirty-ranges.d.ts +11 -0
- package/dist/gpu-dirty-ranges.d.ts.map +1 -0
- package/dist/gpu-driven/batch-topology.d.ts +17 -0
- package/dist/gpu-driven/batch-topology.d.ts.map +1 -1
- package/dist/gpu-driven/material-artifacts.d.ts +6 -0
- package/dist/gpu-driven/material-artifacts.d.ts.map +1 -1
- package/dist/gpu-driven/prepared-draw.d.ts.map +1 -1
- package/dist/gpu-driven/production-raster-material.d.ts +178 -0
- package/dist/gpu-driven/production-raster-material.d.ts.map +1 -0
- package/dist/gpu-driven/production-raster.d.ts +47 -3
- package/dist/gpu-driven/production-raster.d.ts.map +1 -1
- package/dist/gpu-driven/resource-allocation.d.ts +31 -0
- package/dist/gpu-driven/resource-allocation.d.ts.map +1 -0
- package/dist/gpu-driven/shadow-ownership.d.ts +14 -0
- package/dist/gpu-driven/shadow-ownership.d.ts.map +1 -0
- package/dist/gpu-driven/view-gpu.d.ts +26 -2
- package/dist/gpu-driven/view-gpu.d.ts.map +1 -1
- package/dist/gpu-scene.d.ts +5 -0
- package/dist/gpu-scene.d.ts.map +1 -1
- package/dist/hdrp-buffers.d.ts +2 -2
- package/dist/hdrp-buffers.d.ts.map +1 -1
- package/dist/ibl/frame-resources.d.ts.map +1 -1
- package/dist/ibl/skylight-bind-group.d.ts +14 -5
- package/dist/ibl/skylight-bind-group.d.ts.map +1 -1
- package/dist/index.d.ts +30 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +780 -9
- package/dist/index.mjs.map +1 -1
- package/dist/inspection-types.d.ts +135 -1
- package/dist/inspection-types.d.ts.map +1 -1
- package/dist/instance-buffer-cache.d.ts +4 -4
- package/dist/instance-buffer-cache.d.ts.map +1 -1
- package/dist/instances.d.ts +47 -100
- package/dist/instances.d.ts.map +1 -1
- package/dist/internal.mjs +7 -8
- package/dist/internal.mjs.map +1 -1
- package/dist/pbr-pipeline.d.ts +22 -4
- package/dist/pbr-pipeline.d.ts.map +1 -1
- package/dist/pipeline/single-layer-medium-passes.d.ts +73 -0
- package/dist/pipeline/single-layer-medium-passes.d.ts.map +1 -0
- package/dist/pipeline/standard-forward-lane.d.ts.map +1 -1
- package/dist/pipeline/standard-output/graph.d.ts.map +1 -1
- package/dist/pipeline/standard-output/lut-gpu.d.ts +2 -2
- package/dist/pipeline/standard-output/lut-gpu.d.ts.map +1 -1
- package/dist/pipeline/standard-output/resources.d.ts +2 -2
- package/dist/pipeline/standard-output/resources.d.ts.map +1 -1
- package/dist/pipeline/standard-output/types.d.ts +4 -2
- package/dist/pipeline/standard-output/types.d.ts.map +1 -1
- package/dist/pipeline/standard-pipeline.d.ts.map +1 -1
- package/dist/pipeline/standard-post.d.ts.map +1 -1
- package/dist/pipeline-builder.d.ts +1 -1
- package/dist/pipeline-builder.d.ts.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/prepare/prepared-graphics-resolver.d.ts +2 -0
- package/dist/prepare/prepared-graphics-resolver.d.ts.map +1 -1
- package/dist/publication/contract.d.ts +77 -0
- package/dist/publication/contract.d.ts.map +1 -0
- package/dist/publication/dependencies.d.ts +7 -0
- package/dist/publication/dependencies.d.ts.map +1 -0
- package/dist/publication/prepare-geometry.d.ts +9 -0
- package/dist/publication/prepare-geometry.d.ts.map +1 -0
- package/dist/publication/programs.d.ts +5 -0
- package/dist/publication/programs.d.ts.map +1 -0
- package/dist/publication/publisher.d.ts +33 -0
- package/dist/publication/publisher.d.ts.map +1 -0
- package/dist/publication/receiver.d.ts +29 -0
- package/dist/publication/receiver.d.ts.map +1 -0
- package/dist/publication/resource-scope.d.ts +18 -0
- package/dist/publication/resource-scope.d.ts.map +1 -0
- package/dist/publication/targets.d.ts +33 -0
- package/dist/publication/targets.d.ts.map +1 -0
- package/dist/publication/video.d.ts +5 -0
- package/dist/publication/video.d.ts.map +1 -0
- package/dist/record/barrel-distortion-frame.d.ts +15 -0
- package/dist/record/barrel-distortion-frame.d.ts.map +1 -0
- package/dist/record/dynamic-geometry-consumption.d.ts +10 -2
- package/dist/record/dynamic-geometry-consumption.d.ts.map +1 -1
- package/dist/record/fold-buckets.d.ts +95 -0
- package/dist/record/fold-buckets.d.ts.map +1 -0
- package/dist/record/fold-instance-buffer.d.ts +6 -0
- package/dist/record/fold-instance-buffer.d.ts.map +1 -0
- package/dist/record/frame-lighting.d.ts +1 -0
- package/dist/record/frame-lighting.d.ts.map +1 -1
- package/dist/record/frame-snapshot.d.ts +43 -9
- package/dist/record/frame-snapshot.d.ts.map +1 -1
- package/dist/record/frame.d.ts +15 -65
- package/dist/record/frame.d.ts.map +1 -1
- package/dist/record/gpu-draw-receipts.d.ts +11 -0
- package/dist/record/gpu-draw-receipts.d.ts.map +1 -0
- package/dist/record/gpu-timing.d.ts +8 -0
- package/dist/record/gpu-timing.d.ts.map +1 -1
- package/dist/record/helpers.d.ts +2 -2
- package/dist/record/helpers.d.ts.map +1 -1
- package/dist/record/main-pass-geometry.d.ts +22 -6
- package/dist/record/main-pass-geometry.d.ts.map +1 -1
- package/dist/record/main-pass-material.d.ts +14 -10
- package/dist/record/main-pass-material.d.ts.map +1 -1
- package/dist/record/main-pass-sprite-draws.d.ts +3 -16
- package/dist/record/main-pass-sprite-draws.d.ts.map +1 -1
- package/dist/record/main-pass.d.ts +13 -2
- package/dist/record/main-pass.d.ts.map +1 -1
- package/dist/record/motion-blur-receipt.d.ts +11 -0
- package/dist/record/motion-blur-receipt.d.ts.map +1 -0
- package/dist/record/prepared-material-bindings.d.ts +3 -3
- package/dist/record/prepared-material-bindings.d.ts.map +1 -1
- package/dist/record/probe-blend-buffer.d.ts +16 -0
- package/dist/record/probe-blend-buffer.d.ts.map +1 -0
- package/dist/record/recovery-pipeline.d.ts.map +1 -1
- package/dist/record/render-context.d.ts +24 -5
- package/dist/record/render-context.d.ts.map +1 -1
- package/dist/record/shadow-pass.d.ts +2 -0
- package/dist/record/shadow-pass.d.ts.map +1 -1
- package/dist/record/skybox-post-pass.d.ts +1 -1
- package/dist/record/skybox-post-pass.d.ts.map +1 -1
- package/dist/record/sprite-instance-buffer.d.ts +31 -0
- package/dist/record/sprite-instance-buffer.d.ts.map +1 -0
- package/dist/record/target-capture-graph.d.ts +19 -0
- package/dist/record/target-capture-graph.d.ts.map +1 -0
- package/dist/record/typed-frame-graph.d.ts +24 -15
- package/dist/record/typed-frame-graph.d.ts.map +1 -1
- package/dist/record/view-ubo.d.ts +11 -3
- package/dist/record/view-ubo.d.ts.map +1 -1
- package/dist/record/volume-params.d.ts +9 -0
- package/dist/record/volume-params.d.ts.map +1 -0
- package/dist/recovery/render-system-candidate.d.ts +14 -4
- package/dist/recovery/render-system-candidate.d.ts.map +1 -1
- package/dist/reflection/record-owner.d.ts.map +1 -1
- package/dist/render-contract.d.ts +46 -5
- 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 +103 -2
- package/dist/render-pipeline.d.ts.map +1 -1
- package/dist/render-system-extract-tail.d.ts +3 -2
- package/dist/render-system-extract-tail.d.ts.map +1 -1
- package/dist/render-system-extract.d.ts +18 -9
- package/dist/render-system-extract.d.ts.map +1 -1
- package/dist/render-system-presentation.d.ts +23 -0
- package/dist/render-system-presentation.d.ts.map +1 -0
- package/dist/render-system-producer-roots.d.ts +10 -0
- package/dist/render-system-producer-roots.d.ts.map +1 -0
- package/dist/render-system-projections.d.ts +3 -2
- package/dist/render-system-projections.d.ts.map +1 -1
- package/dist/render-system-residency.d.ts +12 -0
- package/dist/render-system-residency.d.ts.map +1 -0
- package/dist/render-system.d.ts +22 -21
- package/dist/render-system.d.ts.map +1 -1
- package/dist/scene/probe-blend.d.ts +27 -0
- package/dist/scene/probe-blend.d.ts.map +1 -1
- package/dist/scene/render-scene.d.ts +18 -7
- package/dist/scene/render-scene.d.ts.map +1 -1
- package/dist/scene/render-source.d.ts +42 -0
- package/dist/scene/render-source.d.ts.map +1 -0
- package/dist/scene/source-systems.d.ts +6 -0
- package/dist/scene/source-systems.d.ts.map +1 -0
- package/dist/ssao-buffers.d.ts +9 -0
- package/dist/ssao-buffers.d.ts.map +1 -1
- package/dist/surface/dynamic-input.d.ts +133 -0
- package/dist/surface/dynamic-input.d.ts.map +1 -0
- package/dist/surface/gpu-driven.d.ts +41 -0
- package/dist/surface/gpu-driven.d.ts.map +1 -0
- package/dist/surface/submission-observation.d.ts +136 -0
- package/dist/surface/submission-observation.d.ts.map +1 -0
- package/dist/systems/skin-palette-allocator.d.ts.map +1 -1
- package/dist/systems/skin-palette-types.d.ts +10 -0
- package/dist/systems/skin-palette-types.d.ts.map +1 -1
- package/dist/systems/transparent-dispatch.d.ts +2 -2
- package/dist/systems/transparent-dispatch.d.ts.map +1 -1
- package/dist/systems/transparent-sort-config.d.ts +2 -1
- package/dist/systems/transparent-sort-config.d.ts.map +1 -1
- package/dist/temporal/gpu.d.ts +13 -1
- package/dist/temporal/gpu.d.ts.map +1 -1
- package/dist/temporal/index.mjs +6 -7
- package/dist/temporal/inspection.d.ts.map +1 -1
- package/dist/temporal/standard-scene-data.d.ts.map +1 -1
- package/dist/temporal/target-coverage-attachment.d.ts.map +1 -1
- package/dist/transmission/single-layer-medium.d.ts +89 -0
- package/dist/transmission/single-layer-medium.d.ts.map +1 -0
- package/dist/typed-render-graph-primitives.d.ts +14 -2
- package/dist/typed-render-graph-primitives.d.ts.map +1 -1
- package/dist/volume/component.d.ts +9 -4
- package/dist/volume/component.d.ts.map +1 -1
- package/dist/volume/extract.d.ts +1 -1
- package/dist/volume/extract.d.ts.map +1 -1
- package/dist/volume/inspection.d.ts +2 -0
- package/dist/volume/inspection.d.ts.map +1 -1
- package/dist/volume/passes.d.ts +4 -1
- package/dist/volume/passes.d.ts.map +1 -1
- package/dist/volume/resources.d.ts.map +1 -1
- package/package.json +22 -21
- package/src/__tests__/atmosphere-daylight.dawn.test.ts +72 -0
- package/src/__tests__/auto-exposure-transaction.integration.test.ts +4 -9
- package/src/__tests__/barrel-distortion-lkg.integration.test.ts +353 -0
- package/src/__tests__/barrel-distortion.dawn.test.ts +41 -0
- package/src/__tests__/barrel-distortion.unit.test.ts +364 -0
- package/src/__tests__/construct-renderer-identity.unit.test.ts +49 -0
- package/src/__tests__/detached-recovery-graph.unit.test.ts +277 -0
- package/src/__tests__/device-feature-admission.unit.test.ts +3 -2
- package/src/__tests__/device-loss-fanout.unit.test.ts +36 -1
- package/src/__tests__/docs-gate-green.unit.test.ts +112 -1
- package/src/__tests__/factory-contract.integration.test.ts +295 -45
- package/src/__tests__/feature-depth-input.dawn.test.ts +129 -2
- package/src/__tests__/fullscreen-feature-plan.unit.test.ts +14 -3
- package/src/__tests__/gpu-dirty-ranges.unit.test.ts +22 -0
- package/src/__tests__/gpu-driven-baseline.characterization.test.ts +16 -3
- package/src/__tests__/gpu-driven-batch-topology-pbr.unit.test.ts +12 -0
- package/src/__tests__/gpu-driven-material-artifacts.unit.test.ts +143 -0
- package/src/__tests__/gpu-driven-pbr.dawn.test.ts +5 -6
- package/src/__tests__/gpu-driven-production.integration.test.ts +482 -3
- package/src/__tests__/gpu-driven-shadow-views.dawn.test.ts +6 -5
- package/src/__tests__/gpu-driven-view-gpu-evidence.ts +94 -6
- package/src/__tests__/gpu-driven-view-graph.integration.test.ts +18 -2
- package/src/__tests__/gpu-driven-view.browser.test.ts +5 -8
- package/src/__tests__/gpu-driven-view.dawn.test.ts +6 -2
- package/src/__tests__/gpu-driven-view.unit.test.ts +1 -1
- package/src/__tests__/gpu-pass-timing-lifecycle.integration.test.ts +1 -0
- package/src/__tests__/gpu-pass-timing.browser.test.ts +6 -4
- package/src/__tests__/gpu-pass-timing.rhi-null.unit.test.ts +1 -0
- package/src/__tests__/gpu-scene.unit.test.ts +119 -9
- package/src/__tests__/instance-allocation-failure.unit.test.ts +57 -0
- package/src/__tests__/instances-culling.integration.test.ts +10 -36
- package/src/__tests__/instances-store.unit.test.ts +97 -305
- package/src/__tests__/instances-world-ownership.integration.test.ts +62 -0
- package/src/__tests__/ktx2-basis-gpu-consumer.dawn.test.ts +4 -1
- package/src/__tests__/main-pass-material-medium-selection.unit.test.ts +145 -0
- package/src/__tests__/material-shader-prewarm.unit.test.ts +59 -0
- package/src/__tests__/material-snapshot-mutation.integration.test.ts +39 -1
- package/src/__tests__/materials-standard-contract.unit.test.ts +0 -1
- package/src/__tests__/morph-culling-reentry.dawn.test.ts +5 -5
- package/src/__tests__/morph-visual-evidence.integration.test.ts +8 -7
- package/src/__tests__/motion-blur-compute.dawn.test.ts +13 -7
- package/src/__tests__/motion-blur.pixel.integration.test.ts +2 -2
- package/src/__tests__/nineslice-handle-surface.unit.test.ts +4 -4
- package/src/__tests__/pbr-view-layout.unit.test.ts +9 -0
- package/src/__tests__/physical-clearcoat.integration.test.ts +66 -8
- package/src/__tests__/physical-material-budget.unit.test.ts +40 -0
- package/src/__tests__/prepared-graphics-capability.unit.test.ts +66 -2
- package/src/__tests__/probe-bindings.unit.test.ts +582 -1
- package/src/__tests__/probe-scene-dirty.integration.test.ts +28 -1
- package/src/__tests__/receipt-observation-retirement.unit.test.ts +65 -0
- package/src/__tests__/recovery-candidate-prepare.contract.test.ts +69 -0
- package/src/__tests__/render-error-code-owner.test-d.ts +8 -0
- package/src/__tests__/render-feature-diagnostics.unit.test.ts +15 -2
- package/src/__tests__/render-feature-error-reporting.unit.test.ts +21 -1
- package/src/__tests__/render-feature-prepared-diagnostics.unit.test.ts +10 -1
- package/src/__tests__/render-feature-retry.unit.test.ts +12 -1
- package/src/__tests__/render-scene-mixed-updates.integration.test.ts +145 -19
- package/src/__tests__/render-scene-projection.unit.test.ts +36 -11
- package/src/__tests__/render-scene-temporal-retry.unit.test.ts +20 -20
- package/src/__tests__/render-target-probe-soak.perf.test.ts +2 -2
- package/src/__tests__/render-temporal-environment-consumer.browser.test.ts +3 -3
- package/src/__tests__/render-temporal-environment-consumer.dawn.test.ts +5 -2
- package/src/__tests__/renderer-factory-material-contract.unit.test.ts +42 -8
- package/src/__tests__/renderer-frame-generation-fence.integration.test.ts +16 -0
- package/src/__tests__/renderer-frame-transaction.integration.test.ts +26 -10
- package/src/__tests__/resource-allocation.unit.test.ts +123 -0
- package/src/__tests__/single-layer-medium-passes.unit.test.ts +275 -0
- package/src/__tests__/skin-motion-regression.unit.test.ts +70 -1
- package/src/__tests__/skin-palette-recycling.dawn.test.ts +97 -0
- package/src/__tests__/skinned-shadow-caster.test.ts +15 -0
- package/src/__tests__/ssr-carrier-public-contract.unit.test.ts +21 -0
- package/src/__tests__/ssr-gpu-dispatch.browser.test.ts +4 -4
- package/src/__tests__/ssr-gpu-dispatch.dawn.test.ts +2 -2
- package/src/__tests__/ssr-gpu-dispatch.ts +1 -1
- package/src/__tests__/ssr-receiver-coverage.dawn.test.ts +6 -2
- package/src/__tests__/standard-output-chain-contract.unit.test.ts +28 -0
- package/src/__tests__/standard-pbr-artifact-assembly.unit.test.ts +46 -1
- package/src/__tests__/standard-pipeline.integration.test.ts +182 -1
- package/src/__tests__/surface-dynamic-buffer-lifecycle.unit.test.ts +506 -0
- package/src/__tests__/surface-submission-observation.unit.test.ts +812 -0
- package/src/__tests__/temporal-history-lifecycle.unit.test.ts +32 -0
- package/src/__tests__/temporal-performance.integration.test.ts +3 -3
- package/src/__tests__/visibility-instances.integration.test.ts +7 -19
- package/src/__tests__/visibility-producer-matrix.integration.test.ts +9 -20
- package/src/__tests__/volume-optics-oracle.unit.test.ts +4 -2
- package/src/__tests__/volumetric-fog-budget-recovery.integration.test.ts +30 -20
- package/src/__tests__/volumetric-fog-errors.unit.test.ts +4 -3
- package/src/__tests__/volumetric-fog-multiple.unit.test.ts +55 -0
- package/src/__tests__/volumetric-fog-spot-frame-optics.integration.test.ts +1 -1
- package/src/__tests__/volumetric-fog-stage-readback.dawn.test.ts +113 -9
- package/src/__tests__/volumetric-fog-topology.unit.test.ts +5 -3
- package/src/assembly/backend-contract.ts +30 -0
- package/src/assembly/barrel-distortion-inspection.ts +22 -0
- package/src/assembly/canvas-draw-guard.ts +11 -0
- package/src/assembly/cloud-shadow-entry.ts +22 -0
- package/src/assembly/device-feature-admission.ts +2 -2
- package/src/assembly/dynamic-geometry-host.ts +65 -37
- package/src/assembly/dynamic-geometry-runtime.ts +7 -1
- package/src/assembly/factory.ts +2 -30
- package/src/assembly/host-contract.ts +8 -5
- package/src/assembly/material/assembly.ts +25 -13
- package/src/assembly/material/pipeline-helpers.ts +53 -12
- package/src/assembly/material-shader-policy.ts +55 -0
- package/src/assembly/material-shader-prewarm.ts +21 -10
- package/src/assembly/recovery/device-loss-fanout.ts +13 -0
- package/src/assembly/recovery/renderer-recover.ts +50 -18
- package/src/assembly/render-feature-post-processes.ts +54 -0
- package/src/assembly/render-target-host.ts +57 -47
- package/src/assembly/renderer-facade.ts +7 -2
- package/src/assembly/renderer-feature-inspection.ts +8 -2
- package/src/assembly/renderer-frame-transaction.ts +23 -0
- package/src/assembly/renderer-inspection.ts +28 -0
- package/src/assembly/skin-palette-owner.ts +1 -1
- package/src/assembly/temporal-post-process-prewarm.ts +3 -3
- package/src/assembly/webgpu-pbr-ready.ts +9 -1
- package/src/assembly/webgpu-ready-per-pass.ts +104 -0
- package/src/assembly/webgpu-ready.ts +116 -62
- package/src/assembly/webgpu-renderer-bootstrap.ts +0 -12
- package/src/assembly/webgpu-renderer-observation-owner.ts +222 -0
- package/src/assembly/webgpu-renderer.ts +303 -313
- package/src/assembly/webgpu-vertex-layouts.ts +1 -1
- package/src/barrel-distortion.ts +247 -0
- package/src/cloud/__tests__/cloud-density-parity.dawn.test.ts +173 -0
- package/src/cloud/__tests__/cloud-layer-framebuffer-y.dawn.test.ts +265 -0
- package/src/cloud/__tests__/cloud-layer.browser.test.ts +432 -0
- package/src/cloud/__tests__/cloud-layer.unit.test.ts +634 -0
- package/src/cloud/density.ts +600 -0
- package/src/cloud/extract.ts +110 -0
- package/src/cloud/feature.ts +1810 -0
- package/src/cloud/frame-context.ts +42 -0
- package/src/cloud/inspection.ts +130 -0
- package/src/cloud/optics.ts +285 -0
- package/src/cloud/parameters.ts +255 -0
- package/src/cloud/resources.ts +122 -0
- package/src/cloud/shadow.ts +167 -0
- package/src/cloud/temporal.ts +226 -0
- package/src/components/barrel-distortion.ts +46 -0
- package/src/components/cloud-layer.ts +47 -0
- package/src/components/index.ts +2 -0
- package/src/components/instances.ts +18 -45
- package/src/components/sprite-instances.ts +1 -1
- package/src/construct-renderer.ts +1 -1
- package/src/device/gpu-residency.ts +26 -25
- package/src/dynamic-geometry.ts +12 -1
- package/src/errors/cloud.ts +103 -0
- package/src/errors/render.ts +47 -8
- package/src/examples/single-layer-medium-surface.ts +59 -0
- package/src/extract/camera.ts +15 -1
- package/src/extract/contracts.ts +5 -0
- package/src/extract/material-context.ts +21 -0
- package/src/features/barrel-distortion.ts +172 -0
- package/src/features/error-reporting.ts +26 -6
- package/src/features/host.ts +128 -19
- package/src/features/plan.ts +10 -0
- package/src/features/render-graph-contribution.ts +9 -0
- package/src/features/render-graph-raster.ts +45 -3
- package/src/features/targets.ts +66 -0
- package/src/features/types.ts +51 -0
- package/src/fullscreen-post-process-pass.ts +41 -9
- package/src/glyph-text-layout-system.ts +2 -2
- package/src/gpu-dirty-ranges.ts +48 -0
- package/src/gpu-driven/batch-topology.ts +53 -0
- package/src/gpu-driven/material-artifacts.ts +33 -25
- package/src/gpu-driven/prepared-draw.ts +12 -4
- package/src/gpu-driven/production-raster-material.ts +1894 -0
- package/src/gpu-driven/production-raster.ts +825 -784
- package/src/gpu-driven/resource-allocation.ts +142 -0
- package/src/gpu-driven/shadow-ownership.ts +71 -0
- package/src/gpu-driven/view-gpu.ts +164 -10
- package/src/gpu-scene.ts +75 -84
- package/src/hdrp-buffers.ts +4 -3
- package/src/ibl/frame-resources.ts +0 -1
- package/src/ibl/skylight-bind-group.ts +62 -32
- package/src/index.ts +205 -9
- package/src/inspection-types.ts +162 -0
- package/src/instance-buffer-cache.ts +4 -4
- package/src/instances.ts +152 -569
- package/src/pbr-pipeline.ts +230 -30
- package/src/pipeline/single-layer-medium-passes.ts +267 -0
- package/src/pipeline/standard-forward-lane.ts +313 -57
- package/src/pipeline/standard-output/graph.ts +8 -2
- package/src/pipeline/standard-output/lut-gpu.ts +3 -3
- package/src/pipeline/standard-output/resources.ts +2 -2
- package/src/pipeline/standard-output/types.ts +12 -1
- package/src/pipeline/standard-pipeline.ts +291 -18
- package/src/pipeline/standard-post.ts +90 -24
- package/src/pipeline-builder.ts +1 -1
- package/src/plugin.ts +4 -0
- package/src/points-lines/__tests__/points-lines.bench.ts +17 -8
- package/src/prepare/prepared-graphics-resolver.ts +2 -0
- package/src/publication/__tests__/derived-geometry.integration.test.ts +177 -0
- package/src/publication/__tests__/features.integration.test.ts +122 -0
- package/src/publication/__tests__/programs.unit.test.ts +25 -0
- package/src/publication/__tests__/publication.integration.test.ts +370 -0
- package/src/publication/__tests__/targets.integration.test.ts +120 -0
- package/src/publication/__tests__/video.browser.test.ts +50 -0
- package/src/publication/contract.ts +104 -0
- package/src/publication/dependencies.ts +54 -0
- package/src/publication/prepare-geometry.ts +94 -0
- package/src/publication/programs.ts +45 -0
- package/src/publication/publisher.ts +618 -0
- package/src/publication/receiver.ts +297 -0
- package/src/publication/resource-scope.ts +31 -0
- package/src/publication/targets.ts +182 -0
- package/src/publication/video.ts +33 -0
- package/src/record/__tests__/main-pass-geometry.unit.test.ts +30 -0
- package/src/record/__tests__/material-bg-cache.unit.test.ts +15 -1
- package/src/record/__tests__/sprite-material-abi.unit.test.ts +9 -11
- package/src/record/__tests__/temporal-payload.unit.test.ts +1 -1
- package/src/record/__tests__/transparent-group2-selection.unit.test.ts +11 -0
- package/src/record/__tests__/typed-frame-graph-plan.unit.test.ts +1 -0
- package/src/record/__tests__/video-texture-view.unit.test.ts +9 -9
- package/src/record/__tests__/view-ubo-layout.unit.test.ts +4 -3
- package/src/record/barrel-distortion-frame.ts +110 -0
- package/src/record/dynamic-geometry-consumption.ts +39 -9
- package/src/record/fold-buckets.ts +855 -0
- package/src/record/fold-instance-buffer.ts +51 -0
- package/src/record/frame-lighting.ts +36 -2
- package/src/record/frame-snapshot.ts +45 -9
- package/src/record/frame.ts +258 -1105
- package/src/record/gpu-draw-receipts.ts +38 -0
- package/src/record/gpu-timing.ts +48 -5
- package/src/record/helpers.ts +2 -2
- package/src/record/main-pass-geometry.ts +272 -84
- package/src/record/main-pass-material.ts +102 -36
- package/src/record/main-pass-sprite-draws.ts +13 -217
- package/src/record/main-pass.ts +164 -27
- package/src/record/motion-blur-receipt.ts +91 -0
- package/src/record/prepared-material-bindings.ts +11 -6
- package/src/record/probe-blend-buffer.ts +180 -0
- package/src/record/recovery-pipeline.ts +35 -3
- package/src/record/render-context.ts +41 -5
- package/src/record/shadow-pass.ts +30 -4
- package/src/record/skybox-post-pass.ts +28 -4
- package/src/record/sprite-instance-buffer.ts +155 -0
- package/src/record/target-capture-graph.ts +258 -0
- package/src/record/typed-frame-graph.ts +776 -340
- package/src/record/view-ubo.ts +27 -4
- package/src/record/volume-params.ts +225 -0
- package/src/recovery/render-system-candidate.ts +243 -50
- package/src/reflection/record-owner.ts +7 -3
- package/src/render-contract.ts +54 -5
- package/src/render-graph-primitives.ts +7 -1
- package/src/render-pipeline.ts +130 -0
- package/src/render-system-extract-tail.ts +90 -78
- package/src/render-system-extract.ts +76 -76
- package/src/render-system-presentation.ts +56 -0
- package/src/render-system-producer-roots.ts +96 -0
- package/src/render-system-projections.ts +3 -2
- package/src/render-system-residency.ts +159 -0
- package/src/render-system.ts +421 -408
- package/src/scene/probe-blend.ts +96 -4
- package/src/scene/render-scene.ts +416 -337
- package/src/scene/render-source.ts +90 -0
- package/src/scene/source-systems.ts +33 -0
- package/src/ssao-buffers.ts +95 -2
- package/src/surface/__tests__/dynamic-input.unit.test.ts +374 -0
- package/src/surface/__tests__/gpu-driven.unit.test.ts +87 -0
- package/src/surface/dynamic-input.ts +658 -0
- package/src/surface/gpu-driven.ts +147 -0
- package/src/surface/submission-observation.ts +517 -0
- package/src/systems/skin-palette-allocator.ts +5 -1
- package/src/systems/skin-palette-types.ts +11 -0
- package/src/systems/transparent-dispatch.ts +2 -2
- package/src/systems/transparent-sort-config.ts +3 -1
- package/src/temporal/gpu.ts +101 -17
- package/src/temporal/inspection.ts +7 -1
- package/src/temporal/standard-scene-data.ts +5 -0
- package/src/temporal/target-coverage-attachment.ts +4 -0
- package/src/transmission/__tests__/single-layer-medium.unit.test.ts +149 -0
- package/src/transmission/__tests__/standard-transmission.dawn.test.ts +12 -11
- package/src/transmission/single-layer-medium.ts +322 -0
- package/src/typed-render-graph-primitives.ts +70 -2
- package/src/volume/component.ts +10 -9
- package/src/volume/extract.ts +11 -5
- package/src/volume/inspection.ts +3 -0
- package/src/volume/passes.ts +87 -4
- package/src/volume/resources.ts +2 -1
- package/dist/chunk-3RTCJTH4.mjs +0 -1610
- package/dist/chunk-3RTCJTH4.mjs.map +0 -1
- package/dist/chunk-BLXGONR2.mjs.map +0 -1
- package/dist/chunk-ILQ5MEZF.mjs +0 -32
- package/dist/chunk-ILQ5MEZF.mjs.map +0 -1
- package/dist/chunk-LEAXOMYJ.mjs.map +0 -1
- package/dist/chunk-NB2S7ZRX.mjs +0 -1783
- package/dist/chunk-NB2S7ZRX.mjs.map +0 -1
- package/dist/chunk-NNQL7CB3.mjs +0 -1713
- package/dist/chunk-NNQL7CB3.mjs.map +0 -1
- package/dist/chunk-OO3DRYK7.mjs.map +0 -1
- package/dist/chunk-PA5DRJNI.mjs.map +0 -1
- package/dist/chunk-PLAXOOX5.mjs +0 -1907
- package/dist/chunk-PLAXOOX5.mjs.map +0 -1
- package/dist/chunk-RXZ3RGOU.mjs +0 -53
- package/dist/chunk-RXZ3RGOU.mjs.map +0 -1
- package/dist/chunk-VOZWDM3L.mjs.map +0 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { transmissionBackdropAvailable } from '../assembly/device-feature-admission';
|
|
2
2
|
import { getOrCreateIblCache } from '../ibl/IblPipelineCache';
|
|
3
|
+
import type { RenderResourceScope } from '../publication/resource-scope';
|
|
3
4
|
import type { _InternalRenderPipelineContext } from './render-context';
|
|
4
5
|
// @forgeax/engine-runtime - RenderSystem record stage: main-pass-material.
|
|
5
6
|
// Extracted from render-system-record.ts (feat-20260704 M3/w17, pure move).
|
|
6
7
|
|
|
7
8
|
import { resolveAssetHandle } from '@forgeax/engine-assets-runtime';
|
|
8
|
-
import type { EntityHandle
|
|
9
|
+
import type { EntityHandle } from '@forgeax/engine-ecs';
|
|
9
10
|
import {
|
|
10
|
-
|
|
11
|
-
type
|
|
11
|
+
VIDEO_SOURCE_PROVIDER_KEY,
|
|
12
|
+
type VideoSourceProvider,
|
|
13
|
+
videoSourceExtent,
|
|
12
14
|
} from '@forgeax/engine-graphics-extras';
|
|
13
15
|
import {
|
|
14
16
|
type BindGroup,
|
|
@@ -42,6 +44,7 @@ import { VideoUploadUnsupportedError } from '../errors/render';
|
|
|
42
44
|
import {
|
|
43
45
|
assembleMaterialWithSkylightEntries,
|
|
44
46
|
type SkylightBindGroupResources,
|
|
47
|
+
type SurfaceMediumBindGroupResources,
|
|
45
48
|
type TextureInjectionResource,
|
|
46
49
|
type TransmissionBindGroupResources,
|
|
47
50
|
} from '../ibl/skylight-bind-group';
|
|
@@ -260,11 +263,11 @@ function materialDiagnosticsEnabled(): boolean {
|
|
|
260
263
|
}
|
|
261
264
|
|
|
262
265
|
export function residentTextureView(
|
|
263
|
-
world:
|
|
266
|
+
world: RenderResourceScope,
|
|
264
267
|
store: GpuResidencyCache,
|
|
265
268
|
runtime: RenderSystemRuntime,
|
|
266
269
|
handle: Handle<'TextureAsset', 'shared'>,
|
|
267
|
-
worldId:
|
|
270
|
+
worldId: RenderResourceScope | number = world,
|
|
268
271
|
): TextureView | undefined {
|
|
269
272
|
const podRes = resolveAssetHandle<TextureAsset>(world, handle);
|
|
270
273
|
const diagnosticsEnabled = materialDiagnosticsEnabled();
|
|
@@ -322,11 +325,11 @@ export function residentTextureView(
|
|
|
322
325
|
}
|
|
323
326
|
|
|
324
327
|
function residentSampler(
|
|
325
|
-
world:
|
|
328
|
+
world: RenderResourceScope,
|
|
326
329
|
store: GpuResidencyCache,
|
|
327
330
|
runtime: RenderSystemRuntime,
|
|
328
331
|
handle: Handle<'SamplerAsset', 'shared'>,
|
|
329
|
-
worldId:
|
|
332
|
+
worldId: RenderResourceScope | number = world,
|
|
330
333
|
): Sampler | undefined {
|
|
331
334
|
const podRes = resolveAssetHandle<SamplerAsset>(world, handle);
|
|
332
335
|
if (!podRes.ok) return undefined;
|
|
@@ -343,7 +346,7 @@ function residentSampler(
|
|
|
343
346
|
// transient DynamicTextureStore, NOT the static `residentTextureView` /
|
|
344
347
|
// `ensureResident` cache (video never enters that switch; AC-08).
|
|
345
348
|
//
|
|
346
|
-
// Per frame: ask the host-registered
|
|
349
|
+
// Per frame: ask the host-registered VideoSourceProvider (RenderResourceScope Resource,
|
|
347
350
|
// D-1) for this entity's HTMLVideoElement, upload its current frame via
|
|
348
351
|
// `store.uploadFrame` (copyExternalImageToTexture), and return the resulting
|
|
349
352
|
// view. When the provider is absent / returns no element / the element has no
|
|
@@ -403,7 +406,7 @@ function clearVideoUploadFailureEpisode(
|
|
|
403
406
|
}
|
|
404
407
|
|
|
405
408
|
export function videoTextureView(
|
|
406
|
-
world:
|
|
409
|
+
world: RenderResourceScope,
|
|
407
410
|
store: DynamicTextureStore | undefined,
|
|
408
411
|
runtime: RenderSystemRuntime,
|
|
409
412
|
entityKey: number,
|
|
@@ -411,10 +414,14 @@ export function videoTextureView(
|
|
|
411
414
|
highPerfAvailable: boolean,
|
|
412
415
|
): TextureView | undefined {
|
|
413
416
|
if (store === undefined) return undefined;
|
|
414
|
-
const provider =
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
417
|
+
const provider =
|
|
418
|
+
!('resolveAsset' in world) && world.hasResource(VIDEO_SOURCE_PROVIDER_KEY)
|
|
419
|
+
? world.getResource<VideoSourceProvider>(VIDEO_SOURCE_PROVIDER_KEY)
|
|
420
|
+
: undefined;
|
|
421
|
+
const element =
|
|
422
|
+
'resolveAsset' in world
|
|
423
|
+
? world.videoFrame(entityKey, clip)
|
|
424
|
+
: provider?.getSource(entityKey as EntityHandle, clip);
|
|
418
425
|
// AC-10 double-miss: a VideoPlayer entity can reach NEITHER upload path this
|
|
419
426
|
// frame — no host HTMLVideoElement (general copyExternalImageToTexture path)
|
|
420
427
|
// AND no high-perf GPUExternalTexture path. This is the genuine "this backend
|
|
@@ -440,13 +447,9 @@ export function videoTextureView(
|
|
|
440
447
|
clearVideoUploadFailureEpisode(store, entityKey, clip);
|
|
441
448
|
return store.getView(clip);
|
|
442
449
|
}
|
|
443
|
-
const
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
// current frame. WebGPU rejects copyExternalImageToTexture in that window
|
|
447
|
-
// because the video element has no back resource yet; keep the previous
|
|
448
|
-
// frame/default view until HAVE_CURRENT_DATA (2) is reached.
|
|
449
|
-
if (width <= 0 || height <= 0 || element.readyState < 2) return store.getView(clip);
|
|
450
|
+
const extent = videoSourceExtent(element);
|
|
451
|
+
if (extent === undefined) return store.getView(clip);
|
|
452
|
+
const { width, height } = extent;
|
|
450
453
|
const uploaded = store.uploadFrame(clip, element, width, height);
|
|
451
454
|
if (uploaded === undefined) return store.getView(clip);
|
|
452
455
|
if (!uploaded.ok) {
|
|
@@ -591,7 +594,7 @@ function writeNumericParamValue(
|
|
|
591
594
|
export function applyMaterialTextureUvScales(
|
|
592
595
|
payload: MaterialUboPayload,
|
|
593
596
|
material: MaterialSnapshot,
|
|
594
|
-
world:
|
|
597
|
+
world: RenderResourceScope,
|
|
595
598
|
): void {
|
|
596
599
|
const f32 = materialUboFloatView(payload);
|
|
597
600
|
const coordinateSchema = materialCoordinateSchema(material);
|
|
@@ -939,14 +942,14 @@ export function applyParamSchemaDefaultsToUbo(
|
|
|
939
942
|
export interface PerSubmeshMaterialBgDeps {
|
|
940
943
|
readonly runtime: RenderSystemRuntime;
|
|
941
944
|
readonly pipelineState: PipelineState;
|
|
942
|
-
readonly world:
|
|
945
|
+
readonly world: RenderResourceScope;
|
|
943
946
|
readonly store: GpuResidencyCache;
|
|
944
947
|
readonly materialSlice: number;
|
|
945
948
|
readonly videoHighPerfAvailable: boolean;
|
|
946
949
|
readonly skylightResources: SkylightBindGroupResources;
|
|
947
950
|
readonly resolveRenderTargetTextureSource?: RenderSystemRuntime['resolveRenderTargetTextureSource'];
|
|
948
951
|
readonly resolveReflectionProbeResources?: (
|
|
949
|
-
materialWorld:
|
|
952
|
+
materialWorld: RenderResourceScope,
|
|
950
953
|
entityKey: number,
|
|
951
954
|
) => { readonly resources: SkylightBindGroupResources; readonly probeIndex: number } | undefined;
|
|
952
955
|
readonly materialBgShared: Map<string, WeakMap<object, unknown>>;
|
|
@@ -956,6 +959,12 @@ export interface PerSubmeshMaterialBgDeps {
|
|
|
956
959
|
readonly sceneMaterialBuffer?: Buffer;
|
|
957
960
|
/** Active transmission backdrop; undefined/null means layout placeholder. */
|
|
958
961
|
readonly transmissionBackdropView?: TextureView | null;
|
|
962
|
+
/** Independent sampled raw depth for the active medium graph pass. */
|
|
963
|
+
readonly surfaceRawDepthView?: TextureView | null;
|
|
964
|
+
/** Nearest-layer color from the preceding medium graph pass. */
|
|
965
|
+
readonly surfaceNearestLayerView?: TextureView | null;
|
|
966
|
+
/** Nearest-layer depth from the preceding medium graph pass. */
|
|
967
|
+
readonly surfaceNearestDepthView?: TextureView | null;
|
|
959
968
|
readonly bindGroupCounts: BindGroupCounts;
|
|
960
969
|
readonly frameState: RenderFrameState;
|
|
961
970
|
}
|
|
@@ -972,7 +981,7 @@ function recordIblMaterialBinding(
|
|
|
972
981
|
if (receipt === undefined) return;
|
|
973
982
|
const skylightBindingStart = entries.findIndex((entry) => entry.binding === iblStart);
|
|
974
983
|
if (skylightBindingStart < 0) return;
|
|
975
|
-
const iblEntries = entries.slice(skylightBindingStart, skylightBindingStart +
|
|
984
|
+
const iblEntries = entries.slice(skylightBindingStart, skylightBindingStart + 6);
|
|
976
985
|
const projected: IblBindingEntryInspection[] = [];
|
|
977
986
|
for (const entry of iblEntries) {
|
|
978
987
|
if (entry.resource.kind === 'externalTexture') continue;
|
|
@@ -1009,8 +1018,17 @@ export function isMaterialBgAssemblyCacheHit(
|
|
|
1009
1018
|
materialResourceEpoch: number,
|
|
1010
1019
|
transmissionBackdropView?: TextureView | null,
|
|
1011
1020
|
sceneMaterialBuffer?: Buffer,
|
|
1021
|
+
surfaceRawDepthView?: TextureView | null,
|
|
1012
1022
|
): cached is MaterialBgAssemblyCacheEntry {
|
|
1013
|
-
|
|
1023
|
+
// Logical target sources keep their identity when a resize promotes a new
|
|
1024
|
+
// physical view. Resolve those views each frame; the lower binding cache is
|
|
1025
|
+
// keyed by the actual GPU resources and still reuses unchanged bindings.
|
|
1026
|
+
if (
|
|
1027
|
+
transmissionBackdropView != null ||
|
|
1028
|
+
surfaceRawDepthView != null ||
|
|
1029
|
+
(material.textureSources?.size ?? 0) > 0
|
|
1030
|
+
)
|
|
1031
|
+
return false;
|
|
1014
1032
|
return (
|
|
1015
1033
|
cached?.material === material &&
|
|
1016
1034
|
cached.materialResourceEpoch === materialResourceEpoch &&
|
|
@@ -1023,7 +1041,6 @@ export function isMaterialBgAssemblyCacheHit(
|
|
|
1023
1041
|
cached.skylightResources.skylightPrefilterView === skylightResources.skylightPrefilterView &&
|
|
1024
1042
|
cached.skylightResources.prefilterSampler === skylightResources.prefilterSampler &&
|
|
1025
1043
|
cached.skylightResources.brdfLutView === skylightResources.brdfLutView &&
|
|
1026
|
-
cached.skylightResources.brdfLutSampler === skylightResources.brdfLutSampler &&
|
|
1027
1044
|
cached.skylightResources.intensityBuffer === skylightResources.intensityBuffer
|
|
1028
1045
|
);
|
|
1029
1046
|
}
|
|
@@ -1032,7 +1049,7 @@ export function buildPerSubmeshMaterialBg(
|
|
|
1032
1049
|
deps: PerSubmeshMaterialBgDeps,
|
|
1033
1050
|
submeshMaterial: MaterialSnapshot,
|
|
1034
1051
|
entityKey: number,
|
|
1035
|
-
materialWorld:
|
|
1052
|
+
materialWorld: RenderResourceScope = deps.world,
|
|
1036
1053
|
materialShaderId: string | undefined = submeshMaterial.materialShaderId,
|
|
1037
1054
|
): BindGroup {
|
|
1038
1055
|
const {
|
|
@@ -1047,6 +1064,9 @@ export function buildPerSubmeshMaterialBg(
|
|
|
1047
1064
|
materialBgShared,
|
|
1048
1065
|
materialBgAssemblyCache,
|
|
1049
1066
|
transmissionBackdropView,
|
|
1067
|
+
surfaceRawDepthView,
|
|
1068
|
+
surfaceNearestLayerView,
|
|
1069
|
+
surfaceNearestDepthView,
|
|
1050
1070
|
bindGroupCounts,
|
|
1051
1071
|
frameState,
|
|
1052
1072
|
} = deps;
|
|
@@ -1059,6 +1079,39 @@ export function buildPerSubmeshMaterialBg(
|
|
|
1059
1079
|
: `${materialWorld.identity}:${smMaterialHandle}:${materialShaderId ?? ''}:${selectedProbe?.probeIndex ?? 'sky'}`;
|
|
1060
1080
|
const smHasVideoFields = (submeshMaterial.videoTextureFields?.size ?? 0) > 0;
|
|
1061
1081
|
const smShaderId = materialShaderId;
|
|
1082
|
+
const selectedMaterialShaderArtifact =
|
|
1083
|
+
smShaderId === undefined ? undefined : runtime.getMaterialShaderArtifact?.(smShaderId);
|
|
1084
|
+
const selectedMediumShader =
|
|
1085
|
+
smShaderId === 'forgeax::single-layer-medium' ||
|
|
1086
|
+
selectedMaterialShaderArtifact?.receipt?.surface?.model === 'single-layer-medium';
|
|
1087
|
+
let surfaceMediumResources: SurfaceMediumBindGroupResources | undefined;
|
|
1088
|
+
if (selectedMediumShader) {
|
|
1089
|
+
if (surfaceRawDepthView == null) {
|
|
1090
|
+
throw new RhiError({
|
|
1091
|
+
code: 'rhi-descriptor-invalid',
|
|
1092
|
+
expected: 'single-layer medium material bind group has producer-owned raw depth',
|
|
1093
|
+
hint: 'admit the Surface material only from a graph pass with an available raw-depth pair',
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
const nearestLayerView = surfaceNearestLayerView ?? transmissionBackdropView;
|
|
1097
|
+
const nearestDepthView = surfaceNearestDepthView ?? pipelineState.shadowFallbackTextureView;
|
|
1098
|
+
if (nearestLayerView == null || pipelineState.surfaceMediumDepthSampler === undefined) {
|
|
1099
|
+
throw new RhiError({
|
|
1100
|
+
code: 'rhi-descriptor-invalid',
|
|
1101
|
+
expected:
|
|
1102
|
+
'single-layer medium material bind group has paired nearest resources and depth sampler',
|
|
1103
|
+
hint: 'publish the nearest-layer target and the non-filtering raw-depth sampler before recording the Surface pass',
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
surfaceMediumResources = {
|
|
1107
|
+
rawDepthSampler: pipelineState.surfaceMediumDepthSampler,
|
|
1108
|
+
rawDepthView: surfaceRawDepthView,
|
|
1109
|
+
nearestLayerSampler: effectiveSkylightResources.prefilterSampler,
|
|
1110
|
+
nearestLayerView,
|
|
1111
|
+
nearestDepthSampler: pipelineState.surfaceMediumDepthSampler,
|
|
1112
|
+
nearestDepthView,
|
|
1113
|
+
};
|
|
1114
|
+
}
|
|
1062
1115
|
// The cooked shader schema owns the resource ABI. A material snapshot may
|
|
1063
1116
|
// carry only the authored values (for example a clearcoat-only root omits
|
|
1064
1117
|
// the standard emissive/occlusion maps), while the Standard template still
|
|
@@ -1100,6 +1153,7 @@ export function buildPerSubmeshMaterialBg(
|
|
|
1100
1153
|
store.materialResourceEpoch,
|
|
1101
1154
|
transmissionBackdropView,
|
|
1102
1155
|
sceneMaterialBuffer,
|
|
1156
|
+
surfaceRawDepthView,
|
|
1103
1157
|
)
|
|
1104
1158
|
) {
|
|
1105
1159
|
if (diagnosticsEnabled) {
|
|
@@ -1130,10 +1184,6 @@ export function buildPerSubmeshMaterialBg(
|
|
|
1130
1184
|
},
|
|
1131
1185
|
{
|
|
1132
1186
|
binding: 6 + smUserRegionFields.length * 2,
|
|
1133
|
-
resource: { kind: 'sampler', value: effectiveSkylightResources.brdfLutSampler },
|
|
1134
|
-
},
|
|
1135
|
-
{
|
|
1136
|
-
binding: 7 + smUserRegionFields.length * 2,
|
|
1137
1187
|
resource: {
|
|
1138
1188
|
kind: 'buffer',
|
|
1139
1189
|
value: { buffer: effectiveSkylightResources.intensityBuffer },
|
|
@@ -1232,7 +1282,7 @@ export function buildPerSubmeshMaterialBg(
|
|
|
1232
1282
|
// Physical Standard maps are deliberately appended after the stable IBL /
|
|
1233
1283
|
// transmission tail. Keep their resource projection separate from the
|
|
1234
1284
|
// user-region loop so the slot order is the same as
|
|
1235
|
-
// `appendTextureInjection(
|
|
1285
|
+
// `appendTextureInjection(afterSurfaceMedium, physicalFields)` in the
|
|
1236
1286
|
// layout owner.
|
|
1237
1287
|
const physicalTextureInjections: TextureInjectionResource[] = [];
|
|
1238
1288
|
for (let slot = 0; slot < physicalFields.length; slot += 1) {
|
|
@@ -1271,18 +1321,27 @@ export function buildPerSubmeshMaterialBg(
|
|
|
1271
1321
|
transmissionBackdropView != null
|
|
1272
1322
|
? effectiveSkylightResources.prefilterSampler
|
|
1273
1323
|
: pipelineState.defaultSampler;
|
|
1324
|
+
// The medium shader keeps the transmission backdrop pair in its fixed
|
|
1325
|
+
// group(1) ABI even on a device that cannot admit the ordinary Standard
|
|
1326
|
+
// transmission topology. Its Surface resources start at binding 10, so
|
|
1327
|
+
// retain a real backdrop pair here whenever the medium resources exist;
|
|
1328
|
+
// otherwise the raw-depth view would slide into binding 9 and Dawn would
|
|
1329
|
+
// reject the unfilterable r32float view as a filtering float texture.
|
|
1330
|
+
const keepMediumBackdropSlots = surfaceMediumResources !== undefined;
|
|
1274
1331
|
const smMergedEntries = assembleMaterialWithSkylightEntries(
|
|
1275
1332
|
smBaseEntries,
|
|
1276
1333
|
effectiveSkylightResources,
|
|
1277
|
-
transmissionBackdropAvailable(runtime.device.limits.maxSampledTexturesPerShaderStage)
|
|
1334
|
+
transmissionBackdropAvailable(runtime.device.limits.maxSampledTexturesPerShaderStage) ||
|
|
1335
|
+
keepMediumBackdropSlots
|
|
1278
1336
|
? ({
|
|
1279
1337
|
sampler: transmissionSampler,
|
|
1280
1338
|
...(transmissionBackdropView === undefined
|
|
1281
|
-
? {}
|
|
1339
|
+
? { backdropView: pipelineState.defaultWhiteTextureView }
|
|
1282
1340
|
: { backdropView: transmissionBackdropView }),
|
|
1283
1341
|
} satisfies TransmissionBindGroupResources)
|
|
1284
1342
|
: null,
|
|
1285
1343
|
physicalTextureInjections,
|
|
1344
|
+
surfaceMediumResources,
|
|
1286
1345
|
);
|
|
1287
1346
|
// Storage-capable devices share one Standard material BGL with the
|
|
1288
1347
|
// scene-index GPU lane. Even direct draws need a complete entry for
|
|
@@ -1321,6 +1380,14 @@ export function buildPerSubmeshMaterialBg(
|
|
|
1321
1380
|
entityKey,
|
|
1322
1381
|
materialHandle: smMaterialHandle,
|
|
1323
1382
|
shader: smShaderId,
|
|
1383
|
+
surfaceModel: submeshMaterial.surfaceModel,
|
|
1384
|
+
layoutIdentity: getOpaqueResourceIdentity(smMaterialBgl as object),
|
|
1385
|
+
bindings: smMergedEntries.map((entry) => entry.binding),
|
|
1386
|
+
graphResources: {
|
|
1387
|
+
rawDepth: surfaceRawDepthView != null,
|
|
1388
|
+
nearestLayer: surfaceNearestLayerView != null,
|
|
1389
|
+
nearestDepth: surfaceNearestDepthView != null,
|
|
1390
|
+
},
|
|
1324
1391
|
paramSnapshot: submeshMaterial.paramSnapshot,
|
|
1325
1392
|
handleTypes: materialCacheHandles.map((handle) => typeof handle),
|
|
1326
1393
|
})}`,
|
|
@@ -1367,6 +1434,7 @@ export function buildPerSubmeshMaterialBg(
|
|
|
1367
1434
|
if (
|
|
1368
1435
|
smMaterialHandle !== undefined &&
|
|
1369
1436
|
!smHasVideoFields &&
|
|
1437
|
+
(submeshMaterial.textureSources?.size ?? 0) === 0 &&
|
|
1370
1438
|
materialResourcesResident &&
|
|
1371
1439
|
!hasActiveTransmissionBackdrop
|
|
1372
1440
|
) {
|
|
@@ -1470,7 +1538,6 @@ export function resolveMaterialSkylight(
|
|
|
1470
1538
|
prefilterView: activeViews.pref,
|
|
1471
1539
|
prefilterSampler: skylightFallback.sampler,
|
|
1472
1540
|
brdfLutView: activeViews.brdf,
|
|
1473
|
-
brdfLutSampler: skylightFallback.sampler,
|
|
1474
1541
|
intensityBuffer: skylightFallback.intensityBuffer,
|
|
1475
1542
|
}
|
|
1476
1543
|
: {
|
|
@@ -1479,7 +1546,6 @@ export function resolveMaterialSkylight(
|
|
|
1479
1546
|
prefilterView: skylightFallback.prefilterView,
|
|
1480
1547
|
prefilterSampler: skylightFallback.sampler,
|
|
1481
1548
|
brdfLutView: skylightFallback.brdfLutView,
|
|
1482
|
-
brdfLutSampler: skylightFallback.sampler,
|
|
1483
1549
|
intensityBuffer: skylightFallback.intensityBuffer,
|
|
1484
1550
|
};
|
|
1485
1551
|
return { skylightResources, activeViews };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import type { RenderResourceScope } from '../publication/resource-scope';
|
|
2
|
+
import { resolveSpriteInstancesBuffer } from './sprite-instance-buffer';
|
|
1
3
|
// @forgeax/engine-runtime - RenderSystem record stage: main-pass sprite draws.
|
|
2
4
|
// feat-20260704 M5/w31: further-split from main-pass.ts (AC-05 <=1500 lines/file).
|
|
3
5
|
// recordSpritePass + sprite entity/transparent/instance-buffer helpers, moved verbatim.
|
|
4
6
|
|
|
5
|
-
import type { World } from '@forgeax/engine-ecs';
|
|
6
7
|
import {
|
|
7
8
|
type BindGroup,
|
|
8
9
|
type Buffer,
|
|
@@ -21,11 +22,8 @@ import type { InstanceBufferCacheEntry } from '../instance-buffer-cache';
|
|
|
21
22
|
import { SPRITE_PREMULTIPLIED_ALPHA_BLEND } from '../materials';
|
|
22
23
|
import { SPRITE_PASS_PER_INSTANCE_REGION_VARIANT_SET } from '../pbr-pipeline';
|
|
23
24
|
import { buildBeginRenderPassDescriptor, standardTopologyVariantSet } from '../pipeline-spec';
|
|
24
|
-
import type {
|
|
25
|
-
|
|
26
|
-
MaterialSnapshot,
|
|
27
|
-
SpriteInstancesSnapshot,
|
|
28
|
-
} from '../render-system-extract';
|
|
25
|
+
import type { DispatchEntry, MaterialSnapshot } from '../render-system-extract';
|
|
26
|
+
import { resolveFoldInstanceBuffer } from './fold-instance-buffer';
|
|
29
27
|
import { worldEntityKey } from './frame-snapshot';
|
|
30
28
|
import { recordGeometryDraws, resolveGeometryInstancesBindGroup } from './main-pass-geometry';
|
|
31
29
|
import {
|
|
@@ -36,55 +34,6 @@ import {
|
|
|
36
34
|
import type { _InternalRenderPipelineContext } from './render-context';
|
|
37
35
|
import { MATERIAL_PER_ENTITY_STRIDE } from './render-context';
|
|
38
36
|
|
|
39
|
-
export type { SpriteInstancesSnapshot };
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Build the interleaved sprite instance payload consumed by this record owner.
|
|
43
|
-
* The extract stage validates the two packed arrays before they reach this
|
|
44
|
-
* function, so the record path has one source of count-mismatch errors.
|
|
45
|
-
*/
|
|
46
|
-
export function interleaveSpriteInstanceBuffer(
|
|
47
|
-
transforms: Float32Array,
|
|
48
|
-
regions: Float32Array,
|
|
49
|
-
includePrevious = false,
|
|
50
|
-
): Float32Array {
|
|
51
|
-
const count = transforms.length / 16;
|
|
52
|
-
const stride = includePrevious ? 36 : 20;
|
|
53
|
-
const regionOffset = includePrevious ? 32 : 16;
|
|
54
|
-
const out = new Float32Array(count * stride);
|
|
55
|
-
for (let i = 0; i < count; i++) {
|
|
56
|
-
const dstBase = i * stride;
|
|
57
|
-
const transformBase = i * 16;
|
|
58
|
-
const regionBase = i * 4;
|
|
59
|
-
for (let k = 0; k < 16; k++) out[dstBase + k] = transforms[transformBase + k] ?? 0;
|
|
60
|
-
if (includePrevious) {
|
|
61
|
-
for (let k = 0; k < 16; k++) {
|
|
62
|
-
out[dstBase + 16 + k] = transforms[transformBase + k] ?? 0;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
for (let k = 0; k < 4; k++) {
|
|
66
|
-
out[dstBase + regionOffset + k] = regions[regionBase + k] ?? 0;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return out;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Check whether the existing per-entity sprite buffer still matches the
|
|
74
|
-
* extract snapshot and interleaved byte count.
|
|
75
|
-
*/
|
|
76
|
-
export function spriteInstancesCacheHit(
|
|
77
|
-
entry: InstanceBufferCacheEntry | undefined,
|
|
78
|
-
snapshot: SpriteInstancesSnapshot,
|
|
79
|
-
requestedBytes: number,
|
|
80
|
-
): boolean {
|
|
81
|
-
return (
|
|
82
|
-
entry !== undefined &&
|
|
83
|
-
entry.uploadedArchVersion === snapshot.archVersion &&
|
|
84
|
-
entry.uploadedByteLength === requestedBytes
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
37
|
/**
|
|
89
38
|
* Decide whether the LDR record needs the transparent sprite sub-pass. This
|
|
90
39
|
* remains beside the sprite record owner so the frame stage and draw stage
|
|
@@ -143,7 +92,7 @@ export function recordSpritePass(
|
|
|
143
92
|
materialSlot: number,
|
|
144
93
|
submeshMaterial: MaterialSnapshot,
|
|
145
94
|
entityKey: number,
|
|
146
|
-
materialWorld:
|
|
95
|
+
materialWorld: RenderResourceScope,
|
|
147
96
|
materialShaderId?: string,
|
|
148
97
|
) => BindGroup,
|
|
149
98
|
graphPass?: RhiRenderPassEncoder,
|
|
@@ -381,7 +330,7 @@ function recordSpriteTransparentPbrDraws(
|
|
|
381
330
|
slot: number,
|
|
382
331
|
material: MaterialSnapshot,
|
|
383
332
|
entityKey: number,
|
|
384
|
-
world:
|
|
333
|
+
world: RenderResourceScope,
|
|
385
334
|
shader?: string,
|
|
386
335
|
) => BindGroup,
|
|
387
336
|
meshGroup2: BindGroup | null,
|
|
@@ -454,7 +403,7 @@ function recordSpriteEntityDraws(
|
|
|
454
403
|
materialSlot: number,
|
|
455
404
|
material: MaterialSnapshot,
|
|
456
405
|
entityKey: number,
|
|
457
|
-
materialWorld:
|
|
406
|
+
materialWorld: RenderResourceScope,
|
|
458
407
|
) => BindGroup,
|
|
459
408
|
spritePH: RenderPipeline | null,
|
|
460
409
|
spritePH_withRegion: RenderPipeline | null,
|
|
@@ -589,69 +538,10 @@ function recordSpriteEntityDraws(
|
|
|
589
538
|
const spriteInst = spriteEntry.source.instances;
|
|
590
539
|
const useFold = foldHeadBucket !== undefined && spriteInst === undefined;
|
|
591
540
|
if (useFold && foldHeadBucket !== undefined) {
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
// requires a 32-bit-safe fold; we use a negative number-space prefix
|
|
597
|
-
// (-1, -2, ...) by `((materialHandle << 16) | i)` shifted into the
|
|
598
|
-
// negative half so it never collides with positive entity-Instances
|
|
599
|
-
// cacheKeys (which are extracted from Instances component cacheKey
|
|
600
|
-
// numeric ids, always non-negative). The `archVersion` proxy is
|
|
601
|
-
// bucketSize (a structural-shape signal) so static frames hit the
|
|
602
|
-
// cache.
|
|
603
|
-
const bucketCacheKey = -1 - (((foldHeadBucket.materialHandle & 0xffff) << 16) | (i & 0xffff));
|
|
604
|
-
const uniformFallback = runtime.device.caps.storageBuffer === false;
|
|
605
|
-
const bucketPayload = uniformFallback
|
|
606
|
-
? foldHeadBucket.transforms
|
|
607
|
-
: packInstanceStorageBuffer(foldHeadBucket.transforms);
|
|
608
|
-
const bucketBytes = bucketPayload.byteLength;
|
|
609
|
-
const bucketBufUsage = uniformFallback
|
|
610
|
-
? GPU_BUFFER_USAGE_UNIFORM | GPU_BUFFER_USAGE_COPY_DST
|
|
611
|
-
: GPU_BUFFER_USAGE_STORAGE | GPU_BUFFER_USAGE_COPY_DST;
|
|
612
|
-
const cachedBucket = frameState.instanceBuffers.get(bucketCacheKey);
|
|
613
|
-
let activeBucket: InstanceBufferCacheEntry | null = null;
|
|
614
|
-
if (
|
|
615
|
-
cachedBucket !== undefined &&
|
|
616
|
-
cachedBucket.uploadedArchVersion === foldHeadBucket.bucketSize &&
|
|
617
|
-
cachedBucket.uploadedByteLength === bucketBytes
|
|
618
|
-
) {
|
|
619
|
-
activeBucket = cachedBucket;
|
|
620
|
-
} else if (bucketBytes > 0) {
|
|
621
|
-
const bufRes = runtime.device.createBuffer({
|
|
622
|
-
size: bucketBytes,
|
|
623
|
-
usage: bucketBufUsage,
|
|
624
|
-
mappedAtCreation: false,
|
|
625
|
-
});
|
|
626
|
-
if (!bufRes.ok) {
|
|
627
|
-
runtime.errorRegistry.fire(bufRes.error);
|
|
628
|
-
} else {
|
|
629
|
-
if (cachedBucket !== undefined && !cachedBucket.buffer.isDestroyed) {
|
|
630
|
-
const r = cachedBucket.buffer.destroy();
|
|
631
|
-
if (!r.ok) runtime.errorRegistry.fire(r.error);
|
|
632
|
-
}
|
|
633
|
-
const newBuf = new GpuBuffer(runtime.device, bufRes.value);
|
|
634
|
-
activeBucket = {
|
|
635
|
-
buffer: newBuf,
|
|
636
|
-
uploadedArchVersion: foldHeadBucket.bucketSize,
|
|
637
|
-
uploadedByteLength: bucketBytes,
|
|
638
|
-
};
|
|
639
|
-
frameState.instanceBuffers.set(bucketCacheKey, activeBucket);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
if (activeBucket !== null) {
|
|
643
|
-
const writeRes = runtime.device.queue.writeBuffer(
|
|
644
|
-
activeBucket.buffer.handle,
|
|
645
|
-
0,
|
|
646
|
-
bucketPayload,
|
|
647
|
-
);
|
|
648
|
-
if (!writeRes.ok) {
|
|
649
|
-
runtime.errorRegistry.fire(writeRes.error);
|
|
650
|
-
} else {
|
|
651
|
-
spriteInstanceBuffer = activeBucket.buffer.handle;
|
|
652
|
-
spriteInstanceCount = foldHeadBucket.bucketSize;
|
|
653
|
-
}
|
|
654
|
-
}
|
|
541
|
+
const buffer = resolveFoldInstanceBuffer(c, foldHeadBucket, i);
|
|
542
|
+
if (buffer === null) continue;
|
|
543
|
+
spriteInstanceBuffer = buffer;
|
|
544
|
+
spriteInstanceCount = foldHeadBucket.bucketSize;
|
|
655
545
|
} else if (spriteInst !== undefined) {
|
|
656
546
|
const uniformFallback = runtime.device.caps.storageBuffer === false;
|
|
657
547
|
let spriteBufUsage = GPU_BUFFER_USAGE_STORAGE | GPU_BUFFER_USAGE_COPY_DST;
|
|
@@ -681,7 +571,7 @@ function recordSpriteEntityDraws(
|
|
|
681
571
|
);
|
|
682
572
|
spritePass.setBindGroup(3, spriteInstBg);
|
|
683
573
|
spritePass.drawIndexed(spriteEntry.mesh.indexCount, spriteInstanceCount, 0, 0, 0);
|
|
684
|
-
c.onRenderableDraw?.(spriteEntry);
|
|
574
|
+
c.onRenderableDraw?.(spriteEntry, 0);
|
|
685
575
|
continue;
|
|
686
576
|
}
|
|
687
577
|
spriteBufUsage = GPU_BUFFER_USAGE_UNIFORM | GPU_BUFFER_USAGE_COPY_DST;
|
|
@@ -814,102 +704,8 @@ function recordSpriteEntityDraws(
|
|
|
814
704
|
spritePass.setBindGroup(1, spritePassBg, [materialSlot * MATERIAL_PER_ENTITY_STRIDE]);
|
|
815
705
|
spritePass.setBindGroup(3, spriteInstancesBg);
|
|
816
706
|
spritePass.drawIndexed(spriteEntry.mesh.indexCount, spriteInstanceCount, 0, 0, 0);
|
|
817
|
-
c.onRenderableDraw?.(spriteEntry);
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
|
|
821
|
-
/**
|
|
822
|
-
* feat-20260704 M3/w19: resolve the interleaved SpriteInstances (@group(3))
|
|
823
|
-
* buffer + instanceCount for a sprite entity in the LDR blend sub-pass,
|
|
824
|
-
* extracted verbatim from recordSpriteEntityDraws. Uploads the interleaved
|
|
825
|
-
* mat4 + per-instance UV region transforms (cache-keyed on the snapshot); on
|
|
826
|
-
* over-cap fires the structured limit-exceeded error and leaves the passed-in
|
|
827
|
-
* fallback buffer/count. Returns the resolved (or unchanged) buffer + count.
|
|
828
|
-
*
|
|
829
|
-
* @internal
|
|
830
|
-
*/
|
|
831
|
-
function resolveSpriteInstancesBuffer(
|
|
832
|
-
c: _InternalRenderPipelineContext,
|
|
833
|
-
spriteEntry: _InternalRenderPipelineContext['validatedOrdered'][number],
|
|
834
|
-
fallbackBuffer: Buffer,
|
|
835
|
-
fallbackCount: number,
|
|
836
|
-
): { buffer: Buffer; count: number } {
|
|
837
|
-
const { runtime, frameState } = c;
|
|
838
|
-
let buffer = fallbackBuffer;
|
|
839
|
-
let count = fallbackCount;
|
|
840
|
-
const spriteInstancesSnap: SpriteInstancesSnapshot | undefined =
|
|
841
|
-
spriteEntry.source.spriteInstances;
|
|
842
|
-
if (spriteInstancesSnap !== undefined) {
|
|
843
|
-
const uniformFallback = runtime.device.caps.storageBuffer === false;
|
|
844
|
-
const interleaved = interleaveSpriteInstanceBuffer(
|
|
845
|
-
spriteInstancesSnap.transforms,
|
|
846
|
-
spriteInstancesSnap.regions,
|
|
847
|
-
!uniformFallback,
|
|
848
|
-
);
|
|
849
|
-
const requestedBytes = interleaved.byteLength;
|
|
850
|
-
const cap = runtime.device.limits.maxStorageBufferBindingSize;
|
|
851
|
-
if (typeof cap === 'number' && requestedBytes > cap) {
|
|
852
|
-
runtime.errorRegistry.fire(
|
|
853
|
-
new RhiError({
|
|
854
|
-
code: 'limit-exceeded',
|
|
855
|
-
expected: `requestedBytes (${requestedBytes}) <= maxStorageBufferBindingSize (${cap})`,
|
|
856
|
-
hint: 'reduce SpriteInstances instance count to fit within device.limits.maxStorageBufferBindingSize (144 bytes per instance: current mat4 64B + previous mat4 64B + region 16B)',
|
|
857
|
-
detail: {
|
|
858
|
-
maxStorageBufferBindingSize: cap,
|
|
859
|
-
requestedBytes,
|
|
860
|
-
},
|
|
861
|
-
}),
|
|
862
|
-
);
|
|
863
|
-
} else {
|
|
864
|
-
const cachedSpriteInst = frameState.instanceBuffers.get(
|
|
865
|
-
worldEntityKey(spriteEntry.source.worldId, spriteInstancesSnap.cacheKey),
|
|
866
|
-
);
|
|
867
|
-
let activeSpriteInst: InstanceBufferCacheEntry | null = null;
|
|
868
|
-
if (spriteInstancesCacheHit(cachedSpriteInst, spriteInstancesSnap, requestedBytes)) {
|
|
869
|
-
activeSpriteInst = cachedSpriteInst ?? null;
|
|
870
|
-
} else if (requestedBytes > 0) {
|
|
871
|
-
const bufRes = runtime.device.createBuffer({
|
|
872
|
-
size: requestedBytes,
|
|
873
|
-
usage:
|
|
874
|
-
(uniformFallback ? GPU_BUFFER_USAGE_UNIFORM : GPU_BUFFER_USAGE_STORAGE) |
|
|
875
|
-
GPU_BUFFER_USAGE_COPY_DST,
|
|
876
|
-
mappedAtCreation: false,
|
|
877
|
-
});
|
|
878
|
-
if (!bufRes.ok) {
|
|
879
|
-
runtime.errorRegistry.fire(bufRes.error);
|
|
880
|
-
} else {
|
|
881
|
-
if (cachedSpriteInst !== undefined && !cachedSpriteInst.buffer.isDestroyed) {
|
|
882
|
-
const r = cachedSpriteInst.buffer.destroy();
|
|
883
|
-
if (!r.ok) runtime.errorRegistry.fire(r.error);
|
|
884
|
-
}
|
|
885
|
-
const newBuf = new GpuBuffer(runtime.device, bufRes.value);
|
|
886
|
-
activeSpriteInst = {
|
|
887
|
-
buffer: newBuf,
|
|
888
|
-
uploadedArchVersion: spriteInstancesSnap.archVersion,
|
|
889
|
-
uploadedByteLength: requestedBytes,
|
|
890
|
-
};
|
|
891
|
-
frameState.instanceBuffers.set(
|
|
892
|
-
worldEntityKey(spriteEntry.source.worldId, spriteInstancesSnap.cacheKey),
|
|
893
|
-
activeSpriteInst,
|
|
894
|
-
);
|
|
895
|
-
}
|
|
896
|
-
}
|
|
897
|
-
if (activeSpriteInst !== null && requestedBytes > 0) {
|
|
898
|
-
const writeRes = runtime.device.queue.writeBuffer(
|
|
899
|
-
activeSpriteInst.buffer.handle,
|
|
900
|
-
0,
|
|
901
|
-
interleaved,
|
|
902
|
-
);
|
|
903
|
-
if (!writeRes.ok) {
|
|
904
|
-
runtime.errorRegistry.fire(writeRes.error);
|
|
905
|
-
} else {
|
|
906
|
-
buffer = activeSpriteInst.buffer.handle;
|
|
907
|
-
count = spriteInstancesSnap.instanceCount;
|
|
908
|
-
}
|
|
909
|
-
}
|
|
910
|
-
}
|
|
707
|
+
c.onRenderableDraw?.(spriteEntry, 0);
|
|
911
708
|
}
|
|
912
|
-
return { buffer, count };
|
|
913
709
|
}
|
|
914
710
|
|
|
915
711
|
function transparentPassColorFormat(
|