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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 void CleanupNativeLibraries(void* unused) { | 46 void CleanupNativeLibraries(void* unused) { |
47 if (g_libraries) { | 47 if (g_libraries) { |
48 // We do not call base::UnloadNativeLibrary() for these libraries as | 48 // We do not call base::UnloadNativeLibrary() for these libraries as |
49 // unloading libGL without closing X display is not allowed. See | 49 // unloading libGL without closing X display is not allowed. See |
50 // crbug.com/250813 for details. | 50 // crbug.com/250813 for details. |
51 delete g_libraries; | 51 delete g_libraries; |
52 g_libraries = NULL; | 52 g_libraries = NULL; |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 } | 56 } // namespace |
57 | 57 |
58 base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls = NULL; | 58 base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls = NULL; |
59 OSMESAApi* g_current_osmesa_context; | 59 OSMESAApi* g_current_osmesa_context; |
60 | 60 |
| 61 #if defined(USE_EGL) |
| 62 EGLApi* g_current_egl_context; |
| 63 #endif |
| 64 |
61 #if defined(OS_WIN) | 65 #if defined(OS_WIN) |
| 66 WGLApi* g_current_wgl_context; |
| 67 #endif |
62 | 68 |
63 EGLApi* g_current_egl_context; | 69 #if defined(USE_GLX) |
64 WGLApi* g_current_wgl_context; | |
65 | |
66 #elif defined(USE_X11) | |
67 | |
68 EGLApi* g_current_egl_context; | |
69 GLXApi* g_current_glx_context; | 70 GLXApi* g_current_glx_context; |
70 | |
71 #elif defined(USE_OZONE) | |
72 | |
73 EGLApi* g_current_egl_context; | |
74 | |
75 #elif defined(OS_ANDROID) | |
76 | |
77 EGLApi* g_current_egl_context; | |
78 | |
79 #endif | 71 #endif |
80 | 72 |
81 GLImplementation GetNamedGLImplementation(const std::string& name) { | 73 GLImplementation GetNamedGLImplementation(const std::string& name) { |
82 for (size_t i = 0; i < arraysize(kGLImplementationNamePairs); ++i) { | 74 for (size_t i = 0; i < arraysize(kGLImplementationNamePairs); ++i) { |
83 if (name == kGLImplementationNamePairs[i].name) | 75 if (name == kGLImplementationNamePairs[i].name) |
84 return kGLImplementationNamePairs[i].implementation; | 76 return kGLImplementationNamePairs[i].implementation; |
85 } | 77 } |
86 | 78 |
87 return kGLImplementationNone; | 79 return kGLImplementationNone; |
88 } | 80 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 const char* version_str = | 205 const char* version_str = |
214 reinterpret_cast<const char*>(glGetString(GL_VERSION)); | 206 reinterpret_cast<const char*>(glGetString(GL_VERSION)); |
215 unsigned major_version, minor_version; | 207 unsigned major_version, minor_version; |
216 bool is_es, is_es3; | 208 bool is_es, is_es3; |
217 gfx::GLVersionInfo::ParseVersionString( | 209 gfx::GLVersionInfo::ParseVersionString( |
218 version_str, &major_version, &minor_version, &is_es, &is_es3); | 210 version_str, &major_version, &minor_version, &is_es, &is_es3); |
219 return is_es || major_version < 3; | 211 return is_es || major_version < 3; |
220 } | 212 } |
221 | 213 |
222 } // namespace gfx | 214 } // namespace gfx |
OLD | NEW |