pub struct FormatCostEntry {
pub key: Option<FormatCostKey>,
pub cost: Option<f32>,
}Expand description
A FormatCostEntry can be used to influence which PixelFormatAndModifier is chosen for a buffer collection, optionally taking BufferUsage into account.
The default cost is f32::MAX, so any specified cost with a non-MAX value will prefer the specified format over any formats that don’t have any FormatCost entry.
Entries which have the same pixel_format, pixel_format_modifier, and required_usage_bits as a previous entry will override that previous entry. For matching purposes, an absent pixel_format_modifier matches LINEAR, and an absent required_buffer_usage_bits matches all-0 usage bits.
Board info sysmem_defaults entries are logically before platform sysmem entries.
Sysmem uses the resulting aggregated list of FormatCostEntry(s) when breaking ties among the set of formats which are supported by all participants of a buffer collection. For each mutually-supported format, entries with non-matching format are ignored, and entries with extra buffer_usage_bits set are ignored. Among the remaining entries, the entry with the most usage bits in common with the aggregated participant usages is selected to determine the cost (if a tie, the later entry wins). Then the format with the lowest cost is chosen. If it’s still a tie (equal cost), the tie is broken arbitrarily but not randomly.
This is not intended as a mechanism to disallow selection of a format that is supported by all participants of a buffer collection. If a participant claims support for a format but fails to handle that format correctly, it should be fixed to handle that format correctly or changed to stop claiming support for that format.
This mechanism is intended to influence format selection toward more efficient formats with better performance, lower memory bandwidth usage, etc, for a given set of usage bits, taking into account quirks that may be unique to a given board or overall platform config.
Fields§
§key: Option<FormatCostKey>§cost: Option<f32>Trait Implementations§
Source§impl Clone for FormatCostEntry
impl Clone for FormatCostEntry
Source§fn clone(&self) -> FormatCostEntry
fn clone(&self) -> FormatCostEntry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FormatCostEntry
impl Debug for FormatCostEntry
Source§impl Default for FormatCostEntry
impl Default for FormatCostEntry
Source§fn default() -> FormatCostEntry
fn default() -> FormatCostEntry
Source§impl<'a, ___E> Encode<FormatCostEntry<'static>, ___E> for &'a FormatCostEntrywhere
___E: Encoder + ?Sized,
impl<'a, ___E> Encode<FormatCostEntry<'static>, ___E> for &'a FormatCostEntrywhere
___E: Encoder + ?Sized,
Source§fn encode(
self,
encoder: &mut ___E,
out: &mut MaybeUninit<FormatCostEntry<'static>>,
_: (),
) -> Result<(), EncodeError>
fn encode( self, encoder: &mut ___E, out: &mut MaybeUninit<FormatCostEntry<'static>>, _: (), ) -> Result<(), EncodeError>
§const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _
const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _
Source§impl<___E> Encode<FormatCostEntry<'static>, ___E> for FormatCostEntrywhere
___E: Encoder + ?Sized,
impl<___E> Encode<FormatCostEntry<'static>, ___E> for FormatCostEntrywhere
___E: Encoder + ?Sized,
Source§fn encode(
self,
encoder: &mut ___E,
out: &mut MaybeUninit<FormatCostEntry<'static>>,
_: (),
) -> Result<(), EncodeError>
fn encode( self, encoder: &mut ___E, out: &mut MaybeUninit<FormatCostEntry<'static>>, _: (), ) -> Result<(), EncodeError>
§const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _
const COPY_OPTIMIZATION: CopyOptimization<Self, W> = _
Source§impl<'de> FromWire<FormatCostEntry<'de>> for FormatCostEntry
impl<'de> FromWire<FormatCostEntry<'de>> for FormatCostEntry
Source§fn from_wire(wire_: FormatCostEntry<'de>) -> FormatCostEntry
fn from_wire(wire_: FormatCostEntry<'de>) -> FormatCostEntry
§const COPY_OPTIMIZATION: CopyOptimization<W, Self> = _
const COPY_OPTIMIZATION: CopyOptimization<W, Self> = _
Source§impl<'de> FromWireRef<FormatCostEntry<'de>> for FormatCostEntry
impl<'de> FromWireRef<FormatCostEntry<'de>> for FormatCostEntry
Source§fn from_wire_ref(wire: &FormatCostEntry<'de>) -> FormatCostEntry
fn from_wire_ref(wire: &FormatCostEntry<'de>) -> FormatCostEntry
Source§impl PartialEq for FormatCostEntry
impl PartialEq for FormatCostEntry
Source§fn eq(&self, other: &FormatCostEntry) -> bool
fn eq(&self, other: &FormatCostEntry) -> bool
self and other values to be equal, and is used by ==.Source§impl PartialOrd for FormatCostEntry
impl PartialOrd for FormatCostEntry
impl Copy for FormatCostEntry
impl StructuralPartialEq for FormatCostEntry
Auto Trait Implementations§
impl Freeze for FormatCostEntry
impl RefUnwindSafe for FormatCostEntry
impl Send for FormatCostEntry
impl Sync for FormatCostEntry
impl Unpin for FormatCostEntry
impl UnsafeUnpin for FormatCostEntry
impl UnwindSafe for FormatCostEntry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, W> FromWireOption<Box<'_, W>> for Twhere
T: FromWire<W>,
impl<T, W> FromWireOption<Box<'_, W>> for Twhere
T: FromWire<W>,
§fn from_wire_option(wire: Box<'_, W>) -> Option<T>
fn from_wire_option(wire: Box<'_, W>) -> Option<T>
§impl<T, W> FromWireOptionRef<Box<'_, W>> for Twhere
T: FromWireRef<W>,
impl<T, W> FromWireOptionRef<Box<'_, W>> for Twhere
T: FromWireRef<W>,
§fn from_wire_option_ref(wire: &Box<'_, W>) -> Option<T>
fn from_wire_option_ref(wire: &Box<'_, W>) -> Option<T>
§impl<T> InstanceFromServiceTransport<T> for T
impl<T> InstanceFromServiceTransport<T> for T
§fn from_service_transport(handle: T) -> T
fn from_service_transport(handle: T) -> T
T to [Self]