Chromium Code Reviews| Index: gpu/command_buffer/common/gles2_cmd_utils.cc |
| diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc |
| index cb0bd6396b2912c953fa139520320a2bc7f85a23..93a90002c851e1a12322088ae6b879a5cfa71092 100644 |
| --- a/gpu/command_buffer/common/gles2_cmd_utils.cc |
| +++ b/gpu/command_buffer/common/gles2_cmd_utils.cc |
| @@ -979,7 +979,9 @@ size_t GLES2Util::GLTargetToFaceIndex(uint32_t target) { |
| } |
| uint32_t GLES2Util::GetGLReadPixelsImplementationFormat( |
| - uint32_t internal_format) { |
| + uint32_t internal_format, |
| + uint32_t texture_type, |
| + bool supports_bgra) { |
|
ericrk
2016/03/07 20:38:59
could pass the context in as well (and have the ex
|
| switch (internal_format) { |
| case GL_R8: |
| case GL_R16F: |
| @@ -1018,6 +1020,14 @@ uint32_t GLES2Util::GetGLReadPixelsImplementationFormat( |
| case GL_RGBA32UI: |
| case GL_RGBA32I: |
| return GL_RGBA_INTEGER; |
| + case GL_BGRA_EXT: |
| + case GL_BGRA8_EXT: |
| + // If the internal format is BGRA, we prefer reading back BGRA if |
| + // possible. |
| + if (texture_type == GL_UNSIGNED_BYTE && supports_bgra) |
| + return GL_BGRA_EXT; |
| + else |
| + return GL_RGBA; |
| default: |
| return GL_RGBA; |
| } |