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

Side by Side Diff: gpu/command_buffer/service/feature_info.cc

Issue 2444813002: Remove unsafe mode to enable es3 api by default for WebGL2 and ES3 context (Closed)
Patch Set: remove runtime flag unsafeES3APIs from blink webgl module Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "gpu/command_buffer/service/feature_info.h" 5 #include "gpu/command_buffer/service/feature_info.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 void FeatureInfo::InitializeBasicState(const base::CommandLine* command_line) { 192 void FeatureInfo::InitializeBasicState(const base::CommandLine* command_line) {
193 if (!command_line) 193 if (!command_line)
194 return; 194 return;
195 195
196 feature_flags_.enable_shader_name_hashing = 196 feature_flags_.enable_shader_name_hashing =
197 !command_line->HasSwitch(switches::kDisableShaderNameHashing); 197 !command_line->HasSwitch(switches::kDisableShaderNameHashing);
198 198
199 feature_flags_.is_swiftshader = 199 feature_flags_.is_swiftshader =
200 (command_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader"); 200 (command_line->GetSwitchValueASCII(switches::kUseGL) == "swiftshader");
201 201
202 enable_unsafe_es3_apis_switch_ = 202 enable_es3_apis_switch_ = true;
203 command_line->HasSwitch(switches::kEnableUnsafeES3APIs); 203
204 // enable_unsafe_es3_apis_switch_ =
205 // command_line->HasSwitch(switches::kEnableUnsafeES3APIs);
204 206
205 // The shader translator is needed to translate from WebGL-conformant GLES SL 207 // The shader translator is needed to translate from WebGL-conformant GLES SL
206 // to normal GLES SL, enforce WebGL conformance, translate from GLES SL 1.0 to 208 // to normal GLES SL, enforce WebGL conformance, translate from GLES SL 1.0 to
207 // target context GLSL, implement emulation of OpenGL ES features on OpenGL, 209 // target context GLSL, implement emulation of OpenGL ES features on OpenGL,
208 // etc. 210 // etc.
209 // The flag here is for testing only. 211 // The flag here is for testing only.
210 disable_shader_translator_ = 212 disable_shader_translator_ =
211 command_line->HasSwitch(switches::kDisableGLSLTranslator); 213 command_line->HasSwitch(switches::kDisableGLSLTranslator);
212 214
213 unsafe_es3_apis_enabled_ = false; 215 es3_apis_enabled_ = false;
214 216
215 // Default context_type_ to a GLES2 Context. 217 // Default context_type_ to a GLES2 Context.
216 context_type_ = CONTEXT_TYPE_OPENGLES2; 218 context_type_ = CONTEXT_TYPE_OPENGLES2;
217 219
218 chromium_color_buffer_float_rgba_available_ = false; 220 chromium_color_buffer_float_rgba_available_ = false;
219 chromium_color_buffer_float_rgb_available_ = false; 221 chromium_color_buffer_float_rgb_available_ = false;
220 ext_color_buffer_float_available_ = false; 222 ext_color_buffer_float_available_ = false;
221 oes_texture_float_linear_available_ = false; 223 oes_texture_float_linear_available_ = false;
222 oes_texture_half_float_linear_available_ = false; 224 oes_texture_half_float_linear_available_ = false;
223 } 225 }
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1397 1399
1398 if (gl_version_info_->IsLowerThanGL(4, 3)) { 1400 if (gl_version_info_->IsLowerThanGL(4, 3)) {
1399 // crbug.com/481184. 1401 // crbug.com/481184.
1400 // GL_PRIMITIVE_RESTART_FIXED_INDEX is only available on Desktop GL 4.3+, 1402 // GL_PRIMITIVE_RESTART_FIXED_INDEX is only available on Desktop GL 4.3+,
1401 // but we emulate ES 3.0 on top of Desktop GL 4.2+. 1403 // but we emulate ES 3.0 on top of Desktop GL 4.2+.
1402 feature_flags_.emulate_primitive_restart_fixed_index = true; 1404 feature_flags_.emulate_primitive_restart_fixed_index = true;
1403 } 1405 }
1404 } 1406 }
1405 1407
1406 bool FeatureInfo::IsES3Capable() const { 1408 bool FeatureInfo::IsES3Capable() const {
1407 if (!enable_unsafe_es3_apis_switch_) 1409 // if (!enable_unsafe_es3_apis_switch_)
1410 // return false;
1411 if (!enable_es3_apis_switch_)
1408 return false; 1412 return false;
1413 if (context_type_ != CONTEXT_TYPE_WEBGL2 &&
1414 context_type_ != CONTEXT_TYPE_OPENGLES3)
1415 return false;
1416
1409 if (workarounds_.disable_texture_storage) 1417 if (workarounds_.disable_texture_storage)
1410 return false; 1418 return false;
1411 if (gl_version_info_) 1419 if (gl_version_info_)
1412 return gl_version_info_->is_es3_capable; 1420 return gl_version_info_->is_es3_capable;
1413 return false; 1421 return false;
1414 } 1422 }
1415 1423
1416 void FeatureInfo::EnableES3Validators() { 1424 void FeatureInfo::EnableES3Validators() {
1417 DCHECK(IsES3Capable()); 1425 DCHECK(IsES3Capable());
1418 validators_.UpdateValuesES3(); 1426 validators_.UpdateValuesES3();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1470 GL_DRAW_BUFFER13, 1478 GL_DRAW_BUFFER13,
1471 GL_DRAW_BUFFER14, 1479 GL_DRAW_BUFFER14,
1472 GL_DRAW_BUFFER15, 1480 GL_DRAW_BUFFER15,
1473 }; 1481 };
1474 if (max_draw_buffers < kTotalDrawBufferEnums) { 1482 if (max_draw_buffers < kTotalDrawBufferEnums) {
1475 validators_.g_l_state.RemoveValues( 1483 validators_.g_l_state.RemoveValues(
1476 kDrawBuffers + max_draw_buffers, 1484 kDrawBuffers + max_draw_buffers,
1477 kTotalDrawBufferEnums - max_draw_buffers); 1485 kTotalDrawBufferEnums - max_draw_buffers);
1478 } 1486 }
1479 1487
1480 unsafe_es3_apis_enabled_ = true; 1488 es3_apis_enabled_ = true;
1481 } 1489 }
1482 1490
1483 bool FeatureInfo::IsWebGLContext() const { 1491 bool FeatureInfo::IsWebGLContext() const {
1484 // Switch statement to cause a compile-time error if we miss a case. 1492 // Switch statement to cause a compile-time error if we miss a case.
1485 switch (context_type_) { 1493 switch (context_type_) {
1486 case CONTEXT_TYPE_WEBGL1: 1494 case CONTEXT_TYPE_WEBGL1:
1487 case CONTEXT_TYPE_WEBGL2: 1495 case CONTEXT_TYPE_WEBGL2:
1488 return true; 1496 return true;
1489 case CONTEXT_TYPE_OPENGLES2: 1497 case CONTEXT_TYPE_OPENGLES2:
1490 case CONTEXT_TYPE_OPENGLES3: 1498 case CONTEXT_TYPE_OPENGLES3:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 if (pos == std::string::npos) { 1545 if (pos == std::string::npos) {
1538 extensions_ += (extensions_.empty() ? "" : " ") + str; 1546 extensions_ += (extensions_.empty() ? "" : " ") + str;
1539 } 1547 }
1540 } 1548 }
1541 1549
1542 FeatureInfo::~FeatureInfo() { 1550 FeatureInfo::~FeatureInfo() {
1543 } 1551 }
1544 1552
1545 } // namespace gles2 1553 } // namespace gles2
1546 } // namespace gpu 1554 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698