Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/common/gpu/client/gl_helper_readback_support.h" | 5 #include "content/common/gpu/client/gl_helper_readback_support.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "gpu/GLES2/gl2extchromium.h" | 7 #include "gpu/GLES2/gl2extchromium.h" |
| 8 #include "third_party/skia/include/core/SkImageInfo.h" | 8 #include "third_party/skia/include/core/SkImageInfo.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 struct FormatCacheEntry entry = { format, type, *format_out, *type_out }; | 97 struct FormatCacheEntry entry = { format, type, *format_out, *type_out }; |
| 98 format_cache_.push_back(entry); | 98 format_cache_.push_back(entry); |
| 99 } | 99 } |
| 100 | 100 |
| 101 bool GLHelperReadbackSupport::SupportsFormat(GLenum format, GLenum type) { | 101 bool GLHelperReadbackSupport::SupportsFormat(GLenum format, GLenum type) { |
| 102 // GLES2.0 Specification says this pairing is always supported | 102 // GLES2.0 Specification says this pairing is always supported |
| 103 // with additional format from GL_IMPLEMENTATION_COLOR_READ_FORMAT/TYPE | 103 // with additional format from GL_IMPLEMENTATION_COLOR_READ_FORMAT/TYPE |
| 104 if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) | 104 if (format == GL_RGBA && type == GL_UNSIGNED_BYTE) |
| 105 return true; | 105 return true; |
| 106 | 106 |
| 107 if (format == GL_BGRA_EXT && type == GL_UNSIGNED_BYTE) { | |
|
ericrk
2016/03/02 17:40:30
The presence of GL_EXT_read_format_bgra doesn't gu
| |
| 108 const GLubyte* tmp = gl_->GetString(GL_EXTENSIONS); | |
| 109 if (tmp) { | |
| 110 std::string extensions = | |
| 111 " " + std::string(reinterpret_cast<const char*>(tmp)) + " "; | |
| 112 if (extensions.find(" GL_EXT_read_format_bgra ") != std::string::npos) { | |
| 113 return true; | |
| 114 } | |
| 115 } | |
| 116 } | |
| 117 | |
| 118 bool supports_format = false; | 107 bool supports_format = false; |
| 119 GLenum ext_format = 0, ext_type = 0; | 108 GLenum ext_format = 0, ext_type = 0; |
| 120 GetAdditionalFormat(format, type, &ext_format, &ext_type); | 109 GetAdditionalFormat(format, type, &ext_format, &ext_type); |
| 121 if ((ext_format == format) && (ext_type == type)) { | 110 if ((ext_format == format) && (ext_type == type)) { |
| 122 supports_format = true; | 111 supports_format = true; |
| 123 } | 112 } |
| 124 return supports_format; | 113 return supports_format; |
| 125 } | 114 } |
| 126 | 115 |
| 127 GLHelperReadbackSupport::FormatSupport | 116 GLHelperReadbackSupport::FormatSupport |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 return GLHelperReadbackSupport::NOT_SUPPORTED; | 163 return GLHelperReadbackSupport::NOT_SUPPORTED; |
| 175 default: | 164 default: |
| 176 NOTREACHED(); | 165 NOTREACHED(); |
| 177 break; | 166 break; |
| 178 } | 167 } |
| 179 | 168 |
| 180 return GLHelperReadbackSupport::NOT_SUPPORTED; | 169 return GLHelperReadbackSupport::NOT_SUPPORTED; |
| 181 } | 170 } |
| 182 | 171 |
| 183 } // namespace content | 172 } // namespace content |
| OLD | NEW |