mesa: add missing error check for linear blit of integer colors
authorBrian Paul <brianp@vmware.com>
Mon, 9 Jan 2012 15:11:33 +0000 (08:11 -0700)
committerBrian Paul <brianp@vmware.com>
Mon, 9 Jan 2012 15:11:33 +0000 (08:11 -0700)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/fbobject.c

index 912170aba4746b08957c383cc14fa02731927022..1d5e3da30649ac7b43b03d0457a8c443d911b3d9 100644 (file)
@@ -2742,6 +2742,19 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
       }
    }
 
+   if (filter == GL_LINEAR && (mask & GL_COLOR_BUFFER_BIT)) {
+      /* 3.1 spec, page 199:
+       * "Calling BlitFramebuffer will result in an INVALID_OPERATION error
+       * if filter is LINEAR and read buffer contains integer data."
+       */
+      GLenum type = _mesa_get_format_datatype(colorReadRb->Format);
+      if (type == GL_INT || type == GL_UNSIGNED_INT) {
+         _mesa_error(ctx, GL_INVALID_OPERATION,
+                     "glBlitFramebufferEXT(integer color type)");
+         return;
+      }
+   }
+
    if (!ctx->Extensions.EXT_framebuffer_blit) {
       _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT");
       return;