@forgeax/engine-render 0.1.20 → 0.1.23
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 +365 -29
- package/dist/assembly/backend-contract.d.ts +13 -0
- package/dist/assembly/backend-contract.d.ts.map +1 -1
- package/dist/assembly/device-feature-admission.d.ts +18 -0
- package/dist/assembly/device-feature-admission.d.ts.map +1 -0
- package/dist/assembly/directional-shadow-inspection.d.ts +38 -0
- package/dist/assembly/directional-shadow-inspection.d.ts.map +1 -0
- package/dist/assembly/factory.d.ts +30 -19
- package/dist/assembly/factory.d.ts.map +1 -1
- package/dist/assembly/host-contract.d.ts +19 -0
- package/dist/assembly/host-contract.d.ts.map +1 -1
- package/dist/assembly/render-target-host.d.ts +46 -0
- package/dist/assembly/render-target-host.d.ts.map +1 -0
- package/dist/assets/render-asset-port.d.ts.map +1 -1
- package/dist/authoring.mjs +4 -1
- package/dist/authoring.mjs.map +1 -1
- package/dist/capture/cube-views.d.ts +21 -0
- package/dist/capture/cube-views.d.ts.map +1 -0
- package/dist/capture/scheduler.d.ts +54 -0
- package/dist/capture/scheduler.d.ts.map +1 -0
- package/dist/{chunk-PCHBPYML.mjs → chunk-4L3P6DT5.mjs} +2 -2
- package/dist/chunk-4L3P6DT5.mjs.map +1 -0
- package/dist/{chunk-VFPLTKCU.mjs → chunk-4NPUASZR.mjs} +15 -4
- package/dist/chunk-4NPUASZR.mjs.map +1 -0
- package/dist/chunk-DIYW3M5D.mjs +5085 -0
- package/dist/chunk-DIYW3M5D.mjs.map +1 -0
- package/dist/chunk-FBC4R44J.mjs +1003 -0
- package/dist/chunk-FBC4R44J.mjs.map +1 -0
- package/dist/{chunk-CDTWTHZR.mjs → chunk-FF7K3FSO.mjs} +474 -168
- package/dist/chunk-FF7K3FSO.mjs.map +1 -0
- package/dist/chunk-HZUPSYW7.mjs +1104 -0
- package/dist/chunk-HZUPSYW7.mjs.map +1 -0
- package/dist/{chunk-TBQJOK2L.mjs → chunk-QODA5UKU.mjs} +321 -269
- package/dist/chunk-QODA5UKU.mjs.map +1 -0
- package/dist/chunk-YALPS44A.mjs +296 -0
- package/dist/chunk-YALPS44A.mjs.map +1 -0
- package/dist/{chunk-4XINDLAY.mjs → chunk-ZUWKAZ2I.mjs} +1963 -2178
- package/dist/chunk-ZUWKAZ2I.mjs.map +1 -0
- package/dist/cluster-binner.d.ts +5 -0
- package/dist/cluster-binner.d.ts.map +1 -1
- package/dist/components/camera.d.ts +1 -0
- package/dist/components/camera.d.ts.map +1 -1
- package/dist/components/cube-camera.d.ts +20 -0
- package/dist/components/cube-camera.d.ts.map +1 -0
- package/dist/components/directional-light.d.ts +11 -2
- package/dist/components/directional-light.d.ts.map +1 -1
- package/dist/components/directional-shadow-filter.d.ts +25 -0
- package/dist/components/directional-shadow-filter.d.ts.map +1 -0
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/light-helpers.d.ts +4 -0
- package/dist/components/light-helpers.d.ts.map +1 -1
- package/dist/components/light-probe.d.ts +9 -0
- package/dist/components/light-probe.d.ts.map +1 -0
- package/dist/components/rect-area-light.d.ts +12 -0
- package/dist/components/rect-area-light.d.ts.map +1 -0
- package/dist/components/reflection-probe.d.ts +17 -0
- package/dist/components/reflection-probe.d.ts.map +1 -0
- package/dist/components/scene-instance.d.ts +4 -0
- package/dist/components/scene-instance.d.ts.map +1 -1
- package/dist/components/spot-light.d.ts +3 -0
- package/dist/components/spot-light.d.ts.map +1 -1
- package/dist/construct-renderer.mjs +14836 -9620
- package/dist/construct-renderer.mjs.map +1 -1
- package/dist/device/gpu-residency.d.ts +8 -1
- package/dist/device/gpu-residency.d.ts.map +1 -1
- package/dist/device/lifecycle-transaction.d.ts +2 -0
- package/dist/device/lifecycle-transaction.d.ts.map +1 -0
- package/dist/environment/frame.d.ts.map +1 -1
- package/dist/environment/lifecycle.d.ts +5 -0
- package/dist/environment/lifecycle.d.ts.map +1 -1
- package/dist/errors/gpu-driven.d.ts +26 -0
- package/dist/errors/gpu-driven.d.ts.map +1 -0
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/recover.d.ts +9 -1
- package/dist/errors/recover.d.ts.map +1 -1
- package/dist/errors/render.d.ts +166 -93
- package/dist/errors/render.d.ts.map +1 -1
- package/dist/extract/directional-shadow-projection.d.ts +23 -0
- package/dist/extract/directional-shadow-projection.d.ts.map +1 -0
- package/dist/extract/environment.d.ts +14 -0
- package/dist/extract/environment.d.ts.map +1 -1
- package/dist/extract/gpu-driven.d.ts +50 -0
- package/dist/extract/gpu-driven.d.ts.map +1 -0
- package/dist/extract/visibility.d.ts.map +1 -1
- package/dist/features/fullscreen.d.ts.map +1 -1
- package/dist/features/targets.d.ts.map +1 -1
- package/dist/features/types.d.ts +10 -0
- package/dist/features/types.d.ts.map +1 -1
- package/dist/fullscreen-post-process-pass.d.ts +13 -2
- package/dist/fullscreen-post-process-pass.d.ts.map +1 -1
- package/dist/gpu-driven/batch-topology.d.ts +34 -0
- package/dist/gpu-driven/batch-topology.d.ts.map +1 -1
- package/dist/gpu-driven/prepared-draw.d.ts +63 -0
- package/dist/gpu-driven/prepared-draw.d.ts.map +1 -0
- package/dist/gpu-driven/production-raster.d.ts +97 -2
- package/dist/gpu-driven/production-raster.d.ts.map +1 -1
- package/dist/gpu-driven/view-gpu.d.ts +64 -1
- package/dist/gpu-driven/view-gpu.d.ts.map +1 -1
- package/dist/gpu-scene-schema.d.ts +14 -0
- package/dist/gpu-scene-schema.d.ts.map +1 -1
- package/dist/gpu-scene.d.ts +8 -1
- package/dist/gpu-scene.d.ts.map +1 -1
- package/dist/gpu-usage.d.ts +0 -1
- package/dist/gpu-usage.d.ts.map +1 -1
- package/dist/hdrp-buffers.d.ts +21 -19
- package/dist/hdrp-buffers.d.ts.map +1 -1
- package/dist/ibl/IblPipelineCache.d.ts +4 -0
- package/dist/ibl/IblPipelineCache.d.ts.map +1 -1
- package/dist/ibl/kernel-cache.d.ts +36 -0
- package/dist/ibl/kernel-cache.d.ts.map +1 -0
- package/dist/index.d.ts +39 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +91 -6
- package/dist/index.mjs.map +1 -1
- package/dist/inspection-types.d.ts +214 -1
- package/dist/inspection-types.d.ts.map +1 -1
- package/dist/instances-derived-bounds.d.ts +50 -0
- package/dist/instances-derived-bounds.d.ts.map +1 -0
- package/dist/internal.d.ts +9 -0
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.mjs +23 -2
- package/dist/internal.mjs.map +1 -1
- package/dist/light-buffer-layout.d.ts +58 -140
- package/dist/light-buffer-layout.d.ts.map +1 -1
- package/dist/materials.d.ts.map +1 -1
- package/dist/mesh-material-bindings.d.ts +54 -0
- package/dist/mesh-material-bindings.d.ts.map +1 -1
- package/dist/pbr-pipeline.d.ts +38 -14
- package/dist/pbr-pipeline.d.ts.map +1 -1
- package/dist/pipeline/standard-forward-lane.d.ts +2 -1
- package/dist/pipeline/standard-forward-lane.d.ts.map +1 -1
- package/dist/pipeline/standard-lighting/errors.d.ts +4 -0
- package/dist/pipeline/standard-lighting/errors.d.ts.map +1 -0
- package/dist/pipeline/standard-lighting/graph.d.ts +24 -0
- package/dist/pipeline/standard-lighting/graph.d.ts.map +1 -0
- package/dist/pipeline/standard-lighting/inspection.d.ts +38 -0
- package/dist/pipeline/standard-lighting/inspection.d.ts.map +1 -0
- package/dist/pipeline/standard-lighting/layout.d.ts +28 -0
- package/dist/pipeline/standard-lighting/layout.d.ts.map +1 -0
- package/dist/pipeline/standard-lighting/light-frame.d.ts +33 -0
- package/dist/pipeline/standard-lighting/light-frame.d.ts.map +1 -0
- package/dist/pipeline/standard-lighting/membership.d.ts +14 -0
- package/dist/pipeline/standard-lighting/membership.d.ts.map +1 -0
- package/dist/pipeline/standard-lighting/prepare.d.ts +16 -0
- package/dist/pipeline/standard-lighting/prepare.d.ts.map +1 -0
- package/dist/pipeline/standard-lighting/topology.d.ts +45 -0
- package/dist/pipeline/standard-lighting/topology.d.ts.map +1 -0
- package/dist/pipeline/standard-lighting/transport.d.ts +36 -0
- package/dist/pipeline/standard-lighting/transport.d.ts.map +1 -0
- package/dist/pipeline/standard-pipeline.d.ts +4 -13
- package/dist/pipeline/standard-pipeline.d.ts.map +1 -1
- package/dist/pipeline/standard-post.d.ts.map +1 -1
- package/dist/pipeline/standard-profile.d.ts +5 -26
- package/dist/pipeline/standard-profile.d.ts.map +1 -1
- package/dist/pipeline-builder.d.ts +2 -0
- package/dist/pipeline-builder.d.ts.map +1 -1
- package/dist/pipeline-spec.d.ts +40 -7
- package/dist/pipeline-spec.d.ts.map +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/point-shadow-inspection.d.ts +21 -0
- package/dist/point-shadow-inspection.d.ts.map +1 -0
- package/dist/prepare/extended-lighting/ltc-resources.d.ts +31 -0
- package/dist/prepare/extended-lighting/ltc-resources.d.ts.map +1 -0
- package/dist/prepare/extended-lighting/resources.d.ts +72 -0
- package/dist/prepare/extended-lighting/resources.d.ts.map +1 -0
- package/dist/prepare/extended-lighting/spot-modifiers.d.ts +42 -0
- package/dist/prepare/extended-lighting/spot-modifiers.d.ts.map +1 -0
- package/dist/prepare/extended-lighting/state.d.ts +24 -0
- package/dist/prepare/extended-lighting/state.d.ts.map +1 -0
- package/dist/record/frame-lighting.d.ts +33 -36
- package/dist/record/frame-lighting.d.ts.map +1 -1
- package/dist/record/frame-snapshot.d.ts +78 -24
- package/dist/record/frame-snapshot.d.ts.map +1 -1
- package/dist/record/frame-targets.d.ts +5 -0
- package/dist/record/frame-targets.d.ts.map +1 -1
- package/dist/record/frame.d.ts +16 -6
- package/dist/record/frame.d.ts.map +1 -1
- package/dist/record/gpu-pass-timing/contract.d.ts +96 -0
- package/dist/record/gpu-pass-timing/contract.d.ts.map +1 -0
- package/dist/record/gpu-pass-timing/errors.d.ts +18 -0
- package/dist/record/gpu-pass-timing/errors.d.ts.map +1 -0
- package/dist/record/gpu-pass-timing/index.d.ts +8 -0
- package/dist/record/gpu-pass-timing/index.d.ts.map +1 -0
- package/dist/record/gpu-pass-timing/parser.d.ts +11 -0
- package/dist/record/gpu-pass-timing/parser.d.ts.map +1 -0
- package/dist/record/gpu-pass-timing/session.d.ts +43 -0
- package/dist/record/gpu-pass-timing/session.d.ts.map +1 -0
- package/dist/record/gpu-timing.d.ts +20 -3
- package/dist/record/gpu-timing.d.ts.map +1 -1
- package/dist/record/helpers.d.ts +0 -20
- package/dist/record/helpers.d.ts.map +1 -1
- package/dist/record/main-pass-geometry.d.ts +6 -1
- package/dist/record/main-pass-geometry.d.ts.map +1 -1
- package/dist/record/main-pass-material.d.ts +25 -2
- package/dist/record/main-pass-material.d.ts.map +1 -1
- package/dist/record/main-pass-sprite-draws.d.ts.map +1 -1
- package/dist/record/main-pass.d.ts +2 -0
- package/dist/record/main-pass.d.ts.map +1 -1
- package/dist/record/mesh-ssbo.d.ts.map +1 -1
- package/dist/record/render-context.d.ts +98 -6
- package/dist/record/render-context.d.ts.map +1 -1
- package/dist/record/shadow-pass.d.ts.map +1 -1
- package/dist/record/skybox-post-pass.d.ts.map +1 -1
- package/dist/record/typed-frame-graph.d.ts +119 -4
- package/dist/record/typed-frame-graph.d.ts.map +1 -1
- package/dist/record/view-ubo.d.ts +7 -5
- package/dist/record/view-ubo.d.ts.map +1 -1
- package/dist/reflection/filter.d.ts +22 -0
- package/dist/reflection/filter.d.ts.map +1 -0
- package/dist/reflection/gpu-table.d.ts +25 -0
- package/dist/reflection/gpu-table.d.ts.map +1 -0
- package/dist/reflection/inspection.d.ts +10 -0
- package/dist/reflection/inspection.d.ts.map +1 -0
- package/dist/reflection/projection.d.ts +140 -0
- package/dist/reflection/projection.d.ts.map +1 -0
- package/dist/reflection/record-owner.d.ts +60 -0
- package/dist/reflection/record-owner.d.ts.map +1 -0
- package/dist/render-contract.d.ts +62 -14
- package/dist/render-contract.d.ts.map +1 -1
- package/dist/render-graph-primitives.d.ts +1 -0
- package/dist/render-graph-primitives.d.ts.map +1 -1
- package/dist/render-pipeline.d.ts +49 -2
- package/dist/render-pipeline.d.ts.map +1 -1
- package/dist/render-system-extract.d.ts +160 -31
- package/dist/render-system-extract.d.ts.map +1 -1
- package/dist/render-system.d.ts +28 -2
- package/dist/render-system.d.ts.map +1 -1
- package/dist/renderer.d.ts +43 -0
- package/dist/renderer.d.ts.map +1 -0
- package/dist/scene/probe-blend-record.d.ts +22 -0
- package/dist/scene/probe-blend-record.d.ts.map +1 -0
- package/dist/scene/probe-blend.d.ts +142 -0
- package/dist/scene/probe-blend.d.ts.map +1 -0
- package/dist/scene/render-scene-types.d.ts +0 -6
- package/dist/scene/render-scene-types.d.ts.map +1 -1
- package/dist/scene/render-scene.d.ts +117 -9
- package/dist/scene/render-scene.d.ts.map +1 -1
- package/dist/scene/visibility/bounds.d.ts +20 -0
- package/dist/scene/visibility/bounds.d.ts.map +1 -0
- package/dist/scene/visibility/budget.d.ts +16 -0
- package/dist/scene/visibility/budget.d.ts.map +1 -0
- package/dist/scene/visibility/facet.d.ts +73 -0
- package/dist/scene/visibility/facet.d.ts.map +1 -0
- package/dist/scene/visibility/gpu-frame-timing.d.ts +41 -0
- package/dist/scene/visibility/gpu-frame-timing.d.ts.map +1 -0
- package/dist/scene/visibility/gpu-lod.d.ts +46 -0
- package/dist/scene/visibility/gpu-lod.d.ts.map +1 -0
- package/dist/scene/visibility/inspection.d.ts +132 -0
- package/dist/scene/visibility/inspection.d.ts.map +1 -0
- package/dist/scene/visibility/lod-selector.d.ts +25 -0
- package/dist/scene/visibility/lod-selector.d.ts.map +1 -0
- package/dist/scene/visibility/occlusion-confidence.d.ts +81 -0
- package/dist/scene/visibility/occlusion-confidence.d.ts.map +1 -0
- package/dist/scene/visibility/occlusion-pass.d.ts +57 -0
- package/dist/scene/visibility/occlusion-pass.d.ts.map +1 -0
- package/dist/scene/visibility/occlusion-query-pool.d.ts +57 -0
- package/dist/scene/visibility/occlusion-query-pool.d.ts.map +1 -0
- package/dist/scene/visibility/occlusion-runtime.d.ts +96 -0
- package/dist/scene/visibility/occlusion-runtime.d.ts.map +1 -0
- package/dist/scene/visibility/types.d.ts +34 -0
- package/dist/scene/visibility/types.d.ts.map +1 -0
- package/dist/shadow-atlas.d.ts +3 -3
- package/dist/shadow-atlas.d.ts.map +1 -1
- package/dist/ssao-buffers.d.ts +3 -0
- package/dist/ssao-buffers.d.ts.map +1 -1
- package/dist/ssr/admission.d.ts +122 -0
- package/dist/ssr/admission.d.ts.map +1 -0
- package/dist/ssr/composition.d.ts +32 -0
- package/dist/ssr/composition.d.ts.map +1 -0
- package/dist/ssr/errors.d.ts +39 -0
- package/dist/ssr/errors.d.ts.map +1 -0
- package/dist/ssr/identity.d.ts +13 -0
- package/dist/ssr/identity.d.ts.map +1 -0
- package/dist/systems/skin-palette-allocator.d.ts +1 -1
- package/dist/targets/contracts.d.ts +66 -0
- package/dist/targets/contracts.d.ts.map +1 -0
- package/dist/targets/graph-projection.d.ts +29 -0
- package/dist/targets/graph-projection.d.ts.map +1 -0
- package/dist/targets/material-source.d.ts +34 -0
- package/dist/targets/material-source.d.ts.map +1 -0
- package/dist/targets/owner.d.ts +32 -0
- package/dist/targets/owner.d.ts.map +1 -0
- package/dist/targets/physical.d.ts +18 -0
- package/dist/targets/physical.d.ts.map +1 -0
- package/dist/targets/readback.d.ts +39 -0
- package/dist/targets/readback.d.ts.map +1 -0
- package/dist/temporal/frame-coordinator.d.ts +13 -0
- package/dist/temporal/frame-coordinator.d.ts.map +1 -1
- package/dist/temporal/frame.d.ts +2 -0
- package/dist/temporal/frame.d.ts.map +1 -1
- package/dist/temporal/index.mjs +6 -5
- package/dist/temporal/view.d.ts +7 -0
- package/dist/temporal/view.d.ts.map +1 -1
- package/dist/tilemap-chunk-extract-system.d.ts +1 -1
- package/dist/typed-render-graph-primitives.d.ts +5 -1
- package/dist/typed-render-graph-primitives.d.ts.map +1 -1
- package/dist/typed-shadow-passes.d.ts +1 -1
- package/dist/typed-shadow-passes.d.ts.map +1 -1
- package/dist/volume/passes.d.ts +9 -5
- package/dist/volume/passes.d.ts.map +1 -1
- package/package.json +20 -20
- package/src/__tests__/bloom-exact-zero.unit.test.ts +48 -19
- package/src/__tests__/bloom-lifecycle.integration.test.ts +41 -13
- package/src/__tests__/camera-target-consumption.unit.test.ts +53 -0
- package/src/__tests__/cluster-binner.unit.test.ts +35 -0
- package/src/__tests__/cluster-grid-default-surface.unit.test.ts +12 -2
- package/src/__tests__/cube-camera-scheduler.unit.test.ts +70 -0
- package/src/__tests__/cube-camera-single-submit.perf.test.ts +75 -0
- package/src/__tests__/cube-camera-view-matrices.unit.test.ts +41 -0
- package/src/__tests__/cube-camera-vocabulary.unit.test.ts +47 -0
- package/src/__tests__/cube-camera.integration.test.ts +42 -0
- package/src/__tests__/detached-inspection.integration.test.ts +6 -0
- package/src/__tests__/device-feature-admission.unit.test.ts +85 -0
- package/src/__tests__/direct-light-snapshot.unit.test.ts +62 -6
- package/src/__tests__/docs-gate-green.unit.test.ts +38 -0
- package/src/__tests__/environment-generation.integration.test.ts +16 -0
- package/src/__tests__/evidence-identity.ts +13 -0
- package/src/__tests__/evidence-identity.unit.test.ts +24 -0
- package/src/__tests__/extended-lighting-recovery.browser.test.ts +14 -0
- package/src/__tests__/extended-lighting-recovery.dawn.test.ts +14 -0
- package/src/__tests__/extended-lighting-recovery.integration.test.ts +81 -0
- package/src/__tests__/extended-lighting-resources.unit.test.ts +51 -0
- package/src/__tests__/extended-lighting-zero-feature.integration.test.ts +52 -0
- package/src/__tests__/factory-contract.integration.test.ts +288 -29
- package/src/__tests__/fog-component.unit.test.ts +67 -0
- package/src/__tests__/fog.integration.test.ts +86 -0
- package/src/__tests__/frame-observation.contract.test.ts +15 -0
- package/src/__tests__/fullscreen-feature-plan.unit.test.ts +37 -0
- package/src/__tests__/gpu-driven-batch-topology-pbr.unit.test.ts +146 -0
- package/src/__tests__/gpu-driven-indirect-raster-evidence.ts +10 -8
- package/src/__tests__/gpu-driven-indirect-raster.dawn.test.ts +18 -1
- package/src/__tests__/gpu-driven-production.integration.test.ts +579 -17
- package/src/__tests__/gpu-driven-scaling.unit.test.ts +66 -2
- package/src/__tests__/gpu-driven-view-gpu-evidence.ts +26 -1
- package/src/__tests__/gpu-driven-view-graph.integration.test.ts +101 -6
- package/src/__tests__/gpu-driven-view.browser.test.ts +3 -3
- package/src/__tests__/gpu-driven-view.dawn.test.ts +3 -3
- package/src/__tests__/gpu-driven-view.unit.test.ts +50 -0
- package/src/__tests__/gpu-lod-evidence.ts +188 -0
- package/src/__tests__/gpu-lod-fallback.integration.test.ts +10 -0
- package/src/__tests__/gpu-lod-indirect.integration.test.ts +40 -0
- package/src/__tests__/gpu-lod-parity.dawn.test.ts +29 -0
- package/src/__tests__/gpu-lod-readiness.integration.test.ts +52 -0
- package/src/__tests__/gpu-lod-schema.unit.test.ts +66 -0
- package/src/__tests__/gpu-lod-selector.unit.test.ts +28 -0
- package/src/__tests__/gpu-lod-silhouette.browser.test.ts +13 -0
- package/src/__tests__/gpu-pass-timing-browser-runner.ts +281 -0
- package/src/__tests__/gpu-pass-timing-coexistence.integration.test.ts +80 -0
- package/src/__tests__/gpu-pass-timing-contract.unit.test.ts +243 -0
- package/src/__tests__/gpu-pass-timing-exact-zero.unit.test.ts +131 -0
- package/src/__tests__/gpu-pass-timing-lifecycle.integration.test.ts +230 -0
- package/src/__tests__/gpu-pass-timing-observation.unit.test.ts +233 -0
- package/src/__tests__/gpu-pass-timing-session.unit.test.ts +438 -0
- package/src/__tests__/gpu-pass-timing.browser.test.ts +26 -0
- package/src/__tests__/gpu-pass-timing.rhi-null.unit.test.ts +125 -0
- package/src/__tests__/gpu-resource-store-stride.unit.test.ts +66 -1
- package/src/__tests__/gpu-scene.dawn.test.ts +8 -1
- package/src/__tests__/gpu-scene.unit.test.ts +49 -3
- package/src/__tests__/hdrp-group2-visibility.unit.test.ts +24 -0
- package/src/__tests__/instances-culling.integration.test.ts +94 -0
- package/src/__tests__/instances-derived-bounds.unit.test.ts +118 -0
- package/src/__tests__/light-buffer-layout.unit.test.ts +113 -3
- package/src/__tests__/light-inspection.unit.test.ts +55 -0
- package/src/__tests__/light-resource-error.unit.test.ts +43 -0
- package/src/__tests__/lighting-scene-roundtrip.integration.test.ts +109 -0
- package/src/__tests__/lod-bounds.unit.test.ts +42 -0
- package/src/__tests__/lod-cpu-lane.integration.test.ts +55 -0
- package/src/__tests__/lod-cpu-no-change.perf.test.ts +19 -0
- package/src/__tests__/lod-gpu-frame-timing.unit.test.ts +49 -0
- package/src/__tests__/lod-multi-view.integration.test.ts +63 -0
- package/src/__tests__/lod-occlusion-device-loss.integration.test.ts +27 -0
- package/src/__tests__/lod-occlusion-final-decision.integration.test.ts +47 -0
- package/src/__tests__/lod-occlusion-inspection.integration.test.ts +217 -0
- package/src/__tests__/lod-occlusion-inspection.schema.test-d.ts +14 -0
- package/src/__tests__/lod-occlusion-inspection.unit.test.ts +72 -0
- package/src/__tests__/lod-occlusion-visual-evidence.ts +91 -0
- package/src/__tests__/lod-occlusion.browser.test.ts +15 -0
- package/src/__tests__/lod-occlusion.dawn.test.ts +20 -0
- package/src/__tests__/lod-selector.profile.test.ts +35 -0
- package/src/__tests__/lod-selector.unit.test.ts +68 -0
- package/src/__tests__/lod-visibility-identity.unit.test.ts +198 -0
- package/src/__tests__/lod-visibility-lifecycle.integration.test.ts +132 -0
- package/src/__tests__/ltc-resources.unit.test.ts +32 -0
- package/src/__tests__/material-contract-inventory.unit.test.ts +17 -0
- package/src/__tests__/material-observation.integration.test.ts +101 -0
- package/src/__tests__/occlusion-confidence.unit.test.ts +168 -0
- package/src/__tests__/occlusion-invalidation.integration.test.ts +37 -0
- package/src/__tests__/occlusion-pass-routing.unit.test.ts +16 -0
- package/src/__tests__/occlusion-pass.dawn.test.ts +20 -0
- package/src/__tests__/occlusion-pass.integration.test.ts +43 -0
- package/src/__tests__/occlusion-pass.rhi-null.test.ts +22 -0
- package/src/__tests__/occlusion-query-pool.rhi-null.test.ts +21 -0
- package/src/__tests__/occlusion-query-pool.unit.test.ts +95 -0
- package/src/__tests__/occlusion-query-ticket.integration.test.ts +47 -0
- package/src/__tests__/occlusion-query.dawn.test.ts +16 -0
- package/src/__tests__/occlusion-query.evidence.ts +178 -0
- package/src/__tests__/occlusion-query.rhi-null.test.ts +31 -0
- package/src/__tests__/occlusion-runtime.unit.test.ts +120 -0
- package/src/__tests__/pbr-view-layout.unit.test.ts +16 -0
- package/src/__tests__/point-shadow-inspection.unit.test.ts +60 -0
- package/src/__tests__/prepared-gpu-driven-pbr.integration.test.ts +196 -0
- package/src/__tests__/probe-bindings.unit.test.ts +200 -0
- package/src/__tests__/probe-blend-numeric.unit.test.ts +67 -0
- package/src/__tests__/probe-blend-oracle.unit.test.ts +136 -0
- package/src/__tests__/probe-capacity.integration.test.ts +97 -0
- package/src/__tests__/probe-recovery.integration.test.ts +104 -0
- package/src/__tests__/probe-scene-dirty.integration.test.ts +211 -0
- package/src/__tests__/profiler-phase-catalog.test.ts +4 -1
- package/src/__tests__/profiler-phase-token.test.ts +1 -0
- package/src/__tests__/public-surface.test-d.ts +10 -0
- package/src/__tests__/rect-area-boundary.unit.test.ts +24 -0
- package/src/__tests__/reflection-fallback-graph.unit.test.ts +67 -0
- package/src/__tests__/reflection-fallback-inspection.unit.test.ts +77 -0
- package/src/__tests__/reflection-fallback-lifecycle.integration.test.ts +21 -0
- package/src/__tests__/reflection-fallback-projection.unit.test.ts +90 -0
- package/src/__tests__/reflection-fallback-source.unit.test.ts +32 -0
- package/src/__tests__/reflection-probe-authoring.unit.test.ts +71 -0
- package/src/__tests__/reflection-probe-filter.unit.test.ts +54 -0
- package/src/__tests__/reflection-probe-ibl-topology.unit.test.ts +45 -0
- package/src/__tests__/reflection-probe-owner-placement.unit.test.ts +39 -0
- package/src/__tests__/reflection-probe-pass-encode.integration.test.ts +101 -0
- package/src/__tests__/reflection-probe-performance.perf.test.ts +60 -0
- package/src/__tests__/reflection-probe-record-owner.characterization.unit.test.ts +120 -0
- package/src/__tests__/reflection-probe-recovery.integration.test.ts +55 -0
- package/src/__tests__/reflection-probe-selection.unit.test.ts +46 -0
- package/src/__tests__/render-error-code-owner.test-d.ts +19 -3
- package/src/__tests__/render-feature-docs.unit.test.ts +12 -7
- package/src/__tests__/render-graph-fallback.integration.test.ts +24 -0
- package/src/__tests__/render-perf/extended-lighting.bench.test.ts +66 -0
- package/src/__tests__/render-scene-projection.unit.test.ts +447 -18
- package/src/__tests__/render-target-admission.unit.test.ts +80 -0
- package/src/__tests__/render-target-graph-projection.unit.test.ts +102 -0
- package/src/__tests__/render-target-inspection.unit.test.ts +52 -0
- package/src/__tests__/render-target-material-source.test-d.ts +30 -0
- package/src/__tests__/render-target-material-source.unit.test.ts +97 -0
- package/src/__tests__/render-target-owner-placement.unit.test.ts +203 -0
- package/src/__tests__/render-target-owner.unit.test.ts +122 -0
- package/src/__tests__/render-target-probe-soak.perf.test.ts +94 -0
- package/src/__tests__/render-target-public-schema.json +107 -0
- package/src/__tests__/render-target-public-schema.unit.test.ts +91 -0
- package/src/__tests__/render-target-public-surface.test-d.ts +83 -0
- package/src/__tests__/render-target-readback.integration.test.ts +90 -0
- package/src/__tests__/render-target-recovery.integration.test.ts +85 -0
- package/src/__tests__/renderer-factory-material-contract.unit.test.ts +124 -0
- package/src/__tests__/renderer-lifecycle.integration.test.ts +14 -0
- package/src/__tests__/shader-stage-surface.unit.test.ts +19 -4
- package/src/__tests__/skin-motion-regression.unit.test.ts +154 -0
- package/src/__tests__/skinned-shadow-caster.test.ts +13 -4
- package/src/__tests__/spot-modifier-projection.unit.test.ts +70 -0
- package/src/__tests__/ssr-admission-matrix.integration.test.ts +206 -0
- package/src/__tests__/ssr-composition.unit.test.ts +46 -0
- package/src/__tests__/ssr-fallback-zero-work.bench.test.ts +94 -0
- package/src/__tests__/ssr-recovery-errors.unit.test.ts +58 -0
- package/src/__tests__/standard-cluster-capability.integration.test.ts +63 -0
- package/src/__tests__/standard-cluster-transport.unit.test.ts +121 -0
- package/src/__tests__/standard-cluster-variant-resolution.unit.test.ts +299 -0
- package/src/__tests__/standard-clustered-pipeline.unit.test.ts +15 -5
- package/src/__tests__/standard-lighting-inspection.integration.test.ts +138 -0
- package/src/__tests__/standard-lighting-ssot.unit.test.ts +18 -0
- package/src/__tests__/standard-lighting-write.unit.test.ts +441 -0
- package/src/__tests__/standard-lighting.integration.test.ts +67 -0
- package/src/__tests__/standard-pipeline.dawn.test.ts +206 -5
- package/src/__tests__/standard-pipeline.integration.test.ts +181 -150
- package/src/__tests__/standard-probe-binding.unit.test.ts +25 -0
- package/src/__tests__/standard-profile-oracle.unit.test.ts +23 -38
- package/src/__tests__/temporal-fallback-generation.integration.test.ts +16 -0
- package/src/__tests__/temporal-view.unit.test.ts +3 -3
- package/src/__tests__/transmission-prewarm.unit.test.ts +69 -0
- package/src/__tests__/typed-pipeline-topology.unit.test.ts +395 -14
- package/src/__tests__/urp-pipeline-targets.unit.test.ts +2 -2
- package/src/__tests__/visibility-budget.integration.test.ts +140 -0
- package/src/__tests__/visibility-budget.unit.test.ts +70 -0
- package/src/__tests__/visibility-extract.integration.test.ts +11 -6
- package/src/__tests__/visibility-resolver.unit.test.ts +15 -0
- package/src/__tests__/volumetric-fog-point-spot-accumulation.integration.test.ts +6 -3
- package/src/__tests__/volumetric-fog-stage-readback.dawn.test.ts +31 -28
- package/src/assembly/backend-contract.ts +13 -0
- package/src/assembly/device-feature-admission.ts +80 -0
- package/src/assembly/directional-shadow-inspection.ts +122 -0
- package/src/assembly/factory.ts +1411 -366
- package/src/assembly/host-contract.ts +35 -0
- package/src/assembly/render-target-host.ts +847 -0
- package/src/assets/asset-decoders.ts +1 -1
- package/src/assets/render-asset-port.ts +7 -1
- package/src/capture/cube-views.ts +69 -0
- package/src/capture/scheduler.ts +265 -0
- package/src/cluster-binner.ts +31 -0
- package/src/components/__tests__/lighting-authoring.unit.test.ts +39 -0
- package/src/components/__tests__/rect-area-light.unit.test.ts +33 -0
- package/src/components/__tests__/schema-contract.unit.test.ts +12 -0
- package/src/components/__tests__/schema-parity.unit.test.ts +9 -0
- package/src/components/camera.ts +4 -0
- package/src/components/cube-camera.ts +52 -0
- package/src/components/directional-light.ts +22 -2
- package/src/components/directional-shadow-filter.ts +57 -0
- package/src/components/index.ts +5 -0
- package/src/components/light-helpers.ts +133 -8
- package/src/components/light-probe.ts +13 -0
- package/src/components/rect-area-light.ts +15 -0
- package/src/components/reflection-probe.ts +49 -0
- package/src/components/scene-instance.ts +6 -0
- package/src/components/spot-light.ts +3 -0
- package/src/device/__tests__/extended-lighting-recovery.unit.test.ts +24 -0
- package/src/device/gpu-residency.ts +140 -9
- package/src/device/lifecycle-transaction.ts +12 -0
- package/src/environment/frame.ts +6 -24
- package/src/environment/lifecycle.ts +20 -1
- package/src/errors/gpu-driven.ts +92 -0
- package/src/errors/index.ts +1 -0
- package/src/errors/recover.ts +32 -0
- package/src/errors/render.ts +341 -143
- package/src/extract/camera.ts +3 -3
- package/src/extract/directional-shadow-projection.ts +61 -0
- package/src/extract/environment.ts +57 -0
- package/src/extract/gpu-driven.ts +108 -0
- package/src/extract/visibility.ts +2 -1
- package/src/features/fullscreen.ts +3 -0
- package/src/features/targets.ts +4 -1
- package/src/features/types.ts +10 -0
- package/src/fullscreen-post-process-pass.ts +43 -2
- package/src/gpu-driven/batch-topology.ts +207 -28
- package/src/gpu-driven/prepared-draw.ts +208 -0
- package/src/gpu-driven/production-raster.ts +953 -43
- package/src/gpu-driven/view-gpu.ts +411 -29
- package/src/gpu-scene-schema.ts +13 -0
- package/src/gpu-scene.ts +140 -64
- package/src/gpu-usage.ts +0 -1
- package/src/hdrp-buffers.ts +169 -63
- package/src/ibl/IblPipelineCache.ts +11 -0
- package/src/ibl/kernel-cache.ts +88 -0
- package/src/index.ts +222 -0
- package/src/inspection-types.ts +276 -1
- package/src/instances-derived-bounds.ts +171 -0
- package/src/internal.ts +38 -0
- package/src/light-buffer-layout.ts +155 -310
- package/src/materials.ts +16 -2
- package/src/mesh-material-bindings.ts +132 -0
- package/src/pbr-pipeline.ts +255 -60
- package/src/pipeline/standard-forward-lane.ts +93 -16
- package/src/pipeline/standard-lighting/errors.ts +6 -0
- package/src/pipeline/standard-lighting/graph.ts +158 -0
- package/src/pipeline/standard-lighting/inspection.ts +88 -0
- package/src/pipeline/standard-lighting/layout.ts +31 -0
- package/src/pipeline/standard-lighting/light-frame.ts +35 -0
- package/src/pipeline/standard-lighting/membership.ts +43 -0
- package/src/pipeline/standard-lighting/prepare.ts +37 -0
- package/src/pipeline/standard-lighting/topology.ts +120 -0
- package/src/pipeline/standard-lighting/transport.ts +78 -0
- package/src/pipeline/standard-pipeline.ts +124 -193
- package/src/pipeline/standard-post.ts +26 -7
- package/src/pipeline/standard-profile.ts +17 -47
- package/src/pipeline-builder.ts +5 -2
- package/src/pipeline-spec.ts +95 -21
- package/src/plugin.ts +4 -0
- package/src/point-shadow-inspection.ts +55 -0
- package/src/prepare/__tests__/extended-lighting-capability.unit.test.ts +56 -0
- package/src/prepare/extended-lighting/ltc-resources.ts +136 -0
- package/src/prepare/extended-lighting/resources.ts +389 -0
- package/src/prepare/extended-lighting/spot-modifiers.ts +194 -0
- package/src/prepare/extended-lighting/state.ts +92 -0
- package/src/record/__tests__/gpu-timing.unit.test.ts +177 -0
- package/src/record/__tests__/temporal-payload.unit.test.ts +64 -1
- package/src/record/__tests__/transparent-group2-selection.unit.test.ts +73 -0
- package/src/record/__tests__/typed-frame-graph-plan.unit.test.ts +20 -1
- package/src/record/__tests__/view-ubo-layout.unit.test.ts +40 -0
- package/src/record/frame-lighting.ts +591 -452
- package/src/record/frame-snapshot.ts +92 -39
- package/src/record/frame-targets.ts +17 -0
- package/src/record/frame.ts +662 -158
- package/src/record/gpu-pass-timing/contract.ts +180 -0
- package/src/record/gpu-pass-timing/errors.ts +34 -0
- package/src/record/gpu-pass-timing/index.ts +37 -0
- package/src/record/gpu-pass-timing/parser.ts +97 -0
- package/src/record/gpu-pass-timing/session.ts +938 -0
- package/src/record/gpu-timing.ts +112 -39
- package/src/record/helpers.ts +0 -58
- package/src/record/main-pass-geometry.ts +324 -119
- package/src/record/main-pass-material.ts +103 -10
- package/src/record/main-pass-sprite-draws.ts +99 -103
- package/src/record/main-pass.ts +71 -15
- package/src/record/mesh-ssbo.ts +47 -36
- package/src/record/render-context.ts +136 -3
- package/src/record/shadow-pass.ts +83 -68
- package/src/record/skybox-post-pass.ts +20 -4
- package/src/record/typed-frame-graph.ts +1034 -43
- package/src/record/view-ubo.ts +72 -47
- package/src/reflection/filter.ts +81 -0
- package/src/reflection/gpu-table.ts +44 -0
- package/src/reflection/inspection.ts +67 -0
- package/src/reflection/projection.ts +476 -0
- package/src/reflection/record-owner.ts +1283 -0
- package/src/render-contract.ts +93 -10
- package/src/render-graph-primitives.ts +9 -4
- package/src/render-pipeline.ts +122 -2
- package/src/render-system-extract.ts +1041 -225
- package/src/render-system.ts +1310 -85
- package/src/renderer.ts +222 -0
- package/src/scene/__tests__/changed-block-summary.candidate.test.ts +36 -0
- package/src/scene/probe-blend-record.ts +54 -0
- package/src/scene/probe-blend.ts +813 -0
- package/src/scene/render-scene-types.ts +0 -7
- package/src/scene/render-scene.ts +942 -171
- package/src/scene/visibility/bounds.ts +57 -0
- package/src/scene/visibility/budget.ts +40 -0
- package/src/scene/visibility/facet.ts +400 -0
- package/src/scene/visibility/gpu-frame-timing.ts +101 -0
- package/src/scene/visibility/gpu-lod.ts +119 -0
- package/src/scene/visibility/inspection.ts +313 -0
- package/src/scene/visibility/lod-selector.ts +84 -0
- package/src/scene/visibility/occlusion-confidence.ts +478 -0
- package/src/scene/visibility/occlusion-pass.ts +165 -0
- package/src/scene/visibility/occlusion-query-pool.ts +178 -0
- package/src/scene/visibility/occlusion-runtime.ts +672 -0
- package/src/scene/visibility/types.ts +50 -0
- package/src/shadow-atlas.ts +5 -5
- package/src/ssao-buffers.ts +9 -2
- package/src/ssr/admission.ts +451 -0
- package/src/ssr/composition.ts +73 -0
- package/src/ssr/errors.ts +76 -0
- package/src/ssr/identity.ts +12 -0
- package/src/systems/skin-palette-allocator.ts +1 -1
- package/src/targets/contracts.ts +182 -0
- package/src/targets/graph-projection.ts +169 -0
- package/src/targets/material-source.ts +143 -0
- package/src/targets/owner.ts +214 -0
- package/src/targets/physical.ts +18 -0
- package/src/targets/readback.ts +153 -0
- package/src/temporal/frame-coordinator.ts +26 -0
- package/src/temporal/frame.ts +14 -1
- package/src/temporal/view.ts +11 -0
- package/src/tilemap-chunk-extract-system.ts +4 -4
- package/src/transmission/__tests__/standard-transmission.dawn.test.ts +59 -20
- package/src/typed-render-graph-primitives.ts +53 -3
- package/src/typed-shadow-passes.ts +46 -40
- package/src/volume/passes.ts +61 -58
- package/dist/.tsbuildinfo +0 -1
- package/dist/chunk-4XINDLAY.mjs.map +0 -1
- package/dist/chunk-CDTWTHZR.mjs.map +0 -1
- package/dist/chunk-M2MP4ZOU.mjs +0 -73
- package/dist/chunk-M2MP4ZOU.mjs.map +0 -1
- package/dist/chunk-PCHBPYML.mjs.map +0 -1
- package/dist/chunk-TBQJOK2L.mjs.map +0 -1
- package/dist/chunk-VFPLTKCU.mjs.map +0 -1
|
@@ -1,10 +1,29 @@
|
|
|
1
|
+
import { World } from '@forgeax/engine-ecs';
|
|
2
|
+
import { createRenderReadLease } from '@forgeax/engine-ecs/projection';
|
|
3
|
+
import { AssetGuid } from '@forgeax/engine-pack/guid';
|
|
4
|
+
import { Transform } from '@forgeax/engine-scene';
|
|
1
5
|
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
6
|
+
import { Camera, MotionBlur } from '../components';
|
|
7
|
+
import { makeZeroCameraFallbackSnapshot } from '../record/frame-snapshot';
|
|
8
|
+
import type {
|
|
9
|
+
ExtractedFrame,
|
|
10
|
+
MaterialSnapshot,
|
|
11
|
+
RenderableSnapshot,
|
|
12
|
+
} from '../render-system-extract';
|
|
13
|
+
import { PersistentRenderScene, RenderScene } from '../scene/render-scene';
|
|
14
|
+
import { primitiveKey, viewKey } from '../scene/visibility/types';
|
|
4
15
|
import { classifySceneDataCoverage } from '../temporal/coverage';
|
|
5
16
|
|
|
6
17
|
const material = {} as MaterialSnapshot;
|
|
7
18
|
|
|
19
|
+
function guid(value: string) {
|
|
20
|
+
const parsed = AssetGuid.parse(value);
|
|
21
|
+
if (!parsed.ok) throw new Error(`invalid fixture guid: ${value}`);
|
|
22
|
+
return parsed.value;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const LOD_MESH_GUID = guid('019d0000-0000-7000-8000-000000000001');
|
|
26
|
+
|
|
8
27
|
function snapshot(entityKey: number, translationX: number): RenderableSnapshot {
|
|
9
28
|
const world = new Float32Array(16);
|
|
10
29
|
world[0] = 1;
|
|
@@ -24,6 +43,101 @@ function snapshot(entityKey: number, translationX: number): RenderableSnapshot {
|
|
|
24
43
|
}
|
|
25
44
|
|
|
26
45
|
describe('RenderScene canonical owner', () => {
|
|
46
|
+
it('rebuilds the retained composition when Motion Blur is toggled', () => {
|
|
47
|
+
const world = new World();
|
|
48
|
+
const camera = world
|
|
49
|
+
.spawn(
|
|
50
|
+
{
|
|
51
|
+
component: Transform,
|
|
52
|
+
data: { pos: [0, 0, 4], quat: [0, 0, 0, 1], scale: [1, 1, 1] },
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
component: Camera,
|
|
56
|
+
data: { fov: Math.PI / 3, aspect: 1, near: 0.1, far: 100 },
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
component: MotionBlur,
|
|
60
|
+
data: { shutterAngle: 180, maxRadiusPixels: 32, sampleCount: 8 },
|
|
61
|
+
},
|
|
62
|
+
)
|
|
63
|
+
.unwrap();
|
|
64
|
+
const lease = createRenderReadLease(world);
|
|
65
|
+
const frame = {
|
|
66
|
+
cameras: [{ ...makeZeroCameraFallbackSnapshot(), worldId: 0, entityKey: camera as number }],
|
|
67
|
+
renderables: [],
|
|
68
|
+
dispatch: [],
|
|
69
|
+
} as unknown as ExtractedFrame;
|
|
70
|
+
const persistent = new PersistentRenderScene();
|
|
71
|
+
let builds = 0;
|
|
72
|
+
const build = (): ExtractedFrame => {
|
|
73
|
+
builds += 1;
|
|
74
|
+
return frame;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
persistent.extractComposition([world], { cameraOwner: 0, resourceOwner: 0 }, 0, build, [lease]);
|
|
78
|
+
expect(builds).toBe(1);
|
|
79
|
+
|
|
80
|
+
world.removeComponent(camera, MotionBlur).unwrap();
|
|
81
|
+
world.update().unwrap();
|
|
82
|
+
persistent.extractComposition([world], { cameraOwner: 0, resourceOwner: 0 }, 0, build, [lease]);
|
|
83
|
+
expect(builds).toBe(2);
|
|
84
|
+
|
|
85
|
+
world
|
|
86
|
+
.addComponent(camera, {
|
|
87
|
+
component: MotionBlur,
|
|
88
|
+
data: { shutterAngle: 180, maxRadiusPixels: 32, sampleCount: 8 },
|
|
89
|
+
})
|
|
90
|
+
.unwrap();
|
|
91
|
+
world.update().unwrap();
|
|
92
|
+
persistent.extractComposition([world], { cameraOwner: 0, resourceOwner: 0 }, 0, build, [lease]);
|
|
93
|
+
expect(builds).toBe(3);
|
|
94
|
+
lease.dispose();
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('retains renderable topology while refreshing per-frame resources', () => {
|
|
98
|
+
const world = new World();
|
|
99
|
+
const lease = createRenderReadLease(world);
|
|
100
|
+
const camera = { ...makeZeroCameraFallbackSnapshot(), worldId: 0, entityKey: 1 };
|
|
101
|
+
const renderables = Array.from({ length: 1024 }, (_, entityKey) =>
|
|
102
|
+
snapshot(entityKey + 1, entityKey * 0.01),
|
|
103
|
+
);
|
|
104
|
+
const frame = {
|
|
105
|
+
cameras: [camera],
|
|
106
|
+
renderables,
|
|
107
|
+
dispatch: [],
|
|
108
|
+
} as unknown as ExtractedFrame;
|
|
109
|
+
const persistent = new PersistentRenderScene();
|
|
110
|
+
let builds = 0;
|
|
111
|
+
const build = (): ExtractedFrame => {
|
|
112
|
+
builds += 1;
|
|
113
|
+
return frame;
|
|
114
|
+
};
|
|
115
|
+
const first = persistent.extractComposition(
|
|
116
|
+
[world],
|
|
117
|
+
{ cameraOwner: 0, resourceOwner: 0 },
|
|
118
|
+
0,
|
|
119
|
+
build,
|
|
120
|
+
[lease],
|
|
121
|
+
);
|
|
122
|
+
const stable = persistent.extractComposition(
|
|
123
|
+
[world],
|
|
124
|
+
{ cameraOwner: 0, resourceOwner: 0 },
|
|
125
|
+
0,
|
|
126
|
+
build,
|
|
127
|
+
[lease],
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
expect(stable).not.toBe(first);
|
|
131
|
+
expect(stable.renderables).toEqual(first.renderables);
|
|
132
|
+
expect(builds).toBe(2);
|
|
133
|
+
expect(persistent.inspect()).toMatchObject({
|
|
134
|
+
worldEntitiesScanned: 0,
|
|
135
|
+
noChangeFrames: 1,
|
|
136
|
+
projectionRecords: 1024,
|
|
137
|
+
});
|
|
138
|
+
lease.dispose();
|
|
139
|
+
});
|
|
140
|
+
|
|
27
141
|
it('projects current scene contributors without owning temporal history', () => {
|
|
28
142
|
const coverage = classifySceneDataCoverage({
|
|
29
143
|
contributors: [{ id: 'world', kind: 'reactive' }],
|
|
@@ -51,6 +165,27 @@ describe('RenderScene canonical owner', () => {
|
|
|
51
165
|
expect(projection.materialize()[0]?.transform.world[12]).toBe(9);
|
|
52
166
|
});
|
|
53
167
|
|
|
168
|
+
it('updates cached dynamic world bounds without replacing the bounds object', () => {
|
|
169
|
+
const projection = new RenderScene();
|
|
170
|
+
const initial = {
|
|
171
|
+
...snapshot(7, 1),
|
|
172
|
+
localAabb: new Float32Array([-1, -1, -1, 1, 1, 1]),
|
|
173
|
+
};
|
|
174
|
+
projection.apply([{ kind: 'create', snapshot: initial }]);
|
|
175
|
+
const retained = projection.materialize()[0];
|
|
176
|
+
if (retained === undefined) throw new Error('expected retained snapshot');
|
|
177
|
+
const first = projection.cullingWorldBounds(retained);
|
|
178
|
+
const moved = new Float32Array(initial.transform.world);
|
|
179
|
+
moved[12] = 9;
|
|
180
|
+
|
|
181
|
+
projection.applyTransformSpans([{ worldId: 0, entities: new Uint32Array([7]), worlds: moved }]);
|
|
182
|
+
|
|
183
|
+
const next = projection.cullingWorldBounds(retained);
|
|
184
|
+
expect(next).toBe(first);
|
|
185
|
+
expect(next?.min[0]).toBe(8);
|
|
186
|
+
expect(next?.max[0]).toBe(10);
|
|
187
|
+
});
|
|
188
|
+
|
|
54
189
|
it('cancels a transient create/remove pair without allocating a slot', () => {
|
|
55
190
|
const projection = new RenderScene();
|
|
56
191
|
|
|
@@ -103,9 +238,319 @@ describe('RenderScene canonical owner', () => {
|
|
|
103
238
|
|
|
104
239
|
expect(projection.materialize().map((record) => record.transform.world[12])).toEqual([3, 8]);
|
|
105
240
|
});
|
|
241
|
+
|
|
242
|
+
it('suppresses an occluded LOD candidate after two zero results and reopens it on a hit', () => {
|
|
243
|
+
const world = new World();
|
|
244
|
+
const camera = {
|
|
245
|
+
...makeZeroCameraFallbackSnapshot(),
|
|
246
|
+
worldId: 0,
|
|
247
|
+
entityKey: 1,
|
|
248
|
+
};
|
|
249
|
+
const candidate = {
|
|
250
|
+
...snapshot(7, 1),
|
|
251
|
+
lods: [{ mesh: LOD_MESH_GUID, screenCoverage: 0.5 }],
|
|
252
|
+
localAabb: new Float32Array([-1, -1, -1, 1, 1, 1]),
|
|
253
|
+
} as RenderableSnapshot;
|
|
254
|
+
const dispatch = {
|
|
255
|
+
entityIndex: candidate.entityKey,
|
|
256
|
+
materialHandle: 0,
|
|
257
|
+
renderableIndex: 0,
|
|
258
|
+
passIndex: 0,
|
|
259
|
+
queue: 2000,
|
|
260
|
+
layer: 0,
|
|
261
|
+
tags: {},
|
|
262
|
+
renderState: undefined,
|
|
263
|
+
defines: undefined,
|
|
264
|
+
vertexEntry: undefined,
|
|
265
|
+
fragmentEntry: undefined,
|
|
266
|
+
materialShaderId: 'forgeax::default-unlit',
|
|
267
|
+
paramSnapshot: undefined,
|
|
268
|
+
};
|
|
269
|
+
const frame = {
|
|
270
|
+
cameras: [camera],
|
|
271
|
+
dispatch: [dispatch],
|
|
272
|
+
renderables: [candidate],
|
|
273
|
+
} as unknown as ExtractedFrame;
|
|
274
|
+
const persistent = new PersistentRenderScene();
|
|
275
|
+
const lease = createRenderReadLease(world);
|
|
276
|
+
persistent.extractComposition([world], { cameraOwner: 0, resourceOwner: 0 }, 0, () => frame, [
|
|
277
|
+
lease,
|
|
278
|
+
]);
|
|
279
|
+
const renderableInput = [candidate];
|
|
280
|
+
const dispatchInput = [dispatch];
|
|
281
|
+
persistent.updateVisibilityFacet([world], camera, renderableInput);
|
|
282
|
+
const view = viewKey({
|
|
283
|
+
attachmentId: world.identity,
|
|
284
|
+
cameraEntity: camera.entityKey ?? 0,
|
|
285
|
+
viewRole: 'main',
|
|
286
|
+
viewGeneration: camera.historyVersion ?? 0,
|
|
287
|
+
});
|
|
288
|
+
const primitive = primitiveKey({
|
|
289
|
+
attachmentId: world.identity,
|
|
290
|
+
worldGeneration: 0,
|
|
291
|
+
primitiveSlot: 0,
|
|
292
|
+
slotGeneration: 0,
|
|
293
|
+
});
|
|
294
|
+
const facets = persistent.visibilityFacetStore();
|
|
295
|
+
const initialProjection = persistent.projectVisibility(
|
|
296
|
+
[world],
|
|
297
|
+
camera,
|
|
298
|
+
renderableInput,
|
|
299
|
+
dispatchInput,
|
|
300
|
+
);
|
|
301
|
+
const beforeCompletionRevision = facets.drawRevisionValue;
|
|
302
|
+
expect(facets.applyCompletion(view, primitive, 0, { level: 0, confidence: 1 })).toBe(true);
|
|
303
|
+
expect(facets.drawRevisionValue).toBe(beforeCompletionRevision);
|
|
304
|
+
expect(persistent.projectVisibility([world], camera, renderableInput, dispatchInput)).toBe(
|
|
305
|
+
initialProjection,
|
|
306
|
+
);
|
|
307
|
+
facets.applyConfidence(view, primitive, {
|
|
308
|
+
type: 'result',
|
|
309
|
+
samples: 0,
|
|
310
|
+
submissionGeneration: 1,
|
|
311
|
+
});
|
|
312
|
+
facets.applyConfidence(view, primitive, {
|
|
313
|
+
type: 'result',
|
|
314
|
+
samples: 0,
|
|
315
|
+
submissionGeneration: 2,
|
|
316
|
+
});
|
|
317
|
+
const hidden = persistent.projectVisibility([world], camera, renderableInput, dispatchInput);
|
|
318
|
+
expect(hidden.renderables).toHaveLength(0);
|
|
319
|
+
expect(hidden.dispatch).toHaveLength(0);
|
|
320
|
+
expect(hidden.suppressed).toBe(1);
|
|
321
|
+
|
|
322
|
+
facets.applyConfidence(view, primitive, {
|
|
323
|
+
type: 'result',
|
|
324
|
+
samples: 1,
|
|
325
|
+
submissionGeneration: 3,
|
|
326
|
+
});
|
|
327
|
+
const reopened = persistent.projectVisibility([world], camera, renderableInput, dispatchInput);
|
|
328
|
+
expect(reopened.renderables).toHaveLength(1);
|
|
329
|
+
expect(reopened.dispatch).toHaveLength(1);
|
|
330
|
+
expect(reopened.activeEntityKeys.size).toBe(1);
|
|
331
|
+
lease.dispose();
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('keeps a secondary World primitive identity stable across composition reorder', () => {
|
|
335
|
+
const worldA = new World();
|
|
336
|
+
const worldB = new World();
|
|
337
|
+
const leaseA = createRenderReadLease(worldA);
|
|
338
|
+
const leaseB = createRenderReadLease(worldB);
|
|
339
|
+
const cameraA = { ...makeZeroCameraFallbackSnapshot(), worldId: 0, entityKey: 10 };
|
|
340
|
+
const candidateB = {
|
|
341
|
+
...snapshot(7, 1),
|
|
342
|
+
worldId: 1,
|
|
343
|
+
lods: [{ mesh: LOD_MESH_GUID, screenCoverage: 0.5 }],
|
|
344
|
+
localAabb: new Float32Array([-1, -1, -1, 1, 1, 1]),
|
|
345
|
+
} as RenderableSnapshot;
|
|
346
|
+
const ordinaryA = snapshot(8, -1);
|
|
347
|
+
const dispatchFor = (renderableIndex: number) => ({
|
|
348
|
+
entityIndex: 7,
|
|
349
|
+
materialHandle: 0,
|
|
350
|
+
renderableIndex,
|
|
351
|
+
passIndex: 0,
|
|
352
|
+
queue: 2000,
|
|
353
|
+
layer: 0,
|
|
354
|
+
tags: {},
|
|
355
|
+
renderState: undefined,
|
|
356
|
+
defines: undefined,
|
|
357
|
+
variantSet: undefined,
|
|
358
|
+
vertexEntry: undefined,
|
|
359
|
+
fragmentEntry: undefined,
|
|
360
|
+
materialShaderId: 'forgeax::default-unlit',
|
|
361
|
+
paramSnapshot: undefined,
|
|
362
|
+
});
|
|
363
|
+
const frameAB = {
|
|
364
|
+
cameras: [cameraA],
|
|
365
|
+
dispatch: [dispatchFor(1)],
|
|
366
|
+
renderables: [ordinaryA, candidateB],
|
|
367
|
+
} as unknown as ExtractedFrame;
|
|
368
|
+
const persistent = new PersistentRenderScene();
|
|
369
|
+
persistent.extractComposition(
|
|
370
|
+
[worldA, worldB],
|
|
371
|
+
{ cameraOwner: 0, resourceOwner: 0 },
|
|
372
|
+
0,
|
|
373
|
+
() => frameAB,
|
|
374
|
+
[leaseA, leaseB],
|
|
375
|
+
);
|
|
376
|
+
persistent.updateVisibilityFacet([worldA, worldB], cameraA, [ordinaryA, candidateB]);
|
|
377
|
+
const viewA = viewKey({
|
|
378
|
+
attachmentId: worldA.identity,
|
|
379
|
+
cameraEntity: 10,
|
|
380
|
+
viewRole: 'main',
|
|
381
|
+
viewGeneration: 0,
|
|
382
|
+
});
|
|
383
|
+
const primitiveB = primitiveKey({
|
|
384
|
+
attachmentId: worldA.identity,
|
|
385
|
+
worldGeneration: 1,
|
|
386
|
+
primitiveSlot: 1,
|
|
387
|
+
slotGeneration: 0,
|
|
388
|
+
});
|
|
389
|
+
const facets = persistent.visibilityFacetStore();
|
|
390
|
+
facets.applyConfidence(viewA, primitiveB, {
|
|
391
|
+
type: 'result',
|
|
392
|
+
samples: 0,
|
|
393
|
+
submissionGeneration: 1,
|
|
394
|
+
});
|
|
395
|
+
facets.applyConfidence(viewA, primitiveB, {
|
|
396
|
+
type: 'result',
|
|
397
|
+
samples: 0,
|
|
398
|
+
submissionGeneration: 2,
|
|
399
|
+
});
|
|
400
|
+
|
|
401
|
+
const reorderedCandidateB = { ...candidateB, worldId: 0 };
|
|
402
|
+
const reorderedOrdinaryA = { ...ordinaryA, worldId: 1 };
|
|
403
|
+
const cameraAReordered = { ...cameraA, worldId: 1 };
|
|
404
|
+
const frameBA = {
|
|
405
|
+
cameras: [cameraAReordered],
|
|
406
|
+
dispatch: [dispatchFor(0)],
|
|
407
|
+
renderables: [reorderedCandidateB, reorderedOrdinaryA],
|
|
408
|
+
} as unknown as ExtractedFrame;
|
|
409
|
+
persistent.extractComposition(
|
|
410
|
+
[worldB, worldA],
|
|
411
|
+
{ cameraOwner: 1, resourceOwner: 1 },
|
|
412
|
+
0,
|
|
413
|
+
() => frameBA,
|
|
414
|
+
[leaseB, leaseA],
|
|
415
|
+
);
|
|
416
|
+
persistent.updateVisibilityFacet([worldB, worldA], cameraAReordered, [reorderedCandidateB]);
|
|
417
|
+
const projected = persistent.projectVisibility(
|
|
418
|
+
[worldB, worldA],
|
|
419
|
+
cameraAReordered,
|
|
420
|
+
[reorderedCandidateB],
|
|
421
|
+
[dispatchFor(0)],
|
|
422
|
+
);
|
|
423
|
+
expect(projected.suppressed).toBe(1);
|
|
424
|
+
expect(projected.renderables).toHaveLength(0);
|
|
425
|
+
leaseA.dispose();
|
|
426
|
+
leaseB.dispose();
|
|
427
|
+
});
|
|
428
|
+
|
|
429
|
+
it('clears visibility facets when a same-World topology rebuild reuses slots', () => {
|
|
430
|
+
const world = new World();
|
|
431
|
+
const lease = createRenderReadLease(world);
|
|
432
|
+
const camera = { ...makeZeroCameraFallbackSnapshot(), worldId: 0, entityKey: 10 };
|
|
433
|
+
const candidate = {
|
|
434
|
+
...snapshot(7, 1),
|
|
435
|
+
lods: [{ mesh: LOD_MESH_GUID, screenCoverage: 0.5 }],
|
|
436
|
+
localAabb: new Float32Array([-1, -1, -1, 1, 1, 1]),
|
|
437
|
+
} as RenderableSnapshot;
|
|
438
|
+
const dispatch = {
|
|
439
|
+
entityIndex: 7,
|
|
440
|
+
materialHandle: 0,
|
|
441
|
+
renderableIndex: 0,
|
|
442
|
+
passIndex: 0,
|
|
443
|
+
queue: 2000,
|
|
444
|
+
layer: 0,
|
|
445
|
+
tags: {},
|
|
446
|
+
renderState: undefined,
|
|
447
|
+
defines: undefined,
|
|
448
|
+
variantSet: undefined,
|
|
449
|
+
vertexEntry: undefined,
|
|
450
|
+
fragmentEntry: undefined,
|
|
451
|
+
materialShaderId: 'forgeax::default-unlit',
|
|
452
|
+
paramSnapshot: undefined,
|
|
453
|
+
};
|
|
454
|
+
const frame = {
|
|
455
|
+
cameras: [camera],
|
|
456
|
+
dispatch: [dispatch],
|
|
457
|
+
renderables: [candidate],
|
|
458
|
+
} as unknown as ExtractedFrame;
|
|
459
|
+
const persistent = new PersistentRenderScene();
|
|
460
|
+
persistent.extractComposition([world], { cameraOwner: 0, resourceOwner: 0 }, 0, () => frame, [
|
|
461
|
+
lease,
|
|
462
|
+
]);
|
|
463
|
+
persistent.updateVisibilityFacet([world], camera, [candidate]);
|
|
464
|
+
const view = viewKey({
|
|
465
|
+
attachmentId: world.identity,
|
|
466
|
+
cameraEntity: 10,
|
|
467
|
+
viewRole: 'main',
|
|
468
|
+
viewGeneration: 0,
|
|
469
|
+
});
|
|
470
|
+
const before = persistent.compositionSlots()[0];
|
|
471
|
+
const primitive = primitiveKey({
|
|
472
|
+
attachmentId: world.identity,
|
|
473
|
+
worldGeneration: 0,
|
|
474
|
+
primitiveSlot: before?.slot ?? 0,
|
|
475
|
+
slotGeneration: before?.generation ?? 0,
|
|
476
|
+
});
|
|
477
|
+
const facets = persistent.visibilityFacetStore();
|
|
478
|
+
facets.applyConfidence(view, primitive, {
|
|
479
|
+
type: 'result',
|
|
480
|
+
samples: 0,
|
|
481
|
+
submissionGeneration: 1,
|
|
482
|
+
});
|
|
483
|
+
facets.applyConfidence(view, primitive, {
|
|
484
|
+
type: 'result',
|
|
485
|
+
samples: 0,
|
|
486
|
+
submissionGeneration: 2,
|
|
487
|
+
});
|
|
488
|
+
expect(persistent.projectVisibility([world], camera, [candidate], [dispatch]).suppressed).toBe(
|
|
489
|
+
1,
|
|
490
|
+
);
|
|
491
|
+
|
|
492
|
+
// A real journal change forces the composition rebuild. The callback adds
|
|
493
|
+
// a new renderable, so the previous slot generation could otherwise ABA
|
|
494
|
+
// into the newly rebuilt projection.
|
|
495
|
+
world.spawn({ component: Transform, data: {} }).unwrap();
|
|
496
|
+
world.update().unwrap();
|
|
497
|
+
const extra = { ...snapshot(8, 2), localAabb: candidate.localAabb };
|
|
498
|
+
const rebuiltFrame = {
|
|
499
|
+
cameras: [camera],
|
|
500
|
+
dispatch: [dispatch, { ...dispatch, entityIndex: 8, renderableIndex: 1 }],
|
|
501
|
+
renderables: [candidate, extra],
|
|
502
|
+
} as unknown as ExtractedFrame;
|
|
503
|
+
persistent.extractComposition(
|
|
504
|
+
[world],
|
|
505
|
+
{ cameraOwner: 0, resourceOwner: 0 },
|
|
506
|
+
0,
|
|
507
|
+
() => rebuiltFrame,
|
|
508
|
+
[lease],
|
|
509
|
+
);
|
|
510
|
+
persistent.updateVisibilityFacet([world], camera, [candidate]);
|
|
511
|
+
expect(persistent.projectVisibility([world], camera, [candidate], [dispatch]).suppressed).toBe(
|
|
512
|
+
0,
|
|
513
|
+
);
|
|
514
|
+
lease.dispose();
|
|
515
|
+
});
|
|
106
516
|
});
|
|
107
517
|
|
|
108
518
|
describe('RenderScene', () => {
|
|
519
|
+
it('retains attached probe records through persistent frustum culling', () => {
|
|
520
|
+
const scene = new PersistentRenderScene();
|
|
521
|
+
const renderable = {
|
|
522
|
+
...snapshot(7, 0),
|
|
523
|
+
localAabb: new Float32Array([-1, -1, -1, 1, 1, 1]),
|
|
524
|
+
};
|
|
525
|
+
const frame = {
|
|
526
|
+
cameras: [],
|
|
527
|
+
renderables: [renderable],
|
|
528
|
+
dispatch: [],
|
|
529
|
+
lightProbes: [
|
|
530
|
+
{
|
|
531
|
+
identity: 'probe-a',
|
|
532
|
+
position: [0, 0, 0] as const,
|
|
533
|
+
radius: 2,
|
|
534
|
+
irradiance: new Float32Array(27).fill(1),
|
|
535
|
+
admitted: true,
|
|
536
|
+
},
|
|
537
|
+
],
|
|
538
|
+
} as unknown as ExtractedFrame;
|
|
539
|
+
|
|
540
|
+
const projected = scene.extractComposition(
|
|
541
|
+
[{} as World],
|
|
542
|
+
{ cameraOwner: 0, resourceOwner: 0 },
|
|
543
|
+
0,
|
|
544
|
+
() => frame,
|
|
545
|
+
);
|
|
546
|
+
|
|
547
|
+
expect(projected.renderables[0]?.probeBlendRecord).toMatchObject({
|
|
548
|
+
objectKey: 0,
|
|
549
|
+
localBlendFraction: 1,
|
|
550
|
+
accepted: true,
|
|
551
|
+
});
|
|
552
|
+
});
|
|
553
|
+
|
|
109
554
|
it('keeps world identity slots stable across a composition reorder', () => {
|
|
110
555
|
const scene = new RenderScene();
|
|
111
556
|
const first = snapshot(1, 3);
|
|
@@ -177,20 +622,4 @@ describe('RenderScene', () => {
|
|
|
177
622
|
expect(scene.querySpatial({ min: [-2, -2, -2], max: [2, 2, 2] })).toEqual([]);
|
|
178
623
|
expect(scene.querySpatial({ min: [9, -2, -2], max: [11, 2, 2] })).toHaveLength(1);
|
|
179
624
|
});
|
|
180
|
-
|
|
181
|
-
it('rebuilds from a resync delta after journal overflow', () => {
|
|
182
|
-
const scene = new RenderScene();
|
|
183
|
-
scene.apply([{ kind: 'create', snapshot: snapshot(1, 0) }]);
|
|
184
|
-
|
|
185
|
-
const result = scene.applyDelta({
|
|
186
|
-
operations: [],
|
|
187
|
-
overflowed: true,
|
|
188
|
-
resync: [snapshot(99, 9)],
|
|
189
|
-
reason: 'journal-overflow',
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
expect(result.resynced).toBe(1);
|
|
193
|
-
expect(scene.has(0, 1)).toBe(false);
|
|
194
|
-
expect(scene.has(0, 99)).toBe(true);
|
|
195
|
-
});
|
|
196
625
|
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { RenderTargetCapabilityMissingError } from '../errors/render';
|
|
3
|
+
import {
|
|
4
|
+
admitRenderTargetDescriptor,
|
|
5
|
+
type RenderTargetAdmissionLimits,
|
|
6
|
+
type RenderTargetDescriptor,
|
|
7
|
+
} from '../targets/contracts';
|
|
8
|
+
|
|
9
|
+
const limits: RenderTargetAdmissionLimits = {
|
|
10
|
+
maxTextureDimension2D: 4096,
|
|
11
|
+
maxBytesPerTarget: 64 * 1024 * 1024,
|
|
12
|
+
renderableFormats: ['rgba16float', 'rgba8unorm', 'rgba8unorm-srgb'],
|
|
13
|
+
sampleCounts: [1, 4],
|
|
14
|
+
depthFormats: ['depth24plus-stencil8', 'depth32float'],
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const base: RenderTargetDescriptor = {
|
|
18
|
+
shape: '2d',
|
|
19
|
+
width: 512,
|
|
20
|
+
height: 256,
|
|
21
|
+
format: 'rgba8unorm',
|
|
22
|
+
mipLevels: 1,
|
|
23
|
+
sampleCount: 1,
|
|
24
|
+
sampled: true,
|
|
25
|
+
readback: true,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
describe('RenderTarget descriptor admission', () => {
|
|
29
|
+
it('accepts the complete first-version descriptor vocabulary', () => {
|
|
30
|
+
const result = admitRenderTargetDescriptor(base, limits);
|
|
31
|
+
expect(result.ok).toBe(true);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it.each([
|
|
35
|
+
['zero width', { width: 0 }],
|
|
36
|
+
['zero height', { height: 0 }],
|
|
37
|
+
['non-square cube', { shape: 'cube' as const }],
|
|
38
|
+
])('rejects %s before allocation', (_name, patch) => {
|
|
39
|
+
const descriptor = { ...base, ...patch };
|
|
40
|
+
if ('shape' in patch && patch.shape === 'cube') descriptor.height = 256;
|
|
41
|
+
const result = admitRenderTargetDescriptor(descriptor, limits);
|
|
42
|
+
expect(result.ok).toBe(false);
|
|
43
|
+
if (!result.ok) expect(result.error.code).toBe('render-target-descriptor-invalid');
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('rejects unsupported format, sample count, and byte budget', () => {
|
|
47
|
+
const formatResult = admitRenderTargetDescriptor(
|
|
48
|
+
{ ...base, format: 'rgba16float' },
|
|
49
|
+
{ ...limits, renderableFormats: ['rgba8unorm'] },
|
|
50
|
+
);
|
|
51
|
+
expect(formatResult.ok).toBe(false);
|
|
52
|
+
if (!formatResult.ok) expect(formatResult.error.code).toBe('render-target-capability-missing');
|
|
53
|
+
|
|
54
|
+
const sampleResult = admitRenderTargetDescriptor(
|
|
55
|
+
{ ...base, sampleCount: 4 },
|
|
56
|
+
{ ...limits, sampleCounts: [1] },
|
|
57
|
+
);
|
|
58
|
+
expect(sampleResult.ok).toBe(false);
|
|
59
|
+
if (!sampleResult.ok) expect(sampleResult.error.code).toBe('render-target-capability-missing');
|
|
60
|
+
|
|
61
|
+
const bytesResult = admitRenderTargetDescriptor(
|
|
62
|
+
{ ...base, width: 2048, height: 2048, mipLevels: 'full' },
|
|
63
|
+
{ ...limits, maxBytesPerTarget: 1024 },
|
|
64
|
+
);
|
|
65
|
+
expect(bytesResult.ok).toBe(false);
|
|
66
|
+
if (!bytesResult.ok) expect(bytesResult.error.code).toBe('render-target-descriptor-invalid');
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('does not reinterpret format or silently fall back on depth', () => {
|
|
70
|
+
const result = admitRenderTargetDescriptor(
|
|
71
|
+
{ ...base, depth: 'depth32float' },
|
|
72
|
+
{ ...limits, depthFormats: ['depth24plus-stencil8'] },
|
|
73
|
+
);
|
|
74
|
+
expect(result.ok).toBe(false);
|
|
75
|
+
if (!result.ok && result.error instanceof RenderTargetCapabilityMissingError) {
|
|
76
|
+
expect(result.error.code).toBe('render-target-capability-missing');
|
|
77
|
+
expect(result.error.detail.requested).toBe('depth32float');
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { RenderGraphBuilder } from '@forgeax/engine-render-graph';
|
|
2
|
+
import type { RhiCommandEncoder, Texture, TextureView } from '@forgeax/engine-rhi';
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import type { RenderTargetDescriptor } from '../targets/contracts';
|
|
5
|
+
import { projectRenderTargetGraph, type RenderTargetGraphInput } from '../targets/graph-projection';
|
|
6
|
+
import { createRenderTargetOwner } from '../targets/owner';
|
|
7
|
+
|
|
8
|
+
type Frame = { readonly encoder: RhiCommandEncoder };
|
|
9
|
+
|
|
10
|
+
const owner = createRenderTargetOwner({ rendererId: Symbol('renderer'), initialGeneration: 3 });
|
|
11
|
+
const texture = {} as Texture;
|
|
12
|
+
const view = {} as TextureView;
|
|
13
|
+
const resolveView = {} as TextureView;
|
|
14
|
+
|
|
15
|
+
function targetInput(descriptor: RenderTargetDescriptor): RenderTargetGraphInput {
|
|
16
|
+
const target = owner.create(descriptor);
|
|
17
|
+
if (!target.ok) throw target.error;
|
|
18
|
+
return {
|
|
19
|
+
target: target.value,
|
|
20
|
+
generation: 3,
|
|
21
|
+
descriptor,
|
|
22
|
+
texture,
|
|
23
|
+
view,
|
|
24
|
+
...(descriptor.sampleCount === 4 ? { resolveView } : {}),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
describe('RenderTarget graph projection', () => {
|
|
29
|
+
it('imports a 2D target with sampled/readback usage and an exact mip view', () => {
|
|
30
|
+
const descriptor: RenderTargetDescriptor = {
|
|
31
|
+
shape: '2d',
|
|
32
|
+
width: 64,
|
|
33
|
+
height: 32,
|
|
34
|
+
format: 'rgba8unorm',
|
|
35
|
+
mipLevels: 'full',
|
|
36
|
+
sampleCount: 1,
|
|
37
|
+
sampled: true,
|
|
38
|
+
readback: true,
|
|
39
|
+
};
|
|
40
|
+
const graph = new RenderGraphBuilder<Frame>();
|
|
41
|
+
const projected = projectRenderTargetGraph(graph, targetInput(descriptor), {
|
|
42
|
+
mipLevel: 2,
|
|
43
|
+
});
|
|
44
|
+
expect(projected.ok).toBe(true);
|
|
45
|
+
if (!projected.ok) return;
|
|
46
|
+
expect(projected.value.ownership).toBe('imported');
|
|
47
|
+
expect(projected.value.generation).toBe(3);
|
|
48
|
+
expect(projected.value.viewDescriptor).toMatchObject({
|
|
49
|
+
dimension: '2d',
|
|
50
|
+
baseMipLevel: 2,
|
|
51
|
+
mipLevelCount: 1,
|
|
52
|
+
});
|
|
53
|
+
expect(projected.value.usage).toEqual(['sampled-read', 'copy-src']);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('keeps cube subresources as cube views and resolves MSAA before sampling', () => {
|
|
57
|
+
const descriptor: RenderTargetDescriptor = {
|
|
58
|
+
shape: 'cube',
|
|
59
|
+
width: 64,
|
|
60
|
+
height: 64,
|
|
61
|
+
format: 'rgba16float',
|
|
62
|
+
mipLevels: 1,
|
|
63
|
+
sampleCount: 4,
|
|
64
|
+
sampled: true,
|
|
65
|
+
readback: true,
|
|
66
|
+
};
|
|
67
|
+
const graph = new RenderGraphBuilder<Frame>();
|
|
68
|
+
const projected = projectRenderTargetGraph(graph, targetInput(descriptor), {
|
|
69
|
+
mipLevel: 0,
|
|
70
|
+
face: 4,
|
|
71
|
+
});
|
|
72
|
+
expect(projected.ok).toBe(true);
|
|
73
|
+
if (!projected.ok) return;
|
|
74
|
+
expect(projected.value.viewDescriptor).toMatchObject({
|
|
75
|
+
dimension: 'cube',
|
|
76
|
+
baseMipLevel: 0,
|
|
77
|
+
baseArrayLayer: 4,
|
|
78
|
+
arrayLayerCount: 1,
|
|
79
|
+
});
|
|
80
|
+
expect(projected.value.resolveView).toBeDefined();
|
|
81
|
+
expect(projected.value.sampleView).toBe(projected.value.resolveView);
|
|
82
|
+
expect(projected.value.usage).toEqual(['sampled-read', 'copy-src']);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('rejects a missing MSAA resolve view without changing graph ownership', () => {
|
|
86
|
+
const descriptor: RenderTargetDescriptor = {
|
|
87
|
+
shape: '2d',
|
|
88
|
+
width: 32,
|
|
89
|
+
height: 32,
|
|
90
|
+
format: 'rgba8unorm',
|
|
91
|
+
mipLevels: 1,
|
|
92
|
+
sampleCount: 4,
|
|
93
|
+
sampled: true,
|
|
94
|
+
readback: false,
|
|
95
|
+
};
|
|
96
|
+
const graph = new RenderGraphBuilder<Frame>();
|
|
97
|
+
const input = targetInput(descriptor);
|
|
98
|
+
const projected = projectRenderTargetGraph(graph, { ...input, resolveView: undefined });
|
|
99
|
+
expect(projected.ok).toBe(false);
|
|
100
|
+
if (!projected.ok) expect(projected.error.code).toBe('render-target-operation-failed');
|
|
101
|
+
});
|
|
102
|
+
});
|