mac: Disable Address Book integration.
[chromium-blink-merge.git] / ui / gl / gl_version_info.h
blob593ed15c24a468a49132cae3e0a196bec6f44987
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
3 // found in the LICENSE file.
5 #ifndef UI_GL_GL_VERSION_INFO_H_
6 #define UI_GL_GL_VERSION_INFO_H_
8 #include <set>
9 #include <string>
10 #include "base/basictypes.h"
11 #include "ui/gl/gl_export.h"
13 namespace gfx {
15 struct GL_EXPORT GLVersionInfo {
16 GLVersionInfo(const char* version_str, const char* renderer_str,
17 const char* extensions_str);
19 GLVersionInfo(const char* version_str, const char* renderer_str,
20 const std::set<std::string>& exts);
22 bool IsAtLeastGL(unsigned major, unsigned minor) const {
23 return !is_es && (major_version > major ||
24 (major_version == major && minor_version >= minor));
27 bool IsLowerThanGL(unsigned major, unsigned minor) const {
28 return !is_es && (major_version < major ||
29 (major_version == major && minor_version < minor));
32 bool IsAtLeastGLES(unsigned major, unsigned minor) const {
33 return is_es && (major_version > major ||
34 (major_version == major && minor_version >= minor));
37 bool BehavesLikeGLES() const {
38 return is_es || is_desktop_core_profile;
41 bool IsES3Capable() const {
42 if (IsAtLeastGLES(3, 0) || IsAtLeastGL(4, 2))
43 return true;
44 #if defined(OS_MACOSX)
45 // TODO(zmo): For experimentation purpose on MacOSX with core profile,
46 // allow 3.2 or plus for now.
47 if (IsAtLeastGL(3, 2))
48 return true;
49 #endif
50 return false;
53 static void ParseVersionString(const char* version_str,
54 unsigned* major_version,
55 unsigned* minor_version,
56 bool* is_es,
57 bool* is_es3);
59 bool is_es;
60 bool is_angle;
61 unsigned major_version;
62 unsigned minor_version;
63 bool is_es3;
64 bool is_desktop_core_profile;
66 private:
67 GLVersionInfo(const char* version_str, const char* renderer_str);
69 DISALLOW_COPY_AND_ASSIGN(GLVersionInfo);
72 } // namespace gfx
74 #endif // UI_GL_GL_VERSION_INFO_H_