From d93b78a66edb81eab08b7aad9c8c5f7115a0799e Mon Sep 17 00:00:00 2001 From: Allen Pocket Date: Wed, 28 Aug 2024 19:38:38 +0800 Subject: [PATCH] Remove unnecessary muts in `RenderSet::QueueMeshes` (#14953) # Objective Fixes #14952 --- crates/bevy_pbr/src/material.rs | 4 ++-- crates/bevy_pbr/src/prepass/mod.rs | 4 ++-- crates/bevy_pbr/src/render/light.rs | 4 ++-- crates/bevy_sprite/src/mesh2d/material.rs | 4 ++-- examples/2d/mesh2d_manual.rs | 4 ++-- examples/shader/shader_instancing.rs | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/bevy_pbr/src/material.rs b/crates/bevy_pbr/src/material.rs index 05bb1d7acc..cee8129feb 100644 --- a/crates/bevy_pbr/src/material.rs +++ b/crates/bevy_pbr/src/material.rs @@ -545,7 +545,7 @@ pub fn queue_material_meshes( mut alpha_mask_render_phases: ResMut>, mut transmissive_render_phases: ResMut>, mut transparent_render_phases: ResMut>, - mut views: Query<( + views: Query<( Entity, &ExtractedView, &VisibleEntities, @@ -585,7 +585,7 @@ pub fn queue_material_meshes( temporal_jitter, projection, (has_environment_maps, has_irradiance_volumes), - ) in &mut views + ) in &views { let ( Some(opaque_phase), diff --git a/crates/bevy_pbr/src/prepass/mod.rs b/crates/bevy_pbr/src/prepass/mod.rs index a639813d0d..859a862406 100644 --- a/crates/bevy_pbr/src/prepass/mod.rs +++ b/crates/bevy_pbr/src/prepass/mod.rs @@ -688,7 +688,7 @@ pub fn queue_prepass_material_meshes( mut alpha_mask_prepass_render_phases: ResMut>, mut opaque_deferred_render_phases: ResMut>, mut alpha_mask_deferred_render_phases: ResMut>, - mut views: Query< + views: Query< ( Entity, &VisibleEntities, @@ -727,7 +727,7 @@ pub fn queue_prepass_material_meshes( normal_prepass, motion_vector_prepass, deferred_prepass, - ) in &mut views + ) in &views { let ( mut opaque_phase, diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs index ae509c8739..6bf1013295 100644 --- a/crates/bevy_pbr/src/render/light.rs +++ b/crates/bevy_pbr/src/render/light.rs @@ -1174,7 +1174,7 @@ pub fn queue_shadows( pipeline_cache: Res, render_lightmaps: Res, view_lights: Query<(Entity, &ViewLightEntities)>, - mut view_light_entities: Query<&LightEntity>, + view_light_entities: Query<&LightEntity>, point_light_entities: Query<&CubemapVisibleEntities, With>, directional_light_entities: Query<&CascadesVisibleEntities, With>, spot_light_entities: Query<&VisibleMeshEntities, With>, @@ -1184,7 +1184,7 @@ pub fn queue_shadows( for (entity, view_lights) in &view_lights { let draw_shadow_mesh = shadow_draw_functions.read().id::>(); for view_light_entity in view_lights.lights.iter().copied() { - let Ok(light_entity) = view_light_entities.get_mut(view_light_entity) else { + let Ok(light_entity) = view_light_entities.get(view_light_entity) else { continue; }; let Some(shadow_phase) = shadow_render_phases.get_mut(&view_light_entity) else { diff --git a/crates/bevy_sprite/src/mesh2d/material.rs b/crates/bevy_sprite/src/mesh2d/material.rs index 17743f5aab..6c91e27ee8 100644 --- a/crates/bevy_sprite/src/mesh2d/material.rs +++ b/crates/bevy_sprite/src/mesh2d/material.rs @@ -418,7 +418,7 @@ pub fn queue_material2d_meshes( mut transparent_render_phases: ResMut>, mut opaque_render_phases: ResMut>, mut alpha_mask_render_phases: ResMut>, - mut views: Query<( + views: Query<( Entity, &ExtractedView, &VisibleEntities, @@ -433,7 +433,7 @@ pub fn queue_material2d_meshes( return; } - for (view_entity, view, visible_entities, msaa, tonemapping, dither) in &mut views { + for (view_entity, view, visible_entities, msaa, tonemapping, dither) in &views { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else { continue; }; diff --git a/examples/2d/mesh2d_manual.rs b/examples/2d/mesh2d_manual.rs index 6a7e97f6fd..b298a12fec 100644 --- a/examples/2d/mesh2d_manual.rs +++ b/examples/2d/mesh2d_manual.rs @@ -370,13 +370,13 @@ pub fn queue_colored_mesh2d( render_meshes: Res>, render_mesh_instances: Res, mut transparent_render_phases: ResMut>, - mut views: Query<(Entity, &VisibleEntities, &ExtractedView, &Msaa)>, + views: Query<(Entity, &VisibleEntities, &ExtractedView, &Msaa)>, ) { if render_mesh_instances.is_empty() { return; } // Iterate each view (a camera is a view) - for (view_entity, visible_entities, view, msaa) in &mut views { + for (view_entity, visible_entities, view, msaa) in &views { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else { continue; }; diff --git a/examples/shader/shader_instancing.rs b/examples/shader/shader_instancing.rs index e93eeac61c..734408f15d 100644 --- a/examples/shader/shader_instancing.rs +++ b/examples/shader/shader_instancing.rs @@ -123,11 +123,11 @@ fn queue_custom( render_mesh_instances: Res, material_meshes: Query>, mut transparent_render_phases: ResMut>, - mut views: Query<(Entity, &ExtractedView, &Msaa)>, + views: Query<(Entity, &ExtractedView, &Msaa)>, ) { let draw_custom = transparent_3d_draw_functions.read().id::(); - for (view_entity, view, msaa) in &mut views { + for (view_entity, view, msaa) in &views { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else { continue; };