Enum TypeInner

Source
pub enum TypeInner<'a> {
    Unknown,
    Void,
    Pointer {
        base: Handle<TypeId>,
        storage: StorageClass,
        forward: bool,
    },
    Struct(StructType<'a>),
    Scalar(Scalar),
    Vector {
        width: u32,
        scalar: Scalar,
    },
    Matrix {
        columns: u32,
        rows: u32,
        scalar: Scalar,
    },
    Array {
        base: Handle<TypeId>,
        storage: StorageClass,
        dimensions: Vec<ArrayDimension>,
        stride: Option<u32>,
    },
    Image(ImageType),
    AccelerationStructure,
    Sampler,
}
Expand description

Enum with additional type information, depending on the kind of type.

The design of this API is inspired heavily by naga::TypeInner, with some changes to fit SPIR-V.

Variants§

§

Unknown

Unknown type.

§

Void

The void type.

§

Pointer

A pointer to another type.

Atomics are represented as TypeInner::Pointer with the storage class StorageClass::AtomicCounter.

Fields

§base: Handle<TypeId>

A handle to the base type this points to.

§storage: StorageClass

The storage class of the pointer.

Atomics are represented as TypeInner::Pointer with the storage class StorageClass::AtomicCounter.

§forward: bool

Whether this pointer is a forward pointer (i.e. base is another pointer type).

§

Struct(StructType<'a>)

A struct type.

§

Scalar(Scalar)

A scalar type.

§

Vector

A vector type.

For example, vec4 would have a width of 4, and a scalar type with ScalarKind::Float and bit-width 32.

Fields

§width: u32

The width of the vector.

§scalar: Scalar

The scalar type of the vector.

§

Matrix

A matrix type.

For example, mat4 would have 4 columns, 4 rows, and a scalar type with ScalarKind::Float and bit-width 32.

Fields

§columns: u32

The number of columns of the matrix type.

§rows: u32

The number of rows of the matrix type.

§scalar: Scalar

The scalar type of the matrix.

§

Array

An array type.

Fields

§base: Handle<TypeId>

The base type that the type is an array of.

§storage: StorageClass

The storage class of the array.

§dimensions: Vec<ArrayDimension>

The dimensions of the array.

Most of the time, these will be ArrayDimension::Literal. If an array dimension is specified as a specialization constant, then the dimension will be ArrayDimension::Constant.

The order of dimensions follow SPIR-V semantics, i.e. backwards compared to C-style declarations.

i.e. int a[4][6] will return as [Linear(6), Linear(4)].

§stride: Option<u32>

The stride, in bytes, of the array’s elements, if this array type appears as a struct member.

§

Image(ImageType)

A texture or image handle.

§

AccelerationStructure

An opaque acceleration structure.

§

Sampler

An opaque sampler.

Trait Implementations§

Source§

impl<'a> Clone for TypeInner<'a>

Source§

fn clone(&self) -> TypeInner<'a>

Returns a duplicate 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<'a> Debug for TypeInner<'a>

Source§

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

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

impl<'a> PartialEq for TypeInner<'a>

Source§

fn eq(&self, other: &TypeInner<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for TypeInner<'a>

Source§

impl<'a> StructuralPartialEq for TypeInner<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for TypeInner<'a>

§

impl<'a> RefUnwindSafe for TypeInner<'a>

§

impl<'a> Send for TypeInner<'a>

§

impl<'a> Sync for TypeInner<'a>

§

impl<'a> Unpin for TypeInner<'a>

§

impl<'a> UnwindSafe for TypeInner<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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 T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.