diff options
author | Brian Paul <[email protected]> | 2009-10-06 18:56:29 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2009-10-06 18:56:29 -0600 |
commit | f7b5e616e07b5caa27e91bb5733a8a849d5963f6 (patch) | |
tree | e9f97eb5917f7f9e6e49408bd3b6e93db193f19a /src/mesa/main/formats.c | |
parent | edfd2f7c4f942ed0c1aa1238ab0684ee7dd889a2 (diff) |
mesa: added _mesa_get_format_color_encoding()
Diffstat (limited to 'src/mesa/main/formats.c')
-rw-r--r-- | src/mesa/main/formats.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 9bc05093681..d1d84913912 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -638,6 +638,31 @@ _mesa_is_format_compressed(gl_format format) /** + * Return color encoding for given format. + * \return GL_LINEAR or GL_SRGB + */ +GLenum +_mesa_get_format_color_encoding(gl_format format) +{ + /* XXX this info should be encoded in gl_format_info */ + switch (format) { + case MESA_FORMAT_SRGB8: + case MESA_FORMAT_SRGBA8: + case MESA_FORMAT_SARGB8: + case MESA_FORMAT_SL8: + case MESA_FORMAT_SLA8: + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: + return GL_SRGB; + default: + return GL_LINEAR; + } +} + + +/** * Return number of bytes needed to store an image of the given size * in the given format. */ |