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

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: Remove no longer needed check from GLHelperReadbackSupport::SupportsFormat Created 4 years, 10 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 bc39543385e9725f149da6809caa2b367e414b95..639ab0c9717fcb3c034281307486a88201942e13 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -978,8 +978,13 @@ size_t GLES2Util::GLTargetToFaceIndex(uint32_t target) {
}
}
-uint32_t GLES2Util::GetGLReadPixelsImplementationFormat(
- uint32_t internal_format) {
+uint32_t GLES2Util::GetGLReadPixelsAdditionalFormat(uint32_t internal_format,
+ uint32_t texture_type) {
+ // GL_RGBA is supported by default. According to the spec, this function
+ // should return a second, implementaiton-chosen format. For consumers of
piman 2016/03/04 20:55:36 typo: implementaiton->implementation
+ // this API to get the most benefit (as many efficient options as
+ // possible), this function attempts to return a non GL_RGBA format in
+ // cases where GL_RGBA would be returned.
switch (internal_format) {
case GL_R8:
case GL_R16F:
@@ -1018,13 +1023,25 @@ uint32_t GLES2Util::GetGLReadPixelsImplementationFormat(
case GL_RGBA32UI:
case GL_RGBA32I:
return GL_RGBA_INTEGER;
+ case GL_RGBA:
+ case GL_RGBA8:
+ case GL_BGRA_EXT:
+ case GL_BGRA8_EXT:
+ // We would return GL_RGBA here, but that is uninteresting, as it is
+ // supported by default. If the texture's type is GL_UNSIGNED_BYTE, we
+ // can also support GL_BGRA_EXT, so return this as another option.
+ if (texture_type == GL_UNSIGNED_BYTE)
+ return GL_BGRA_EXT;
piman 2016/03/04 20:55:37 We're only allowed to return this if we expose GL_
+ else
+ return GL_RGBA;
default:
return GL_RGBA;
}
}
-uint32_t GLES2Util::GetGLReadPixelsImplementationType(uint32_t internal_format,
- uint32_t texture_type) {
+uint32_t GLES2Util::GetGLReadPixelsTypeForAdditionalFormat(
+ uint32_t internal_format,
+ uint32_t texture_type) {
switch (internal_format) {
case GL_R16UI:
case GL_RG16UI:

Powered by Google App Engine
This is Rietveld 408576698