Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(466)

Side by Side Diff: ui/gl/gl_version_info.cc

Issue 2109773003: GLVersionInfo: for ES3 check for sampler array indexing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
83 // Don't try supporting ES3 on ES2, or desktop before 3.2 because there are no 83 // Don't try supporting ES3 on ES2, or desktop before 3.2 because there are no
84 // extension that allow querying for GL_MAX_FRAGMENT_INPUT_COMPONENTS 84 // extension that allow querying for GL_MAX_FRAGMENT_INPUT_COMPONENTS
85 if (is_es || !IsAtLeastGL(3, 2)) { 85 if (is_es || !IsAtLeastGL(3, 2)) {
86 return false; 86 return false;
87 } 87 }
88 88
89 bool has_shader_packing = has_extension("GL_ARB_shading_bit_packing") || 89 bool has_shader_packing = has_extension("GL_ARB_shading_bit_packing") ||
90 has_extension("GL_ARB_shader_bit_encoding"); 90 has_extension("GL_ARB_shader_bit_encoding");
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 // Technically this is required for ES2 as well, but some drivers silently
94 // support it, without the required extensions. To avoid breaking WebGL for
95 // some users, only require detectable support for ES3.
96 bool has_sampler_indexing = IsAtLeastGL(4, 0) || IsAtLeastGLES(2, 0) ||
Zhenyao Mo 2016/06/28 21:43:26 nit: IsAtLeastGLES(2, 0) can be is_es, which is cl
97 has_extension("GL_ARB_gpu_shader5");
93 bool has_samplers = 98 bool has_samplers =
94 IsAtLeastGL(3, 3) || has_extension("GL_ARB_sampler_object"); 99 IsAtLeastGL(3, 3) || has_extension("GL_ARB_sampler_object");
95 bool has_swizzle = IsAtLeastGL(3, 3) || 100 bool has_swizzle = IsAtLeastGL(3, 3) ||
96 has_extension("GL_ARB_texture_swizzle") || 101 has_extension("GL_ARB_texture_swizzle") ||
97 has_extension("GL_EXT_texture_swizzle"); 102 has_extension("GL_EXT_texture_swizzle");
98 bool has_attrib_location = 103 bool has_attrib_location =
99 IsAtLeastGL(3, 3) || has_extension("GL_ARB_explicit_attrib_location"); 104 IsAtLeastGL(3, 3) || has_extension("GL_ARB_explicit_attrib_location");
100 105
101 // TODO(cwallez) check for texture related extensions. See crbug.com/623577 106 // TODO(cwallez) check for texture related extensions. See crbug.com/623577
102 107
103 return has_shader_packing && has_transform_feedback && has_samplers && 108 return has_shader_packing && has_transform_feedback && has_sampler_indexing &&
104 has_swizzle && has_attrib_location; 109 has_samplers && has_swizzle && has_attrib_location;
105 } 110 }
106 111
107 void GLVersionInfo::ParseVersionString(const char* version_str, 112 void GLVersionInfo::ParseVersionString(const char* version_str,
108 unsigned* major_version, 113 unsigned* major_version,
109 unsigned* minor_version, 114 unsigned* minor_version,
110 bool* is_es, 115 bool* is_es,
111 bool* is_es2, 116 bool* is_es2,
112 bool* is_es3) { 117 bool* is_es3) {
113 // Make sure the outputs are always initialized. 118 // Make sure the outputs are always initialized.
114 *major_version = 0; 119 *major_version = 0;
(...skipping 18 matching lines...) Expand all
133 } 138 }
134 } 139 }
135 if (*is_es && *major_version == 2) 140 if (*is_es && *major_version == 2)
136 *is_es2 = true; 141 *is_es2 = true;
137 if (*is_es && *major_version == 3) 142 if (*is_es && *major_version == 3)
138 *is_es3 = true; 143 *is_es3 = true;
139 DCHECK(major_version != 0); 144 DCHECK(major_version != 0);
140 } 145 }
141 146
142 } // namespace gl 147 } // namespace gl
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698