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 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1417 return true; | 1417 return true; |
1418 case CONTEXT_TYPE_OPENGLES2: | 1418 case CONTEXT_TYPE_OPENGLES2: |
1419 case CONTEXT_TYPE_OPENGLES3: | 1419 case CONTEXT_TYPE_OPENGLES3: |
1420 return false; | 1420 return false; |
1421 } | 1421 } |
1422 | 1422 |
1423 NOTREACHED(); | 1423 NOTREACHED(); |
1424 return false; | 1424 return false; |
1425 } | 1425 } |
1426 | 1426 |
1427 bool FeatureInfo::IsWebGL2OrES3Context() const { | |
1428 // Switch statement to cause a compile-time error if we miss a case. | |
Zhenyao Mo
2016/07/22 14:36:47
Since you add a default, this comment is incorrect
| |
1429 switch (context_type_) { | |
1430 case CONTEXT_TYPE_WEBGL2: | |
1431 case CONTEXT_TYPE_OPENGLES3: | |
1432 return true; | |
1433 case CONTEXT_TYPE_WEBGL1: | |
1434 case CONTEXT_TYPE_OPENGLES2: | |
1435 return false; | |
1436 default: | |
1437 NOTREACHED(); | |
1438 return false; | |
1439 } | |
1440 } | |
1441 | |
1427 void FeatureInfo::AddExtensionString(const char* s) { | 1442 void FeatureInfo::AddExtensionString(const char* s) { |
1428 std::string str(s); | 1443 std::string str(s); |
1429 size_t pos = extensions_.find(str); | 1444 size_t pos = extensions_.find(str); |
1430 while (pos != std::string::npos && | 1445 while (pos != std::string::npos && |
1431 pos + str.length() < extensions_.length() && | 1446 pos + str.length() < extensions_.length() && |
1432 extensions_.substr(pos + str.length(), 1) != " ") { | 1447 extensions_.substr(pos + str.length(), 1) != " ") { |
1433 // This extension name is a substring of another. | 1448 // This extension name is a substring of another. |
1434 pos = extensions_.find(str, pos + str.length()); | 1449 pos = extensions_.find(str, pos + str.length()); |
1435 } | 1450 } |
1436 if (pos == std::string::npos) { | 1451 if (pos == std::string::npos) { |
1437 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1452 extensions_ += (extensions_.empty() ? "" : " ") + str; |
1438 } | 1453 } |
1439 } | 1454 } |
1440 | 1455 |
1441 FeatureInfo::~FeatureInfo() { | 1456 FeatureInfo::~FeatureInfo() { |
1442 } | 1457 } |
1443 | 1458 |
1444 } // namespace gles2 | 1459 } // namespace gles2 |
1445 } // namespace gpu | 1460 } // namespace gpu |
OLD | NEW |