Fixed blitFramebuffer issue with Depth/Stencil 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>
diff --git a/src/OpenGL/libGLESv2/Context.cpp b/src/OpenGL/libGLESv2/Context.cpp index 0e32336..7ccfc9d 100644 --- a/src/OpenGL/libGLESv2/Context.cpp +++ b/src/OpenGL/libGLESv2/Context.cpp
@@ -4111,8 +4111,16 @@ 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); }