diff --git a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs index e76be196d5..fbc3ecfec3 100644 --- a/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs +++ b/crates/bevy_core_pipeline/src/contrast_adaptive_sharpening/mod.rs @@ -243,14 +243,22 @@ fn prepare_cas_pipelines( pipeline_cache: Res, mut pipelines: ResMut>, sharpening_pipeline: Res, - views: Query<(Entity, &ExtractedView, &DenoiseCas), With>, + views: Query< + (Entity, &ExtractedView, &DenoiseCas), + Or<(Added, Changed)>, + >, + mut removals: RemovedComponents, ) { - for (entity, view, cas) in &views { + for entity in removals.read() { + commands.entity(entity).remove::(); + } + + 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 {