| 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 1478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1489 validators_.texture_parameter.AddValue(GL_TEXTURE_SWIZZLE_B); | 1489 validators_.texture_parameter.AddValue(GL_TEXTURE_SWIZZLE_B); |
| 1490 validators_.texture_parameter.AddValue(GL_TEXTURE_SWIZZLE_A); | 1490 validators_.texture_parameter.AddValue(GL_TEXTURE_SWIZZLE_A); |
| 1491 } | 1491 } |
| 1492 } | 1492 } |
| 1493 | 1493 |
| 1494 bool FeatureInfo::IsWebGLContext() const { | 1494 bool FeatureInfo::IsWebGLContext() const { |
| 1495 return IsWebGLContextType(context_type_); | 1495 return IsWebGLContextType(context_type_); |
| 1496 } | 1496 } |
| 1497 | 1497 |
| 1498 bool FeatureInfo::IsWebGL1OrES2Context() const { | 1498 bool FeatureInfo::IsWebGL1OrES2Context() const { |
| 1499 // Switch statement to cause a compile-time error if we miss a case. | 1499 return IsWebGL1OrES2ContextType(context_type_); |
| 1500 switch (context_type_) { | |
| 1501 case CONTEXT_TYPE_WEBGL1: | |
| 1502 case CONTEXT_TYPE_OPENGLES2: | |
| 1503 return true; | |
| 1504 case CONTEXT_TYPE_WEBGL2: | |
| 1505 case CONTEXT_TYPE_OPENGLES3: | |
| 1506 return false; | |
| 1507 } | |
| 1508 | |
| 1509 NOTREACHED(); | |
| 1510 return false; | |
| 1511 } | 1500 } |
| 1512 | 1501 |
| 1513 bool FeatureInfo::IsWebGL2OrES3Context() const { | 1502 bool FeatureInfo::IsWebGL2OrES3Context() const { |
| 1514 // Switch statement to cause a compile-time error if we miss a case. | 1503 return IsWebGL2OrES3ContextType(context_type_); |
| 1515 switch (context_type_) { | |
| 1516 case CONTEXT_TYPE_WEBGL2: | |
| 1517 case CONTEXT_TYPE_OPENGLES3: | |
| 1518 return true; | |
| 1519 case CONTEXT_TYPE_WEBGL1: | |
| 1520 case CONTEXT_TYPE_OPENGLES2: | |
| 1521 return false; | |
| 1522 } | |
| 1523 | |
| 1524 NOTREACHED(); | |
| 1525 return false; | |
| 1526 } | 1504 } |
| 1527 | 1505 |
| 1528 void FeatureInfo::AddExtensionString(const char* s) { | 1506 void FeatureInfo::AddExtensionString(const char* s) { |
| 1529 std::string str(s); | 1507 std::string str(s); |
| 1530 size_t pos = extensions_.find(str); | 1508 size_t pos = extensions_.find(str); |
| 1531 while (pos != std::string::npos && | 1509 while (pos != std::string::npos && |
| 1532 pos + str.length() < extensions_.length() && | 1510 pos + str.length() < extensions_.length() && |
| 1533 extensions_.substr(pos + str.length(), 1) != " ") { | 1511 extensions_.substr(pos + str.length(), 1) != " ") { |
| 1534 // This extension name is a substring of another. | 1512 // This extension name is a substring of another. |
| 1535 pos = extensions_.find(str, pos + str.length()); | 1513 pos = extensions_.find(str, pos + str.length()); |
| 1536 } | 1514 } |
| 1537 if (pos == std::string::npos) { | 1515 if (pos == std::string::npos) { |
| 1538 extensions_ += (extensions_.empty() ? "" : " ") + str; | 1516 extensions_ += (extensions_.empty() ? "" : " ") + str; |
| 1539 } | 1517 } |
| 1540 } | 1518 } |
| 1541 | 1519 |
| 1542 FeatureInfo::~FeatureInfo() { | 1520 FeatureInfo::~FeatureInfo() { |
| 1543 } | 1521 } |
| 1544 | 1522 |
| 1545 } // namespace gles2 | 1523 } // namespace gles2 |
| 1546 } // namespace gpu | 1524 } // namespace gpu |
| OLD | NEW |