diff --git a/crates/bevy_render/src/renderer/mod.rs b/crates/bevy_render/src/renderer/mod.rs index 3fae24e1e477d..c645f0811f0f0 100644 --- a/crates/bevy_render/src/renderer/mod.rs +++ b/crates/bevy_render/src/renderer/mod.rs @@ -13,7 +13,7 @@ use crate::{ settings::{WgpuSettings, WgpuSettingsPriority}, view::{ExtractedWindows, ViewTarget}, }; -use bevy_ecs::prelude::*; +use bevy_ecs::{prelude::*, system::SystemState}; use bevy_time::TimeSender; use bevy_utils::Instant; use std::sync::Arc; @@ -22,7 +22,7 @@ use wgpu::{ }; /// Updates the [`RenderGraph`] with all of its nodes and then runs it to render the entire frame. -pub fn render_system(world: &mut World) { +pub fn render_system(world: &mut World, state: &mut SystemState>>) { world.resource_scope(|world, mut graph: Mut| { graph.update(world); }); @@ -59,10 +59,7 @@ pub fn render_system(world: &mut World) { // Remove ViewTarget components to ensure swap chain TextureViews are dropped. // If all TextureViews aren't dropped before present, acquiring the next swap chain texture will fail. - let view_entities = world - .query_filtered::>() - .iter(world) - .collect::>(); + let view_entities = state.get(world).iter().collect::>(); for view_entity in view_entities { world.entity_mut(view_entity).remove::(); }