Enum naga::TypeInner[][src]

pub enum TypeInner {
    Scalar {
        kind: ScalarKind,
        width: Bytes,
    },
    Vector {
        size: VectorSize,
        kind: ScalarKind,
        width: Bytes,
    },
    Matrix {
        columns: VectorSize,
        rows: VectorSize,
        width: Bytes,
    },
    Atomic {
        kind: ScalarKind,
        width: Bytes,
    },
    Pointer {
        base: Handle<Type>,
        class: StorageClass,
    },
    ValuePointer {
        size: Option<VectorSize>,
        kind: ScalarKind,
        width: Bytes,
        class: StorageClass,
    },
    Array {
        base: Handle<Type>,
        size: ArraySize,
        stride: u32,
    },
    Struct {
        top_level: bool,
        members: Vec<StructMember>,
        span: u32,
    },
    Image {
        dim: ImageDimension,
        arrayed: bool,
        class: ImageClass,
    },
    Sampler {
        comparison: bool,
    },
}
Expand description

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

Variants

Scalar

Number of integral or floating-point kind.

Fields of Scalar

kind: ScalarKindwidth: Bytes
Vector

Vector of numbers.

Fields of Vector

size: VectorSizekind: ScalarKindwidth: Bytes
Matrix

Matrix of floats.

Fields of Matrix

columns: VectorSizerows: VectorSizewidth: Bytes
Atomic

Atomic scalar.

Fields of Atomic

kind: ScalarKindwidth: Bytes
Pointer

Pointer to another type.

Pointers to non-SIZED types

The base type of a pointer may be a non-SIZED type like a dynamically-sized Array, or a Struct whose last member is a dynamically sized array. Such pointers occur as the types of GlobalVariable or AccessIndex expressions referring to dynamically-sized arrays.

However, among pointers to non-SIZED types, only pointers to Structs are DATA. Pointers to dynamically sized Arrays cannot be passed as arguments, stored in variables, or held in arrays or structures. Their only use is as the types of AccessIndex expressions.

Fields of Pointer

base: Handle<Type>class: StorageClass
ValuePointer

Pointer to a value.

Fields of ValuePointer

size: Option<VectorSize>kind: ScalarKindwidth: Bytesclass: StorageClass
Array

Homogenous list of elements.

The base type must be a SIZED, DATA type.

Dynamically sized arrays

An Array is SIZED unless its size is Dynamic. Dynamically-sized arrays may only appear in a few situations:

  • They may appear as the last member of a Struct whose top_level flag is set.

  • They may appear as the base type of a Pointer. An AccessIndex expression referring to a top-level struct’s final unsized array member would have such a pointer type. However, such pointer types may only appear as the types of such intermediate expressions. They are not DATA, and cannot be stored in variables, held in arrays or structs, or passed as parameters.

Fields of Array

base: Handle<Type>size: ArraySizestride: u32
Struct

User-defined structure.

A Struct type is DATA, and the types of its members must be DATA as well.

Member types must be SIZED, except for the final member of a top-level struct, which may be a dynamically sized Array. The Struct type itself is SIZED when all its members are SIZED.

When top_level is true, this Struct represents the contents of a buffer resource occupying a single binding slot in a shader’s resource interface. Top-level Structs may not be used as members of any other struct, or as array elements.

Fields of Struct

top_level: bool

This struct serves as the type of a binding slot in a shader’s resource interface.

members: Vec<StructMember>span: u32
Image

Possibly multidimensional array of texels.

Fields of Image

dim: ImageDimensionarrayed: boolclass: ImageClass
Sampler

Can be used to sample values from images.

Fields of Sampler

comparison: bool

Implementations

Return the length of a subscriptable type.

The self parameter should be a handle to a vector, matrix, or array type, a pointer to one of those, or a value pointer. Arrays may be fixed-size, dynamically sized, or sized by a specializable constant.

The value returned is appropriate for bounds checks on subscripting.

Return an error if self does not describe a subscriptable type at all.

Trait Implementations

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.