pub enum ArrayKind {
F32,
F16,
I8,
U8,
U8Clamped,
I16,
U16,
I32,
U32,
}Expand description
The element type of a TypedArray — the JavaScript array constructor
(Float32Array, Uint8Array, …) without the data.
Variants§
F32
Float32Array.
F16
Float16BufferAttribute’s Uint16Array of binary16 bits.
I8
Int8Array.
U8
Uint8Array.
U8Clamped
Uint8ClampedArray.
I16
Int16Array.
U16
Uint16Array.
I32
Int32Array.
U32
Uint32Array.
Implementations§
Source§impl ArrayKind
impl ArrayKind
Sourcepub fn bytes_per_element(self) -> usize
pub fn bytes_per_element(self) -> usize
TypedArray.BYTES_PER_ELEMENT.
Sourcepub fn vertex_format(
self,
item_size: usize,
normalized: bool,
interleaved: bool,
) -> (VertexFormat, usize)
pub fn vertex_format( self, item_size: usize, normalized: bool, interleaved: bool, ) -> (VertexFormat, usize)
The table of decision 3: WebGPUAttributeUtils._getVertexFormat()
applied to the array createAttribute() uploads, returning the format
and the padded item size (the components per element in the uploaded
bytes, item_size rounded up so the byte stride is a multiple of 4).
§Panics
On the rows three has no format for, with three’s message: item size 1
of an 8- or 16-bit array that is normalized or interleaved (or of
F16), a normalized F32/I32/U32/F16 with item size above 1,
and any U8Clamped that reaches the table unwidened — which is every
one, since Uint8ClampedArray is in neither prefix map. Three logs
and returns undefined here instead, leaving the failure to pipeline
validation; panicking is a deliberate divergence (decision 3 in the
module docs).
Sourcepub fn shader_type(self, item_size: usize, normalized: bool) -> Type
pub fn shader_type(self, item_size: usize, normalized: bool) -> Type
NodeBuilder.getTypeFromAttribute(): the type the vertex input is
declared in. normalized or F16 reads as floats; otherwise signed
integers as i32, unsigned as u32, F32 (and U8Clamped, which
three’s typeFromArray map lacks, so its 'float' default applies) as
f32. The vector width is the attribute’s own item size, unpadded.
Trait Implementations§
impl Copy for ArrayKind
impl Eq for ArrayKind
impl StructuralPartialEq for ArrayKind
Auto Trait Implementations§
impl Freeze for ArrayKind
impl RefUnwindSafe for ArrayKind
impl Send for ArrayKind
impl Sync for ArrayKind
impl Unpin for ArrayKind
impl UnsafeUnpin for ArrayKind
impl UnwindSafe for ArrayKind
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.