| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return true; | 83 return true; |
| 84 } | 84 } |
| 85 | 85 |
| 86 // Don't try supporting ES3 on ES2, or desktop before 3.3. | 86 // Don't try supporting ES3 on ES2, or desktop before 3.3. |
| 87 if (is_es || !IsAtLeastGL(3, 3)) { | 87 if (is_es || !IsAtLeastGL(3, 3)) { |
| 88 return false; | 88 return false; |
| 89 } | 89 } |
| 90 | 90 |
| 91 bool has_transform_feedback = | 91 bool has_transform_feedback = |
| 92 (IsAtLeastGL(4, 0) || has_extension("GL_ARB_transform_feedback2")); | 92 (IsAtLeastGL(4, 0) || has_extension("GL_ARB_transform_feedback2")); |
| 93 bool has_sampler_indexing = | 93 |
| 94 (IsAtLeastGL(4, 0) || has_extension("GL_ARB_gpu_shader5")); | 94 // This code used to require the GL_ARB_gpu_shader5 extension in order to |
| 95 // have support for dynamic indexing of sampler arrays, which was |
| 96 // optionally supported in ESSL 1.00. However, since this is expressly |
| 97 // forbidden in ESSL 3.00, and some desktop drivers (specifically |
| 98 // Mesa/Gallium on AMD GPUs) don't support it, we no longer require it. |
| 99 |
| 95 // tex storage is available in core spec since GL 4.2. | 100 // tex storage is available in core spec since GL 4.2. |
| 96 bool has_tex_storage = has_extension("GL_ARB_texture_storage"); | 101 bool has_tex_storage = has_extension("GL_ARB_texture_storage"); |
| 97 | 102 |
| 98 // TODO(cwallez) check for texture related extensions. See crbug.com/623577 | 103 // TODO(cwallez) check for texture related extensions. See crbug.com/623577 |
| 99 | 104 |
| 100 return (has_transform_feedback && | 105 return (has_transform_feedback && has_tex_storage); |
| 101 has_sampler_indexing && | |
| 102 has_tex_storage); | |
| 103 } | 106 } |
| 104 | 107 |
| 105 void GLVersionInfo::ParseVersionString(const char* version_str, | 108 void GLVersionInfo::ParseVersionString(const char* version_str, |
| 106 unsigned* major_version, | 109 unsigned* major_version, |
| 107 unsigned* minor_version, | 110 unsigned* minor_version, |
| 108 bool* is_es, | 111 bool* is_es, |
| 109 bool* is_es2, | 112 bool* is_es2, |
| 110 bool* is_es3) { | 113 bool* is_es3) { |
| 111 // Make sure the outputs are always initialized. | 114 // Make sure the outputs are always initialized. |
| 112 *major_version = 0; | 115 *major_version = 0; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 131 } | 134 } |
| 132 } | 135 } |
| 133 if (*is_es && *major_version == 2) | 136 if (*is_es && *major_version == 2) |
| 134 *is_es2 = true; | 137 *is_es2 = true; |
| 135 if (*is_es && *major_version == 3) | 138 if (*is_es && *major_version == 3) |
| 136 *is_es3 = true; | 139 *is_es3 = true; |
| 137 DCHECK(major_version != 0); | 140 DCHECK(major_version != 0); |
| 138 } | 141 } |
| 139 | 142 |
| 140 } // namespace gl | 143 } // namespace gl |
| OLD | NEW |