mesa: new glDrawPixels error check for integer formats
authorBrian Paul <brianp@vmware.com>
Sat, 23 Oct 2010 15:35:01 +0000 (09:35 -0600)
committerBrian Paul <brianp@vmware.com>
Sat, 23 Oct 2010 16:19:30 +0000 (10:19 -0600)
src/mesa/main/drawpix.c

index ac92a3fb0847d4c727f8e2801efd218b9056ec49..890d0ab5a72e2a9836cde310c2f588a85bc128b2 100644 (file)
 #include "enums.h"
 #include "feedback.h"
 #include "framebuffer.h"
+#include "image.h"
 #include "readpix.h"
+#include "shaderobj.h"
 #include "state.h"
-#include "main/dispatch.h"
+#include "dispatch.h"
 
 
 #if FEATURE_drawpix
@@ -94,6 +96,14 @@ _mesa_DrawPixels( GLsizei width, GLsizei height,
       goto end; /* no-op, not an error */
    }
 
+   if (_mesa_is_integer_format(format) &&
+       !_mesa_is_fragment_shader_active(ctx)) {
+      /* A fragment shader is required when drawing integer formats */
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "glDrawPixels(integer format but no fragment shader)");
+      goto end;
+   }
+
    if (ctx->RenderMode == GL_RENDER) {
       if (width > 0 && height > 0) {
          /* Round, to satisfy conformance tests (matches SGI's OpenGL) */