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 // This file is auto-generated from | 5 // This file is auto-generated from |
6 // ui/gl/generate_bindings.py | 6 // ui/gl/generate_bindings.py |
7 // It's formatted by clang-format using chromium coding style: | 7 // It's formatted by clang-format using chromium coding style: |
8 // clang-format -i -style=chromium filename | 8 // clang-format -i -style=chromium filename |
9 // DO NOT EDIT! | 9 // DO NOT EDIT! |
10 | 10 |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/trace_event/trace_event.h" | 13 #include "base/trace_event/trace_event.h" |
14 #include "ui/gl/gl_bindings.h" | 14 #include "ui/gl/gl_bindings.h" |
15 #include "ui/gl/gl_context.h" | 15 #include "ui/gl/gl_context.h" |
16 #include "ui/gl/gl_enums.h" | 16 #include "ui/gl/gl_enums.h" |
17 #include "ui/gl/gl_glx_api_implementation.h" | 17 #include "ui/gl/gl_glx_api_implementation.h" |
18 #include "ui/gl/gl_implementation.h" | 18 #include "ui/gl/gl_implementation.h" |
19 #include "ui/gl/gl_version_info.h" | 19 #include "ui/gl/gl_version_info.h" |
20 | 20 |
21 namespace gfx { | 21 namespace gfx { |
22 | 22 |
23 static bool g_debugBindingsInitialized; | 23 static bool g_debugBindingsInitialized; |
24 DriverGLX g_driver_glx; | 24 DriverGLX g_driver_glx; |
25 | 25 |
26 void DriverGLX::InitializeStaticBindings() { | 26 void DriverGLX::InitializeStaticBindings() { |
27 fn.glXBindTexImageEXTFn = 0; | 27 fn.glXBindTexImageEXTFn = reinterpret_cast<glXBindTexImageEXTProc>( |
| 28 GetGLProcAddress("glXBindTexImageEXT")); |
28 fn.glXChooseFBConfigFn = reinterpret_cast<glXChooseFBConfigProc>( | 29 fn.glXChooseFBConfigFn = reinterpret_cast<glXChooseFBConfigProc>( |
29 GetGLProcAddress("glXChooseFBConfig")); | 30 GetGLProcAddress("glXChooseFBConfig")); |
30 fn.glXChooseVisualFn = reinterpret_cast<glXChooseVisualProc>( | 31 fn.glXChooseVisualFn = reinterpret_cast<glXChooseVisualProc>( |
31 GetGLProcAddress("glXChooseVisual")); | 32 GetGLProcAddress("glXChooseVisual")); |
32 fn.glXCopyContextFn = | 33 fn.glXCopyContextFn = |
33 reinterpret_cast<glXCopyContextProc>(GetGLProcAddress("glXCopyContext")); | 34 reinterpret_cast<glXCopyContextProc>(GetGLProcAddress("glXCopyContext")); |
34 fn.glXCopySubBufferMESAFn = 0; | 35 fn.glXCopySubBufferMESAFn = reinterpret_cast<glXCopySubBufferMESAProc>( |
| 36 GetGLProcAddress("glXCopySubBufferMESA")); |
35 fn.glXCreateContextFn = reinterpret_cast<glXCreateContextProc>( | 37 fn.glXCreateContextFn = reinterpret_cast<glXCreateContextProc>( |
36 GetGLProcAddress("glXCreateContext")); | 38 GetGLProcAddress("glXCreateContext")); |
37 fn.glXCreateContextAttribsARBFn = 0; | 39 fn.glXCreateContextAttribsARBFn = |
| 40 reinterpret_cast<glXCreateContextAttribsARBProc>( |
| 41 GetGLProcAddress("glXCreateContextAttribsARB")); |
38 fn.glXCreateGLXPixmapFn = reinterpret_cast<glXCreateGLXPixmapProc>( | 42 fn.glXCreateGLXPixmapFn = reinterpret_cast<glXCreateGLXPixmapProc>( |
39 GetGLProcAddress("glXCreateGLXPixmap")); | 43 GetGLProcAddress("glXCreateGLXPixmap")); |
40 fn.glXCreateNewContextFn = reinterpret_cast<glXCreateNewContextProc>( | 44 fn.glXCreateNewContextFn = reinterpret_cast<glXCreateNewContextProc>( |
41 GetGLProcAddress("glXCreateNewContext")); | 45 GetGLProcAddress("glXCreateNewContext")); |
42 fn.glXCreatePbufferFn = reinterpret_cast<glXCreatePbufferProc>( | 46 fn.glXCreatePbufferFn = reinterpret_cast<glXCreatePbufferProc>( |
43 GetGLProcAddress("glXCreatePbuffer")); | 47 GetGLProcAddress("glXCreatePbuffer")); |
44 fn.glXCreatePixmapFn = reinterpret_cast<glXCreatePixmapProc>( | 48 fn.glXCreatePixmapFn = reinterpret_cast<glXCreatePixmapProc>( |
45 GetGLProcAddress("glXCreatePixmap")); | 49 GetGLProcAddress("glXCreatePixmap")); |
46 fn.glXCreateWindowFn = reinterpret_cast<glXCreateWindowProc>( | 50 fn.glXCreateWindowFn = reinterpret_cast<glXCreateWindowProc>( |
47 GetGLProcAddress("glXCreateWindow")); | 51 GetGLProcAddress("glXCreateWindow")); |
(...skipping 15 matching lines...) Expand all Loading... |
63 GetGLProcAddress("glXGetCurrentContext")); | 67 GetGLProcAddress("glXGetCurrentContext")); |
64 fn.glXGetCurrentDisplayFn = reinterpret_cast<glXGetCurrentDisplayProc>( | 68 fn.glXGetCurrentDisplayFn = reinterpret_cast<glXGetCurrentDisplayProc>( |
65 GetGLProcAddress("glXGetCurrentDisplay")); | 69 GetGLProcAddress("glXGetCurrentDisplay")); |
66 fn.glXGetCurrentDrawableFn = reinterpret_cast<glXGetCurrentDrawableProc>( | 70 fn.glXGetCurrentDrawableFn = reinterpret_cast<glXGetCurrentDrawableProc>( |
67 GetGLProcAddress("glXGetCurrentDrawable")); | 71 GetGLProcAddress("glXGetCurrentDrawable")); |
68 fn.glXGetCurrentReadDrawableFn = | 72 fn.glXGetCurrentReadDrawableFn = |
69 reinterpret_cast<glXGetCurrentReadDrawableProc>( | 73 reinterpret_cast<glXGetCurrentReadDrawableProc>( |
70 GetGLProcAddress("glXGetCurrentReadDrawable")); | 74 GetGLProcAddress("glXGetCurrentReadDrawable")); |
71 fn.glXGetFBConfigAttribFn = reinterpret_cast<glXGetFBConfigAttribProc>( | 75 fn.glXGetFBConfigAttribFn = reinterpret_cast<glXGetFBConfigAttribProc>( |
72 GetGLProcAddress("glXGetFBConfigAttrib")); | 76 GetGLProcAddress("glXGetFBConfigAttrib")); |
73 fn.glXGetFBConfigFromVisualSGIXFn = 0; | 77 fn.glXGetFBConfigFromVisualSGIXFn = |
| 78 reinterpret_cast<glXGetFBConfigFromVisualSGIXProc>( |
| 79 GetGLProcAddress("glXGetFBConfigFromVisualSGIX")); |
74 fn.glXGetFBConfigsFn = reinterpret_cast<glXGetFBConfigsProc>( | 80 fn.glXGetFBConfigsFn = reinterpret_cast<glXGetFBConfigsProc>( |
75 GetGLProcAddress("glXGetFBConfigs")); | 81 GetGLProcAddress("glXGetFBConfigs")); |
76 fn.glXGetMscRateOMLFn = 0; | 82 fn.glXGetMscRateOMLFn = reinterpret_cast<glXGetMscRateOMLProc>( |
| 83 GetGLProcAddress("glXGetMscRateOML")); |
77 fn.glXGetSelectedEventFn = reinterpret_cast<glXGetSelectedEventProc>( | 84 fn.glXGetSelectedEventFn = reinterpret_cast<glXGetSelectedEventProc>( |
78 GetGLProcAddress("glXGetSelectedEvent")); | 85 GetGLProcAddress("glXGetSelectedEvent")); |
79 fn.glXGetSyncValuesOMLFn = 0; | 86 fn.glXGetSyncValuesOMLFn = reinterpret_cast<glXGetSyncValuesOMLProc>( |
| 87 GetGLProcAddress("glXGetSyncValuesOML")); |
80 fn.glXGetVisualFromFBConfigFn = | 88 fn.glXGetVisualFromFBConfigFn = |
81 reinterpret_cast<glXGetVisualFromFBConfigProc>( | 89 reinterpret_cast<glXGetVisualFromFBConfigProc>( |
82 GetGLProcAddress("glXGetVisualFromFBConfig")); | 90 GetGLProcAddress("glXGetVisualFromFBConfig")); |
83 fn.glXIsDirectFn = | 91 fn.glXIsDirectFn = |
84 reinterpret_cast<glXIsDirectProc>(GetGLProcAddress("glXIsDirect")); | 92 reinterpret_cast<glXIsDirectProc>(GetGLProcAddress("glXIsDirect")); |
85 fn.glXMakeContextCurrentFn = reinterpret_cast<glXMakeContextCurrentProc>( | 93 fn.glXMakeContextCurrentFn = reinterpret_cast<glXMakeContextCurrentProc>( |
86 GetGLProcAddress("glXMakeContextCurrent")); | 94 GetGLProcAddress("glXMakeContextCurrent")); |
87 fn.glXMakeCurrentFn = | 95 fn.glXMakeCurrentFn = |
88 reinterpret_cast<glXMakeCurrentProc>(GetGLProcAddress("glXMakeCurrent")); | 96 reinterpret_cast<glXMakeCurrentProc>(GetGLProcAddress("glXMakeCurrent")); |
89 fn.glXQueryContextFn = reinterpret_cast<glXQueryContextProc>( | 97 fn.glXQueryContextFn = reinterpret_cast<glXQueryContextProc>( |
90 GetGLProcAddress("glXQueryContext")); | 98 GetGLProcAddress("glXQueryContext")); |
91 fn.glXQueryDrawableFn = reinterpret_cast<glXQueryDrawableProc>( | 99 fn.glXQueryDrawableFn = reinterpret_cast<glXQueryDrawableProc>( |
92 GetGLProcAddress("glXQueryDrawable")); | 100 GetGLProcAddress("glXQueryDrawable")); |
93 fn.glXQueryExtensionFn = reinterpret_cast<glXQueryExtensionProc>( | 101 fn.glXQueryExtensionFn = reinterpret_cast<glXQueryExtensionProc>( |
94 GetGLProcAddress("glXQueryExtension")); | 102 GetGLProcAddress("glXQueryExtension")); |
95 fn.glXQueryExtensionsStringFn = | 103 fn.glXQueryExtensionsStringFn = |
96 reinterpret_cast<glXQueryExtensionsStringProc>( | 104 reinterpret_cast<glXQueryExtensionsStringProc>( |
97 GetGLProcAddress("glXQueryExtensionsString")); | 105 GetGLProcAddress("glXQueryExtensionsString")); |
98 fn.glXQueryServerStringFn = reinterpret_cast<glXQueryServerStringProc>( | 106 fn.glXQueryServerStringFn = reinterpret_cast<glXQueryServerStringProc>( |
99 GetGLProcAddress("glXQueryServerString")); | 107 GetGLProcAddress("glXQueryServerString")); |
100 fn.glXQueryVersionFn = reinterpret_cast<glXQueryVersionProc>( | 108 fn.glXQueryVersionFn = reinterpret_cast<glXQueryVersionProc>( |
101 GetGLProcAddress("glXQueryVersion")); | 109 GetGLProcAddress("glXQueryVersion")); |
102 fn.glXReleaseTexImageEXTFn = 0; | 110 fn.glXReleaseTexImageEXTFn = reinterpret_cast<glXReleaseTexImageEXTProc>( |
| 111 GetGLProcAddress("glXReleaseTexImageEXT")); |
103 fn.glXSelectEventFn = | 112 fn.glXSelectEventFn = |
104 reinterpret_cast<glXSelectEventProc>(GetGLProcAddress("glXSelectEvent")); | 113 reinterpret_cast<glXSelectEventProc>(GetGLProcAddress("glXSelectEvent")); |
105 fn.glXSwapBuffersFn = | 114 fn.glXSwapBuffersFn = |
106 reinterpret_cast<glXSwapBuffersProc>(GetGLProcAddress("glXSwapBuffers")); | 115 reinterpret_cast<glXSwapBuffersProc>(GetGLProcAddress("glXSwapBuffers")); |
107 fn.glXSwapIntervalEXTFn = 0; | 116 fn.glXSwapIntervalEXTFn = reinterpret_cast<glXSwapIntervalEXTProc>( |
108 fn.glXSwapIntervalMESAFn = 0; | 117 GetGLProcAddress("glXSwapIntervalEXT")); |
| 118 fn.glXSwapIntervalMESAFn = reinterpret_cast<glXSwapIntervalMESAProc>( |
| 119 GetGLProcAddress("glXSwapIntervalMESA")); |
109 fn.glXUseXFontFn = | 120 fn.glXUseXFontFn = |
110 reinterpret_cast<glXUseXFontProc>(GetGLProcAddress("glXUseXFont")); | 121 reinterpret_cast<glXUseXFontProc>(GetGLProcAddress("glXUseXFont")); |
111 fn.glXWaitGLFn = | 122 fn.glXWaitGLFn = |
112 reinterpret_cast<glXWaitGLProc>(GetGLProcAddress("glXWaitGL")); | 123 reinterpret_cast<glXWaitGLProc>(GetGLProcAddress("glXWaitGL")); |
113 fn.glXWaitVideoSyncSGIFn = 0; | 124 fn.glXWaitVideoSyncSGIFn = reinterpret_cast<glXWaitVideoSyncSGIProc>( |
| 125 GetGLProcAddress("glXWaitVideoSyncSGI")); |
114 fn.glXWaitXFn = reinterpret_cast<glXWaitXProc>(GetGLProcAddress("glXWaitX")); | 126 fn.glXWaitXFn = reinterpret_cast<glXWaitXProc>(GetGLProcAddress("glXWaitX")); |
115 std::string extensions(GetPlatformExtensions()); | 127 } |
116 extensions += " "; | 128 |
| 129 void DriverGLX::InitializeDynamicBindings(GLContext* context) { |
| 130 DCHECK(context && context->IsCurrent(NULL)); |
| 131 const GLVersionInfo* ver = context->GetVersionInfo(); |
| 132 ALLOW_UNUSED_LOCAL(ver); |
| 133 std::string extensions = context->GetExtensions() + " "; |
117 ALLOW_UNUSED_LOCAL(extensions); | 134 ALLOW_UNUSED_LOCAL(extensions); |
118 | 135 |
119 ext.b_GLX_ARB_create_context = | 136 ext.b_GLX_ARB_create_context = |
120 extensions.find("GLX_ARB_create_context ") != std::string::npos; | 137 extensions.find("GLX_ARB_create_context ") != std::string::npos; |
121 ext.b_GLX_EXT_swap_control = | 138 ext.b_GLX_EXT_swap_control = |
122 extensions.find("GLX_EXT_swap_control ") != std::string::npos; | 139 extensions.find("GLX_EXT_swap_control ") != std::string::npos; |
123 ext.b_GLX_EXT_texture_from_pixmap = | 140 ext.b_GLX_EXT_texture_from_pixmap = |
124 extensions.find("GLX_EXT_texture_from_pixmap ") != std::string::npos; | 141 extensions.find("GLX_EXT_texture_from_pixmap ") != std::string::npos; |
125 ext.b_GLX_MESA_copy_sub_buffer = | 142 ext.b_GLX_MESA_copy_sub_buffer = |
126 extensions.find("GLX_MESA_copy_sub_buffer ") != std::string::npos; | 143 extensions.find("GLX_MESA_copy_sub_buffer ") != std::string::npos; |
127 ext.b_GLX_MESA_swap_control = | 144 ext.b_GLX_MESA_swap_control = |
128 extensions.find("GLX_MESA_swap_control ") != std::string::npos; | 145 extensions.find("GLX_MESA_swap_control ") != std::string::npos; |
129 ext.b_GLX_OML_sync_control = | 146 ext.b_GLX_OML_sync_control = |
130 extensions.find("GLX_OML_sync_control ") != std::string::npos; | 147 extensions.find("GLX_OML_sync_control ") != std::string::npos; |
131 ext.b_GLX_SGIX_fbconfig = | 148 ext.b_GLX_SGIX_fbconfig = |
132 extensions.find("GLX_SGIX_fbconfig ") != std::string::npos; | 149 extensions.find("GLX_SGIX_fbconfig ") != std::string::npos; |
133 ext.b_GLX_SGI_video_sync = | 150 ext.b_GLX_SGI_video_sync = |
134 extensions.find("GLX_SGI_video_sync ") != std::string::npos; | 151 extensions.find("GLX_SGI_video_sync ") != std::string::npos; |
135 | 152 |
136 debug_fn.glXBindTexImageEXTFn = 0; | |
137 if (ext.b_GLX_EXT_texture_from_pixmap) { | |
138 fn.glXBindTexImageEXTFn = reinterpret_cast<glXBindTexImageEXTProc>( | |
139 GetGLProcAddress("glXBindTexImageEXT")); | |
140 DCHECK(fn.glXBindTexImageEXTFn); | |
141 } | |
142 | |
143 debug_fn.glXCopySubBufferMESAFn = 0; | |
144 if (ext.b_GLX_MESA_copy_sub_buffer) { | |
145 fn.glXCopySubBufferMESAFn = reinterpret_cast<glXCopySubBufferMESAProc>( | |
146 GetGLProcAddress("glXCopySubBufferMESA")); | |
147 DCHECK(fn.glXCopySubBufferMESAFn); | |
148 } | |
149 | |
150 debug_fn.glXCreateContextAttribsARBFn = 0; | |
151 if (ext.b_GLX_ARB_create_context) { | |
152 fn.glXCreateContextAttribsARBFn = | |
153 reinterpret_cast<glXCreateContextAttribsARBProc>( | |
154 GetGLProcAddress("glXCreateContextAttribsARB")); | |
155 DCHECK(fn.glXCreateContextAttribsARBFn); | |
156 } | |
157 | |
158 debug_fn.glXGetFBConfigFromVisualSGIXFn = 0; | |
159 if (ext.b_GLX_SGIX_fbconfig) { | |
160 fn.glXGetFBConfigFromVisualSGIXFn = | |
161 reinterpret_cast<glXGetFBConfigFromVisualSGIXProc>( | |
162 GetGLProcAddress("glXGetFBConfigFromVisualSGIX")); | |
163 DCHECK(fn.glXGetFBConfigFromVisualSGIXFn); | |
164 } | |
165 | |
166 debug_fn.glXGetMscRateOMLFn = 0; | |
167 if (ext.b_GLX_OML_sync_control) { | |
168 fn.glXGetMscRateOMLFn = reinterpret_cast<glXGetMscRateOMLProc>( | |
169 GetGLProcAddress("glXGetMscRateOML")); | |
170 DCHECK(fn.glXGetMscRateOMLFn); | |
171 } | |
172 | |
173 debug_fn.glXGetSyncValuesOMLFn = 0; | |
174 if (ext.b_GLX_OML_sync_control) { | |
175 fn.glXGetSyncValuesOMLFn = reinterpret_cast<glXGetSyncValuesOMLProc>( | |
176 GetGLProcAddress("glXGetSyncValuesOML")); | |
177 DCHECK(fn.glXGetSyncValuesOMLFn); | |
178 } | |
179 | |
180 debug_fn.glXReleaseTexImageEXTFn = 0; | |
181 if (ext.b_GLX_EXT_texture_from_pixmap) { | |
182 fn.glXReleaseTexImageEXTFn = reinterpret_cast<glXReleaseTexImageEXTProc>( | |
183 GetGLProcAddress("glXReleaseTexImageEXT")); | |
184 DCHECK(fn.glXReleaseTexImageEXTFn); | |
185 } | |
186 | |
187 debug_fn.glXSwapIntervalEXTFn = 0; | |
188 if (ext.b_GLX_EXT_swap_control) { | |
189 fn.glXSwapIntervalEXTFn = reinterpret_cast<glXSwapIntervalEXTProc>( | |
190 GetGLProcAddress("glXSwapIntervalEXT")); | |
191 DCHECK(fn.glXSwapIntervalEXTFn); | |
192 } | |
193 | |
194 debug_fn.glXSwapIntervalMESAFn = 0; | |
195 if (ext.b_GLX_MESA_swap_control) { | |
196 fn.glXSwapIntervalMESAFn = reinterpret_cast<glXSwapIntervalMESAProc>( | |
197 GetGLProcAddress("glXSwapIntervalMESA")); | |
198 DCHECK(fn.glXSwapIntervalMESAFn); | |
199 } | |
200 | |
201 debug_fn.glXWaitVideoSyncSGIFn = 0; | |
202 if (ext.b_GLX_SGI_video_sync) { | |
203 fn.glXWaitVideoSyncSGIFn = reinterpret_cast<glXWaitVideoSyncSGIProc>( | |
204 GetGLProcAddress("glXWaitVideoSyncSGI")); | |
205 DCHECK(fn.glXWaitVideoSyncSGIFn); | |
206 } | |
207 | |
208 if (g_debugBindingsInitialized) | 153 if (g_debugBindingsInitialized) |
209 InitializeDebugBindings(); | 154 InitializeDebugBindings(); |
210 } | 155 } |
211 | 156 |
212 extern "C" { | 157 extern "C" { |
213 | 158 |
214 static void GL_BINDING_CALL Debug_glXBindTexImageEXT(Display* dpy, | 159 static void GL_BINDING_CALL Debug_glXBindTexImageEXT(Display* dpy, |
215 GLXDrawable drawable, | 160 GLXDrawable drawable, |
216 int buffer, | 161 int buffer, |
217 int* attribList) { | 162 int* attribList) { |
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXWaitVideoSyncSGI") | 1454 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXWaitVideoSyncSGI") |
1510 return glx_api_->glXWaitVideoSyncSGIFn(divisor, remainder, count); | 1455 return glx_api_->glXWaitVideoSyncSGIFn(divisor, remainder, count); |
1511 } | 1456 } |
1512 | 1457 |
1513 void TraceGLXApi::glXWaitXFn(void) { | 1458 void TraceGLXApi::glXWaitXFn(void) { |
1514 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXWaitX") | 1459 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXWaitX") |
1515 glx_api_->glXWaitXFn(); | 1460 glx_api_->glXWaitXFn(); |
1516 } | 1461 } |
1517 | 1462 |
1518 } // namespace gfx | 1463 } // namespace gfx |
OLD | NEW |