move around some error checking
authorBrian Paul <brian.paul@tungstengraphics.com>
Sat, 1 Oct 2005 16:02:11 +0000 (16:02 +0000)
committerBrian Paul <brian.paul@tungstengraphics.com>
Sat, 1 Oct 2005 16:02:11 +0000 (16:02 +0000)
src/mesa/main/drawpix.c

index 2872a03..701ac6a 100644 (file)
@@ -44,6 +44,14 @@ error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
 {
    const char *readDraw = drawing ? "Draw" : "Read";
 
+   if (ctx->Extensions.EXT_packed_depth_stencil
+       && type == GL_UNSIGNED_INT_24_8_EXT
+       && format != GL_DEPTH_STENCIL_EXT) {
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "gl%sPixels(format is not GL_DEPTH_STENCIL_EXT)", readDraw);
+      return GL_TRUE;
+   }
+
    /* basic combinations test */
    if (!_mesa_is_legal_format_and_type(ctx, format, type)) {
       _mesa_error(ctx, GL_INVALID_ENUM,
@@ -112,13 +120,6 @@ error_check_format_type(GLcontext *ctx, GLenum format, GLenum type,
       return GL_TRUE;
    }
 
-   /* XXX might have to move this to the top of the function */
-   if (type == GL_UNSIGNED_INT_24_8_EXT && format != GL_DEPTH_STENCIL_EXT) {
-      _mesa_error(ctx, GL_INVALID_OPERATION,
-                  "gl%sPixels(format is not GL_DEPTH_STENCIL_EXT)", readDraw);
-      return GL_TRUE;
-   }
-
    /* no errors */
    return GL_FALSE;
 }