pub enum TexFormat {
Show 40 variants
R8Unorm,
R8Snorm,
A8Unorm,
Rg8Unorm,
Rg8Snorm,
Rgba8Unorm,
Rgba8Snorm,
Bgra8Unorm,
Bgrx8Unorm,
B5g6r5Unorm,
B5g5r5a1Unorm,
B4g4r4a4Unorm,
Rgb10a2Unorm,
R16Unorm,
R16Float,
Rg16Unorm,
Rg16Snorm,
Rg16Float,
Rgba16Unorm,
Rgba16Float,
R32Float,
Rg32Float,
Rgba32Float,
Bc1,
Bc2,
Bc3,
Bc4Unorm,
Bc4Snorm,
Bc5Unorm,
Bc5Snorm,
Bc6hUfloat,
Bc6hSfloat,
Bc7,
Etc1,
Etc2Rgb,
Etc2Rgba,
Etc2RgbA1,
EacR11Unorm,
EacRg11Unorm,
Astc {
block_w: u8,
block_h: u8,
},
}Expand description
How a texture’s bytes are laid out.
Closed on purpose, as SurfaceClass is: a classification of every format (rgba8_exact, a decoder’s table) matches
it without a wildcard, so adding a format fails to compile until each one says what it does with it.
Variants§
R8Unorm
R8Snorm
A8Unorm
Rg8Unorm
Rg8Snorm
Rgba8Unorm
Rgba8Snorm
Bgra8Unorm
Bgrx8Unorm
B8G8R8X8: alpha byte ignored (decodes to 255).
B5g6r5Unorm
B5G6R5 in a little-endian u16 (blue in the low bits).
B5g5r5a1Unorm
B5G5R5A1 in a little-endian u16 (blue in the low bits, alpha the top bit).
B4g4r4a4Unorm
B4G4R4A4 in a little-endian u16.
Rgb10a2Unorm
R10G10B10A2 in a little-endian u32 (red in the low bits).
R16Unorm
R16Float
Rg16Unorm
Rg16Snorm
Rg16Float
Rgba16Unorm
Rgba16Float
R32Float
Rg32Float
Rgba32Float
Bc1
BC1 (DXT1). 3-colour blocks (c0 <= c1) decode index 3 as transparent black (D3D10).
Bc2
BC2 (DXT3): explicit 4-bit alpha.
Bc3
BC3 (DXT5): interpolated alpha.
Bc4Unorm
Bc4Snorm
Bc5Unorm
Bc5Snorm
Bc6hUfloat
Bc6hSfloat
Bc7
Etc1
Etc2Rgb
Etc2Rgba
Etc2RgbA1
EacR11Unorm
EacRg11Unorm
Astc
ASTC LDR with the given block footprint (4x4 to 12x12).
Implementations§
Source§impl TexFormat
impl TexFormat
Sourcepub fn block_dims(self) -> (u32, u32)
pub fn block_dims(self) -> (u32, u32)
Block footprint in pixels: (1, 1) for uncompressed formats.
Sourcepub fn block_bytes(self) -> u32
pub fn block_bytes(self) -> u32
Bytes per block (per pixel for uncompressed formats).
pub fn is_block_compressed(self) -> bool
Sourcepub fn level_size(self, width: u32, height: u32) -> usize
pub fn level_size(self, width: u32, height: u32) -> usize
Size in bytes of one level of width x height pixels: whole blocks, at least one per axis.
Sourcepub fn checked_level_size(self, width: u32, height: u32) -> Option<usize>
pub fn checked_level_size(self, width: u32, height: u32) -> Option<usize>
TexFormat::level_size, None when it doesn’t fit in a usize (dimensions a file states).
Trait Implementations§
impl Copy for TexFormat
impl Eq for TexFormat
Source§impl Ord for TexFormat
impl Ord for TexFormat
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for TexFormat
impl PartialOrd for TexFormat
impl StructuralPartialEq for TexFormat
Auto Trait Implementations§
impl Forget for TexFormat
impl Freeze for TexFormat
impl RefUnwindSafe for TexFormat
impl Send for TexFormat
impl Sync for TexFormat
impl Unpin for TexFormat
impl UnsafeUnpin for TexFormat
impl UnwindSafe for TexFormat
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> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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.