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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file is here so other GLES2 related files can have a common set of 5 // This file is here so other GLES2 related files can have a common set of
6 // includes where appropriate. 6 // includes where appropriate.
7 7
8 #include <sstream> 8 #include <sstream>
9 #include <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 961 matching lines...) Expand 10 before | Expand all | Expand 10 after
972 return 4; 972 return 4;
973 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: 973 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
974 return 5; 974 return 5;
975 default: 975 default:
976 NOTREACHED(); 976 NOTREACHED();
977 return 0; 977 return 0;
978 } 978 }
979 } 979 }
980 980
981 uint32_t GLES2Util::GetGLReadPixelsImplementationFormat( 981 uint32_t GLES2Util::GetGLReadPixelsImplementationFormat(
982 uint32_t internal_format) { 982 uint32_t internal_format,
983 uint32_t texture_type,
984 bool supports_bgra) {
ericrk 2016/03/07 20:38:59 could pass the context in as well (and have the ex
983 switch (internal_format) { 985 switch (internal_format) {
984 case GL_R8: 986 case GL_R8:
985 case GL_R16F: 987 case GL_R16F:
986 case GL_R32F: 988 case GL_R32F:
987 return GL_RED; 989 return GL_RED;
988 case GL_R8UI: 990 case GL_R8UI:
989 case GL_R8I: 991 case GL_R8I:
990 case GL_R16UI: 992 case GL_R16UI:
991 case GL_R16I: 993 case GL_R16I:
992 case GL_R32UI: 994 case GL_R32UI:
(...skipping 18 matching lines...) Expand all
1011 case GL_RGB32F: 1013 case GL_RGB32F:
1012 return GL_RGB; 1014 return GL_RGB;
1013 case GL_RGBA8UI: 1015 case GL_RGBA8UI:
1014 case GL_RGBA8I: 1016 case GL_RGBA8I:
1015 case GL_RGB10_A2UI: 1017 case GL_RGB10_A2UI:
1016 case GL_RGBA16UI: 1018 case GL_RGBA16UI:
1017 case GL_RGBA16I: 1019 case GL_RGBA16I:
1018 case GL_RGBA32UI: 1020 case GL_RGBA32UI:
1019 case GL_RGBA32I: 1021 case GL_RGBA32I:
1020 return GL_RGBA_INTEGER; 1022 return GL_RGBA_INTEGER;
1023 case GL_BGRA_EXT:
1024 case GL_BGRA8_EXT:
1025 // If the internal format is BGRA, we prefer reading back BGRA if
1026 // possible.
1027 if (texture_type == GL_UNSIGNED_BYTE && supports_bgra)
1028 return GL_BGRA_EXT;
1029 else
1030 return GL_RGBA;
1021 default: 1031 default:
1022 return GL_RGBA; 1032 return GL_RGBA;
1023 } 1033 }
1024 } 1034 }
1025 1035
1026 uint32_t GLES2Util::GetGLReadPixelsImplementationType(uint32_t internal_format, 1036 uint32_t GLES2Util::GetGLReadPixelsImplementationType(uint32_t internal_format,
1027 uint32_t texture_type) { 1037 uint32_t texture_type) {
1028 switch (internal_format) { 1038 switch (internal_format) {
1029 case GL_R16UI: 1039 case GL_R16UI:
1030 case GL_RG16UI: 1040 case GL_RG16UI:
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 } 1539 }
1530 1540
1531 return true; 1541 return true;
1532 } 1542 }
1533 1543
1534 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" 1544 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h"
1535 1545
1536 } // namespace gles2 1546 } // namespace gles2
1537 } // namespace gpu 1547 } // namespace gpu
1538 1548
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698