Skip to main content

WGSLType

Enum WGSLType 

Source
pub enum WGSLType {
Show 35 variants Bool, I32, U32, F32, F16, Vec2f, Vec3f, Vec4f, Vec2i, Vec3i, Vec4i, Vec2u, Vec3u, Vec4u, Vec2b, Mat2x2f, Mat3x3f, Mat4x4f, Mat2x4f, Mat4x2f, Texture2D, Texture2DArray, TextureCube, Texture3D, TextureDepth2D, TextureStorage2D { format: String, access: String, }, TextureMultisampled2D, Sampler, SamplerComparison, Struct(String), Array(Box<WGSLType>, u32), RuntimeArray(Box<WGSLType>), Ptr { address_space: WGSLAddressSpace, inner: Box<WGSLType>, }, AtomicU32, AtomicI32,
}
Expand description

WGSL type system.

Variants§

§

Bool

bool

§

I32

i32

§

U32

u32

§

F32

f32

§

F16

f16 (requires enable f16;)

§

Vec2f

vec2<f32>

§

Vec3f

vec3<f32>

§

Vec4f

vec4<f32>

§

Vec2i

vec2<i32>

§

Vec3i

vec3<i32>

§

Vec4i

vec4<i32>

§

Vec2u

vec2<u32>

§

Vec3u

vec3<u32>

§

Vec4u

vec4<u32>

§

Vec2b

vec2<bool>

§

Mat2x2f

mat2x2<f32>

§

Mat3x3f

mat3x3<f32>

§

Mat4x4f

mat4x4<f32>

§

Mat2x4f

mat2x4<f32>

§

Mat4x2f

mat4x2<f32>

§

Texture2D

texture_2d<f32>

§

Texture2DArray

texture_2d_array<f32>

§

TextureCube

texture_cube<f32>

§

Texture3D

texture_3d<f32>

§

TextureDepth2D

texture_depth_2d

§

TextureStorage2D

texture_storage_2d<rgba8unorm, write>

Fields

§format: String
§access: String
§

TextureMultisampled2D

texture_multisampled_2d<f32>

§

Sampler

sampler

§

SamplerComparison

sampler_comparison

§

Struct(String)

A named struct type.

§

Array(Box<WGSLType>, u32)

A fixed-length array: array<T, N>.

§

RuntimeArray(Box<WGSLType>)

A runtime-sized array: array<T>.

§

Ptr

A pointer type: ptr<address_space, T>.

Fields

§address_space: WGSLAddressSpace
§inner: Box<WGSLType>
§

AtomicU32

atomic<u32>

§

AtomicI32

atomic<i32>

Implementations§

Source§

impl WGSLType

Source

pub fn keyword(&self) -> String

Return the WGSL source representation of this type.

Source

pub fn is_opaque(&self) -> bool

Return true for opaque texture/sampler types.

Source

pub fn is_float_like(&self) -> bool

Return true for floating-point scalar and vector types.

Trait Implementations§

Source§

impl Clone for WGSLType

Source§

fn clone(&self) -> WGSLType

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 Debug for WGSLType

Source§

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

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

impl Display for WGSLType

Source§

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

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

impl Hash for WGSLType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for WGSLType

Source§

fn eq(&self, other: &WGSLType) -> 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 Eq for WGSLType

Source§

impl StructuralPartialEq for WGSLType

Auto Trait Implementations§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.