| OLD | NEW |
| 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 Loading... |
| 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); | |
| 204 | 203 |
| 205 // The shader translator is needed to translate from WebGL-conformant GLES SL | 204 // 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 | 205 // 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, | 206 // target context GLSL, implement emulation of OpenGL ES features on OpenGL, |
| 208 // etc. | 207 // etc. |
| 209 // The flag here is for testing only. | 208 // The flag here is for testing only. |
| 210 disable_shader_translator_ = | 209 disable_shader_translator_ = |
| 211 command_line->HasSwitch(switches::kDisableGLSLTranslator); | 210 command_line->HasSwitch(switches::kDisableGLSLTranslator); |
| 212 | 211 |
| 213 unsafe_es3_apis_enabled_ = false; | 212 es3_apis_enabled_ = false; |
| 214 | 213 |
| 215 // Default context_type_ to a GLES2 Context. | 214 // Default context_type_ to a GLES2 Context. |
| 216 context_type_ = CONTEXT_TYPE_OPENGLES2; | 215 context_type_ = CONTEXT_TYPE_OPENGLES2; // ?? |
| 217 | 216 |
| 218 ext_color_buffer_float_available_ = false; | 217 ext_color_buffer_float_available_ = false; |
| 219 oes_texture_float_linear_available_ = false; | 218 oes_texture_float_linear_available_ = false; |
| 220 oes_texture_half_float_linear_available_ = false; | 219 oes_texture_half_float_linear_available_ = false; |
| 221 } | 220 } |
| 222 | 221 |
| 223 bool FeatureInfo::Initialize(ContextType context_type, | 222 bool FeatureInfo::Initialize(ContextType context_type, |
| 224 const DisallowedFeatures& disallowed_features) { | 223 const DisallowedFeatures& disallowed_features) { |
| 225 disallowed_features_ = disallowed_features; | 224 disallowed_features_ = disallowed_features; |
| 226 context_type_ = context_type; | 225 context_type_ = context_type; |
| (...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1403 // 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+, |
| 1404 // 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+. |
| 1405 feature_flags_.emulate_primitive_restart_fixed_index = true; | 1404 feature_flags_.emulate_primitive_restart_fixed_index = true; |
| 1406 } | 1405 } |
| 1407 | 1406 |
| 1408 feature_flags_.angle_robust_client_memory = | 1407 feature_flags_.angle_robust_client_memory = |
| 1409 extensions.Contains("GL_ANGLE_robust_client_memory"); | 1408 extensions.Contains("GL_ANGLE_robust_client_memory"); |
| 1410 } | 1409 } |
| 1411 | 1410 |
| 1412 bool FeatureInfo::IsES3Capable() const { | 1411 bool FeatureInfo::IsES3Capable() const { |
| 1413 if (!enable_unsafe_es3_apis_switch_) | 1412 if (!enable_es3_apis_switch_) |
| 1413 return false; |
| 1414 if (context_type_ != CONTEXT_TYPE_WEBGL2 && |
| 1415 context_type_ != CONTEXT_TYPE_OPENGLES3) |
| 1414 return false; | 1416 return false; |
| 1415 if (workarounds_.disable_texture_storage) | 1417 if (workarounds_.disable_texture_storage) |
| 1416 return false; | 1418 return false; |
| 1417 if (gl_version_info_) | 1419 if (gl_version_info_) |
| 1418 return gl_version_info_->is_es3_capable; | 1420 return gl_version_info_->is_es3_capable; |
| 1419 return false; | 1421 return false; |
| 1420 } | 1422 } |
| 1421 | 1423 |
| 1422 void FeatureInfo::EnableES3Validators() { | 1424 void FeatureInfo::EnableES3Validators() { |
| 1423 DCHECK(IsES3Capable()); | 1425 DCHECK(IsES3Capable()); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 } | 1486 } |
| 1485 | 1487 |
| 1486 if (feature_flags_.ext_texture_format_bgra8888) { | 1488 if (feature_flags_.ext_texture_format_bgra8888) { |
| 1487 validators_.texture_internal_format.AddValue(GL_BGRA8_EXT); | 1489 validators_.texture_internal_format.AddValue(GL_BGRA8_EXT); |
| 1488 validators_.texture_sized_color_renderable_internal_format.AddValue( | 1490 validators_.texture_sized_color_renderable_internal_format.AddValue( |
| 1489 GL_BGRA8_EXT); | 1491 GL_BGRA8_EXT); |
| 1490 validators_.texture_sized_texture_filterable_internal_format.AddValue( | 1492 validators_.texture_sized_texture_filterable_internal_format.AddValue( |
| 1491 GL_BGRA8_EXT); | 1493 GL_BGRA8_EXT); |
| 1492 } | 1494 } |
| 1493 | 1495 |
| 1494 unsafe_es3_apis_enabled_ = true; | 1496 es3_apis_enabled_ = true; |
| 1495 } | 1497 } |
| 1496 | 1498 |
| 1497 bool FeatureInfo::IsWebGLContext() const { | 1499 bool FeatureInfo::IsWebGLContext() const { |
| 1498 // Switch statement to cause a compile-time error if we miss a case. | 1500 // Switch statement to cause a compile-time error if we miss a case. |
| 1499 switch (context_type_) { | 1501 switch (context_type_) { |
| 1500 case CONTEXT_TYPE_WEBGL1: | 1502 case CONTEXT_TYPE_WEBGL1: |
| 1501 case CONTEXT_TYPE_WEBGL2: | 1503 case CONTEXT_TYPE_WEBGL2: |
| 1502 return true; | 1504 return true; |
| 1503 case CONTEXT_TYPE_OPENGLES2: | 1505 case CONTEXT_TYPE_OPENGLES2: |
| 1504 case CONTEXT_TYPE_OPENGLES3: | 1506 case CONTEXT_TYPE_OPENGLES3: |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 if (pos == std::string::npos) { | 1553 if (pos == std::string::npos) { |
| 1552 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1554 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 1553 } | 1555 } |
| 1554 } | 1556 } |
| 1555 | 1557 |
| 1556 FeatureInfo::~FeatureInfo() { | 1558 FeatureInfo::~FeatureInfo() { |
| 1557 } | 1559 } |
| 1558 | 1560 |
| 1559 } // namespace gles2 | 1561 } // namespace gles2 |
| 1560 } // namespace gpu | 1562 } // namespace gpu |
| OLD | NEW |