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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1045 } | 1045 } |
1046 } | 1046 } |
1047 | 1047 |
1048 #if !defined(OS_MACOSX) | 1048 #if !defined(OS_MACOSX) |
1049 if (workarounds_.ignore_egl_sync_failures) { | 1049 if (workarounds_.ignore_egl_sync_failures) { |
1050 gfx::GLFenceEGL::SetIgnoreFailures(); | 1050 gfx::GLFenceEGL::SetIgnoreFailures(); |
1051 } | 1051 } |
1052 #endif | 1052 #endif |
1053 } | 1053 } |
1054 | 1054 |
| 1055 bool FeatureInfo::IsES3Capable() const { |
| 1056 if (gl_version_info_->IsAtLeastGLES(3, 0)) |
| 1057 return true; |
| 1058 // TODO(zmo): For Desktop GL, with anything lower than 4.2, we need to check |
| 1059 // the existence of a few extensions to have full WebGL 2 capabilities. |
| 1060 if (gl_version_info_->IsAtLeastGL(4, 2)) |
| 1061 return true; |
| 1062 #if defined(OS_MACOSX) |
| 1063 // TODO(zmo): For experimentation purpose on MacOSX with core profile, |
| 1064 // allow 3.2 or plus for now. |
| 1065 if (gl_version_info_->IsAtLeastGL(3, 2)) |
| 1066 return true; |
| 1067 #endif |
| 1068 return false; |
| 1069 } |
| 1070 |
| 1071 void FeatureInfo::EnableES3Validators() { |
| 1072 DCHECK(IsES3Capable()); |
| 1073 validators_.AddES3Values(); |
| 1074 } |
| 1075 |
1055 void FeatureInfo::AddExtensionString(const char* s) { | 1076 void FeatureInfo::AddExtensionString(const char* s) { |
1056 std::string str(s); | 1077 std::string str(s); |
1057 size_t pos = extensions_.find(str); | 1078 size_t pos = extensions_.find(str); |
1058 while (pos != std::string::npos && | 1079 while (pos != std::string::npos && |
1059 pos + str.length() < extensions_.length() && | 1080 pos + str.length() < extensions_.length() && |
1060 extensions_.substr(pos + str.length(), 1) != " ") { | 1081 extensions_.substr(pos + str.length(), 1) != " ") { |
1061 // This extension name is a substring of another. | 1082 // This extension name is a substring of another. |
1062 pos = extensions_.find(str, pos + str.length()); | 1083 pos = extensions_.find(str, pos + str.length()); |
1063 } | 1084 } |
1064 if (pos == std::string::npos) { | 1085 if (pos == std::string::npos) { |
1065 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1086 extensions_ += (extensions_.empty() ? "" : " ") + str; |
1066 } | 1087 } |
1067 } | 1088 } |
1068 | 1089 |
1069 FeatureInfo::~FeatureInfo() { | 1090 FeatureInfo::~FeatureInfo() { |
1070 } | 1091 } |
1071 | 1092 |
1072 } // namespace gles2 | 1093 } // namespace gles2 |
1073 } // namespace gpu | 1094 } // namespace gpu |
OLD | NEW |