OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ
ONE) | |
6 #include <EGL/egl.h> | |
7 #endif | |
8 | |
9 #include "ui/gl/gl_bindings.h" | |
10 | |
11 #if defined(USE_X11) | |
12 #include "ui/gfx/x/x11_types.h" | |
13 #endif | |
14 | |
15 #if defined(OS_WIN) | |
16 #include "ui/gl/gl_surface_wgl.h" | |
17 #endif | |
18 | |
19 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ
ONE) | |
20 #include "ui/gl/gl_surface_egl.h" | |
21 #endif | |
22 | |
23 namespace gfx { | |
24 | |
25 std::string DriverOSMESA::GetPlatformExtensions() { | |
26 return ""; | |
27 } | |
28 | |
29 #if defined(OS_WIN) | |
30 std::string DriverWGL::GetPlatformExtensions() { | |
31 const char* str = nullptr; | |
32 if (g_driver_wgl.fn.wglGetExtensionsStringARBFn) { | |
33 str = g_driver_wgl.fn.wglGetExtensionsStringARBFn( | |
34 GLSurfaceWGL::GetDisplayDC()); | |
35 } else if (g_driver_wgl.fn.wglGetExtensionsStringEXTFn) { | |
36 str = g_driver_wgl.fn.wglGetExtensionsStringEXTFn(); | |
37 } | |
38 return str ? std::string(str) : ""; | |
39 } | |
40 #endif | |
41 | |
42 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ
ONE) | |
43 std::string DriverEGL::GetPlatformExtensions() { | |
44 EGLDisplay display = | |
45 #if defined(OS_WIN) | |
46 GLSurfaceEGL::GetPlatformDisplay(GetPlatformDefaultEGLNativeDisplay()); | |
47 #else | |
48 g_driver_egl.fn.eglGetDisplayFn(GetPlatformDefaultEGLNativeDisplay()); | |
49 #endif | |
50 | |
51 DCHECK(g_driver_egl.fn.eglInitializeFn); | |
52 g_driver_egl.fn.eglInitializeFn(display, NULL, NULL); | |
53 DCHECK(g_driver_egl.fn.eglQueryStringFn); | |
54 const char* str = g_driver_egl.fn.eglQueryStringFn(display, EGL_EXTENSIONS); | |
55 return str ? std::string(str) : ""; | |
56 } | |
57 #endif | |
58 | |
59 #if defined(USE_X11) | |
60 std::string DriverGLX::GetPlatformExtensions() { | |
61 DCHECK(g_driver_glx.fn.glXQueryExtensionsStringFn); | |
62 const char* str = | |
63 g_driver_glx.fn.glXQueryExtensionsStringFn(gfx::GetXDisplay(), 0); | |
64 return str ? std::string(str) : ""; | |
65 } | |
66 #endif | |
67 | |
68 } // namespace gfx | |
OLD | NEW |