Mesa (texformat-rework): mesa: added _mesa_get_format_color_encoding()
Brian Paul
brianp at kemper.freedesktop.org
Wed Oct 7 04:32:06 UTC 2009
Module: Mesa
Branch: texformat-rework
Commit: f7b5e616e07b5caa27e91bb5733a8a849d5963f6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f7b5e616e07b5caa27e91bb5733a8a849d5963f6
Author: Brian Paul <brianp at vmware.com>
Date: Tue Oct 6 18:56:29 2009 -0600
mesa: added _mesa_get_format_color_encoding()
---
src/mesa/main/formats.c | 25 +++++++++++++++++++++++++
src/mesa/main/formats.h | 3 +++
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 9bc0509..d1d8491 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.
*/
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index 6aebb85..fcedbe9 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -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);
More information about the mesa-commit
mailing list