Mesa (7.11): mesa: Remove redundant compressed paletted texture error checks

Ian Romanick idr at kemper.freedesktop.org
Wed Oct 26 01:42:10 UTC 2011


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

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

mesa: Remove redundant compressed paletted texture error checks

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 13757f7080426e99511456ea6c44af63b8e7e861)

---

 src/mesa/main/texpal.c |   34 +++++-----------------------------
 1 files changed, 5 insertions(+), 29 deletions(-)

diff --git a/src/mesa/main/texpal.c b/src/mesa/main/texpal.c
index 0684638..ed2261b 100644
--- a/src/mesa/main/texpal.c
+++ b/src/mesa/main/texpal.c
@@ -127,31 +127,6 @@ _mesa_cpal_compressed_size(int level, GLenum internalFormat,
    return expect_size;
 }
 
-static const struct cpal_format_info *
-cpal_get_info(GLint level, GLenum internalFormat,
-              GLsizei width, GLsizei height, GLsizei imageSize)
-{
-   const struct cpal_format_info *info;
-
-   info = &formats[internalFormat - GL_PALETTE4_RGB8_OES];
-   ASSERT(info->cpal_format == internalFormat);
-
-   if (level > 0) {
-      _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE,
-            "glCompressedTexImage2D(level=%d)", level);
-      return NULL;
-   }
-
-   expect_size = _mesa_cpal_compressed_size(level, internalFormat,
-					    width, height);
-   if (expect_size > imageSize) {
-      _mesa_error(_mesa_get_current_context(), GL_INVALID_VALUE,
-            "glCompressedTexImage2D(imageSize=%d)", imageSize);
-      return NULL;
-   }
-   return info;
-}
-
 void
 _mesa_cpal_compressed_format_type(GLenum internalFormat, GLenum *format,
 				  GLenum *type)
@@ -184,12 +159,13 @@ _mesa_cpal_compressed_teximage2d(GLenum target, GLint level,
    GLint saved_align, align;
    GET_CURRENT_CONTEXT(ctx);
 
-   info = cpal_get_info(level, internalFormat, width, height, imageSize);
-   if (!info)
-      return;
+   /* By this point, the internalFormat should have been validated.
+    */
+   assert(internalFormat >= GL_PALETTE4_RGB8_OES
+	  && internalFormat <= GL_PALETTE8_RGB5_A1_OES);
 
    info = &formats[internalFormat - GL_PALETTE4_RGB8_OES];
-   ASSERT(info->cpal_format == internalFormat);
+
    num_levels = -level + 1;
 
    /* first image follows the palette */




More information about the mesa-commit mailing list