[Mesa-dev] [PATCH 5/5] mesa: move/fix levels check for glTexStorage()

Brian Paul brian.e.paul at gmail.com
Sat Sep 15 09:30:35 PDT 2012


From: Brian Paul <brianp at vmware.com>

Fix copy&paste error and move min levels check closer to max levels check.
---
 src/mesa/main/texstorage.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c
index 0a4cafe..ca02ef3 100644
--- a/src/mesa/main/texstorage.c
+++ b/src/mesa/main/texstorage.c
@@ -268,13 +268,6 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
       return GL_TRUE;
    }  
 
-   /* levels check */
-   if (levels < 1 || height < 1 || depth < 1) {
-      _mesa_error(ctx, GL_INVALID_VALUE, "glTexStorage%uD(levels < 1)",
-                  dims);
-      return GL_TRUE;
-   }  
-
    /* target check */
    if (!legal_texobj_target(ctx, dims, target)) {
       _mesa_error(ctx, GL_INVALID_ENUM,
@@ -283,7 +276,14 @@ tex_storage_error_check(struct gl_context *ctx, GLuint dims, GLenum target,
       return GL_TRUE;
    }
 
-   /* check levels against maximum */
+   /* levels check */
+   if (levels < 1) {
+      _mesa_error(ctx, GL_INVALID_VALUE, "glTexStorage%uD(levels < 1)",
+                  dims);
+      return GL_TRUE;
+   }  
+
+   /* check levels against maximum (note different error than above) */
    if (levels > _mesa_max_texture_levels(ctx, target)) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                   "glTexStorage%uD(levels too large)", dims);
-- 
1.7.4.1



More information about the mesa-dev mailing list