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 | 14 |
14 namespace gfx { | 15 namespace gfx { |
15 | 16 |
16 namespace { | 17 namespace { |
17 | 18 |
18 const struct { | 19 const struct { |
19 const char* name; | 20 const char* name; |
20 GLImplementation implementation; | 21 GLImplementation implementation; |
21 } kGLImplementationNamePairs[] = { | 22 } kGLImplementationNamePairs[] = { |
22 { kGLImplementationDesktopName, kGLImplementationDesktopGL }, | 23 { kGLImplementationDesktopName, kGLImplementationDesktopGL }, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 case kGLImplementationEGLGLES2: | 56 case kGLImplementationEGLGLES2: |
56 return false; | 57 return false; |
57 default: | 58 default: |
58 NOTREACHED(); | 59 NOTREACHED(); |
59 return true; | 60 return true; |
60 } | 61 } |
61 } | 62 } |
62 | 63 |
63 } | 64 } |
64 | 65 |
| 66 GLApi* g_current_gl_context; |
| 67 OSMESAApi* g_current_osmesa_context; |
| 68 |
| 69 #if defined(OS_WIN) |
| 70 |
| 71 EGLApi* g_current_egl_context; |
| 72 WGLApi* g_current_wgl_context; |
| 73 |
| 74 #elif defined(USE_X11) |
| 75 |
| 76 EGLApi* g_current_egl_context; |
| 77 GLXApi* g_current_glx_context; |
| 78 |
| 79 #elif defined(OS_ANDROID) |
| 80 |
| 81 EGLApi* g_current_egl_context; |
| 82 |
| 83 #endif |
| 84 |
65 GLImplementation GetNamedGLImplementation(const std::string& name) { | 85 GLImplementation GetNamedGLImplementation(const std::string& name) { |
66 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kGLImplementationNamePairs); ++i) { | 86 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kGLImplementationNamePairs); ++i) { |
67 if (name == kGLImplementationNamePairs[i].name) | 87 if (name == kGLImplementationNamePairs[i].name) |
68 return kGLImplementationNamePairs[i].implementation; | 88 return kGLImplementationNamePairs[i].implementation; |
69 } | 89 } |
70 | 90 |
71 return kGLImplementationNone; | 91 return kGLImplementationNone; |
72 } | 92 } |
73 | 93 |
74 const char* GetGLImplementationName(GLImplementation implementation) { | 94 const char* GetGLImplementationName(GLImplementation implementation) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if (!proc && g_get_proc_address) { | 162 if (!proc && g_get_proc_address) { |
143 proc = g_get_proc_address(name); | 163 proc = g_get_proc_address(name); |
144 if (proc) | 164 if (proc) |
145 return proc; | 165 return proc; |
146 } | 166 } |
147 | 167 |
148 return proc; | 168 return proc; |
149 } | 169 } |
150 | 170 |
151 } // namespace gfx | 171 } // namespace gfx |
OLD | NEW |