Mesa (master): mesa: check depth, stencil formats (not depths) in glBlitFramebuffer

Brian Paul brianp at kemper.freedesktop.org
Mon Jan 9 15:11:54 UTC 2012


Module: Mesa
Branch: master
Commit: 3f1fab06844f696de44d9a56e83ff62e8ea576bd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f1fab06844f696de44d9a56e83ff62e8ea576bd

Author: Brian Paul <brianp at vmware.com>
Date:   Mon Jan  9 08:11:33 2012 -0700

mesa: check depth, stencil formats (not depths) in glBlitFramebuffer

We were only comparing the number of depth and stencil bits but the
extension spec actually says the formats must match:

    The error INVALID_OPERATION is generated if BlitFramebufferEXT is
    called and <mask> includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT
    and the source and destination depth or stencil buffer formats do
    not match.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/main/fbobject.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 1d5e3da..912436b 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2683,10 +2683,9 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
       if ((readRb == NULL) || (drawRb == NULL)) {
 	 mask &= ~GL_STENCIL_BUFFER_BIT;
       }
-      else if (_mesa_get_format_bits(readRb->Format, GL_STENCIL_BITS) !=
-	       _mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS)) {
+      else if (readRb->Format != drawRb->Format) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glBlitFramebufferEXT(stencil buffer size mismatch)");
+                     "glBlitFramebufferEXT(stencil buffer format mismatch)");
          return;
       }
    }
@@ -2706,10 +2705,9 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
       if ((readRb == NULL) || (drawRb == NULL)) {
 	 mask &= ~GL_DEPTH_BUFFER_BIT;
       }
-      else if (_mesa_get_format_bits(readRb->Format, GL_DEPTH_BITS) !=
-	       _mesa_get_format_bits(drawRb->Format, GL_DEPTH_BITS)) {
+      else if (readRb->Format != drawRb->Format) {
          _mesa_error(ctx, GL_INVALID_OPERATION,
-                     "glBlitFramebufferEXT(depth buffer size mismatch)");
+                     "glBlitFramebufferEXT(depth buffer format mismatch)");
          return;
       }
    }




More information about the mesa-commit mailing list