#[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 ingrr
, 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
impl Format
Sourcepub fn num_components(self) -> u32
pub fn num_components(self) -> u32
Return the number of components of the pixel format.
Sourcepub fn base_format(self) -> BaseFormat
pub fn base_format(self) -> BaseFormat
Return the corresponding base format for this format.