Enum nutexb::NutexbFormat
source · pub enum NutexbFormat {
Show 20 variants
R8Unorm = 256,
R8G8B8A8Unorm = 1_024,
R8G8B8A8Srgb = 1_029,
R32G32B32A32Float = 1_076,
B8G8R8A8Unorm = 1_104,
B8G8R8A8Srgb = 1_109,
BC1Unorm = 1_152,
BC1Srgb = 1_157,
BC2Unorm = 1_168,
BC2Srgb = 1_173,
BC3Unorm = 1_184,
BC3Srgb = 1_189,
BC4Unorm = 384,
BC4Snorm = 389,
BC5Unorm = 640,
BC5Snorm = 645,
BC6Ufloat = 1_239,
BC6Sfloat = 1_240,
BC7Unorm = 1_248,
BC7Srgb = 1_253,
}
Expand description
Supported image data formats.
These formats have a corresponding format in modern versions of graphics APIs like OpenGL, Vulkan, etc. All known NutexbFormat are supported by DDS DXGI formats.
In some contexts, “Unorm” is called “linear” or expanded to “unsigned normalized”. “U” and “S” prefixes refer to “unsigned” and “signed” data, respectively. “Srgb”, “Unorm”, and “Snorm” variants use the same data format but use different conversions to floating point when accessed by a GPU shader.
Variants§
R8Unorm = 256
R8G8B8A8Unorm = 1_024
R8G8B8A8Srgb = 1_029
R32G32B32A32Float = 1_076
B8G8R8A8Unorm = 1_104
B8G8R8A8Srgb = 1_109
BC1Unorm = 1_152
BC1Srgb = 1_157
BC2Unorm = 1_168
BC2Srgb = 1_173
BC3Unorm = 1_184
BC3Srgb = 1_189
BC4Unorm = 384
BC4Snorm = 389
BC5Unorm = 640
BC5Snorm = 645
BC6Ufloat = 1_239
BC6Sfloat = 1_240
BC7Unorm = 1_248
BC7Srgb = 1_253
Implementations§
source§impl NutexbFormat
impl NutexbFormat
sourcepub fn bytes_per_pixel(&self) -> u32
pub fn bytes_per_pixel(&self) -> u32
The number of bytes per pixel. For block compressed formats like NutexbFormat::BC7Srgb, this is the size in bytes of a single block.
§Examples
assert_eq!(1, NutexbFormat::R8Unorm.bytes_per_pixel());
assert_eq!(4, NutexbFormat::R8G8B8A8Unorm.bytes_per_pixel());
assert_eq!(8, NutexbFormat::BC1Unorm.bytes_per_pixel());
assert_eq!(16, NutexbFormat::BC7Srgb.bytes_per_pixel());
assert_eq!(16, NutexbFormat::R32G32B32A32Float.bytes_per_pixel());
sourcepub fn block_width(&self) -> u32
pub fn block_width(&self) -> u32
The width in pixels for a compressed block or 1
for uncompressed formats.
§Examples
assert_eq!(1, NutexbFormat::R8Unorm.block_width());
assert_eq!(1, NutexbFormat::R8G8B8A8Unorm.block_width());
assert_eq!(4, NutexbFormat::BC1Unorm.block_width());
assert_eq!(4, NutexbFormat::BC7Srgb.block_width());
sourcepub fn block_height(&self) -> u32
pub fn block_height(&self) -> u32
The height in pixels for a compressed block or 1
for uncompressed formats.
§Examples
assert_eq!(1, NutexbFormat::R8Unorm.block_height());
assert_eq!(1, NutexbFormat::R8G8B8A8Unorm.block_height());
assert_eq!(4, NutexbFormat::BC1Unorm.block_height());
assert_eq!(4, NutexbFormat::BC7Srgb.block_height());
sourcepub fn block_depth(&self) -> u32
pub fn block_depth(&self) -> u32
The depth in pixels for a compressed block or 1
for uncompressed formats.
§Examples
assert_eq!(1, NutexbFormat::R8Unorm.block_depth());
assert_eq!(1, NutexbFormat::R8G8B8A8Unorm.block_depth());
assert_eq!(1, NutexbFormat::BC1Unorm.block_depth());
assert_eq!(1, NutexbFormat::BC7Srgb.block_depth());
Trait Implementations§
source§impl BinRead for NutexbFormat
impl BinRead for NutexbFormat
source§fn read_options<R: Read + Seek>(
__binrw_generated_var_reader: &mut R,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>
) -> BinResult<Self>
fn read_options<R: Read + Seek>( __binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_> ) -> BinResult<Self>
source§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Self
from the reader using default arguments and assuming
big-endian byte order. Read moresource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Self
from the reader using default arguments and assuming
little-endian byte order. Read moresource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
T
from the reader assuming native-endian byte order. Read moresource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Self
from the reader, assuming big-endian byte order, using the
given arguments. Read moresource§impl BinWrite for NutexbFormat
impl BinWrite for NutexbFormat
source§fn write_options<W: Write + Seek>(
&self,
__binrw_generated_var_writer: &mut W,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>
) -> BinResult<()>
fn write_options<W: Write + Seek>( &self, __binrw_generated_var_writer: &mut W, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_> ) -> BinResult<()>
source§fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_be<W>(&self, writer: &mut W) -> Result<(), Error>
Self
to the writer assuming big-endian byte order. Read moresource§fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
fn write_le<W>(&self, writer: &mut W) -> Result<(), Error>
Self
to the writer assuming little-endian byte order. Read moresource§impl Clone for NutexbFormat
impl Clone for NutexbFormat
source§fn clone(&self) -> NutexbFormat
fn clone(&self) -> NutexbFormat
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for NutexbFormat
impl Debug for NutexbFormat
source§impl From<NutexbFormat> for DxgiFormat
impl From<NutexbFormat> for DxgiFormat
source§fn from(value: NutexbFormat) -> Self
fn from(value: NutexbFormat) -> Self
source§impl PartialEq for NutexbFormat
impl PartialEq for NutexbFormat
source§fn eq(&self, other: &NutexbFormat) -> bool
fn eq(&self, other: &NutexbFormat) -> bool
self
and other
values to be equal, and is used
by ==
.