[Android] Implement 3-way sensor fallback for Device Orientation.
[chromium-blink-merge.git] / ui / gl / gl_bindings.cc
blob0a1fd193bb80377d17e92fa805a661b4d27185cb
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 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZONE)
6 #include <EGL/egl.h>
7 #endif
9 #include "ui/gl/gl_bindings.h"
11 #if defined(USE_X11)
12 #include "ui/gfx/x/x11_types.h"
13 #endif
15 #if defined(OS_WIN)
16 #include "ui/gl/gl_surface_wgl.h"
17 #endif
19 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZONE)
20 #include "ui/gl/gl_surface_egl.h"
21 #endif
23 namespace gfx {
25 std::string DriverOSMESA::GetPlatformExtensions() {
26 return "";
29 #if defined(OS_WIN)
30 std::string DriverWGL::GetPlatformExtensions() {
31 const char* str = nullptr;
32 str = wglGetExtensionsStringARB(GLSurfaceWGL::GetDisplayDC());
33 if (str)
34 return str;
35 return wglGetExtensionsStringEXT();
37 #endif
39 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZONE)
40 std::string DriverEGL::GetPlatformExtensions() {
41 EGLDisplay display = GLSurfaceEGL::InitializeDisplay();
42 if (display == EGL_NO_DISPLAY)
43 return "";
44 const char* str = eglQueryString(display, EGL_EXTENSIONS);
45 return str ? std::string(str) : "";
48 // static
49 std::string DriverEGL::GetClientExtensions() {
50 const char* str = eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
51 return str ? std::string(str) : "";
53 #endif
55 #if defined(USE_X11)
56 std::string DriverGLX::GetPlatformExtensions() {
57 const char* str = glXQueryExtensionsString(gfx::GetXDisplay(), 0);
58 return str ? std::string(str) : "";
60 #endif
62 } // namespace gfx