[][src]Enum grr::Format

#[repr(u32)]pub enum Format {
    R8_UNORM,
    R8G8_UNORM,
    R8G8B8_UNORM,
    R8G8B8A8_UNORM,
    R16_UNORM,
    R16G16_UNORM,
    R16G16B16_UNORM,
    R16G16B16A16_UNORM,
    R8_SNORM,
    R8G8_SNORM,
    R8G8B8_SNORM,
    R8G8B8A8_SNORM,
    R16_SNORM,
    R16G16_SNORM,
    R16G16B16_SNORM,
    R16G16B16A16_SNORM,
    R16_SFLOAT,
    R16G16_SFLOAT,
    R16G16B16_SFLOAT,
    R16G16B16A16_SFLOAT,
    R32_SFLOAT,
    R32G32_SFLOAT,
    R32G32B32_SFLOAT,
    R32G32B32A32_SFLOAT,
    R8_SINT,
    R8G8_SINT,
    R8G8B8_SINT,
    R8G8B8A8_SINT,
    R16_SINT,
    R16G16_SINT,
    R16G16B16_SINT,
    R16G16B16A16_SINT,
    R32_SINT,
    R32G32_SINT,
    R32G32B32_SINT,
    R32G32B32A32_SINT,
    R8_UINT,
    R8G8_UINT,
    R8G8B8_UINT,
    R8G8B8A8_UINT,
    R16_UINT,
    R16G16_UINT,
    R16G16B16_UINT,
    R16G16B16A16_UINT,
    R32_UINT,
    R32G32_UINT,
    R32G32B32_UINT,
    R32G32B32A32_UINT,
    R8G8B8_SRGB,
    R8G8B8A8_SRGB,
    D16_UNORM,
    D24_UNORM,
    D32_UNORM,
    D32_SFLOAT,
    S8_UINT,
    D24_UNORM_S8_UINT,
    D32_SFLOAT_S8_UINT,
}

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
R8G8_UNORM
R8G8B8_UNORM
R8G8B8A8_UNORM
R16_UNORM
R16G16_UNORM
R16G16B16_UNORM
R16G16B16A16_UNORM
R8_SNORM
R8G8_SNORM
R8G8B8_SNORM
R8G8B8A8_SNORM
R16_SNORM
R16G16_SNORM
R16G16B16_SNORM
R16G16B16A16_SNORM
R16_SFLOAT
R16G16_SFLOAT
R16G16B16_SFLOAT
R16G16B16A16_SFLOAT
R32_SFLOAT
R32G32_SFLOAT
R32G32B32_SFLOAT
R32G32B32A32_SFLOAT
R8_SINT
R8G8_SINT
R8G8B8_SINT
R8G8B8A8_SINT
R16_SINT
R16G16_SINT
R16G16B16_SINT
R16G16B16A16_SINT
R32_SINT
R32G32_SINT
R32G32B32_SINT
R32G32B32A32_SINT
R8_UINT
R8G8_UINT
R8G8B8_UINT
R8G8B8A8_UINT
R16_UINT
R16G16_UINT
R16G16B16_UINT
R16G16B16A16_UINT
R32_UINT
R32G32_UINT
R32G32B32_UINT
R32G32B32A32_UINT
R8G8B8_SRGB
R8G8B8A8_SRGB

sRGB8 color space with a linear alpha

D16_UNORM
D24_UNORM
D32_UNORM
D32_SFLOAT
S8_UINT
D24_UNORM_S8_UINT
D32_SFLOAT_S8_UINT

Implementations

impl Format[src]

pub fn num_components(self) -> u32[src]

Return the number of components of the pixel format.

pub fn base_format(self) -> BaseFormat[src]

Return the corresponding base format for this format.

Trait Implementations

impl Clone for Format[src]

impl Copy for Format[src]

impl Debug for Format[src]

impl Eq for Format[src]

impl PartialEq<Format> for Format[src]

impl StructuralEq for Format[src]

impl StructuralPartialEq for Format[src]

Auto Trait Implementations

impl RefUnwindSafe for Format

impl Send for Format

impl Sync for Format

impl Unpin for Format

impl UnwindSafe for Format

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.