| 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 "ui/gl/gl_version_info.h" | 5 #include "ui/gl/gl_version_info.h" |
| 6 | 6 |
| 7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "base/strings/string_tokenizer.h" | 9 #include "base/strings/string_tokenizer.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 GLVersionInfo::GLVersionInfo(const char* version_str, | 38 GLVersionInfo::GLVersionInfo(const char* version_str, |
| 39 const char* renderer_str, | 39 const char* renderer_str, |
| 40 const std::set<std::string>& extensions) | 40 const std::set<std::string>& extensions) |
| 41 : GLVersionInfo() { | 41 : GLVersionInfo() { |
| 42 Initialize(version_str, renderer_str, extensions); | 42 Initialize(version_str, renderer_str, extensions); |
| 43 } | 43 } |
| 44 | 44 |
| 45 GLVersionInfo::GLVersionInfo() | 45 GLVersionInfo::GLVersionInfo() |
| 46 : is_es(false), | 46 : is_es(false), |
| 47 is_angle(false), | 47 is_angle(false), |
| 48 is_mesa(false), |
| 48 major_version(0), | 49 major_version(0), |
| 49 minor_version(0), | 50 minor_version(0), |
| 50 is_es2(false), | 51 is_es2(false), |
| 51 is_es3(false), | 52 is_es3(false), |
| 52 is_desktop_core_profile(false), | 53 is_desktop_core_profile(false), |
| 53 is_es3_capable(false) {} | 54 is_es3_capable(false) {} |
| 54 | 55 |
| 55 void GLVersionInfo::Initialize(const char* version_str, | 56 void GLVersionInfo::Initialize(const char* version_str, |
| 56 const char* renderer_str, | 57 const char* renderer_str, |
| 57 const std::set<std::string>& extensions) { | 58 const std::set<std::string>& extensions) { |
| 58 if (version_str) { | 59 if (version_str) { |
| 59 ParseVersionString(version_str, &major_version, &minor_version, | 60 ParseVersionString(version_str, &major_version, &minor_version, |
| 60 &is_es, &is_es2, &is_es3); | 61 &is_es, &is_es2, &is_es3); |
| 61 } | 62 } |
| 62 if (renderer_str) { | 63 if (renderer_str) { |
| 63 is_angle = base::StartsWith(renderer_str, "ANGLE", | 64 is_angle = base::StartsWith(renderer_str, "ANGLE", |
| 64 base::CompareCase::SENSITIVE); | 65 base::CompareCase::SENSITIVE); |
| 66 is_mesa = base::StartsWith(renderer_str, "Mesa", |
| 67 base::CompareCase::SENSITIVE); |
| 65 } | 68 } |
| 66 is_desktop_core_profile = | 69 is_desktop_core_profile = |
| 67 DesktopCoreCommonCheck(is_es, major_version, minor_version) && | 70 DesktopCoreCommonCheck(is_es, major_version, minor_version) && |
| 68 extensions.find("GL_ARB_compatibility") == extensions.end(); | 71 extensions.find("GL_ARB_compatibility") == extensions.end(); |
| 69 is_es3_capable = IsES3Capable(extensions); | 72 is_es3_capable = IsES3Capable(extensions); |
| 70 } | 73 } |
| 71 | 74 |
| 72 bool GLVersionInfo::IsES3Capable( | 75 bool GLVersionInfo::IsES3Capable( |
| 73 const std::set<std::string>& extensions) const { | 76 const std::set<std::string>& extensions) const { |
| 74 auto has_extension = [&extensions](std::string extension) -> bool { | 77 auto has_extension = [&extensions](std::string extension) -> bool { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 141 } |
| 139 } | 142 } |
| 140 if (*is_es && *major_version == 2) | 143 if (*is_es && *major_version == 2) |
| 141 *is_es2 = true; | 144 *is_es2 = true; |
| 142 if (*is_es && *major_version == 3) | 145 if (*is_es && *major_version == 3) |
| 143 *is_es3 = true; | 146 *is_es3 = true; |
| 144 DCHECK(major_version != 0); | 147 DCHECK(major_version != 0); |
| 145 } | 148 } |
| 146 | 149 |
| 147 } // namespace gl | 150 } // namespace gl |
| OLD | NEW |