mesa: added _mesa_get_format_color_encoding()

This commit is contained in:
Brian Paul
2009-10-06 18:56:29 -06:00
parent edfd2f7c4f
commit f7b5e616e0
2 changed files with 28 additions and 0 deletions
+25
View File
@@ -637,6 +637,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.
+3
View File
@@ -152,6 +152,9 @@ _mesa_get_format_base_format(gl_format format);
extern GLboolean
_mesa_is_format_compressed(gl_format format);
extern GLenum
_mesa_get_format_color_encoding(gl_format format);
extern GLuint
_mesa_format_image_size(gl_format format, GLsizei width,
GLsizei height, GLsizei depth);