Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 971 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: | 971 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: |
| 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::GetGLReadPixelsAdditionalFormat(uint32_t internal_format, |
| 982 uint32_t internal_format) { | 982 uint32_t texture_type) { |
| 983 // GL_RGBA is supported by default. According to the spec, this function | |
| 984 // should return a second, implementaiton-chosen format. For consumers of | |
|
piman
2016/03/04 20:55:36
typo: implementaiton->implementation
| |
| 985 // this API to get the most benefit (as many efficient options as | |
| 986 // possible), this function attempts to return a non GL_RGBA format in | |
| 987 // cases where GL_RGBA would be returned. | |
| 983 switch (internal_format) { | 988 switch (internal_format) { |
| 984 case GL_R8: | 989 case GL_R8: |
| 985 case GL_R16F: | 990 case GL_R16F: |
| 986 case GL_R32F: | 991 case GL_R32F: |
| 987 return GL_RED; | 992 return GL_RED; |
| 988 case GL_R8UI: | 993 case GL_R8UI: |
| 989 case GL_R8I: | 994 case GL_R8I: |
| 990 case GL_R16UI: | 995 case GL_R16UI: |
| 991 case GL_R16I: | 996 case GL_R16I: |
| 992 case GL_R32UI: | 997 case GL_R32UI: |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 1011 case GL_RGB32F: | 1016 case GL_RGB32F: |
| 1012 return GL_RGB; | 1017 return GL_RGB; |
| 1013 case GL_RGBA8UI: | 1018 case GL_RGBA8UI: |
| 1014 case GL_RGBA8I: | 1019 case GL_RGBA8I: |
| 1015 case GL_RGB10_A2UI: | 1020 case GL_RGB10_A2UI: |
| 1016 case GL_RGBA16UI: | 1021 case GL_RGBA16UI: |
| 1017 case GL_RGBA16I: | 1022 case GL_RGBA16I: |
| 1018 case GL_RGBA32UI: | 1023 case GL_RGBA32UI: |
| 1019 case GL_RGBA32I: | 1024 case GL_RGBA32I: |
| 1020 return GL_RGBA_INTEGER; | 1025 return GL_RGBA_INTEGER; |
| 1026 case GL_RGBA: | |
| 1027 case GL_RGBA8: | |
| 1028 case GL_BGRA_EXT: | |
| 1029 case GL_BGRA8_EXT: | |
| 1030 // We would return GL_RGBA here, but that is uninteresting, as it is | |
| 1031 // supported by default. If the texture's type is GL_UNSIGNED_BYTE, we | |
| 1032 // can also support GL_BGRA_EXT, so return this as another option. | |
| 1033 if (texture_type == GL_UNSIGNED_BYTE) | |
| 1034 return GL_BGRA_EXT; | |
|
piman
2016/03/04 20:55:37
We're only allowed to return this if we expose GL_
| |
| 1035 else | |
| 1036 return GL_RGBA; | |
| 1021 default: | 1037 default: |
| 1022 return GL_RGBA; | 1038 return GL_RGBA; |
| 1023 } | 1039 } |
| 1024 } | 1040 } |
| 1025 | 1041 |
| 1026 uint32_t GLES2Util::GetGLReadPixelsImplementationType(uint32_t internal_format, | 1042 uint32_t GLES2Util::GetGLReadPixelsTypeForAdditionalFormat( |
| 1027 uint32_t texture_type) { | 1043 uint32_t internal_format, |
| 1044 uint32_t texture_type) { | |
| 1028 switch (internal_format) { | 1045 switch (internal_format) { |
| 1029 case GL_R16UI: | 1046 case GL_R16UI: |
| 1030 case GL_RG16UI: | 1047 case GL_RG16UI: |
| 1031 case GL_RGBA16UI: | 1048 case GL_RGBA16UI: |
| 1032 case GL_RGB10_A2: | 1049 case GL_RGB10_A2: |
| 1033 case GL_RGB10_A2UI: | 1050 case GL_RGB10_A2UI: |
| 1034 return GL_UNSIGNED_SHORT; | 1051 return GL_UNSIGNED_SHORT; |
| 1035 case GL_R32UI: | 1052 case GL_R32UI: |
| 1036 case GL_RG32UI: | 1053 case GL_RG32UI: |
| 1037 case GL_RGBA32UI: | 1054 case GL_RGBA32UI: |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1526 } | 1543 } |
| 1527 | 1544 |
| 1528 return true; | 1545 return true; |
| 1529 } | 1546 } |
| 1530 | 1547 |
| 1531 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" | 1548 #include "gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h" |
| 1532 | 1549 |
| 1533 } // namespace gles2 | 1550 } // namespace gles2 |
| 1534 } // namespace gpu | 1551 } // namespace gpu |
| 1535 | 1552 |
| OLD | NEW |