OSDN Git Service

Fixed blitFramebuffer issue with Depth/Stencil
authorAlexis Hetu <sugoi@google.com>
Wed, 30 Nov 2016 16:25:28 +0000 (11:25 -0500)
committerAlexis Hétu <sugoi@google.com>
Wed, 30 Nov 2016 17:58:25 +0000 (17:58 +0000)
A condition was overly aggressive in producing an INVALID_OPERATION
when the read depth/stencil framebuffer is multisampled. When the
formats are the same and source and destination rectangles are the
same, performing a blitFramebuffer operation is allowed.

Change-Id: I29e52cb546ae1bf248ac0107492c97ea82406613
Reviewed-on: https://swiftshader-review.googlesource.com/8212
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
src/OpenGL/libGLESv2/Context.cpp

index 0e32336..7ccfc9d 100644 (file)
@@ -4111,8 +4111,16 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
                        return error(GL_INVALID_OPERATION);   // Only whole-buffer copies are permitted
                }
 
+               // OpenGL ES 3.0.4 spec, p.199:
+               // ...an INVALID_OPERATION error is generated if the formats of the read
+               // and draw framebuffers are not identical or if the source and destination 
+               // rectangles are not defined with the same(X0, Y 0) and (X1, Y 1) bounds.
+               // If SAMPLE_BUFFERS for the draw framebuffer is greater than zero, an
+               // INVALID_OPERATION error is generated.
                if((drawDSBuffer && drawDSBuffer->getSamples() > 1) ||
-                  (readDSBuffer && readDSBuffer->getSamples() > 1))
+                  ((readDSBuffer && readDSBuffer->getSamples() > 1) &&
+                   ((srcX0 != dstX0 || srcY0 != dstY0 || srcX1 != dstX1 || srcY1 != dstY1) ||
+                    (drawDSBuffer->getFormat() != readDSBuffer->getFormat()))))
                {
                        return error(GL_INVALID_OPERATION);
                }