Fix glBlitFramebuffer validation for BGRA8 IOSurfaces The format comparison for blitting from a multisampled buffer was not ES2 specific, so the ES3 check was removed. That had been added to fix blitting to the backbuffer on MacOS, which is now instead fixed by allowing BGRA8 and RGBA8 to be accepted interchangeably as draw and read formats. Fixes dEQP-GLES3.functional.negative_api.buffer.blit_framebuffer_multisample Change-Id: Id577372791007a780c542b0986378147e1e7bc1b Reviewed-on: https://swiftshader-review.googlesource.com/18888 Reviewed-by: Nicolas Capens <nicolascapens@google.com> Tested-by: Alexis Hétu <sugoi@google.com>
diff --git a/src/OpenGL/libGLESv2/Context.cpp b/src/OpenGL/libGLESv2/Context.cpp index 0fe4f9c..b8d9542 100644 --- a/src/OpenGL/libGLESv2/Context.cpp +++ b/src/OpenGL/libGLESv2/Context.cpp
@@ -4145,12 +4145,14 @@ return error(GL_INVALID_OPERATION); } - // From the ANGLE_framebuffer_blit extension: - // "Calling BlitFramebufferANGLE will result in an INVALID_OPERATION error if <mask> - // includes COLOR_BUFFER_BIT and the source and destination color formats to not match." - if((clientVersion < 3) && (readRenderbuffer->getSamples() > 0) && (readFormat != drawFormat)) + if((readRenderbuffer->getSamples() > 0) && (readFormat != drawFormat)) { - return error(GL_INVALID_OPERATION); + // RGBA8 and BGRA8 should be interchangeable here + if(!(((readFormat == GL_RGBA8) && (drawFormat == GL_BGRA8_EXT)) || + ((readFormat == GL_BGRA8_EXT) && (drawFormat == GL_RGBA8)))) + { + return error(GL_INVALID_OPERATION); + } } blitRenderTarget = true;