pub struct TexelArrayLayout {
pub texel_format: TextureFormat,
pub lanes_per_texel: u32,
pub element_size: u64,
pub elements_per_row: u32,
pub width: u32,
pub height: u32,
}Expand description
A texel array’s shape and texel format.
Derived from an element size and a capacity; see the module docs for how the row width follows from the two.
Fields§
§texel_format: TextureFormatThe format the texture is created with.
lanes_per_texel: u32f32 lanes per texel: 1 for R32Float, 4 for Rgba32Float.
element_size: u64Bytes per element.
elements_per_row: u32How many elements one row holds.
width: u32The texture’s width in texels.
height: u32The texture’s height in texels.
Implementations§
Source§impl TexelArrayLayout
impl TexelArrayLayout
Sourcepub fn new(element_size: u64, capacity: u64, max_dimension: u32) -> Self
pub fn new(element_size: u64, capacity: u64, max_dimension: u32) -> Self
Lay out capacity elements of element_size bytes in a texture no
larger than max_dimension on either axis.
max_dimension is the device’s
[wgpu::Limits::max_texture_dimension_2d].
§Panics
If element_size is not a whole number of f32 lanes, or if capacity
elements of that size cannot be stored in a texture within
max_dimension.
Sourcepub fn row_bytes(&self) -> u64
pub fn row_bytes(&self) -> u64
Bytes one row spans, padding included.
Always a whole number of [wgpu::COPY_BYTES_PER_ROW_ALIGNMENT] bytes.
Sourcepub fn texture_size(&self) -> Extent3d
pub fn texture_size(&self) -> Extent3d
The texture size to create.
Sourcepub fn pack(&self, elements: &[u8], out: &mut Vec<u8>)
pub fn pack(&self, elements: &[u8], out: &mut Vec<u8>)
Write elements into out as the row-padded image the texture holds.
elements is the packed element bytes — the same bytes a storage buffer
would have been uploaded, and the same ones Self::element_size
describes one of. out is reused across calls, so a steady frame
reallocates nothing. Only the rows the elements reach are written; the
rest of the texture is left as it was, which is sound because the shader
addresses nothing past the element count the caller uploaded.
§Panics
If elements is not a whole number of elements, or holds more than
Self::capacity of them.
Trait Implementations§
Source§impl Clone for TexelArrayLayout
impl Clone for TexelArrayLayout
impl Copy for TexelArrayLayout
Source§impl Debug for TexelArrayLayout
impl Debug for TexelArrayLayout
impl Eq for TexelArrayLayout
Source§impl PartialEq for TexelArrayLayout
impl PartialEq for TexelArrayLayout
impl StructuralPartialEq for TexelArrayLayout
Auto Trait Implementations§
impl Forget for TexelArrayLayout
impl Freeze for TexelArrayLayout
impl RefUnwindSafe for TexelArrayLayout
impl Send for TexelArrayLayout
impl Sync for TexelArrayLayout
impl Unpin for TexelArrayLayout
impl UnsafeUnpin for TexelArrayLayout
impl UnwindSafe for TexelArrayLayout
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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