OSDN Git Service

WebGL test fix for MacOS
authorAlexis Hetu <sugoi@google.com>
Mon, 9 Apr 2018 15:43:58 +0000 (11:43 -0400)
committerAlexis Hétu <sugoi@google.com>
Mon, 9 Apr 2018 16:46:29 +0000 (16:46 +0000)
On MacOS, the BGRA format is used for framebuffers. Because of that,
copying from the BGRA format must be allowed in the same places the
RGBA format is allowed.

This fixes the following WebGL test on MacOS:
conformance/textures/misc/copy-tex-image-2d-formats.html

Change-Id: I45c6b81a894dd8d55c4ab5cff0cf9ad1a08c8303
Reviewed-on: https://swiftshader-review.googlesource.com/18348
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
src/OpenGL/libGLESv2/utilities.cpp

index 76b5b12..109cb8e 100644 (file)
@@ -571,7 +571,8 @@ namespace es2
                {
                case GL_ALPHA:
                        if(baseColorbufferFormat != GL_ALPHA &&
-                          baseColorbufferFormat != GL_RGBA)
+                          baseColorbufferFormat != GL_RGBA &&
+                          baseColorbufferFormat != GL_BGRA_EXT)   // GL_EXT_texture_format_BGRA8888 / GL_APPLE_texture_format_BGRA8888
                        {
                                return error(GL_INVALID_OPERATION, false);
                        }
@@ -589,7 +590,8 @@ namespace es2
                        if(baseColorbufferFormat != GL_RED &&
                           baseColorbufferFormat != GL_RG &&
                           baseColorbufferFormat != GL_RGB &&
-                          baseColorbufferFormat != GL_RGBA)
+                          baseColorbufferFormat != GL_RGBA &&
+                          baseColorbufferFormat != GL_BGRA_EXT)   // GL_EXT_texture_format_BGRA8888 / GL_APPLE_texture_format_BGRA8888
                        {
                                return error(GL_INVALID_OPERATION, false);
                        }
@@ -597,14 +599,16 @@ namespace es2
                case GL_RG:
                        if(baseColorbufferFormat != GL_RG &&
                           baseColorbufferFormat != GL_RGB &&
-                          baseColorbufferFormat != GL_RGBA)
+                          baseColorbufferFormat != GL_RGBA &&
+                          baseColorbufferFormat != GL_BGRA_EXT)   // GL_EXT_texture_format_BGRA8888 / GL_APPLE_texture_format_BGRA8888
                        {
                                return error(GL_INVALID_OPERATION, false);
                        }
                        break;
                case GL_RGB:
                        if(baseColorbufferFormat != GL_RGB &&
-                          baseColorbufferFormat != GL_RGBA)
+                          baseColorbufferFormat != GL_RGBA &&
+                          baseColorbufferFormat != GL_BGRA_EXT)   // GL_EXT_texture_format_BGRA8888 / GL_APPLE_texture_format_BGRA8888
                        {
                                return error(GL_INVALID_OPERATION, false);
                        }