Fix CAS toggle broken by retained render world (#16533)

# Objective

Fixes #16531

I also added change detection when creating the pipeline, which
technically isn't needed but it felt weird leaving it as is.

## Solution

Remove the pipeline if CAS is disabled. The uniform was already being
removed, which caused flickering / weirdness.

## Testing

Tested the anti_alias example by toggling CAS a bunch on/off.
This commit is contained in:
Kristoffer Søholm 2024-11-28 00:38:09 +01:00 committed by GitHub
parent af10aa38aa
commit 3d72e08f32
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -243,14 +243,22 @@ fn prepare_cas_pipelines(
pipeline_cache: Res<PipelineCache>,
mut pipelines: ResMut<SpecializedRenderPipelines<CasPipeline>>,
sharpening_pipeline: Res<CasPipeline>,
views: Query<(Entity, &ExtractedView, &DenoiseCas), With<CasUniform>>,
views: Query<
(Entity, &ExtractedView, &DenoiseCas),
Or<(Added<CasUniform>, Changed<DenoiseCas>)>,
>,
mut removals: RemovedComponents<CasUniform>,
) {
for (entity, view, cas) in &views {
for entity in removals.read() {
commands.entity(entity).remove::<ViewCasPipeline>();
}
for (entity, view, denoise_cas) in &views {
let pipeline_id = pipelines.specialize(
&pipeline_cache,
&sharpening_pipeline,
CasPipelineKey {
denoise: cas.0,
denoise: denoise_cas.0,
texture_format: if view.hdr {
ViewTarget::TEXTURE_FORMAT_HDR
} else {