Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Unified Diff: gpu/command_buffer/common/gles2_cmd_utils.cc

Issue 1759433002: Update GL_IMPLEMENTATION_COLOR_READ_FORMAT for BGRA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
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;
}

Powered by Google App Engine
This is Rietveld 408576698