Mesa (7.11): mesa: Add _mesa_cpal_compressed_format_type

Ian Romanick idr at kemper.freedesktop.org
Tue Oct 25 18:42:08 PDT 2011


Module: Mesa
Branch: 7.11
Commit: 9b242a03d5df517f0dae61a1b9572147fba33310
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9b242a03d5df517f0dae61a1b9572147fba33310

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Sep 12 11:45:43 2011 -0500

mesa: Add _mesa_cpal_compressed_format_type

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Brian Paul <brianp at vmware.com>
Tested-by: Jin Yang <jin.a.yang at intel.com>
(cherry picked from commit b433e7ba073c66d974dfd8a180ab3970acf18105)

---

 src/mesa/main/texpal.c |   16 ++++++++++++++++
 src/mesa/main/texpal.h |    4 ++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/texpal.c b/src/mesa/main/texpal.c
index 7608087..0684638 100644
--- a/src/mesa/main/texpal.c
+++ b/src/mesa/main/texpal.c
@@ -152,6 +152,22 @@ cpal_get_info(GLint level, GLenum internalFormat,
    return info;
 }
 
+void
+_mesa_cpal_compressed_format_type(GLenum internalFormat, GLenum *format,
+				  GLenum *type)
+{
+   const struct cpal_format_info *info;
+
+   if (internalFormat < GL_PALETTE4_RGB8_OES
+       || internalFormat > GL_PALETTE8_RGB5_A1_OES) {
+      return;
+   }
+
+   info = &formats[internalFormat - GL_PALETTE4_RGB8_OES];
+   *format = info->format;
+   *type = info->type;
+}
+
 /**
  * Convert a call to glCompressedTexImage2D() where internalFormat is a
  *  compressed palette format into a regular GLubyte/RGBA glTexImage2D() call.
diff --git a/src/mesa/main/texpal.h b/src/mesa/main/texpal.h
index e180999..acfaa31 100644
--- a/src/mesa/main/texpal.h
+++ b/src/mesa/main/texpal.h
@@ -38,4 +38,8 @@ extern unsigned
 _mesa_cpal_compressed_size(int level, GLenum internalFormat,
 			   unsigned width, unsigned height);
 
+extern void
+_mesa_cpal_compressed_format_type(GLenum internalFormat, GLenum *format,
+				  GLenum *type);
+
 #endif /* TEXPAL_H */



More information about the mesa-commit mailing list