OSDN Git Service

Fix glBlitFramebuffer validation for BGRA8 IOSurfaces
authorAlexis Hetu <sugoi@google.com>
Wed, 16 May 2018 17:03:41 +0000 (13:03 -0400)
committerAlexis Hétu <sugoi@google.com>
Wed, 16 May 2018 18:11:52 +0000 (18:11 +0000)
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>
src/OpenGL/libGLESv2/Context.cpp

index 0fe4f9c..b8d9542 100644 (file)
@@ -4145,12 +4145,14 @@ void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1
                        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;