Files
LunaDL 5c887bfc59 Perf: Create screen-effect pipelines on demand (#3453)
* perf: create screen-effect pipelines on demand

* fix: prepare screen-effect fallback pipelines

* docs: describe lazy screen-effect pipelines

* test: guard lazy screen-effect pipeline setup
2026-11-30 15:03:30 -05:00

1.6 KiB

Screen-effect pipeline creation

The screen-effect chain creates its shared render passes, sampler, descriptor layout/pool and pipeline layout when first used. Graphics pipelines are created only when the frame's settings require them, then reused until output-format reset or explicit chain teardown. Source-image and size changes keep the cache.

Pipeline preparation happens before any effect draw is recorded. If a required pipeline fails to initialize, the chain follows its existing whole-chain fallback and returns the unprocessed scene; it does not record a partial stack. Settings are snapshotted at frame entry, so changes during recording apply to the next invocation.

Spatial upscalers are prepared only when their dispatch path is active. FSR creates EASU and creates RCAS only when sharpening is enabled; sharpen-only mode creates RCAS. SMAA prepares its three passes only when selected, while keeping FXAA available for the existing SMAA scratch-allocation fallback. Half-precision shaders remain selected by the existing debug property. The optional fast NIS path and its coefficient resources are deferred until NIS is actually used; the existing fragment-shader fallback is retained.

This reduces unused pipeline creation and first-use setup work. It does not reduce the shader work performed each frame, and first use of a newly selected effect may still compile its pipelines. No background precompilation is added. Pipeline-count reductions are not measurements of startup latency or FPS.

Validation still requires the native effect-chain tests and on-device visual testing. Static source checks alone do not establish Vulkan runtime correctness.