mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-04 04:50:11 +01:00
mesa/glformats: Add a helper function _mesa_is_srgb_format()
Returns true if the passed format is an sRGB format, false otherwise. Reviewed-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
87b2de3998
commit
b1755535ec
2 changed files with 48 additions and 0 deletions
|
|
@ -1338,6 +1338,51 @@ _mesa_is_compressed_format(const struct gl_context *ctx, GLenum format)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test if the given format represents an sRGB format.
|
||||
* \param format the GL format (can be an internal format)
|
||||
* \return GL_TRUE if format is sRGB, GL_FALSE otherwise
|
||||
*/
|
||||
GLboolean
|
||||
_mesa_is_srgb_format(GLenum format)
|
||||
{
|
||||
switch (format) {
|
||||
case GL_SRGB:
|
||||
case GL_SRGB8:
|
||||
case GL_SRGB_ALPHA:
|
||||
case GL_SRGB8_ALPHA8:
|
||||
case GL_COMPRESSED_SRGB:
|
||||
case GL_COMPRESSED_SRGB_ALPHA:
|
||||
case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
|
||||
case GL_COMPRESSED_SRGB8_ETC2:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
|
||||
case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
|
||||
case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
|
||||
case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
|
||||
return GL_TRUE;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return GL_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert various unpack formats to the corresponding base format.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -101,6 +101,9 @@ _mesa_is_depth_or_stencil_format(GLenum format);
|
|||
extern GLboolean
|
||||
_mesa_is_compressed_format(const struct gl_context *ctx, GLenum format);
|
||||
|
||||
extern GLboolean
|
||||
_mesa_is_srgb_format(GLenum format);
|
||||
|
||||
extern GLenum
|
||||
_mesa_base_format_to_integer_format(GLenum format);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue