| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "ui/gl/gl_implementation.h" | 5 #include "ui/gl/gl_implementation.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "ui/gl/gl_bindings.h" | 13 #include "ui/gl/gl_bindings.h" |
| 14 #include "ui/gl/gl_gl_api_implementation.h" | 14 #include "ui/gl/gl_gl_api_implementation.h" |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 const struct { | 20 const struct { |
| 21 const char* name; | 21 const char* name; |
| 22 GLImplementation implementation; | 22 GLImplementation implementation; |
| 23 } kGLImplementationNamePairs[] = { | 23 } kGLImplementationNamePairs[] = { |
| 24 { kGLImplementationDesktopName, kGLImplementationDesktopGL }, | 24 { kGLImplementationDesktopName, kGLImplementationDesktopGL }, |
| 25 { kGLImplementationOSMesaName, kGLImplementationOSMesaGL }, | 25 { kGLImplementationOSMesaName, kGLImplementationOSMesaGL }, |
| 26 #if defined(OS_MACOSX) | |
| 27 { kGLImplementationAppleName, kGLImplementationAppleGL }, | |
| 28 #endif | |
| 29 { kGLImplementationEGLName, kGLImplementationEGLGLES2 }, | 26 { kGLImplementationEGLName, kGLImplementationEGLGLES2 }, |
| 30 { kGLImplementationMockName, kGLImplementationMockGL } | 27 { kGLImplementationMockName, kGLImplementationMockGL } |
| 31 }; | 28 }; |
| 32 | 29 |
| 33 typedef std::vector<base::NativeLibrary> LibraryArray; | 30 typedef std::vector<base::NativeLibrary> LibraryArray; |
| 34 | 31 |
| 35 GLImplementation g_gl_implementation = kGLImplementationNone; | 32 GLImplementation g_gl_implementation = kGLImplementationNone; |
| 36 LibraryArray* g_libraries; | 33 LibraryArray* g_libraries; |
| 37 GLGetProcAddressProc g_get_proc_address; | 34 GLGetProcAddressProc g_get_proc_address; |
| 38 | 35 |
| 39 void CleanupNativeLibraries(void* unused) { | 36 void CleanupNativeLibraries(void* unused) { |
| 40 if (g_libraries) { | 37 if (g_libraries) { |
| 41 // We do not call base::UnloadNativeLibrary() for these libraries as | 38 // We do not call base::UnloadNativeLibrary() for these libraries as |
| 42 // unloading libGL without closing X display is not allowed. See | 39 // unloading libGL without closing X display is not allowed. See |
| 43 // crbug.com/250813 for details. | 40 // crbug.com/250813 for details. |
| 44 delete g_libraries; | 41 delete g_libraries; |
| 45 g_libraries = NULL; | 42 g_libraries = NULL; |
| 46 } | 43 } |
| 47 } | 44 } |
| 48 | 45 |
| 49 } | 46 } |
| 50 | 47 |
| 51 base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls = NULL; | 48 base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls = NULL; |
| 52 OSMESAApi* g_current_osmesa_context; | 49 OSMESAApi* g_current_osmesa_context; |
| 53 | 50 |
| 54 #if defined(OS_WIN) | 51 #if defined(USE_X11) |
| 55 | |
| 56 EGLApi* g_current_egl_context; | |
| 57 WGLApi* g_current_wgl_context; | |
| 58 | |
| 59 #elif defined(USE_X11) | |
| 60 | 52 |
| 61 EGLApi* g_current_egl_context; | 53 EGLApi* g_current_egl_context; |
| 62 GLXApi* g_current_glx_context; | 54 GLXApi* g_current_glx_context; |
| 63 | 55 |
| 64 #elif defined(USE_OZONE) | 56 #elif defined(USE_OZONE) |
| 65 | 57 |
| 66 EGLApi* g_current_egl_context; | 58 EGLApi* g_current_egl_context; |
| 67 | 59 |
| 68 #elif defined(OS_ANDROID) | 60 #elif defined(OS_ANDROID) |
| 69 | 61 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 150 } |
| 159 | 151 |
| 160 DisableNullDrawGLBindings::~DisableNullDrawGLBindings() { | 152 DisableNullDrawGLBindings::~DisableNullDrawGLBindings() { |
| 161 SetNullDrawGLBindingsEnabledGL(initial_enabled_); | 153 SetNullDrawGLBindingsEnabledGL(initial_enabled_); |
| 162 } | 154 } |
| 163 | 155 |
| 164 GLWindowSystemBindingInfo::GLWindowSystemBindingInfo() | 156 GLWindowSystemBindingInfo::GLWindowSystemBindingInfo() |
| 165 : direct_rendering(true) {} | 157 : direct_rendering(true) {} |
| 166 | 158 |
| 167 } // namespace gfx | 159 } // namespace gfx |
| OLD | NEW |