pub enum Type {
Show 22 variants
Bool,
AbstractInt,
AbstractFloat,
I32,
U32,
F32,
F16,
Struct(Box<StructType>),
Array(Box<Type>, Option<usize>),
Vec(u8, Box<Type>),
Mat(u8, u8, Box<Type>),
Atomic(Box<Type>),
Ptr(AddressSpace, Box<Type>, AccessMode),
Ref(AddressSpace, Box<Type>, AccessMode),
Texture(TextureType),
Sampler(SamplerType),
I64,
U64,
F64,
BindingArray(Box<Type>, Option<usize>),
RayQuery(Option<AccelerationStructureFlags>),
AccelerationStructure(Option<AccelerationStructureFlags>),
}Expand description
WGSL type.
Variants§
Bool
AbstractInt
AbstractFloat
I32
U32
F32
F16
Struct(Box<StructType>)
Array(Box<Type>, Option<usize>)
Vec(u8, Box<Type>)
Mat(u8, u8, Box<Type>)
Atomic(Box<Type>)
Ptr(AddressSpace, Box<Type>, AccessMode)
Ref(AddressSpace, Box<Type>, AccessMode)
Texture(TextureType)
Sampler(SamplerType)
I64
naga-ext only.U64
naga-ext only.F64
naga-ext only.BindingArray(Box<Type>, Option<usize>)
naga-ext only.RayQuery(Option<AccelerationStructureFlags>)
naga-ext only.AccelerationStructure(Option<AccelerationStructureFlags>)
naga-ext only.Implementations§
Source§impl Type
impl Type
Sourcepub fn size_of(&self) -> Option<u32>
pub fn size_of(&self) -> Option<u32>
Compute the size of the type.
Return None if the type is not host-shareable, or if it contains a
runtime-sized array. See Type::min_size_of for runtime-sized arrays.
Sourcepub fn min_size_of(&self) -> Option<u32>
pub fn min_size_of(&self) -> Option<u32>
Variant of Type::size_of, but for runtime-sized arrays, it returns the minimum
size of the array, i.e. the size of an array with one element.
Source§impl Type
impl Type
Sourcepub fn op_add(&self, rhs: &Type) -> Result<Self, Error>
pub fn op_add(&self, rhs: &Type) -> Result<Self, Error>
Valid operands:
T + T, T: scalar or vecS + VorV + S, S: scalar, V:vec<S>M + M, M: mat
Sourcepub fn op_sub(&self, rhs: &Type) -> Result<Self, Error>
pub fn op_sub(&self, rhs: &Type) -> Result<Self, Error>
Valid operands:
T - T, T: scalar or vecS - VorV - S, S: scalar, V:vec<S>M - M, M: mat
Sourcepub fn op_mul(&self, rhs: &Type) -> Result<Self, Error>
pub fn op_mul(&self, rhs: &Type) -> Result<Self, Error>
Valid operands:
T * T, T: scalar or vecS * VorV * S, S: scalar, V:vec<S>S * MorM * S, S: float, M:mat<S>V * MorM * V, S: float, V:vec<S>, M:mat<S>M1 * M1, M1:matKxR, M2:matCxK
Source§impl Type
impl Type
Sourcepub fn op_eq(&self, rhs: &Type) -> Result<Type, Error>
pub fn op_eq(&self, rhs: &Type) -> Result<Type, Error>
Valid operands:
T == T, T: scalar or vec
Sourcepub fn op_ne(&self, rhs: &Type) -> Result<Type, Error>
pub fn op_ne(&self, rhs: &Type) -> Result<Type, Error>
Valid operands:
T != T, T: scalar or vec
Source§impl Type
impl Type
Sourcepub fn op_bitor(&self, rhs: &Type) -> Result<Type, Error>
pub fn op_bitor(&self, rhs: &Type) -> Result<Type, Error>
Note: this is both the “bitwise OR” and “logical OR” operator.
Valid operands:
T | T, T: integer, orvec<integer>(bitwise OR)V | V, V:vec<bool>(logical OR)
Sourcepub fn op_bitand(&self, rhs: &Type) -> Result<Type, Error>
pub fn op_bitand(&self, rhs: &Type) -> Result<Type, Error>
Note: this is both the “bitwise AND” and “logical AND” operator.
Valid operands:
T & T, T: integer orvec<integer>(bitwise AND)V & V, V:vec<bool>(logical AND)
Sourcepub fn op_bitxor(&self, rhs: &Type) -> Result<Type, Error>
pub fn op_bitxor(&self, rhs: &Type) -> Result<Type, Error>
Valid operands:
T ^ T, T: integer orvec<integer>
Source§impl Type
impl Type
pub fn is_convertible_to(&self, ty: &Type) -> bool
pub fn concretize(&self) -> Self
Sourcepub fn loaded(self) -> Self
pub fn loaded(self) -> Self
Apply the load rule.
Reference: https://www.w3.org/TR/WGSL/#load-rule
Source§impl Type
impl Type
Sourcepub fn is_scalar(&self) -> bool
pub fn is_scalar(&self) -> bool
Reference: https://www.w3.org/TR/WGSL/#scalar
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Reference: https://www.w3.org/TR/WGSL/#numeric-scalar
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Reference: https://www.w3.org/TR/WGSL/#integer-scalar
Sourcepub fn is_abstract(&self) -> bool
pub fn is_abstract(&self) -> bool
Reference: https://www.w3.org/TR/WGSL/#abstract-types
pub fn is_concrete(&self) -> bool
Sourcepub fn is_storable(&self) -> bool
pub fn is_storable(&self) -> bool
Reference: https://www.w3.org/TR/WGSL/#storable-types
pub fn is_array(&self) -> bool
pub fn is_vec(&self) -> bool
pub fn is_i32(&self) -> bool
pub fn is_u32(&self) -> bool
pub fn is_f32(&self) -> bool
pub fn is_i64(&self) -> bool
naga-ext only.pub fn is_u64(&self) -> bool
naga-ext only.pub fn is_f64(&self) -> bool
naga-ext only.pub fn is_bool(&self) -> bool
pub fn is_mat(&self) -> bool
pub fn is_abstract_int(&self) -> bool
pub fn unwrap_atomic(self) -> Box<Type>
pub fn unwrap_struct(self) -> Box<StructType>
pub fn unwrap_vec(self) -> (u8, Box<Type>)
Trait Implementations§
Source§impl Convert for Type
impl Convert for Type
Source§fn convert_to(&self, ty: &Type) -> Option<Self>
fn convert_to(&self, ty: &Type) -> Option<Self>
Source§fn convert_inner_to(&self, ty: &Type) -> Option<Self>
fn convert_inner_to(&self, ty: &Type) -> Option<Self>
Source§fn concretize(&self) -> Option<Self>
fn concretize(&self) -> Option<Self>
Source§impl From<SampledType> for Type
impl From<SampledType> for Type
Source§fn from(value: SampledType) -> Self
fn from(value: SampledType) -> Self
Source§impl From<StructType> for Type
impl From<StructType> for Type
Source§fn from(value: StructType) -> Self
fn from(value: StructType) -> Self
Source§impl TryFrom<&Type> for SampledType
impl TryFrom<&Type> for SampledType
impl Eq for Type
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnwindSafe for Type
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more