pub enum TextureFormat {
Rgba8Unorm,
Rgba8UnormSrgb,
Rgba16Float,
Depth32Float,
Bc7RgbaUnorm,
Astc4x4RgbaUnorm,
Etc2Rgba8Unorm,
}Expand description
CPU-side texture format metadata.
Variants§
Rgba8Unorm
Four 8-bit normalized linear RGBA channels.
Rgba8UnormSrgb
Four 8-bit normalized sRGB RGBA channels.
Rgba16Float
Four 16-bit floating-point RGBA channels.
Depth32Float
32-bit floating-point depth.
Bc7RgbaUnorm
BC7 compressed RGBA, 4x4 blocks, 16 bytes per block.
Astc4x4RgbaUnorm
ASTC 4x4 compressed RGBA, 16 bytes per block.
Etc2Rgba8Unorm
ETC2 RGBA8 compressed data, 4x4 blocks, 16 bytes per block.
Implementations§
Source§impl TextureFormat
impl TextureFormat
Sourcepub const fn is_compressed(self) -> bool
pub const fn is_compressed(self) -> bool
Returns whether this is a block-compressed format.
Sourcepub const fn bytes_per_pixel(self) -> Option<usize>
pub const fn bytes_per_pixel(self) -> Option<usize>
Returns bytes per texel for uncompressed formats.
Sourcepub const fn block_dimensions(self) -> Option<(u32, u32)>
pub const fn block_dimensions(self) -> Option<(u32, u32)>
Returns (width, height) for compressed blocks.
Sourcepub const fn bytes_per_block(self) -> Option<usize>
pub const fn bytes_per_block(self) -> Option<usize>
Returns bytes per compressed block.
Sourcepub const fn mip_dimensions(width: u32, height: u32, level: u32) -> (u32, u32)
pub const fn mip_dimensions(width: u32, height: u32, level: u32) -> (u32, u32)
Returns the dimensions of a mip level.
Sourcepub fn expected_2d_len(
self,
width: u32,
height: u32,
) -> Result<usize, ValidationError>
pub fn expected_2d_len( self, width: u32, height: u32, ) -> Result<usize, ValidationError>
Returns the expected byte length for a 2D texture level.
Sourcepub fn expected_3d_len(
self,
width: u32,
height: u32,
depth: u32,
) -> Result<usize, ValidationError>
pub fn expected_3d_len( self, width: u32, height: u32, depth: u32, ) -> Result<usize, ValidationError>
Returns the expected byte length for a 3D texture level.
Trait Implementations§
Source§impl Clone for TextureFormat
impl Clone for TextureFormat
Source§fn clone(&self) -> TextureFormat
fn clone(&self) -> TextureFormat
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 moreimpl Copy for TextureFormat
Source§impl Debug for TextureFormat
impl Debug for TextureFormat
impl Eq for TextureFormat
Source§impl Hash for TextureFormat
impl Hash for TextureFormat
Source§impl PartialEq for TextureFormat
impl PartialEq for TextureFormat
Source§fn eq(&self, other: &TextureFormat) -> bool
fn eq(&self, other: &TextureFormat) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for TextureFormat
Auto Trait Implementations§
impl Freeze for TextureFormat
impl RefUnwindSafe for TextureFormat
impl Send for TextureFormat
impl Sync for TextureFormat
impl Unpin for TextureFormat
impl UnsafeUnpin for TextureFormat
impl UnwindSafe for TextureFormat
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