@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
|
@@ -30,6 +30,7 @@ import type { ManifestEntry } from '@forgeax/engine-types';
|
|
|
30
30
|
import { handleSlot } from '@forgeax/engine-types';
|
|
31
31
|
import { prewarmDepthOfField } from '../features/depth-of-field/depth-of-field-assembly';
|
|
32
32
|
import { prewarmAtmosphereShaders } from './atmosphere-shader-prewarm';
|
|
33
|
+
import { selectCloudShadowCompatibleEntry } from './cloud-shadow-entry';
|
|
33
34
|
import { prewarmSsrShaders } from './ssr-shader-prewarm';
|
|
34
35
|
|
|
35
36
|
export type { MaterialShaderManifestEntry } from '@forgeax/engine-shader';
|
|
@@ -85,11 +86,10 @@ import { deriveExtendedLightingCapability } from '../prepare/extended-lighting/r
|
|
|
85
86
|
import type { BloomPersistentBundle } from '../record/render-context';
|
|
86
87
|
import { SHADOW_CASTER_BUFFER_SIZE } from '../record/shadow-pass';
|
|
87
88
|
import { POINTS_LINES_VIEW_BUFFER_SIZE } from '../record/view-ubo';
|
|
88
|
-
import {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
type VolumetricFogShaderSources,
|
|
89
|
+
import type {
|
|
90
|
+
AtmosphereShaderSources,
|
|
91
|
+
SsrShaderSources,
|
|
92
|
+
VolumetricFogShaderSources,
|
|
93
93
|
} from '../render-contract';
|
|
94
94
|
import {
|
|
95
95
|
MATERIAL_PER_ENTITY_STRIDE,
|
|
@@ -129,6 +129,7 @@ import {
|
|
|
129
129
|
VIEW_UBO_BYTES,
|
|
130
130
|
} from './webgpu-ready-contract';
|
|
131
131
|
import { prewarmMipmapPipeline } from './webgpu-ready-mipmap';
|
|
132
|
+
import { createReadyPerPassResources } from './webgpu-ready-per-pass';
|
|
132
133
|
|
|
133
134
|
/**
|
|
134
135
|
* Build the `Renderer.initialization` Promise (D-S3 three-step strict-serial chain).
|
|
@@ -235,8 +236,7 @@ export async function buildReadyWebGPU(
|
|
|
235
236
|
): Promise<PipelineState> {
|
|
236
237
|
const extendedLightingShaderAvailable = deriveExtendedLightingCapability(rhiDevice).admitted;
|
|
237
238
|
// Shader and layout construction consume the same storage capability.
|
|
238
|
-
const capValue =
|
|
239
|
-
.maxStorageBuffersPerShaderStage;
|
|
239
|
+
const capValue = rhiDevice.limits.maxStorageBuffersPerShaderStage;
|
|
240
240
|
const webgl2Downlevel = rhiDevice.caps.backendKind === 'wgpu-webgl2';
|
|
241
241
|
let storageBufferCapable = !webgl2Downlevel && rhiDevice.caps.storageBuffer;
|
|
242
242
|
if (typeof capValue === 'number') {
|
|
@@ -590,11 +590,25 @@ export async function buildReadyWebGPU(
|
|
|
590
590
|
return wgsl !== undefined ? { ...entry, wgsl } : entry;
|
|
591
591
|
};
|
|
592
592
|
pbrEntry = patchRuntimeVariant(pbrEntry, 'forgeax::default-standard-pbr');
|
|
593
|
+
const pbrMaterialEntry = Array.from(registry.materialShaderManifestEntries()).find(
|
|
594
|
+
(entry) => entry.identifier === 'forgeax::default-standard-pbr',
|
|
595
|
+
);
|
|
596
|
+
pbrEntry = selectCloudShadowCompatibleEntry(pbrEntry, pbrMaterialEntry, projectorAvailable);
|
|
593
597
|
if (pbrSkinEntry !== undefined) {
|
|
594
598
|
pbrSkinEntry = patchRuntimeVariant(
|
|
595
599
|
patchRuntimeVariant(pbrSkinEntry, SKIN_MATERIAL_SHADER_ID),
|
|
596
600
|
'forgeax::default-standard-pbr-skin',
|
|
597
601
|
);
|
|
602
|
+
const pbrSkinMaterialEntry = Array.from(registry.materialShaderManifestEntries()).find(
|
|
603
|
+
(entry) =>
|
|
604
|
+
entry.identifier === SKIN_MATERIAL_SHADER_ID ||
|
|
605
|
+
entry.identifier === 'forgeax::default-standard-pbr-skin',
|
|
606
|
+
);
|
|
607
|
+
pbrSkinEntry = selectCloudShadowCompatibleEntry(
|
|
608
|
+
pbrSkinEntry,
|
|
609
|
+
pbrSkinMaterialEntry,
|
|
610
|
+
projectorAvailable,
|
|
611
|
+
);
|
|
598
612
|
}
|
|
599
613
|
unlitEntry = patchRuntimeVariant(unlitEntry, 'forgeax::default-unlit');
|
|
600
614
|
if (shadowCasterEntry !== undefined) {
|
|
@@ -693,7 +707,7 @@ export async function buildReadyWebGPU(
|
|
|
693
707
|
seedShaderModule,
|
|
694
708
|
});
|
|
695
709
|
for (const postProcess of requiredFullscreenPostProcesses) {
|
|
696
|
-
const label = postProcessShaderModuleLabel(postProcess.
|
|
710
|
+
const label = postProcessShaderModuleLabel(postProcess.source);
|
|
697
711
|
const shaderResult = await runShimStep(
|
|
698
712
|
() =>
|
|
699
713
|
asyncCreateShaderModule
|
|
@@ -1111,7 +1125,7 @@ export async function buildReadyWebGPU(
|
|
|
1111
1125
|
// frames (e.g. the hello-tonemap dawn smoke) would stall on a black frame
|
|
1112
1126
|
// forever. Mirror the shadow_caster prewarm: await-compile the tonemap module
|
|
1113
1127
|
// here and `seedShaderModule` it under the exact label
|
|
1114
|
-
// `buildPostProcessPipeline` requests (
|
|
1128
|
+
// `buildPostProcessPipeline` requests (keyed by shader source), so the
|
|
1115
1129
|
// first `getPostProcessPipeline(STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, …)` hits the module cache
|
|
1116
1130
|
// synchronously and builds the pipeline on frame 1.
|
|
1117
1131
|
const tonemapPrewarm = await runShimStep(
|
|
@@ -1119,27 +1133,18 @@ export async function buildReadyWebGPU(
|
|
|
1119
1133
|
asyncCreateShaderModule
|
|
1120
1134
|
? asyncCreateShaderModule(rhiDevice, {
|
|
1121
1135
|
code: tonemapEntry.wgsl,
|
|
1122
|
-
label: postProcessShaderModuleLabel(
|
|
1123
|
-
STANDARD_OUTPUT_TRANSFORM_FEATURE_ID,
|
|
1124
|
-
tonemapEntry.wgsl,
|
|
1125
|
-
),
|
|
1136
|
+
label: postProcessShaderModuleLabel(tonemapEntry.wgsl),
|
|
1126
1137
|
})
|
|
1127
1138
|
: invokeDeviceCreateShaderModule(rhiDevice, {
|
|
1128
1139
|
code: tonemapEntry.wgsl,
|
|
1129
|
-
label: postProcessShaderModuleLabel(
|
|
1130
|
-
STANDARD_OUTPUT_TRANSFORM_FEATURE_ID,
|
|
1131
|
-
tonemapEntry.wgsl,
|
|
1132
|
-
),
|
|
1140
|
+
label: postProcessShaderModuleLabel(tonemapEntry.wgsl),
|
|
1133
1141
|
}),
|
|
1134
1142
|
'shader-compile-failed',
|
|
1135
1143
|
'tonemap shader module compiled (unified post-process prewarm)',
|
|
1136
1144
|
'inspect manifest tonemap entry composed wgsl; check device.features',
|
|
1137
1145
|
);
|
|
1138
1146
|
if (!tonemapPrewarm.ok) throw tonemapPrewarm.error;
|
|
1139
|
-
seedShaderModule(
|
|
1140
|
-
postProcessShaderModuleLabel(STANDARD_OUTPUT_TRANSFORM_FEATURE_ID, tonemapEntry.wgsl),
|
|
1141
|
-
tonemapPrewarm.value,
|
|
1142
|
-
);
|
|
1147
|
+
seedShaderModule(postProcessShaderModuleLabel(tonemapEntry.wgsl), tonemapPrewarm.value);
|
|
1143
1148
|
registerBuiltinTonemap(tonemapEntry.wgsl);
|
|
1144
1149
|
|
|
1145
1150
|
// Prewarm temporal fullscreen modules before readiness so first-frame
|
|
@@ -1309,6 +1314,12 @@ export async function buildReadyWebGPU(
|
|
|
1309
1314
|
if (!fxaaShaderResult.ok) throw fxaaShaderResult.error;
|
|
1310
1315
|
fxaaModule = fxaaShaderResult.value;
|
|
1311
1316
|
registerBuiltinFxaa(fxaaEntry.wgsl);
|
|
1317
|
+
// The typed graph may need a second FXAA pipeline for a graph-owned
|
|
1318
|
+
// linear-LDR target (for example BarrelDistortion + FXAA). Seed the
|
|
1319
|
+
// shared post-process adapter with the already compiled module so that
|
|
1320
|
+
// this alternate color format is available on the first submitted
|
|
1321
|
+
// frame instead of waiting for an async recompile.
|
|
1322
|
+
seedShaderModule(postProcessShaderModuleLabel(fxaaEntry.wgsl), fxaaModule);
|
|
1312
1323
|
}
|
|
1313
1324
|
|
|
1314
1325
|
// feat-20260531-skybox-env-background M3 / w15: skybox shader module.
|
|
@@ -1428,7 +1439,7 @@ export async function buildReadyWebGPU(
|
|
|
1428
1439
|
// instances) and the 4-slot pipeline layout in one call, throwing on each
|
|
1429
1440
|
// device.createBindGroupLayout / device.createPipelineLayout failure.
|
|
1430
1441
|
// material BGL now carries 24 entries (canonical material 0..14 + Skylight
|
|
1431
|
-
// 15..
|
|
1442
|
+
// 15..20 + transmission 21..22); authored physical maps append after the
|
|
1432
1443
|
// engine-owned injections. The pipeline layout itself stays at 4 slots, no
|
|
1433
1444
|
// @group(4) allocated (D-5 round-4 fix for the round-2 maxBindGroups=4
|
|
1434
1445
|
// BLOCKER). The standalone unlit BGL is the 15-entry user region exposed by
|
|
@@ -1479,6 +1490,7 @@ export async function buildReadyWebGPU(
|
|
|
1479
1490
|
let hdrpPbrPipelineLayoutHandle: PipelineLayout | null = null;
|
|
1480
1491
|
let hdrpMeshBindGroupLayoutHandle: BindGroupLayout | null = null;
|
|
1481
1492
|
let hdrpProbePbrPipelineLayoutHandle: PipelineLayout | null = null;
|
|
1493
|
+
let hdrpUnifiedBglHandle: BindGroupLayout | null = null;
|
|
1482
1494
|
// The cluster layout is storage-buffer backed. On the WebGL2/fallback
|
|
1483
1495
|
// capability tier its uniform-buffer projection exceeds the backend's
|
|
1484
1496
|
// fragment-stage limit, and HDRP is not a valid route there anyway.
|
|
@@ -1486,6 +1498,7 @@ export async function buildReadyWebGPU(
|
|
|
1486
1498
|
const hdrpUnifiedBglDesc = createHdrpBindGroupLayoutDescriptor();
|
|
1487
1499
|
const hdrpUnifiedBglRes = rhiDevice.createBindGroupLayout(hdrpUnifiedBglDesc);
|
|
1488
1500
|
if (hdrpUnifiedBglRes.ok) {
|
|
1501
|
+
hdrpUnifiedBglHandle = hdrpUnifiedBglRes.value;
|
|
1489
1502
|
hdrpMeshBindGroupLayoutHandle = hdrpUnifiedBglRes.value;
|
|
1490
1503
|
const hdrpPlRes = rhiDevice.createPipelineLayout({
|
|
1491
1504
|
label: 'hdrp-pbr-pl',
|
|
@@ -1571,6 +1584,7 @@ export async function buildReadyWebGPU(
|
|
|
1571
1584
|
gpuDrivenInstancesBindGroupLayout: gpuDrivenInstancesBindGroupLayoutHandle,
|
|
1572
1585
|
gpuDrivenPbrPipelineLayout: gpuDrivenPbrPipelineLayoutHandle,
|
|
1573
1586
|
gpuDrivenPbrSkinPipelineLayout: gpuDrivenPbrSkinPipelineLayoutHandle,
|
|
1587
|
+
surfaceDirectInstancesBindGroupLayout: surfaceDirectInstancesBindGroupLayoutHandle,
|
|
1574
1588
|
} = buildGpuDrivenPbrReadyLayouts(rhiDevice, storageBufferCapable, pbrLayouts.value);
|
|
1575
1589
|
let hdrpSkinPipelineLayoutHandle: PipelineLayout | null = null;
|
|
1576
1590
|
let hdrpSkinMeshBindGroupLayoutHandle: BindGroupLayout | null = null;
|
|
@@ -1595,6 +1609,46 @@ export async function buildReadyWebGPU(
|
|
|
1595
1609
|
}
|
|
1596
1610
|
}
|
|
1597
1611
|
|
|
1612
|
+
// GPU-driven Standard batches use the compact scene-index slot(3) while
|
|
1613
|
+
// retaining the same clustered group(2) bind group that the ordinary main
|
|
1614
|
+
// pass publishes. Build a matching pipeline layout from those exact
|
|
1615
|
+
// producer-owned layouts; a separate URP mesh-array layout would validate
|
|
1616
|
+
// the indirect draw but reject its clustered bind group at encode time.
|
|
1617
|
+
let gpuDrivenClusterPbrPipelineLayoutHandle: PipelineLayout | null = null;
|
|
1618
|
+
let gpuDrivenClusterPbrSkinPipelineLayoutHandle: PipelineLayout | null = null;
|
|
1619
|
+
if (
|
|
1620
|
+
storageBufferCapable &&
|
|
1621
|
+
hdrpUnifiedBglHandle !== null &&
|
|
1622
|
+
gpuDrivenInstancesBindGroupLayoutHandle !== null
|
|
1623
|
+
) {
|
|
1624
|
+
const rigidResult = rhiDevice.createPipelineLayout({
|
|
1625
|
+
label: 'pbr-gpu-driven-cluster-pl',
|
|
1626
|
+
bindGroupLayouts: [
|
|
1627
|
+
viewBglResult.value,
|
|
1628
|
+
materialBglResult.value,
|
|
1629
|
+
hdrpUnifiedBglHandle,
|
|
1630
|
+
gpuDrivenInstancesBindGroupLayoutHandle,
|
|
1631
|
+
],
|
|
1632
|
+
});
|
|
1633
|
+
if (rigidResult.ok) gpuDrivenClusterPbrPipelineLayoutHandle = rigidResult.value;
|
|
1634
|
+
}
|
|
1635
|
+
if (
|
|
1636
|
+
storageBufferCapable &&
|
|
1637
|
+
hdrpSkinMeshBindGroupLayoutHandle !== null &&
|
|
1638
|
+
gpuDrivenInstancesBindGroupLayoutHandle !== null
|
|
1639
|
+
) {
|
|
1640
|
+
const skinResult = rhiDevice.createPipelineLayout({
|
|
1641
|
+
label: 'pbr-skin-gpu-driven-cluster-pl',
|
|
1642
|
+
bindGroupLayouts: [
|
|
1643
|
+
viewBglResult.value,
|
|
1644
|
+
materialBglResult.value,
|
|
1645
|
+
hdrpSkinMeshBindGroupLayoutHandle,
|
|
1646
|
+
gpuDrivenInstancesBindGroupLayoutHandle,
|
|
1647
|
+
],
|
|
1648
|
+
});
|
|
1649
|
+
if (skinResult.ok) gpuDrivenClusterPbrSkinPipelineLayoutHandle = skinResult.value;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1598
1652
|
// feat-20260612-skin-palette-per-frame-upload M1 / m1-2: skin palette
|
|
1599
1653
|
// allocator. Replaces the prior 16320 B identity-seeded UBO stub (PR #353,
|
|
1600
1654
|
// feat-20260611 R2 / M8 / w28 IS-14, retired identity-buffer field) with
|
|
@@ -1622,9 +1676,7 @@ export async function buildReadyWebGPU(
|
|
|
1622
1676
|
const skinPaletteLimitKey = storageBufferCapable
|
|
1623
1677
|
? 'maxStorageBufferBindingSize'
|
|
1624
1678
|
: 'maxUniformBufferBindingSize';
|
|
1625
|
-
const skinPaletteDeviceLimit =
|
|
1626
|
-
skinPaletteLimitKey
|
|
1627
|
-
];
|
|
1679
|
+
const skinPaletteDeviceLimit = rhiDevice.limits[skinPaletteLimitKey];
|
|
1628
1680
|
const SKIN_PALETTE_MAX_BINDING_BYTES =
|
|
1629
1681
|
typeof skinPaletteDeviceLimit === 'number' && skinPaletteDeviceLimit > 0
|
|
1630
1682
|
? skinPaletteDeviceLimit
|
|
@@ -2016,6 +2068,24 @@ export async function buildReadyWebGPU(
|
|
|
2016
2068
|
);
|
|
2017
2069
|
if (!defaultSamplerResult.ok) throw defaultSamplerResult.error;
|
|
2018
2070
|
|
|
2071
|
+
// r32float Surface raw-depth views are unfilterable. Keep their sampler
|
|
2072
|
+
// distinct from the filtering material sampler so WebGPU's sample-type
|
|
2073
|
+
// validation remains explicit at the material BGL boundary.
|
|
2074
|
+
const surfaceMediumDepthSamplerResult = runShimSyncStep(
|
|
2075
|
+
() =>
|
|
2076
|
+
rhiDevice.createSampler({
|
|
2077
|
+
label: 'surface-medium-depth-sampler',
|
|
2078
|
+
magFilter: 'nearest',
|
|
2079
|
+
minFilter: 'nearest',
|
|
2080
|
+
addressModeU: 'clamp-to-edge',
|
|
2081
|
+
addressModeV: 'clamp-to-edge',
|
|
2082
|
+
}),
|
|
2083
|
+
'webgpu-runtime-error',
|
|
2084
|
+
'createSampler (single-layer medium raw depth) succeeded',
|
|
2085
|
+
'check device.limits.maxSamplersPerShaderStage',
|
|
2086
|
+
);
|
|
2087
|
+
if (!surfaceMediumDepthSamplerResult.ok) throw surfaceMediumDepthSamplerResult.error;
|
|
2088
|
+
|
|
2019
2089
|
// feat-20260520-directional-light-shadow-mapping M1c / w8 + M2 / w14:
|
|
2020
2090
|
// shadow comparison sampler — clamp-to-edge, linear filter, compare:'less'.
|
|
2021
2091
|
// Used for shadow map sampling in M2/M3 and shadow depth pass. comparison
|
|
@@ -3879,6 +3949,18 @@ export async function buildReadyWebGPU(
|
|
|
3879
3949
|
gpuDrivenPbrPrograms,
|
|
3880
3950
|
gpuDrivenPbrSkinPipelineLayout:
|
|
3881
3951
|
unlitModule !== null && pbrModule !== null ? gpuDrivenPbrSkinPipelineLayoutHandle : null,
|
|
3952
|
+
surfaceDirectInstancesBindGroupLayout:
|
|
3953
|
+
unlitModule !== null && pbrModule !== null
|
|
3954
|
+
? surfaceDirectInstancesBindGroupLayoutHandle
|
|
3955
|
+
: null,
|
|
3956
|
+
gpuDrivenClusterPbrPipelineLayout:
|
|
3957
|
+
unlitModule !== null && pbrModule !== null ? gpuDrivenClusterPbrPipelineLayoutHandle : null,
|
|
3958
|
+
gpuDrivenClusterPbrSkinPipelineLayout:
|
|
3959
|
+
unlitModule !== null && pbrModule !== null
|
|
3960
|
+
? gpuDrivenClusterPbrSkinPipelineLayoutHandle
|
|
3961
|
+
: null,
|
|
3962
|
+
gpuDrivenClusterMeshBindGroupLayout:
|
|
3963
|
+
unlitModule !== null && pbrModule !== null ? hdrpUnifiedBglHandle : null,
|
|
3882
3964
|
// HDRP variant uses the unified group(2) layout built above.
|
|
3883
3965
|
hdrpPbrPipelineLayout:
|
|
3884
3966
|
unlitModule !== null && pbrModule !== null ? hdrpPbrPipelineLayoutHandle : null,
|
|
@@ -3924,6 +4006,7 @@ export async function buildReadyWebGPU(
|
|
|
3924
4006
|
probeInstancesBindGroupLayout: probeInstancesBglResult.value,
|
|
3925
4007
|
identityInstanceBuffer: identityInstanceResult.value,
|
|
3926
4008
|
defaultSampler: defaultSamplerResult.value,
|
|
4009
|
+
surfaceMediumDepthSampler: surfaceMediumDepthSamplerResult.value,
|
|
3927
4010
|
fallbackTextureView: fallbackTextureViewResult.value,
|
|
3928
4011
|
defaultWhiteTextureView: fallbackTextureViewResult.value,
|
|
3929
4012
|
// Exactly neutral half-float RG=(0.5,0.5) decodes to tangent (0,0,1).
|
|
@@ -3952,44 +4035,15 @@ export async function buildReadyWebGPU(
|
|
|
3952
4035
|
// matrices fold into the View UBO tail (`view.spotLightViewProj`); no
|
|
3953
4036
|
// dedicated buffer / view-BG binding 9 (WebGL2 uniform-buffer budget).
|
|
3954
4037
|
skylightFallback,
|
|
3955
|
-
|
|
3956
|
-
// per-pass mutable resource slots moved to PerPassResources.
|
|
3957
|
-
perPassResources: {
|
|
3958
|
-
depthTexture: null,
|
|
3959
|
-
depthTextureView: null,
|
|
3960
|
-
depthTextureWidth: 0,
|
|
3961
|
-
depthTextureHeight: 0,
|
|
3962
|
-
configured: false,
|
|
3963
|
-
hdrColorTexture: null,
|
|
3964
|
-
hdrColorView: null,
|
|
3965
|
-
hdrDepthTexture: null,
|
|
3966
|
-
hdrDepthView: null,
|
|
3967
|
-
hdrTextureWidth: 0,
|
|
3968
|
-
hdrTextureHeight: 0,
|
|
3969
|
-
hdrDepthSampleCount: 1,
|
|
4038
|
+
perPassResources: createReadyPerPassResources({
|
|
3970
4039
|
fxaaPipeline: fxaaPipelineHandle,
|
|
3971
4040
|
fxaaBindGroupLayout: fxaaBglHandle,
|
|
3972
4041
|
fxaaSampler: fxaaSamplerHandle,
|
|
3973
|
-
// feat-20260604-learn-render-4.10-anti-aliasing-msaa M2 / w7: MSAA
|
|
3974
|
-
// attachment slots. All null/0 until the first antialias='msaa' frame.
|
|
3975
|
-
msaaColorTexture: null,
|
|
3976
|
-
msaaColorView: null,
|
|
3977
|
-
msaaSpriteColorTexture: null,
|
|
3978
|
-
msaaSpriteColorView: null,
|
|
3979
|
-
msaaDepthTexture: null,
|
|
3980
|
-
msaaDepthView: null,
|
|
3981
|
-
msaaTextureWidth: 0,
|
|
3982
|
-
msaaTextureHeight: 0,
|
|
3983
|
-
hdrColorMsaaTexture: null,
|
|
3984
|
-
hdrColorMsaaView: null,
|
|
3985
4042
|
skyboxPipeline: skyboxPipelineHandle,
|
|
3986
4043
|
skyboxPipelineMsaa: skyboxPipelineMsaaHandle,
|
|
3987
4044
|
skyboxBindGroupLayout: skyboxBglHandle,
|
|
3988
4045
|
skyboxSampler: skyboxSamplerHandle,
|
|
3989
4046
|
skyboxRotationBuffer: skyboxRotationBufferHandle,
|
|
3990
|
-
shadowTexture: null,
|
|
3991
|
-
shadowMapSize: 0,
|
|
3992
|
-
shadowCascadeCount: 0,
|
|
3993
4047
|
shadowSampler: shadowSamplerResult.value,
|
|
3994
4048
|
shadowLightSpaceMatrix: null,
|
|
3995
4049
|
shadowCsmLightViewProj: null,
|
|
@@ -4020,13 +4074,13 @@ export async function buildReadyWebGPU(
|
|
|
4020
4074
|
ssaoCalcPipeline: ssaoCalcPipelineHandle,
|
|
4021
4075
|
ssaoBlurPipeline: ssaoBlurPipelineHandle,
|
|
4022
4076
|
ssaoBgl: ssaoBglHandle,
|
|
4023
|
-
|
|
4024
|
-
// and the 1x1 ssaoRaw fallback view are constant across frames and
|
|
4025
|
-
// cached after first construction.
|
|
4026
|
-
ssaoFilteringSampler: null,
|
|
4027
|
-
ssaoDepthSampler: null,
|
|
4028
|
-
ssaoFallbackRawView: null,
|
|
4029
|
-
},
|
|
4077
|
+
}),
|
|
4030
4078
|
};
|
|
4079
|
+
// Boot-time fallback resources submit real GPU work before the renderer is
|
|
4080
|
+
// published. Keep initialization as the readiness barrier for the first
|
|
4081
|
+
// frame: a Worker can otherwise receive `ready`, start its frame deadline,
|
|
4082
|
+
// and report `frame-submitted` while that earlier queue work still holds the
|
|
4083
|
+
// receipt's completion fence.
|
|
4084
|
+
await queue.onSubmittedWorkDone();
|
|
4031
4085
|
return pipelineState;
|
|
4032
4086
|
}
|
|
@@ -53,18 +53,6 @@ export async function tryCreateWebGPURenderer(
|
|
|
53
53
|
onDeviceLost: (detail) => lossObserver.current?.(detail),
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
if (pack._internal_getRawDevice && pack.translateErrorEventToRhiError) {
|
|
57
|
-
const backendDevice = pack._internal_getRawDevice(device);
|
|
58
|
-
if (backendDevice && typeof backendDevice === 'object') {
|
|
59
|
-
const target = backendDevice as {
|
|
60
|
-
onuncapturederror?: ((event: unknown) => void) | null;
|
|
61
|
-
};
|
|
62
|
-
target.onuncapturederror = (event: unknown): void => {
|
|
63
|
-
const translated = pack.translateErrorEventToRhiError?.(event);
|
|
64
|
-
if (translated && !translated.ok) errorRegistry.fire(translated.error);
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
56
|
return {
|
|
69
57
|
kind: 'ok',
|
|
70
58
|
renderer: await createRenderer({
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import type { Buffer } from '@forgeax/engine-rhi';
|
|
2
|
+
import { err, ok } from '@forgeax/engine-rhi';
|
|
3
|
+
import { type RenderError, RendererContractFailureError } from '../errors/render';
|
|
4
|
+
import type { FrameReceipt, RenderResult } from '../render-contract';
|
|
5
|
+
import type { TypedFrameObservationCapture } from '../typed-render-graph-primitives';
|
|
6
|
+
import { disposeObservationCaptureSet } from './webgpu-renderer-observation';
|
|
7
|
+
|
|
8
|
+
export type ObservationCaptureRead = () => Promise<
|
|
9
|
+
RenderResult<
|
|
10
|
+
readonly {
|
|
11
|
+
readonly capture: TypedFrameObservationCapture;
|
|
12
|
+
readonly bytes: Uint8Array;
|
|
13
|
+
}[],
|
|
14
|
+
RenderError
|
|
15
|
+
>
|
|
16
|
+
>;
|
|
17
|
+
|
|
18
|
+
export interface RendererObservationCaptureOwner {
|
|
19
|
+
readonly observationCaptureOwner: {
|
|
20
|
+
register(capture: TypedFrameObservationCapture): void;
|
|
21
|
+
consume(frameNumber: number): readonly TypedFrameObservationCapture[];
|
|
22
|
+
drain(): readonly TypedFrameObservationCapture[];
|
|
23
|
+
};
|
|
24
|
+
readonly stats: {
|
|
25
|
+
allocationCount: number;
|
|
26
|
+
liveCount: number;
|
|
27
|
+
peakLiveCount: number;
|
|
28
|
+
mapCount: number;
|
|
29
|
+
readbackCount: number;
|
|
30
|
+
liveByteLength: number;
|
|
31
|
+
};
|
|
32
|
+
expectedGraphGeneration: number | undefined;
|
|
33
|
+
readonly receiptObservationCaptures: Map<FrameReceipt, ObservationCaptureRead>;
|
|
34
|
+
readonly receiptObservationBuffers: Map<FrameReceipt, readonly TypedFrameObservationCapture[]>;
|
|
35
|
+
readonly destroyedObservationBuffers: WeakSet<Buffer>;
|
|
36
|
+
readonly observationBufferCleanupFailures: WeakMap<Buffer, RendererContractFailureError>;
|
|
37
|
+
readonly failedObservationCaptures: Map<Buffer, TypedFrameObservationCapture>;
|
|
38
|
+
readonly disposeObservationCaptures: (
|
|
39
|
+
captures: readonly TypedFrameObservationCapture[],
|
|
40
|
+
) => RendererContractFailureError | undefined;
|
|
41
|
+
readonly disposeOwnedObservationCaptures: (
|
|
42
|
+
captures: readonly TypedFrameObservationCapture[],
|
|
43
|
+
) => RendererContractFailureError | undefined;
|
|
44
|
+
readonly readObservationCapture: (
|
|
45
|
+
capture: TypedFrameObservationCapture,
|
|
46
|
+
) => Promise<RenderResult<Uint8Array, RenderError>>;
|
|
47
|
+
readonly disposeReceiptObservationCaptures: () => RendererContractFailureError | undefined;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function createRendererObservationCaptureOwner(
|
|
51
|
+
fireError: (error: RendererContractFailureError) => void,
|
|
52
|
+
): RendererObservationCaptureOwner {
|
|
53
|
+
const stats = {
|
|
54
|
+
allocationCount: 0,
|
|
55
|
+
liveCount: 0,
|
|
56
|
+
peakLiveCount: 0,
|
|
57
|
+
mapCount: 0,
|
|
58
|
+
readbackCount: 0,
|
|
59
|
+
liveByteLength: 0,
|
|
60
|
+
};
|
|
61
|
+
const capturesByFrame = new Map<number, TypedFrameObservationCapture[]>();
|
|
62
|
+
const observationCaptureOwner = {
|
|
63
|
+
register(capture: TypedFrameObservationCapture): void {
|
|
64
|
+
const captures = capturesByFrame.get(capture.frameNumber) ?? [];
|
|
65
|
+
captures.push(capture);
|
|
66
|
+
capturesByFrame.set(capture.frameNumber, captures);
|
|
67
|
+
stats.allocationCount += 1;
|
|
68
|
+
stats.liveCount += 1;
|
|
69
|
+
stats.peakLiveCount = Math.max(stats.peakLiveCount, stats.liveCount);
|
|
70
|
+
stats.liveByteLength += capture.bytesPerRow * capture.height;
|
|
71
|
+
},
|
|
72
|
+
consume(frameNumber: number): readonly TypedFrameObservationCapture[] {
|
|
73
|
+
const captures = capturesByFrame.get(frameNumber) ?? [];
|
|
74
|
+
capturesByFrame.delete(frameNumber);
|
|
75
|
+
return Object.freeze(captures);
|
|
76
|
+
},
|
|
77
|
+
drain(): readonly TypedFrameObservationCapture[] {
|
|
78
|
+
const captures = [...capturesByFrame.values()].flat();
|
|
79
|
+
capturesByFrame.clear();
|
|
80
|
+
return Object.freeze(captures);
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
const destroyedObservationBuffers = new WeakSet<Buffer>();
|
|
84
|
+
const observationBufferCleanupFailures = new WeakMap<Buffer, RendererContractFailureError>();
|
|
85
|
+
const failedObservationCaptures = new Map<Buffer, TypedFrameObservationCapture>();
|
|
86
|
+
const disposeObservationCaptures = (
|
|
87
|
+
captures: readonly TypedFrameObservationCapture[],
|
|
88
|
+
): RendererContractFailureError | undefined => {
|
|
89
|
+
const wasDestroyed = new Set(
|
|
90
|
+
captures
|
|
91
|
+
.filter((capture) => destroyedObservationBuffers.has(capture.buffer))
|
|
92
|
+
.map((capture) => capture.buffer),
|
|
93
|
+
);
|
|
94
|
+
const result = disposeObservationCaptureSet(
|
|
95
|
+
captures,
|
|
96
|
+
destroyedObservationBuffers,
|
|
97
|
+
observationBufferCleanupFailures,
|
|
98
|
+
fireError,
|
|
99
|
+
);
|
|
100
|
+
for (const capture of captures) {
|
|
101
|
+
if (!wasDestroyed.has(capture.buffer) && destroyedObservationBuffers.has(capture.buffer)) {
|
|
102
|
+
stats.liveCount = Math.max(0, stats.liveCount - 1);
|
|
103
|
+
stats.liveByteLength = Math.max(
|
|
104
|
+
0,
|
|
105
|
+
stats.liveByteLength - capture.bytesPerRow * capture.height,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return result;
|
|
110
|
+
};
|
|
111
|
+
const disposeOwnedObservationCaptures = (
|
|
112
|
+
captures: readonly TypedFrameObservationCapture[],
|
|
113
|
+
): RendererContractFailureError | undefined => {
|
|
114
|
+
const failure = disposeObservationCaptures(captures);
|
|
115
|
+
if (failure !== undefined) {
|
|
116
|
+
for (const capture of captures) {
|
|
117
|
+
if (!destroyedObservationBuffers.has(capture.buffer)) {
|
|
118
|
+
failedObservationCaptures.set(capture.buffer, capture);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return failure;
|
|
123
|
+
};
|
|
124
|
+
const readObservationCapture = async (
|
|
125
|
+
capture: TypedFrameObservationCapture,
|
|
126
|
+
): Promise<RenderResult<Uint8Array, RenderError>> => {
|
|
127
|
+
try {
|
|
128
|
+
if (typeof capture.buffer.mapAsync !== 'function') {
|
|
129
|
+
const cleanupFailure = disposeObservationCaptures([capture]);
|
|
130
|
+
return err(
|
|
131
|
+
cleanupFailure ??
|
|
132
|
+
new RendererContractFailureError(
|
|
133
|
+
'observe',
|
|
134
|
+
`the ${capture.domain} receipt-bound readback backend has no mapAsync capability`,
|
|
135
|
+
),
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
stats.mapCount += 1;
|
|
139
|
+
const mapped = await capture.buffer.mapAsync(1);
|
|
140
|
+
if (!mapped.ok) {
|
|
141
|
+
const cleanupFailure = disposeObservationCaptures([capture]);
|
|
142
|
+
return err(
|
|
143
|
+
cleanupFailure ??
|
|
144
|
+
new RendererContractFailureError(
|
|
145
|
+
'observe',
|
|
146
|
+
`mapping ${capture.domain} receipt-bound readback failed: ${mapped.error.code}`,
|
|
147
|
+
),
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
const range = mapped.value.getMappedRange();
|
|
151
|
+
if (!range.ok) {
|
|
152
|
+
mapped.value.unmap();
|
|
153
|
+
const cleanupFailure = disposeObservationCaptures([capture]);
|
|
154
|
+
return err(
|
|
155
|
+
cleanupFailure ??
|
|
156
|
+
new RendererContractFailureError(
|
|
157
|
+
'observe',
|
|
158
|
+
`reading ${capture.domain} receipt-bound readback failed: ${range.error.code}`,
|
|
159
|
+
),
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
const bytes = new Uint8Array(range.value.slice(0));
|
|
163
|
+
mapped.value.unmap();
|
|
164
|
+
stats.readbackCount += 1;
|
|
165
|
+
const cleanupFailure = disposeObservationCaptures([capture]);
|
|
166
|
+
if (cleanupFailure !== undefined) return err(cleanupFailure);
|
|
167
|
+
return ok(bytes);
|
|
168
|
+
} catch (cause) {
|
|
169
|
+
const cleanupFailure = disposeObservationCaptures([capture]);
|
|
170
|
+
return err(
|
|
171
|
+
cleanupFailure ??
|
|
172
|
+
new RendererContractFailureError(
|
|
173
|
+
'observe',
|
|
174
|
+
`reading ${capture.domain} receipt-bound readback threw: ${
|
|
175
|
+
cause instanceof Error ? cause.message : String(cause)
|
|
176
|
+
}`,
|
|
177
|
+
),
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
const receiptObservationCaptures = new Map<FrameReceipt, ObservationCaptureRead>();
|
|
182
|
+
const receiptObservationBuffers = new Map<
|
|
183
|
+
FrameReceipt,
|
|
184
|
+
readonly TypedFrameObservationCapture[]
|
|
185
|
+
>();
|
|
186
|
+
const owner: RendererObservationCaptureOwner = {
|
|
187
|
+
observationCaptureOwner,
|
|
188
|
+
stats,
|
|
189
|
+
expectedGraphGeneration: undefined,
|
|
190
|
+
receiptObservationCaptures,
|
|
191
|
+
receiptObservationBuffers,
|
|
192
|
+
destroyedObservationBuffers,
|
|
193
|
+
observationBufferCleanupFailures,
|
|
194
|
+
failedObservationCaptures,
|
|
195
|
+
disposeObservationCaptures,
|
|
196
|
+
disposeOwnedObservationCaptures,
|
|
197
|
+
readObservationCapture,
|
|
198
|
+
disposeReceiptObservationCaptures: () => {
|
|
199
|
+
let firstFailure: RendererContractFailureError | undefined;
|
|
200
|
+
for (const [receipt, captures] of receiptObservationBuffers) {
|
|
201
|
+
const failure = disposeObservationCaptures(captures);
|
|
202
|
+
firstFailure ??= failure;
|
|
203
|
+
if (captures.every((capture) => destroyedObservationBuffers.has(capture.buffer))) {
|
|
204
|
+
receiptObservationBuffers.delete(receipt);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
receiptObservationCaptures.clear();
|
|
208
|
+
const retryCaptures = [...failedObservationCaptures.values()];
|
|
209
|
+
const retryFailure = disposeObservationCaptures(retryCaptures);
|
|
210
|
+
firstFailure ??= retryFailure;
|
|
211
|
+
for (const capture of retryCaptures) {
|
|
212
|
+
if (destroyedObservationBuffers.has(capture.buffer)) {
|
|
213
|
+
failedObservationCaptures.delete(capture.buffer);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const ownedFailure = disposeOwnedObservationCaptures(observationCaptureOwner.drain());
|
|
217
|
+
firstFailure ??= ownedFailure;
|
|
218
|
+
return firstFailure;
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
return owner;
|
|
222
|
+
}
|