pub struct TextureDescriptor {
pub width: u32,
pub height: u32,
pub format: TextureFormat,
pub mip_levels: u8,
pub array_layers: u16,
}Expand description
Descriptor for a single GPU texture
Fields§
§width: u32Width in texels
height: u32Height in texels
format: TextureFormatTexel format
mip_levels: u8Number of mip levels (1 = base level only)
array_layers: u16Number of array layers (1 = single texture)
Implementations§
Source§impl TextureDescriptor
impl TextureDescriptor
Sourcepub fn new(width: u32, height: u32, format: TextureFormat) -> Self
pub fn new(width: u32, height: u32, format: TextureFormat) -> Self
Create a simple 2-D texture with no mip chain and a single layer
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Total size in bytes for the full mip chain and all array layers
Each successive mip level has half the dimensions of the previous. Minimum mip size is 1×1.
Sourcepub fn total_pixels(&self) -> u64
pub fn total_pixels(&self) -> u64
Total number of texels in the base mip level (ignoring arrays / mips)
Trait Implementations§
Source§impl Clone for TextureDescriptor
impl Clone for TextureDescriptor
Source§fn clone(&self) -> TextureDescriptor
fn clone(&self) -> TextureDescriptor
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TextureDescriptor
impl RefUnwindSafe for TextureDescriptor
impl Send for TextureDescriptor
impl Sync for TextureDescriptor
impl Unpin for TextureDescriptor
impl UnsafeUnpin for TextureDescriptor
impl UnwindSafe for TextureDescriptor
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
Mutably borrows from an owned value. Read more
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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