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 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ ONE) | 5 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ ONE) |
6 #include <EGL/egl.h> | 6 #include <EGL/egl.h> |
7 #endif | 7 #endif |
8 | 8 |
9 #include "ui/gl/gl_bindings.h" | 9 #include "ui/gl/gl_bindings.h" |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... | |
36 str = g_driver_wgl.fn.wglGetExtensionsStringEXTFn(); | 36 str = g_driver_wgl.fn.wglGetExtensionsStringEXTFn(); |
37 } | 37 } |
38 return str ? std::string(str) : ""; | 38 return str ? std::string(str) : ""; |
39 } | 39 } |
40 #endif | 40 #endif |
41 | 41 |
42 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ ONE) | 42 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ ONE) |
43 std::string DriverEGL::GetPlatformExtensions() { | 43 std::string DriverEGL::GetPlatformExtensions() { |
44 EGLDisplay display = | 44 EGLDisplay display = |
45 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
46 GLSurfaceEGL::GetPlatformDisplay(GetPlatformDefaultEGLNativeDisplay()); | 46 GLSurfaceEGL::InitializeDisplay(); |
47 if (display == EGL_NO_DISPLAY) | |
48 return ""; | |
47 #else | 49 #else |
48 g_driver_egl.fn.eglGetDisplayFn(GetPlatformDefaultEGLNativeDisplay()); | 50 g_driver_egl.fn.eglGetDisplayFn(GetPlatformDefaultEGLNativeDisplay()); |
51 if (display == EGL_NO_DISPLAY) | |
52 return ""; | |
53 DCHECK(g_driver_egl.fn.eglInitializeFn); | |
54 g_driver_egl.fn.eglInitializeFn(display, NULL, NULL); | |
piman
2015/04/23 21:03:30
It would be easier to follow if both OS_WIN and !O
| |
49 #endif | 55 #endif |
50 | 56 |
51 DCHECK(g_driver_egl.fn.eglInitializeFn); | |
52 g_driver_egl.fn.eglInitializeFn(display, NULL, NULL); | |
53 DCHECK(g_driver_egl.fn.eglQueryStringFn); | 57 DCHECK(g_driver_egl.fn.eglQueryStringFn); |
54 const char* str = g_driver_egl.fn.eglQueryStringFn(display, EGL_EXTENSIONS); | 58 const char* str = g_driver_egl.fn.eglQueryStringFn(display, EGL_EXTENSIONS); |
55 return str ? std::string(str) : ""; | 59 return str ? std::string(str) : ""; |
56 } | 60 } |
57 | 61 |
58 // static | 62 // static |
59 std::string DriverEGL::GetClientExtensions() { | 63 std::string DriverEGL::GetClientExtensions() { |
64 DCHECK(g_driver_egl.fn.eglQueryStringFn); | |
60 const char* str = | 65 const char* str = |
61 g_driver_egl.fn.eglQueryStringFn(EGL_NO_DISPLAY, EGL_EXTENSIONS); | 66 g_driver_egl.fn.eglQueryStringFn(EGL_NO_DISPLAY, EGL_EXTENSIONS); |
62 return str ? std::string(str) : ""; | 67 return str ? std::string(str) : ""; |
63 } | 68 } |
64 #endif | 69 #endif |
65 | 70 |
66 #if defined(USE_X11) | 71 #if defined(USE_X11) |
67 std::string DriverGLX::GetPlatformExtensions() { | 72 std::string DriverGLX::GetPlatformExtensions() { |
68 DCHECK(g_driver_glx.fn.glXQueryExtensionsStringFn); | 73 DCHECK(g_driver_glx.fn.glXQueryExtensionsStringFn); |
69 const char* str = | 74 const char* str = |
70 g_driver_glx.fn.glXQueryExtensionsStringFn(gfx::GetXDisplay(), 0); | 75 g_driver_glx.fn.glXQueryExtensionsStringFn(gfx::GetXDisplay(), 0); |
71 return str ? std::string(str) : ""; | 76 return str ? std::string(str) : ""; |
72 } | 77 } |
73 #endif | 78 #endif |
74 | 79 |
75 } // namespace gfx | 80 } // namespace gfx |
OLD | NEW |