From 49aae890494f276237394faa8e5788050bdee4f8 Mon Sep 17 00:00:00 2001 From: ickshonpe Date: Sun, 5 Jan 2025 20:34:11 +0000 Subject: [PATCH] unmut extracted view queries (#17142) # Objective Noticed a lot of the extracted view queries are unnecessarily mutable. Fixed them. --- crates/bevy_gizmos/src/pipeline_2d.rs | 8 ++++---- crates/bevy_gizmos/src/pipeline_3d.rs | 8 ++++---- crates/bevy_sprite/src/render/mod.rs | 4 ++-- crates/bevy_ui/src/render/box_shadow.rs | 4 ++-- crates/bevy_ui/src/render/mod.rs | 4 ++-- crates/bevy_ui/src/render/ui_material_pipeline.rs | 4 ++-- crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/crates/bevy_gizmos/src/pipeline_2d.rs b/crates/bevy_gizmos/src/pipeline_2d.rs index 2a885a1866..d2e17a680c 100644 --- a/crates/bevy_gizmos/src/pipeline_2d.rs +++ b/crates/bevy_gizmos/src/pipeline_2d.rs @@ -297,7 +297,7 @@ fn queue_line_gizmos_2d( line_gizmos: Query<(Entity, &MainEntity, &GizmoMeshConfig)>, line_gizmo_assets: Res>, mut transparent_render_phases: ResMut>, - mut views: Query<(Entity, &ExtractedView, &Msaa, Option<&RenderLayers>)>, + views: Query<(Entity, &ExtractedView, &Msaa, Option<&RenderLayers>)>, ) { let draw_function = draw_functions.read().get_id::().unwrap(); let draw_function_strip = draw_functions @@ -305,7 +305,7 @@ fn queue_line_gizmos_2d( .get_id::() .unwrap(); - for (view_entity, view, msaa, render_layers) in &mut views { + for (view_entity, view, msaa, render_layers) in &views { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else { continue; }; @@ -375,14 +375,14 @@ fn queue_line_joint_gizmos_2d( line_gizmos: Query<(Entity, &MainEntity, &GizmoMeshConfig)>, line_gizmo_assets: Res>, mut transparent_render_phases: ResMut>, - mut views: Query<(Entity, &ExtractedView, &Msaa, Option<&RenderLayers>)>, + views: Query<(Entity, &ExtractedView, &Msaa, Option<&RenderLayers>)>, ) { let draw_function = draw_functions .read() .get_id::() .unwrap(); - for (view_entity, view, msaa, render_layers) in &mut views { + for (view_entity, view, msaa, render_layers) in &views { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else { continue; }; diff --git a/crates/bevy_gizmos/src/pipeline_3d.rs b/crates/bevy_gizmos/src/pipeline_3d.rs index 025cc4c7c0..49d00b3343 100644 --- a/crates/bevy_gizmos/src/pipeline_3d.rs +++ b/crates/bevy_gizmos/src/pipeline_3d.rs @@ -292,7 +292,7 @@ fn queue_line_gizmos_3d( line_gizmos: Query<(Entity, &MainEntity, &GizmoMeshConfig)>, line_gizmo_assets: Res>, mut transparent_render_phases: ResMut>, - mut views: Query<( + views: Query<( Entity, &ExtractedView, &Msaa, @@ -317,7 +317,7 @@ fn queue_line_gizmos_3d( msaa, render_layers, (normal_prepass, depth_prepass, motion_vector_prepass, deferred_prepass), - ) in &mut views + ) in &views { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else { continue; @@ -407,7 +407,7 @@ fn queue_line_joint_gizmos_3d( line_gizmos: Query<(Entity, &MainEntity, &GizmoMeshConfig)>, line_gizmo_assets: Res>, mut transparent_render_phases: ResMut>, - mut views: Query<( + views: Query<( Entity, &ExtractedView, &Msaa, @@ -431,7 +431,7 @@ fn queue_line_joint_gizmos_3d( msaa, render_layers, (normal_prepass, depth_prepass, motion_vector_prepass, deferred_prepass), - ) in &mut views + ) in &views { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else { continue; diff --git a/crates/bevy_sprite/src/render/mod.rs b/crates/bevy_sprite/src/render/mod.rs index 3adbfc9417..1c91bdd603 100644 --- a/crates/bevy_sprite/src/render/mod.rs +++ b/crates/bevy_sprite/src/render/mod.rs @@ -503,7 +503,7 @@ pub fn queue_sprites( pipeline_cache: Res, extracted_sprites: Res, mut transparent_render_phases: ResMut>, - mut views: Query<( + views: Query<( Entity, &RenderVisibleEntities, &ExtractedView, @@ -514,7 +514,7 @@ pub fn queue_sprites( ) { let draw_sprite_function = draw_functions.read().id::(); - for (view_entity, visible_entities, view, msaa, tonemapping, dither) in &mut views { + for (view_entity, visible_entities, view, msaa, tonemapping, dither) in &views { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else { continue; }; diff --git a/crates/bevy_ui/src/render/box_shadow.rs b/crates/bevy_ui/src/render/box_shadow.rs index 40363bf386..4521f18546 100644 --- a/crates/bevy_ui/src/render/box_shadow.rs +++ b/crates/bevy_ui/src/render/box_shadow.rs @@ -341,13 +341,13 @@ pub fn queue_shadows( box_shadow_pipeline: Res, mut pipelines: ResMut>, mut transparent_render_phases: ResMut>, - mut views: Query<(Entity, &ExtractedView, Option<&BoxShadowSamples>)>, + views: Query<(Entity, &ExtractedView, Option<&BoxShadowSamples>)>, pipeline_cache: Res, draw_functions: Res>, ) { let draw_function = draw_functions.read().id::(); for (entity, extracted_shadow) in extracted_box_shadows.box_shadows.iter() { - let Ok((view_entity, view, shadow_samples)) = views.get_mut(extracted_shadow.camera_entity) + let Ok((view_entity, view, shadow_samples)) = views.get(extracted_shadow.camera_entity) else { continue; }; diff --git a/crates/bevy_ui/src/render/mod.rs b/crates/bevy_ui/src/render/mod.rs index 54795e885f..e1528b02d2 100644 --- a/crates/bevy_ui/src/render/mod.rs +++ b/crates/bevy_ui/src/render/mod.rs @@ -796,13 +796,13 @@ pub fn queue_uinodes( ui_pipeline: Res, mut pipelines: ResMut>, mut transparent_render_phases: ResMut>, - mut views: Query<(Entity, &ExtractedView, Option<&UiAntiAlias>)>, + views: Query<(Entity, &ExtractedView, Option<&UiAntiAlias>)>, pipeline_cache: Res, draw_functions: Res>, ) { let draw_function = draw_functions.read().id::(); for (entity, extracted_uinode) in extracted_uinodes.uinodes.iter() { - let Ok((view_entity, view, ui_anti_alias)) = views.get_mut(extracted_uinode.camera_entity) + let Ok((view_entity, view, ui_anti_alias)) = views.get(extracted_uinode.camera_entity) else { continue; }; diff --git a/crates/bevy_ui/src/render/ui_material_pipeline.rs b/crates/bevy_ui/src/render/ui_material_pipeline.rs index 481dce07d3..831cc71cd4 100644 --- a/crates/bevy_ui/src/render/ui_material_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_material_pipeline.rs @@ -614,7 +614,7 @@ pub fn queue_ui_material_nodes( pipeline_cache: Res, render_materials: Res>>, mut transparent_render_phases: ResMut>, - mut views: Query<&ExtractedView>, + views: Query<&ExtractedView>, ) where M::Data: PartialEq + Eq + Hash + Clone, { @@ -624,7 +624,7 @@ pub fn queue_ui_material_nodes( let Some(material) = render_materials.get(extracted_uinode.material) else { continue; }; - let Ok(view) = views.get_mut(extracted_uinode.camera_entity) else { + let Ok(view) = views.get(extracted_uinode.camera_entity) else { continue; }; let Some(transparent_phase) = diff --git a/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs b/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs index 657e4a95ae..f4fc6d77e9 100644 --- a/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs +++ b/crates/bevy_ui/src/render/ui_texture_slice_pipeline.rs @@ -344,13 +344,13 @@ pub fn queue_ui_slices( ui_slicer_pipeline: Res, mut pipelines: ResMut>, mut transparent_render_phases: ResMut>, - mut views: Query<(Entity, &ExtractedView)>, + views: Query<(Entity, &ExtractedView)>, pipeline_cache: Res, draw_functions: Res>, ) { let draw_function = draw_functions.read().id::(); for (entity, extracted_slicer) in extracted_ui_slicers.slices.iter() { - let Ok((view_entity, view)) = views.get_mut(extracted_slicer.camera_entity) else { + let Ok((view_entity, view)) = views.get(extracted_slicer.camera_entity) else { continue; };