Remove unnecessary muts in RenderSet::QueueMeshes (#14953)

# Objective

Fixes #14952
This commit is contained in:
Allen Pocket 2024-08-28 19:38:38 +08:00 committed by GitHub
parent 371e07e77d
commit d93b78a66e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 12 additions and 12 deletions

View file

@ -545,7 +545,7 @@ pub fn queue_material_meshes<M: Material>(
mut alpha_mask_render_phases: ResMut<ViewBinnedRenderPhases<AlphaMask3d>>, mut alpha_mask_render_phases: ResMut<ViewBinnedRenderPhases<AlphaMask3d>>,
mut transmissive_render_phases: ResMut<ViewSortedRenderPhases<Transmissive3d>>, mut transmissive_render_phases: ResMut<ViewSortedRenderPhases<Transmissive3d>>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent3d>>, mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent3d>>,
mut views: Query<( views: Query<(
Entity, Entity,
&ExtractedView, &ExtractedView,
&VisibleEntities, &VisibleEntities,
@ -585,7 +585,7 @@ pub fn queue_material_meshes<M: Material>(
temporal_jitter, temporal_jitter,
projection, projection,
(has_environment_maps, has_irradiance_volumes), (has_environment_maps, has_irradiance_volumes),
) in &mut views ) in &views
{ {
let ( let (
Some(opaque_phase), Some(opaque_phase),

View file

@ -688,7 +688,7 @@ pub fn queue_prepass_material_meshes<M: Material>(
mut alpha_mask_prepass_render_phases: ResMut<ViewBinnedRenderPhases<AlphaMask3dPrepass>>, mut alpha_mask_prepass_render_phases: ResMut<ViewBinnedRenderPhases<AlphaMask3dPrepass>>,
mut opaque_deferred_render_phases: ResMut<ViewBinnedRenderPhases<Opaque3dDeferred>>, mut opaque_deferred_render_phases: ResMut<ViewBinnedRenderPhases<Opaque3dDeferred>>,
mut alpha_mask_deferred_render_phases: ResMut<ViewBinnedRenderPhases<AlphaMask3dDeferred>>, mut alpha_mask_deferred_render_phases: ResMut<ViewBinnedRenderPhases<AlphaMask3dDeferred>>,
mut views: Query< views: Query<
( (
Entity, Entity,
&VisibleEntities, &VisibleEntities,
@ -727,7 +727,7 @@ pub fn queue_prepass_material_meshes<M: Material>(
normal_prepass, normal_prepass,
motion_vector_prepass, motion_vector_prepass,
deferred_prepass, deferred_prepass,
) in &mut views ) in &views
{ {
let ( let (
mut opaque_phase, mut opaque_phase,

View file

@ -1174,7 +1174,7 @@ pub fn queue_shadows<M: Material>(
pipeline_cache: Res<PipelineCache>, pipeline_cache: Res<PipelineCache>,
render_lightmaps: Res<RenderLightmaps>, render_lightmaps: Res<RenderLightmaps>,
view_lights: Query<(Entity, &ViewLightEntities)>, view_lights: Query<(Entity, &ViewLightEntities)>,
mut view_light_entities: Query<&LightEntity>, view_light_entities: Query<&LightEntity>,
point_light_entities: Query<&CubemapVisibleEntities, With<ExtractedPointLight>>, point_light_entities: Query<&CubemapVisibleEntities, With<ExtractedPointLight>>,
directional_light_entities: Query<&CascadesVisibleEntities, With<ExtractedDirectionalLight>>, directional_light_entities: Query<&CascadesVisibleEntities, With<ExtractedDirectionalLight>>,
spot_light_entities: Query<&VisibleMeshEntities, With<ExtractedPointLight>>, spot_light_entities: Query<&VisibleMeshEntities, With<ExtractedPointLight>>,
@ -1184,7 +1184,7 @@ pub fn queue_shadows<M: Material>(
for (entity, view_lights) in &view_lights { for (entity, view_lights) in &view_lights {
let draw_shadow_mesh = shadow_draw_functions.read().id::<DrawPrepass<M>>(); let draw_shadow_mesh = shadow_draw_functions.read().id::<DrawPrepass<M>>();
for view_light_entity in view_lights.lights.iter().copied() { 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; continue;
}; };
let Some(shadow_phase) = shadow_render_phases.get_mut(&view_light_entity) else { let Some(shadow_phase) = shadow_render_phases.get_mut(&view_light_entity) else {

View file

@ -418,7 +418,7 @@ pub fn queue_material2d_meshes<M: Material2d>(
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent2d>>, mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent2d>>,
mut opaque_render_phases: ResMut<ViewBinnedRenderPhases<Opaque2d>>, mut opaque_render_phases: ResMut<ViewBinnedRenderPhases<Opaque2d>>,
mut alpha_mask_render_phases: ResMut<ViewBinnedRenderPhases<AlphaMask2d>>, mut alpha_mask_render_phases: ResMut<ViewBinnedRenderPhases<AlphaMask2d>>,
mut views: Query<( views: Query<(
Entity, Entity,
&ExtractedView, &ExtractedView,
&VisibleEntities, &VisibleEntities,
@ -433,7 +433,7 @@ pub fn queue_material2d_meshes<M: Material2d>(
return; 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 { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else {
continue; continue;
}; };

View file

@ -370,13 +370,13 @@ pub fn queue_colored_mesh2d(
render_meshes: Res<RenderAssets<RenderMesh>>, render_meshes: Res<RenderAssets<RenderMesh>>,
render_mesh_instances: Res<RenderColoredMesh2dInstances>, render_mesh_instances: Res<RenderColoredMesh2dInstances>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent2d>>, mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent2d>>,
mut views: Query<(Entity, &VisibleEntities, &ExtractedView, &Msaa)>, views: Query<(Entity, &VisibleEntities, &ExtractedView, &Msaa)>,
) { ) {
if render_mesh_instances.is_empty() { if render_mesh_instances.is_empty() {
return; return;
} }
// Iterate each view (a camera is a view) // 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 { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else {
continue; continue;
}; };

View file

@ -123,11 +123,11 @@ fn queue_custom(
render_mesh_instances: Res<RenderMeshInstances>, render_mesh_instances: Res<RenderMeshInstances>,
material_meshes: Query<Entity, With<InstanceMaterialData>>, material_meshes: Query<Entity, With<InstanceMaterialData>>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent3d>>, mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent3d>>,
mut views: Query<(Entity, &ExtractedView, &Msaa)>, views: Query<(Entity, &ExtractedView, &Msaa)>,
) { ) {
let draw_custom = transparent_3d_draw_functions.read().id::<DrawCustom>(); let draw_custom = transparent_3d_draw_functions.read().id::<DrawCustom>();
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 { let Some(transparent_phase) = transparent_render_phases.get_mut(&view_entity) else {
continue; continue;
}; };