pub struct ComponentMapping {
    pub r: ComponentSwizzle,
    pub g: ComponentSwizzle,
    pub b: ComponentSwizzle,
    pub a: ComponentSwizzle,
}
Expand description

A mapping between components of a source format and components read by a shader.

Fields§

§r: ComponentSwizzle

First component.

§g: ComponentSwizzle

Second component.

§b: ComponentSwizzle

Third component.

§a: ComponentSwizzle

Fourth component.

Implementations§

source§

impl ComponentMapping

source

pub fn identity() -> Self

Creates a ComponentMapping with all components identity swizzled.

source

pub fn is_identity(&self) -> bool

Returns true if all components are identity swizzled, meaning that all the members are Identity or the name of that member.

Certain operations require views that are identity swizzled, and will return an error otherwise. For example, attaching a view to a framebuffer is only possible if the view is identity swizzled.

source

pub fn r_is_identity(&self) -> bool

Returns true if the red component mapping is identity swizzled.

source

pub fn g_is_identity(&self) -> bool

Returns true if the green component mapping is identity swizzled.

source

pub fn b_is_identity(&self) -> bool

Returns true if the blue component mapping is identity swizzled.

source

pub fn a_is_identity(&self) -> bool

Returns true if the alpha component mapping is identity swizzled.

source

pub fn component_map(&self) -> [Option<usize>; 4]

Returns the component indices that each component reads from. The index is None if the component has a fixed value and is not read from anywhere (Zero or One).

Trait Implementations§

source§

impl Clone for ComponentMapping

source§

fn clone(&self) -> ComponentMapping

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ComponentMapping

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ComponentMapping

source§

fn default() -> ComponentMapping

Returns the “default value” for a type. Read more
source§

impl From<ComponentMapping> for ComponentMapping

source§

fn from(value: ComponentMapping) -> Self

Converts to this type from the input type.
source§

impl PartialEq<ComponentMapping> for ComponentMapping

source§

fn eq(&self, other: &ComponentMapping) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for ComponentMapping

source§

impl Eq for ComponentMapping

source§

impl StructuralEq for ComponentMapping

source§

impl StructuralPartialEq for ComponentMapping

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.