pub trait GetBatchData {
type Param: SystemParam + 'static;
type CompareData: PartialEq;
type BufferData: GpuArrayBufferable + Sync + Send + 'static;
// Required method
fn get_batch_data(
param: &SystemParamItem<'_, '_, Self::Param>,
query_item: (Entity, MainEntity),
) -> Option<(Self::BufferData, Option<Self::CompareData>)>;
}Expand description
A trait to support getting data used for batching draw commands via phase items.
This is a simple version that only allows for sorting, not binning, as well
as only CPU processing, not GPU preprocessing. For these fancier features,
see GetFullBatchData.
Required Associated Types§
Sourcetype Param: SystemParam + 'static
type Param: SystemParam + 'static
The system parameters GetBatchData::get_batch_data needs in
order to compute the batch data.
Sourcetype CompareData: PartialEq
type CompareData: PartialEq
Data used for comparison between phase items. If the pipeline id, draw function id, per-instance data buffer dynamic offset and this data matches, the draws can be batched.
Sourcetype BufferData: GpuArrayBufferable + Sync + Send + 'static
type BufferData: GpuArrayBufferable + Sync + Send + 'static
The per-instance data to be inserted into the
crate::render_resource::GpuArrayBuffer containing these data for all
instances.
Required Methods§
Sourcefn get_batch_data(
param: &SystemParamItem<'_, '_, Self::Param>,
query_item: (Entity, MainEntity),
) -> Option<(Self::BufferData, Option<Self::CompareData>)>
fn get_batch_data( param: &SystemParamItem<'_, '_, Self::Param>, query_item: (Entity, MainEntity), ) -> Option<(Self::BufferData, Option<Self::CompareData>)>
Get the per-instance data to be inserted into the
crate::render_resource::GpuArrayBuffer. If the instance can be
batched, also return the data used for comparison when deciding whether
draws can be batched, else return None for the CompareData.
This is only called when building instance data on CPU. In the GPU
instance data building path, we use
GetFullBatchData::get_index_and_compare_data instead.
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.