unmut extracted view queries (#17142)

# Objective

Noticed a lot of the extracted view queries are unnecessarily mutable.
Fixed them.
This commit is contained in:
ickshonpe 2025-01-05 20:34:11 +00:00 committed by GitHub
parent 7112d5594e
commit 49aae89049
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 18 additions and 18 deletions

View File

@ -297,7 +297,7 @@ fn queue_line_gizmos_2d(
line_gizmos: Query<(Entity, &MainEntity, &GizmoMeshConfig)>,
line_gizmo_assets: Res<RenderAssets<GpuLineGizmo>>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent2d>>,
mut views: Query<(Entity, &ExtractedView, &Msaa, Option<&RenderLayers>)>,
views: Query<(Entity, &ExtractedView, &Msaa, Option<&RenderLayers>)>,
) {
let draw_function = draw_functions.read().get_id::<DrawLineGizmo2d>().unwrap();
let draw_function_strip = draw_functions
@ -305,7 +305,7 @@ fn queue_line_gizmos_2d(
.get_id::<DrawLineGizmo2dStrip>()
.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<RenderAssets<GpuLineGizmo>>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent2d>>,
mut views: Query<(Entity, &ExtractedView, &Msaa, Option<&RenderLayers>)>,
views: Query<(Entity, &ExtractedView, &Msaa, Option<&RenderLayers>)>,
) {
let draw_function = draw_functions
.read()
.get_id::<DrawLineJointGizmo2d>()
.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;
};

View File

@ -292,7 +292,7 @@ fn queue_line_gizmos_3d(
line_gizmos: Query<(Entity, &MainEntity, &GizmoMeshConfig)>,
line_gizmo_assets: Res<RenderAssets<GpuLineGizmo>>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent3d>>,
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<RenderAssets<GpuLineGizmo>>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent3d>>,
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;

View File

@ -503,7 +503,7 @@ pub fn queue_sprites(
pipeline_cache: Res<PipelineCache>,
extracted_sprites: Res<ExtractedSprites>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<Transparent2d>>,
mut views: Query<(
views: Query<(
Entity,
&RenderVisibleEntities,
&ExtractedView,
@ -514,7 +514,7 @@ pub fn queue_sprites(
) {
let draw_sprite_function = draw_functions.read().id::<DrawSprite>();
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;
};

View File

@ -341,13 +341,13 @@ pub fn queue_shadows(
box_shadow_pipeline: Res<BoxShadowPipeline>,
mut pipelines: ResMut<SpecializedRenderPipelines<BoxShadowPipeline>>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<TransparentUi>>,
mut views: Query<(Entity, &ExtractedView, Option<&BoxShadowSamples>)>,
views: Query<(Entity, &ExtractedView, Option<&BoxShadowSamples>)>,
pipeline_cache: Res<PipelineCache>,
draw_functions: Res<DrawFunctions<TransparentUi>>,
) {
let draw_function = draw_functions.read().id::<DrawBoxShadows>();
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;
};

View File

@ -796,13 +796,13 @@ pub fn queue_uinodes(
ui_pipeline: Res<UiPipeline>,
mut pipelines: ResMut<SpecializedRenderPipelines<UiPipeline>>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<TransparentUi>>,
mut views: Query<(Entity, &ExtractedView, Option<&UiAntiAlias>)>,
views: Query<(Entity, &ExtractedView, Option<&UiAntiAlias>)>,
pipeline_cache: Res<PipelineCache>,
draw_functions: Res<DrawFunctions<TransparentUi>>,
) {
let draw_function = draw_functions.read().id::<DrawUi>();
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;
};

View File

@ -614,7 +614,7 @@ pub fn queue_ui_material_nodes<M: UiMaterial>(
pipeline_cache: Res<PipelineCache>,
render_materials: Res<RenderAssets<PreparedUiMaterial<M>>>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<TransparentUi>>,
mut views: Query<&ExtractedView>,
views: Query<&ExtractedView>,
) where
M::Data: PartialEq + Eq + Hash + Clone,
{
@ -624,7 +624,7 @@ pub fn queue_ui_material_nodes<M: UiMaterial>(
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) =

View File

@ -344,13 +344,13 @@ pub fn queue_ui_slices(
ui_slicer_pipeline: Res<UiTextureSlicePipeline>,
mut pipelines: ResMut<SpecializedRenderPipelines<UiTextureSlicePipeline>>,
mut transparent_render_phases: ResMut<ViewSortedRenderPhases<TransparentUi>>,
mut views: Query<(Entity, &ExtractedView)>,
views: Query<(Entity, &ExtractedView)>,
pipeline_cache: Res<PipelineCache>,
draw_functions: Res<DrawFunctions<TransparentUi>>,
) {
let draw_function = draw_functions.read().id::<DrawUiTextureSlices>();
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;
};