Enum Format

Source
#[repr(u32)]
pub enum Format {
Show 57 variants R8_UNORM = 33_321, R8G8_UNORM = 33_323, R8G8B8_UNORM = 32_849, R8G8B8A8_UNORM = 32_856, R16_UNORM = 33_322, R16G16_UNORM = 33_324, R16G16B16_UNORM = 32_852, R16G16B16A16_UNORM = 32_859, R8_SNORM = 36_756, R8G8_SNORM = 36_757, R8G8B8_SNORM = 36_758, R8G8B8A8_SNORM = 36_759, R16_SNORM = 36_760, R16G16_SNORM = 36_761, R16G16B16_SNORM = 36_762, R16G16B16A16_SNORM = 36_763, R16_SFLOAT = 33_325, R16G16_SFLOAT = 33_327, R16G16B16_SFLOAT = 34_843, R16G16B16A16_SFLOAT = 34_842, R32_SFLOAT = 33_326, R32G32_SFLOAT = 33_328, R32G32B32_SFLOAT = 34_837, R32G32B32A32_SFLOAT = 34_836, R8_SINT = 33_329, R8G8_SINT = 33_335, R8G8B8_SINT = 36_239, R8G8B8A8_SINT = 36_238, R16_SINT = 33_331, R16G16_SINT = 33_337, R16G16B16_SINT = 36_233, R16G16B16A16_SINT = 36_232, R32_SINT = 33_333, R32G32_SINT = 33_339, R32G32B32_SINT = 36_227, R32G32B32A32_SINT = 36_226, R8_UINT = 33_330, R8G8_UINT = 33_336, R8G8B8_UINT = 36_221, R8G8B8A8_UINT = 36_220, R16_UINT = 33_332, R16G16_UINT = 33_338, R16G16B16_UINT = 36_215, R16G16B16A16_UINT = 36_214, R32_UINT = 33_334, R32G32_UINT = 33_340, R32G32B32_UINT = 36_209, R32G32B32A32_UINT = 36_208, R8G8B8_SRGB = 35_905, R8G8B8A8_SRGB = 35_907, D16_UNORM = 33_189, D24_UNORM = 33_190, D32_UNORM = 33_191, D32_SFLOAT = 36_012, S8_UINT = 36_168, D24_UNORM_S8_UINT = 35_056, D32_SFLOAT_S8_UINT = 36_013,
}
Expand description

The Format enum represents a sized internal format of texture storage. The naming convention closely follows that of Vulkan, but it has a close correspondence with OpenGL.

  • The ‘_UNORM’ suffix denotes unsigned normalized formats. They are represented as unsigned integers internally, remapped to the [0.0, 1.0] floating point range in shaders. These are equivalent to the constants with no suffix in OpenGL.

  • The ‘_SNORM’ suffix denotes signed normalized formats. They are represented as signed integers, remapped to the [-1.0, 1.0] floating point range in shaders. This suffix is the same as in OpenGL.

  • The ‘_SFLOAT’ suffix denotes floating point formats, equivalent to the OpenGL ‘F’ suffix.

  • The ‘_SINT’ suffix denotes signed integer formats, exposed to shaders unmodified as integers. This is equivalent to the OpenGL ‘I’ suffix.

  • The ‘_UINT’ suffix denotes unsigned integer formats, exposed to shaders as unsigned integers. This is equivalent to the OpenGL ‘UI’ suffix.

  • The ‘_SRGB’ suffix denotes sRGB formats, which are all unsigned normalized integers. Textures in this format are assumed to be in the sRGB color space. Shaders reading from this format will automatically convert the color components to a linear color space, so the shader will only see linear values. Because GL_FRAMEBUFFER_SRGB is enabled by default in grr, when outputting from a shader to a render target with an ‘_SRGB’ format, OpenGL will convert the color components to an sRGB color space automatically. Alpha components, if they exist, are treated as linear throughout.

Each component is followed by the number of bits used to represent it.

Variants§

§

R8_UNORM = 33_321

§

R8G8_UNORM = 33_323

§

R8G8B8_UNORM = 32_849

§

R8G8B8A8_UNORM = 32_856

§

R16_UNORM = 33_322

§

R16G16_UNORM = 33_324

§

R16G16B16_UNORM = 32_852

§

R16G16B16A16_UNORM = 32_859

§

R8_SNORM = 36_756

§

R8G8_SNORM = 36_757

§

R8G8B8_SNORM = 36_758

§

R8G8B8A8_SNORM = 36_759

§

R16_SNORM = 36_760

§

R16G16_SNORM = 36_761

§

R16G16B16_SNORM = 36_762

§

R16G16B16A16_SNORM = 36_763

§

R16_SFLOAT = 33_325

§

R16G16_SFLOAT = 33_327

§

R16G16B16_SFLOAT = 34_843

§

R16G16B16A16_SFLOAT = 34_842

§

R32_SFLOAT = 33_326

§

R32G32_SFLOAT = 33_328

§

R32G32B32_SFLOAT = 34_837

§

R32G32B32A32_SFLOAT = 34_836

§

R8_SINT = 33_329

§

R8G8_SINT = 33_335

§

R8G8B8_SINT = 36_239

§

R8G8B8A8_SINT = 36_238

§

R16_SINT = 33_331

§

R16G16_SINT = 33_337

§

R16G16B16_SINT = 36_233

§

R16G16B16A16_SINT = 36_232

§

R32_SINT = 33_333

§

R32G32_SINT = 33_339

§

R32G32B32_SINT = 36_227

§

R32G32B32A32_SINT = 36_226

§

R8_UINT = 33_330

§

R8G8_UINT = 33_336

§

R8G8B8_UINT = 36_221

§

R8G8B8A8_UINT = 36_220

§

R16_UINT = 33_332

§

R16G16_UINT = 33_338

§

R16G16B16_UINT = 36_215

§

R16G16B16A16_UINT = 36_214

§

R32_UINT = 33_334

§

R32G32_UINT = 33_340

§

R32G32B32_UINT = 36_209

§

R32G32B32A32_UINT = 36_208

§

R8G8B8_SRGB = 35_905

§

R8G8B8A8_SRGB = 35_907

sRGB8 color space with a linear alpha

§

D16_UNORM = 33_189

§

D24_UNORM = 33_190

§

D32_UNORM = 33_191

§

D32_SFLOAT = 36_012

§

S8_UINT = 36_168

§

D24_UNORM_S8_UINT = 35_056

§

D32_SFLOAT_S8_UINT = 36_013

Implementations§

Source§

impl Format

Source

pub fn num_components(self) -> u32

Return the number of components of the pixel format.

Source

pub fn base_format(self) -> BaseFormat

Return the corresponding base format for this format.

Trait Implementations§

Source§

impl Clone for Format

Source§

fn clone(&self) -> Format

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Format

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Format

Source§

fn eq(&self, other: &Format) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Format

Source§

impl Eq for Format

Source§

impl StructuralPartialEq for Format

Auto Trait Implementations§

§

impl Freeze for Format

§

impl RefUnwindSafe for Format

§

impl Send for Format

§

impl Sync for Format

§

impl Unpin for Format

§

impl UnwindSafe for Format

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.