View filter for batch_and_prepare_render_phase (#14713)

# Objective
- batch_and_prepare_render_phase will iterate all living entities ,which
potentially causes a lot of unnecessary look up
- from
https://github.com/bevyengine/bevy/pull/14449#issuecomment-2282876034

## Solution

- added View filter
This commit is contained in:
re0312 2024-08-13 00:15:54 +08:00 committed by GitHub
parent 61a1530c56
commit 032fd486c7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,7 +24,7 @@ use crate::{
},
render_resource::{BufferVec, GpuArrayBufferable, RawBufferVec, UninitBufferVec},
renderer::{RenderAdapter, RenderDevice, RenderQueue},
view::{GpuCulling, ViewTarget},
view::{ExtractedView, GpuCulling, ViewTarget},
Render, RenderApp, RenderSet,
};
@ -386,7 +386,7 @@ pub fn batch_and_prepare_sorted_render_phase<I, GFBD>(
gpu_array_buffer: ResMut<BatchedInstanceBuffers<GFBD::BufferData, GFBD::BufferInputData>>,
mut indirect_parameters_buffer: ResMut<IndirectParametersBuffer>,
mut sorted_render_phases: ResMut<ViewSortedRenderPhases<I>>,
mut views: Query<(Entity, Has<GpuCulling>)>,
mut views: Query<(Entity, Has<GpuCulling>), With<ExtractedView>>,
system_param_item: StaticSystemParam<GFBD::Param>,
) where
I: CachedRenderPipelinePhaseItem + SortedPhaseItem,
@ -503,7 +503,7 @@ pub fn batch_and_prepare_binned_render_phase<BPI, GFBD>(
gpu_array_buffer: ResMut<BatchedInstanceBuffers<GFBD::BufferData, GFBD::BufferInputData>>,
mut indirect_parameters_buffer: ResMut<IndirectParametersBuffer>,
mut binned_render_phases: ResMut<ViewBinnedRenderPhases<BPI>>,
mut views: Query<(Entity, Has<GpuCulling>)>,
mut views: Query<(Entity, Has<GpuCulling>), With<ExtractedView>>,
param: StaticSystemParam<GFBD::Param>,
) where
BPI: BinnedPhaseItem,