Trait bevy::render::render_phase::BinnedPhaseItem

pub trait BinnedPhaseItem: PhaseItem {
    type BinKey: Clone + Send + Sync + Eq + Ord + Hash;

    // Required method
    fn new(
        key: Self::BinKey,
        representative_entity: Entity,
        batch_range: Range<u32>,
        extra_index: PhaseItemExtraIndex
    ) -> Self;
}
Expand description

Represents phase items that are placed into bins. The BinKey specifies which bin they’re to be placed in. Bin keys are sorted, and items within the same bin are eligible to be batched together. The elements within the bins aren’t themselves sorted.

An example of a binned phase item is Opaque3d, for which the rendering order isn’t critical.

Required Associated Types§

type BinKey: Clone + Send + Sync + Eq + Ord + Hash

The key used for binning PhaseItems into bins. Order the members of BinnedPhaseItem::BinKey by the order of binding for best performance. For example, pipeline id, draw function id, mesh asset id, lowest variable bind group id such as the material bind group id, and its dynamic offsets if any, next bind group and offsets, etc. This reduces the need for rebinding between bins and improves performance.

Required Methods§

fn new( key: Self::BinKey, representative_entity: Entity, batch_range: Range<u32>, extra_index: PhaseItemExtraIndex ) -> Self

Creates a new binned phase item from the key and per-entity data.

Unlike SortedPhaseItems, this is generally called “just in time” before rendering. The resulting phase item isn’t stored in any data structures, resulting in significant memory savings.

Object Safety§

This trait is not object safe.

Implementors§