On 12/12/2012 03:25 PM, Anuj Phogat wrote:
Signed-off-by: Anuj Phogat <anuj.pho...@gmail.com>
---
  src/mesa/main/fbobject.c |   10 +++++++++-
  1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 4b7d4ab..9e32836 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -2856,7 +2856,15 @@ _mesa_BlitFramebuffer(GLint srcX0, GLint srcY0, GLint 
srcX1, GLint srcY1,
         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)) {
+               _mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS) ||
+               /* OpenGL/ES specification is not very clear about it. But GLES3
+                * conformance test expects GL_INVALID_OPERATION in case of 
below
+                * listed combination of formats for read/draw buffers.
+                */
+               (readRb->InternalFormat == GL_DEPTH32F_STENCIL8 &&
+                drawRb->InternalFormat == GL_DEPTH24_STENCIL8) ||
+               (readRb->InternalFormat == GL_DEPTH24_STENCIL8 &&
+                drawRb->InternalFormat == GL_DEPTH32F_STENCIL8)) {
         /* There is no need to check the stencil datatype here, because
          * there is only one: GL_UNSIGNED_INT.
          */

I found this text:

From the OpenGL 3.0 spec, section 4.3 (page 277):
"Calling BlitFramebuffer will result in an INVALID_OPERATION error if mask includes DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT, and the source and destination depth and stencil buffer formats do not match."

This text also appears in the ES 3.0 and GL 4.2 specs.

I believe the existing code's interpretation of this paragraph was:

- if DEPTH_BUFFER_BIT is set, source & destination depth buffer formats must match. - if STENCIL_BUFFER_BIT is set, source & destination stencil buffer formats must match.

An alternate interpretation that might appease those tests is:

- if *either* DEPTH_BUFFER_BIT or STENCIL_BUFFER_BIT is set, both the depth *and* stencil formats must match.

If that's the case, you can simply check readRb->Format == drawRb->Format. It seems reasonable to me, at least for packed formats.
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to