pub trait GetFullBatchData: GetBatchData {
type BufferInputData: Pod + Sync + Send;
// Required methods
fn get_binned_batch_data(
param: &SystemParamItem<'_, '_, Self::Param>,
query_item: Entity,
) -> Option<Self::BufferData>;
fn get_index_and_compare_data(
param: &SystemParamItem<'_, '_, Self::Param>,
query_item: Entity,
) -> Option<(NonMaxU32, Option<Self::CompareData>)>;
fn get_binned_index(
param: &SystemParamItem<'_, '_, Self::Param>,
query_item: Entity,
) -> Option<NonMaxU32>;
fn get_batch_indirect_parameters_index(
param: &SystemParamItem<'_, '_, Self::Param>,
indirect_parameters_buffer: &mut IndirectParametersBuffer,
entity: Entity,
instance_index: u32,
) -> Option<NonMaxU32>;
}
Expand description
A trait to support getting data used for batching draw commands via phase items.
This version allows for binning and GPU preprocessing.
Required Associated Types§
Sourcetype BufferInputData: Pod + Sync + Send
type BufferInputData: Pod + Sync + Send
The per-instance data that was inserted into the
crate::render_resource::BufferVec
during extraction.
Required Methods§
Sourcefn get_binned_batch_data(
param: &SystemParamItem<'_, '_, Self::Param>,
query_item: Entity,
) -> Option<Self::BufferData>
fn get_binned_batch_data( param: &SystemParamItem<'_, '_, Self::Param>, query_item: Entity, ) -> Option<Self::BufferData>
Get the per-instance data to be inserted into the
crate::render_resource::GpuArrayBuffer
.
This is only called when building uniforms on CPU. In the GPU instance
buffer building path, we use
GetFullBatchData::get_index_and_compare_data
instead.
Sourcefn get_index_and_compare_data(
param: &SystemParamItem<'_, '_, Self::Param>,
query_item: Entity,
) -> Option<(NonMaxU32, Option<Self::CompareData>)>
fn get_index_and_compare_data( param: &SystemParamItem<'_, '_, Self::Param>, query_item: Entity, ) -> Option<(NonMaxU32, Option<Self::CompareData>)>
Returns the index of the GetFullBatchData::BufferInputData
that the
GPU preprocessing phase will use.
We already inserted the GetFullBatchData::BufferInputData
during the
extraction phase before we got here, so this function shouldn’t need to
look up any render data. If CPU instance buffer building is in use, this
function will never be called.
Sourcefn get_binned_index(
param: &SystemParamItem<'_, '_, Self::Param>,
query_item: Entity,
) -> Option<NonMaxU32>
fn get_binned_index( param: &SystemParamItem<'_, '_, Self::Param>, query_item: Entity, ) -> Option<NonMaxU32>
Returns the index of the GetFullBatchData::BufferInputData
that the
GPU preprocessing phase will use, for the binning path.
We already inserted the GetFullBatchData::BufferInputData
during the
extraction phase before we got here, so this function shouldn’t need to
look up any render data. If CPU instance buffer building is in use, this
function will never be called.
Sourcefn get_batch_indirect_parameters_index(
param: &SystemParamItem<'_, '_, Self::Param>,
indirect_parameters_buffer: &mut IndirectParametersBuffer,
entity: Entity,
instance_index: u32,
) -> Option<NonMaxU32>
fn get_batch_indirect_parameters_index( param: &SystemParamItem<'_, '_, Self::Param>, indirect_parameters_buffer: &mut IndirectParametersBuffer, entity: Entity, instance_index: u32, ) -> Option<NonMaxU32>
Pushes gpu_preprocessing::IndirectParameters
necessary to draw this
batch onto the given IndirectParametersBuffer
, and returns its
index.
This is only used if GPU culling is enabled (which requires GPU preprocessing).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.