From 58ead9eca5847f06bf9c0455b2b85a1a7835dd13 Mon Sep 17 00:00:00 2001 From: Alexis Hetu Date: Wed, 30 Nov 2016 11:25:28 -0500 Subject: [PATCH] Fixed blitFramebuffer issue with Depth/Stencil MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Nicolas Capens --- src/OpenGL/libGLESv2/Context.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/OpenGL/libGLESv2/Context.cpp b/src/OpenGL/libGLESv2/Context.cpp index 0e323369b..7ccfc9d30 100644 --- a/src/OpenGL/libGLESv2/Context.cpp +++ b/src/OpenGL/libGLESv2/Context.cpp @@ -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); } -- 2.11.0