Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1188)

Side by Side Diff: ui/gl/gl_bindings.cc

Issue 1051253008: gpu: Upgrade to new ANGLE Platform Display init. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid repeated eglInitialize in gl_bindings Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ui/gl/gl_surface_egl.h » ('j') | ui/gl/gl_surface_egl.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 23 matching lines...) Expand all
34 GLSurfaceWGL::GetDisplayDC()); 34 GLSurfaceWGL::GetDisplayDC());
35 } else if (g_driver_wgl.fn.wglGetExtensionsStringEXTFn) { 35 } else if (g_driver_wgl.fn.wglGetExtensionsStringEXTFn) {
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 #if defined(OS_WIN)
45 EGLDisplay display = GLSurfaceEGL::InitializeDisplay();
46 if (display == EGL_NO_DISPLAY)
47 return "";
Jamie Madill 2015/04/20 18:33:11 I wasn't sure if I should put the NO_DISPLAY check
Zhenyao Mo 2015/04/20 19:51:47 If display isn't valid, eglQueryString just return
Jamie Madill 2015/04/20 20:20:09 One difference - if display is EGL_NO_DISPLAY and
48 #else
44 EGLDisplay display = 49 EGLDisplay display =
45 #if defined(OS_WIN) 50 g_driver_egl.fn.eglGetDisplayFn(GetPlatformDefaultEGLNativeDisplay());
46 GLSurfaceEGL::GetPlatformDisplay(GetPlatformDefaultEGLNativeDisplay()); 51 DCHECK(g_driver_egl.fn.eglInitializeFn);
47 #else 52 g_driver_egl.fn.eglInitializeFn(display, NULL, NULL);
48 g_driver_egl.fn.eglGetDisplayFn(GetPlatformDefaultEGLNativeDisplay());
49 #endif 53 #endif
50 54
51 DCHECK(g_driver_egl.fn.eglInitializeFn);
52 g_driver_egl.fn.eglInitializeFn(display, NULL, NULL);
53 DCHECK(g_driver_egl.fn.eglQueryStringFn); 55 DCHECK(g_driver_egl.fn.eglQueryStringFn);
54 const char* str = g_driver_egl.fn.eglQueryStringFn(display, EGL_EXTENSIONS); 56 const char* str = g_driver_egl.fn.eglQueryStringFn(display, EGL_EXTENSIONS);
55 return str ? std::string(str) : ""; 57 return str ? std::string(str) : "";
56 } 58 }
57 59
58 // static 60 // static
59 std::string DriverEGL::GetClientExtensions() { 61 std::string DriverEGL::GetClientExtensions() {
60 const char* str = 62 const char* str =
61 g_driver_egl.fn.eglQueryStringFn(EGL_NO_DISPLAY, EGL_EXTENSIONS); 63 g_driver_egl.fn.eglQueryStringFn(EGL_NO_DISPLAY, EGL_EXTENSIONS);
62 return str ? std::string(str) : ""; 64 return str ? std::string(str) : "";
63 } 65 }
64 #endif 66 #endif
65 67
66 #if defined(USE_X11) 68 #if defined(USE_X11)
67 std::string DriverGLX::GetPlatformExtensions() { 69 std::string DriverGLX::GetPlatformExtensions() {
68 DCHECK(g_driver_glx.fn.glXQueryExtensionsStringFn); 70 DCHECK(g_driver_glx.fn.glXQueryExtensionsStringFn);
69 const char* str = 71 const char* str =
70 g_driver_glx.fn.glXQueryExtensionsStringFn(gfx::GetXDisplay(), 0); 72 g_driver_glx.fn.glXQueryExtensionsStringFn(gfx::GetXDisplay(), 0);
71 return str ? std::string(str) : ""; 73 return str ? std::string(str) : "";
72 } 74 }
73 #endif 75 #endif
74 76
75 } // namespace gfx 77 } // namespace gfx
OLDNEW
« no previous file with comments | « no previous file | ui/gl/gl_surface_egl.h » ('j') | ui/gl/gl_surface_egl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698