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 "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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 const std::set<std::string>& extensions) const { | 76 const std::set<std::string>& extensions) const { |
| 77 auto has_extension = [&extensions](std::string extension) -> bool { | 77 auto has_extension = [&extensions](std::string extension) -> bool { |
| 78 return extensions.find(extension) != extensions.end(); | 78 return extensions.find(extension) != extensions.end(); |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // Version ES3 capable without extensions needed. | 81 // Version ES3 capable without extensions needed. |
| 82 if (IsAtLeastGLES(3, 0) || IsAtLeastGL(4, 2)) { | 82 if (IsAtLeastGLES(3, 0) || IsAtLeastGL(4, 2)) { |
| 83 return true; | 83 return true; |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Don't try supporting ES3 on ES2, or desktop before 4.0. | 86 // Don't try supporting ES3 on ES2, or desktop before 3.3. |
| 87 if (is_es || !IsAtLeastGL(4, 0)) { | 87 if (is_es || !IsAtLeastGL(3, 3)) { |
| 88 return false; | 88 return false; |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool has_tex_storage = has_extension("GL_ARB_texture_storage"); | 91 bool has_transform_feedback = |
| 92 return has_tex_storage; | 92 (IsAtLeastGL(4, 0) || has_extension("GL_ARB_transform_feedback2")); |
| 93 bool has_sampler_indexing = | |
| 94 (IsAtLeastGL(4, 0) || has_extension("GL_ARB_gpu_shader5")); | |
| 95 bool has_tex_storage = | |
| 96 (IsAtLeastGL(4, 2) || has_extension("GL_ARB_texture_storage")); | |
|
piman
2016/10/28 20:01:21
nit: you can skip IsAtLeastGL(4, 2), since it's al
Zhenyao Mo
2016/10/28 23:22:12
Done.
| |
| 97 | |
| 98 // TODO(cwallez) check for texture related extensions. See crbug.com/623577 | |
| 99 | |
| 100 return (has_transform_feedback && | |
| 101 has_sampler_indexing && | |
| 102 has_tex_storage); | |
| 93 } | 103 } |
| 94 | 104 |
| 95 void GLVersionInfo::ParseVersionString(const char* version_str, | 105 void GLVersionInfo::ParseVersionString(const char* version_str, |
| 96 unsigned* major_version, | 106 unsigned* major_version, |
| 97 unsigned* minor_version, | 107 unsigned* minor_version, |
| 98 bool* is_es, | 108 bool* is_es, |
| 99 bool* is_es2, | 109 bool* is_es2, |
| 100 bool* is_es3) { | 110 bool* is_es3) { |
| 101 // Make sure the outputs are always initialized. | 111 // Make sure the outputs are always initialized. |
| 102 *major_version = 0; | 112 *major_version = 0; |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 121 } | 131 } |
| 122 } | 132 } |
| 123 if (*is_es && *major_version == 2) | 133 if (*is_es && *major_version == 2) |
| 124 *is_es2 = true; | 134 *is_es2 = true; |
| 125 if (*is_es && *major_version == 3) | 135 if (*is_es && *major_version == 3) |
| 126 *is_es3 = true; | 136 *is_es3 = true; |
| 127 DCHECK(major_version != 0); | 137 DCHECK(major_version != 0); |
| 128 } | 138 } |
| 129 | 139 |
| 130 } // namespace gl | 140 } // namespace gl |
| OLD | NEW |