| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef UI_GL_GL_VERSION_INFO_H_ | 5 #ifndef UI_GL_GL_VERSION_INFO_H_ |
| 6 #define UI_GL_GL_VERSION_INFO_H_ | 6 #define UI_GL_GL_VERSION_INFO_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 bool IsAtLeastGLES(unsigned major, unsigned minor) const { | 33 bool IsAtLeastGLES(unsigned major, unsigned minor) const { |
| 34 return is_es && (major_version > major || | 34 return is_es && (major_version > major || |
| 35 (major_version == major && minor_version >= minor)); | 35 (major_version == major && minor_version >= minor)); |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool BehavesLikeGLES() const { | 38 bool BehavesLikeGLES() const { |
| 39 return is_es || is_desktop_core_profile; | 39 return is_es || is_desktop_core_profile; |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool IsES3Capable() const { | |
| 43 if (IsAtLeastGLES(3, 0) || IsAtLeastGL(4, 2)) | |
| 44 return true; | |
| 45 #if defined(OS_MACOSX) | |
| 46 // TODO(zmo): For experimentation purpose on MacOSX with core profile, | |
| 47 // allow 3.2 or plus for now. | |
| 48 if (IsAtLeastGL(3, 2)) | |
| 49 return true; | |
| 50 #endif | |
| 51 return false; | |
| 52 } | |
| 53 | |
| 54 static void ParseVersionString(const char* version_str, | 42 static void ParseVersionString(const char* version_str, |
| 55 unsigned* major_version, | 43 unsigned* major_version, |
| 56 unsigned* minor_version, | 44 unsigned* minor_version, |
| 57 bool* is_es, | 45 bool* is_es, |
| 58 bool* is_es2, | 46 bool* is_es2, |
| 59 bool* is_es3); | 47 bool* is_es3); |
| 60 | 48 |
| 61 bool is_es; | 49 bool is_es; |
| 62 bool is_angle; | 50 bool is_angle; |
| 63 unsigned major_version; | 51 unsigned major_version; |
| 64 unsigned minor_version; | 52 unsigned minor_version; |
| 65 bool is_es2; | 53 bool is_es2; |
| 66 bool is_es3; | 54 bool is_es3; |
| 67 bool is_desktop_core_profile; | 55 bool is_desktop_core_profile; |
| 56 bool is_es3_capable; |
| 68 | 57 |
| 69 private: | 58 private: |
| 70 GLVersionInfo(const char* version_str, const char* renderer_str); | 59 GLVersionInfo(); |
| 60 void Initialize(const char* version_str, |
| 61 const char* renderer_str, |
| 62 const std::set<std::string>& extensions); |
| 63 bool IsES3Capable(const std::set<std::string>& extensions) const; |
| 71 | 64 |
| 72 DISALLOW_COPY_AND_ASSIGN(GLVersionInfo); | 65 DISALLOW_COPY_AND_ASSIGN(GLVersionInfo); |
| 73 }; | 66 }; |
| 74 | 67 |
| 75 } // namespace gl | 68 } // namespace gl |
| 76 | 69 |
| 77 #endif // UI_GL_GL_VERSION_INFO_H_ | 70 #endif // UI_GL_GL_VERSION_INFO_H_ |
| OLD | NEW |