pub trait WgslType {
fn min_size() -> NonZeroU64 { ... }
fn size(&self) -> NonZeroU64 { ... }
fn assert_uniform_compat() { ... }
}Expand description
Base trait for all WGSL host-shareable types
Provided methods
fn min_size() -> NonZeroU64
fn min_size() -> NonZeroU64
Represents the minimum size of Self (equivalent to GPUBufferBindingLayout.minBindingSize)
For WGSL fixed-footprint types
it represents WGSL Size
(equivalent to Size::SIZE)
For WGSL runtime-sized arrays and WGSL structs containing runtime-sized arrays (non fixed-footprint types) this will be calculated by assuming the array has one element
fn size(&self) -> NonZeroU64
fn size(&self) -> NonZeroU64
Returns the size of Self at runtime
For WGSL fixed-footprint types
it’s equivalent to Self::min_size and Size::SIZE
Asserts at compile time that Self meets the requirements of the
uniform address space restrictions on stored values and the
uniform address space layout constraints
Examples
Will not compile since runtime-sized arrays are not compatible with the uniform address space restrictions on stored values
<Vec<mint::Vector4<f32>>>::assert_uniform_compat();Will not compile since the stride is 4 bytes
<[f32; 2]>::assert_uniform_compat();Will compile since the stride is 16 bytes
<[mint::Vector4<f32>; 2]>::assert_uniform_compat();Implementations on Foreign Types
impl WgslType for f32
impl WgslType for u32
impl WgslType for i32
impl WgslType for Option<NonZeroU32>
impl WgslType for Option<NonZeroI32>
impl WgslType for Wrapping<u32>
impl WgslType for Wrapping<i32>
impl WgslType for AtomicU32
impl WgslType for AtomicI32
impl<T: WgslType + Size, const N: usize> WgslType for [T; N]
sourceimpl<T> WgslType for [T] where
T: WgslType + Size,
Self: Length,
impl<T> WgslType for [T] where
T: WgslType + Size,
Self: Length,
fn size(&self) -> NonZeroU64
sourceimpl<T> WgslType for Vec<T> where
T: WgslType + Size,
Self: Length,
impl<T> WgslType for Vec<T> where
T: WgslType + Size,
Self: Length,
fn size(&self) -> NonZeroU64
sourceimpl<T> WgslType for VecDeque<T> where
T: WgslType + Size,
Self: Length,
impl<T> WgslType for VecDeque<T> where
T: WgslType + Size,
Self: Length,
fn size(&self) -> NonZeroU64
sourceimpl<T> WgslType for LinkedList<T> where
T: WgslType + Size,
Self: Length,
impl<T> WgslType for LinkedList<T> where
T: WgslType + Size,
Self: Length,
fn size(&self) -> NonZeroU64
sourceimpl<T: ?Sized + ToOwned<Owned = T>> WgslType for Cow<'_, T> where
T: WgslType,
impl<T: ?Sized + ToOwned<Owned = T>> WgslType for Cow<'_, T> where
T: WgslType,
fn size(&self) -> NonZeroU64
sourceimpl<T: ?Sized + Copy> WgslType for Cell<T> where
T: WgslType,
impl<T: ?Sized + Copy> WgslType for Cell<T> where
T: WgslType,
fn size(&self) -> NonZeroU64
fn size(&self) -> NonZeroU64
sourceimpl<T: ?Sized, const NUM: usize, const DEN: usize> WgslType for StaticRc<T, NUM, DEN> where
T: WgslType,
This is supported on crate feature static-rc only.
impl<T: ?Sized, const NUM: usize, const DEN: usize> WgslType for StaticRc<T, NUM, DEN> where
T: WgslType,
static-rc only.fn size(&self) -> NonZeroU64
impl<T> WgslType for Vector2<T> where
T: Size,
cgmath only.impl<T> WgslType for Vector3<T> where
T: Size,
cgmath only.impl<T> WgslType for Vector4<T> where
T: Size,
cgmath only.impl<T> WgslType for Point2<T> where
T: Size,
cgmath only.impl<T> WgslType for Point3<T> where
T: Size,
cgmath only.impl<T> WgslType for Matrix2<T> where
T: Size,
cgmath only.impl<T> WgslType for Matrix3<T> where
T: Size,
cgmath only.impl<T> WgslType for Matrix4<T> where
T: Size,
cgmath only.impl WgslType for Vec2 where
f32: Size,
glam only.impl WgslType for UVec2 where
u32: Size,
glam only.impl WgslType for IVec2 where
i32: Size,
glam only.impl WgslType for Vec3 where
f32: Size,
glam only.impl WgslType for UVec3 where
u32: Size,
glam only.impl WgslType for IVec3 where
i32: Size,
glam only.impl WgslType for Vec4 where
f32: Size,
glam only.impl WgslType for UVec4 where
u32: Size,
glam only.impl WgslType for IVec4 where
i32: Size,
glam only.impl WgslType for Mat2 where
f32: Size,
glam only.impl WgslType for Mat3 where
f32: Size,
glam only.impl WgslType for Mat4 where
f32: Size,
glam only.impl<T> WgslType for Vector2<T> where
T: Size,
mint only.impl<T> WgslType for Vector3<T> where
T: Size,
mint only.impl<T> WgslType for Vector4<T> where
T: Size,
mint only.impl<T> WgslType for Point2<T> where
T: Size,
mint only.impl<T> WgslType for Point3<T> where
T: Size,
mint only.impl<T> WgslType for ColumnMatrix2<T> where
T: Size,
mint only.impl<T> WgslType for ColumnMatrix2x3<T> where
T: Size,
mint only.impl<T> WgslType for ColumnMatrix2x4<T> where
T: Size,
mint only.impl<T> WgslType for ColumnMatrix3x2<T> where
T: Size,
mint only.impl<T> WgslType for ColumnMatrix3<T> where
T: Size,
mint only.impl<T> WgslType for ColumnMatrix3x4<T> where
T: Size,
mint only.impl<T> WgslType for ColumnMatrix4x2<T> where
T: Size,
mint only.impl<T> WgslType for ColumnMatrix4x3<T> where
T: Size,
mint only.impl<T> WgslType for ColumnMatrix4<T> where
T: Size,
mint only.impl<T> WgslType for VectorSlice2<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for VectorSliceMut2<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for Vector2<T> where
T: Size,
nalgebra only.impl<T> WgslType for VectorSlice3<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for VectorSliceMut3<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for Vector3<T> where
T: Size,
nalgebra only.impl<T> WgslType for VectorSlice4<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for VectorSliceMut4<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for Vector4<T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSlice2<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSliceMut2<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for Matrix2<T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSlice2x3<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSlice2x4<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSlice3x2<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSliceMut2x3<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSliceMut2x4<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSliceMut3x2<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for Matrix2x3<T> where
T: Size,
nalgebra only.impl<T> WgslType for Matrix2x4<T> where
T: Size,
nalgebra only.impl<T> WgslType for Matrix3x2<T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSlice3<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSliceMut3<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for Matrix3<T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSlice3x4<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSlice4x2<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSlice4x3<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSliceMut3x4<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSliceMut4x2<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSliceMut4x3<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for Matrix3x4<T> where
T: Size,
nalgebra only.impl<T> WgslType for Matrix4x2<T> where
T: Size,
nalgebra only.impl<T> WgslType for Matrix4x3<T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSlice4<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for MatrixSliceMut4<'_, T> where
T: Size,
nalgebra only.impl<T> WgslType for Matrix4<T> where
T: Size,
nalgebra only.impl WgslType for Vec2 where
f32: Size,
ultraviolet only.impl WgslType for UVec2 where
u32: Size,
ultraviolet only.impl WgslType for IVec2 where
i32: Size,
ultraviolet only.impl WgslType for Vec3 where
f32: Size,
ultraviolet only.impl WgslType for UVec3 where
u32: Size,
ultraviolet only.impl WgslType for IVec3 where
i32: Size,
ultraviolet only.impl WgslType for Vec4 where
f32: Size,
ultraviolet only.impl WgslType for UVec4 where
u32: Size,
ultraviolet only.impl WgslType for IVec4 where
i32: Size,
ultraviolet only.impl WgslType for Mat2 where
f32: Size,
ultraviolet only.impl WgslType for Mat3 where
f32: Size,
ultraviolet only.impl WgslType for Mat4 where
f32: Size,
ultraviolet only.impl<T> WgslType for Vec2<T> where
T: Size,
vek only.impl<T> WgslType for Vec3<T> where
T: Size,
vek only.impl<T> WgslType for Vec4<T> where
T: Size,
vek only.impl<T> WgslType for Mat2<T> where
T: Size,
vek only.impl<T> WgslType for Mat3<T> where
T: Size,
vek only.impl<T> WgslType for Mat4<T> where
T: Size,
vek only.sourceimpl<T, const N: usize> WgslType for ArrayVec<T, N> where
T: WgslType + Size,
Self: Length,
This is supported on crate feature arrayvec only.
impl<T, const N: usize> WgslType for ArrayVec<T, N> where
T: WgslType + Size,
Self: Length,
arrayvec only.fn size(&self) -> NonZeroU64
sourceimpl<T, S: RawData<Elem = T>, D: Dimension> WgslType for ArrayBase<S, D> where
T: WgslType + Size,
Self: Length,
This is supported on crate feature ndarray only.
impl<T, S: RawData<Elem = T>, D: Dimension> WgslType for ArrayBase<S, D> where
T: WgslType + Size,
Self: Length,
ndarray only.fn size(&self) -> NonZeroU64
sourceimpl<T, A: Array<Item = T>> WgslType for SmallVec<A> where
T: WgslType + Size,
Self: Length,
This is supported on crate feature smallvec only.
impl<T, A: Array<Item = T>> WgslType for SmallVec<A> where
T: WgslType + Size,
Self: Length,
smallvec only.fn size(&self) -> NonZeroU64
sourceimpl<T, A: Array<Item = T>> WgslType for ArrayVec<A> where
T: WgslType + Size,
Self: Length,
This is supported on crate feature tinyvec only.
impl<T, A: Array<Item = T>> WgslType for ArrayVec<A> where
T: WgslType + Size,
Self: Length,
tinyvec only.fn size(&self) -> NonZeroU64
sourceimpl<T, A: Array<Item = T>> WgslType for TinyVec<A> where
T: WgslType + Size,
Self: Length,
This is supported on crate feature tinyvec only.
impl<T, A: Array<Item = T>> WgslType for TinyVec<A> where
T: WgslType + Size,
Self: Length,
tinyvec only.fn size(&self) -> NonZeroU64
sourceimpl<T: Clone> WgslType for Vector<T> where
T: WgslType + Size,
Self: Length,
This is supported on crate feature im only.
impl<T: Clone> WgslType for Vector<T> where
T: WgslType + Size,
Self: Length,
im only.fn size(&self) -> NonZeroU64
sourceimpl<T: Clone> WgslType for Vector<T> where
T: WgslType + Size,
Self: Length,
This is supported on crate feature im-rc only.
impl<T: Clone> WgslType for Vector<T> where
T: WgslType + Size,
Self: Length,
im-rc only.fn size(&self) -> NonZeroU64
sourceimpl<T: Clone> WgslType for Vector<T> where
T: WgslType + Size,
Self: Length,
This is supported on crate feature imbl only.
impl<T: Clone> WgslType for Vector<T> where
T: WgslType + Size,
Self: Length,
imbl only.fn size(&self) -> NonZeroU64
sourceimpl<T, P: SharedPointerKind> WgslType for List<T, P> where
T: WgslType + Size,
Self: Length,
This is supported on crate features rpds and archery only.
impl<T, P: SharedPointerKind> WgslType for List<T, P> where
T: WgslType + Size,
Self: Length,
rpds and archery only.fn size(&self) -> NonZeroU64
sourceimpl<T, P: SharedPointerKind> WgslType for Vector<T, P> where
T: WgslType + Size,
Self: Length,
This is supported on crate features rpds and archery only.
impl<T, P: SharedPointerKind> WgslType for Vector<T, P> where
T: WgslType + Size,
Self: Length,
rpds and archery only.fn size(&self) -> NonZeroU64
sourceimpl<T, P: SharedPointerKind> WgslType for Stack<T, P> where
T: WgslType + Size,
Self: Length,
This is supported on crate features rpds and archery only.
impl<T, P: SharedPointerKind> WgslType for Stack<T, P> where
T: WgslType + Size,
Self: Length,
rpds and archery only.fn size(&self) -> NonZeroU64
sourceimpl<T, P: SharedPointerKind> WgslType for Queue<T, P> where
T: WgslType + Size,
Self: Length,
This is supported on crate features rpds and archery only.
impl<T, P: SharedPointerKind> WgslType for Queue<T, P> where
T: WgslType + Size,
Self: Length,
rpds and archery only.