| 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/debug/trace_event.h" | 13 #include "base/debug/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 = reinterpret_cast<glXBindTexImageEXTProc>( | 27 fn.glXBindTexImageEXTFn = 0; |
| 28 GetGLProcAddress("glXBindTexImageEXT")); | |
| 29 fn.glXChooseFBConfigFn = reinterpret_cast<glXChooseFBConfigProc>( | 28 fn.glXChooseFBConfigFn = reinterpret_cast<glXChooseFBConfigProc>( |
| 30 GetGLProcAddress("glXChooseFBConfig")); | 29 GetGLProcAddress("glXChooseFBConfig")); |
| 31 fn.glXChooseVisualFn = reinterpret_cast<glXChooseVisualProc>( | 30 fn.glXChooseVisualFn = reinterpret_cast<glXChooseVisualProc>( |
| 32 GetGLProcAddress("glXChooseVisual")); | 31 GetGLProcAddress("glXChooseVisual")); |
| 33 fn.glXCopyContextFn = | 32 fn.glXCopyContextFn = |
| 34 reinterpret_cast<glXCopyContextProc>(GetGLProcAddress("glXCopyContext")); | 33 reinterpret_cast<glXCopyContextProc>(GetGLProcAddress("glXCopyContext")); |
| 35 fn.glXCopySubBufferMESAFn = reinterpret_cast<glXCopySubBufferMESAProc>( | 34 fn.glXCopySubBufferMESAFn = 0; |
| 36 GetGLProcAddress("glXCopySubBufferMESA")); | |
| 37 fn.glXCreateContextFn = reinterpret_cast<glXCreateContextProc>( | 35 fn.glXCreateContextFn = reinterpret_cast<glXCreateContextProc>( |
| 38 GetGLProcAddress("glXCreateContext")); | 36 GetGLProcAddress("glXCreateContext")); |
| 39 fn.glXCreateContextAttribsARBFn = | 37 fn.glXCreateContextAttribsARBFn = 0; |
| 40 reinterpret_cast<glXCreateContextAttribsARBProc>( | |
| 41 GetGLProcAddress("glXCreateContextAttribsARB")); | |
| 42 fn.glXCreateGLXPixmapFn = reinterpret_cast<glXCreateGLXPixmapProc>( | 38 fn.glXCreateGLXPixmapFn = reinterpret_cast<glXCreateGLXPixmapProc>( |
| 43 GetGLProcAddress("glXCreateGLXPixmap")); | 39 GetGLProcAddress("glXCreateGLXPixmap")); |
| 44 fn.glXCreateNewContextFn = reinterpret_cast<glXCreateNewContextProc>( | 40 fn.glXCreateNewContextFn = reinterpret_cast<glXCreateNewContextProc>( |
| 45 GetGLProcAddress("glXCreateNewContext")); | 41 GetGLProcAddress("glXCreateNewContext")); |
| 46 fn.glXCreatePbufferFn = reinterpret_cast<glXCreatePbufferProc>( | 42 fn.glXCreatePbufferFn = reinterpret_cast<glXCreatePbufferProc>( |
| 47 GetGLProcAddress("glXCreatePbuffer")); | 43 GetGLProcAddress("glXCreatePbuffer")); |
| 48 fn.glXCreatePixmapFn = reinterpret_cast<glXCreatePixmapProc>( | 44 fn.glXCreatePixmapFn = reinterpret_cast<glXCreatePixmapProc>( |
| 49 GetGLProcAddress("glXCreatePixmap")); | 45 GetGLProcAddress("glXCreatePixmap")); |
| 50 fn.glXCreateWindowFn = reinterpret_cast<glXCreateWindowProc>( | 46 fn.glXCreateWindowFn = reinterpret_cast<glXCreateWindowProc>( |
| 51 GetGLProcAddress("glXCreateWindow")); | 47 GetGLProcAddress("glXCreateWindow")); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 67 GetGLProcAddress("glXGetCurrentContext")); | 63 GetGLProcAddress("glXGetCurrentContext")); |
| 68 fn.glXGetCurrentDisplayFn = reinterpret_cast<glXGetCurrentDisplayProc>( | 64 fn.glXGetCurrentDisplayFn = reinterpret_cast<glXGetCurrentDisplayProc>( |
| 69 GetGLProcAddress("glXGetCurrentDisplay")); | 65 GetGLProcAddress("glXGetCurrentDisplay")); |
| 70 fn.glXGetCurrentDrawableFn = reinterpret_cast<glXGetCurrentDrawableProc>( | 66 fn.glXGetCurrentDrawableFn = reinterpret_cast<glXGetCurrentDrawableProc>( |
| 71 GetGLProcAddress("glXGetCurrentDrawable")); | 67 GetGLProcAddress("glXGetCurrentDrawable")); |
| 72 fn.glXGetCurrentReadDrawableFn = | 68 fn.glXGetCurrentReadDrawableFn = |
| 73 reinterpret_cast<glXGetCurrentReadDrawableProc>( | 69 reinterpret_cast<glXGetCurrentReadDrawableProc>( |
| 74 GetGLProcAddress("glXGetCurrentReadDrawable")); | 70 GetGLProcAddress("glXGetCurrentReadDrawable")); |
| 75 fn.glXGetFBConfigAttribFn = reinterpret_cast<glXGetFBConfigAttribProc>( | 71 fn.glXGetFBConfigAttribFn = reinterpret_cast<glXGetFBConfigAttribProc>( |
| 76 GetGLProcAddress("glXGetFBConfigAttrib")); | 72 GetGLProcAddress("glXGetFBConfigAttrib")); |
| 77 fn.glXGetFBConfigFromVisualSGIXFn = | 73 fn.glXGetFBConfigFromVisualSGIXFn = 0; |
| 78 reinterpret_cast<glXGetFBConfigFromVisualSGIXProc>( | |
| 79 GetGLProcAddress("glXGetFBConfigFromVisualSGIX")); | |
| 80 fn.glXGetFBConfigsFn = reinterpret_cast<glXGetFBConfigsProc>( | 74 fn.glXGetFBConfigsFn = reinterpret_cast<glXGetFBConfigsProc>( |
| 81 GetGLProcAddress("glXGetFBConfigs")); | 75 GetGLProcAddress("glXGetFBConfigs")); |
| 82 fn.glXGetMscRateOMLFn = reinterpret_cast<glXGetMscRateOMLProc>( | 76 fn.glXGetMscRateOMLFn = 0; |
| 83 GetGLProcAddress("glXGetMscRateOML")); | |
| 84 fn.glXGetSelectedEventFn = reinterpret_cast<glXGetSelectedEventProc>( | 77 fn.glXGetSelectedEventFn = reinterpret_cast<glXGetSelectedEventProc>( |
| 85 GetGLProcAddress("glXGetSelectedEvent")); | 78 GetGLProcAddress("glXGetSelectedEvent")); |
| 86 fn.glXGetSyncValuesOMLFn = reinterpret_cast<glXGetSyncValuesOMLProc>( | 79 fn.glXGetSyncValuesOMLFn = 0; |
| 87 GetGLProcAddress("glXGetSyncValuesOML")); | |
| 88 fn.glXGetVisualFromFBConfigFn = | 80 fn.glXGetVisualFromFBConfigFn = |
| 89 reinterpret_cast<glXGetVisualFromFBConfigProc>( | 81 reinterpret_cast<glXGetVisualFromFBConfigProc>( |
| 90 GetGLProcAddress("glXGetVisualFromFBConfig")); | 82 GetGLProcAddress("glXGetVisualFromFBConfig")); |
| 91 fn.glXIsDirectFn = | 83 fn.glXIsDirectFn = |
| 92 reinterpret_cast<glXIsDirectProc>(GetGLProcAddress("glXIsDirect")); | 84 reinterpret_cast<glXIsDirectProc>(GetGLProcAddress("glXIsDirect")); |
| 93 fn.glXMakeContextCurrentFn = reinterpret_cast<glXMakeContextCurrentProc>( | 85 fn.glXMakeContextCurrentFn = reinterpret_cast<glXMakeContextCurrentProc>( |
| 94 GetGLProcAddress("glXMakeContextCurrent")); | 86 GetGLProcAddress("glXMakeContextCurrent")); |
| 95 fn.glXMakeCurrentFn = | 87 fn.glXMakeCurrentFn = |
| 96 reinterpret_cast<glXMakeCurrentProc>(GetGLProcAddress("glXMakeCurrent")); | 88 reinterpret_cast<glXMakeCurrentProc>(GetGLProcAddress("glXMakeCurrent")); |
| 97 fn.glXQueryContextFn = reinterpret_cast<glXQueryContextProc>( | 89 fn.glXQueryContextFn = reinterpret_cast<glXQueryContextProc>( |
| 98 GetGLProcAddress("glXQueryContext")); | 90 GetGLProcAddress("glXQueryContext")); |
| 99 fn.glXQueryDrawableFn = reinterpret_cast<glXQueryDrawableProc>( | 91 fn.glXQueryDrawableFn = reinterpret_cast<glXQueryDrawableProc>( |
| 100 GetGLProcAddress("glXQueryDrawable")); | 92 GetGLProcAddress("glXQueryDrawable")); |
| 101 fn.glXQueryExtensionFn = reinterpret_cast<glXQueryExtensionProc>( | 93 fn.glXQueryExtensionFn = reinterpret_cast<glXQueryExtensionProc>( |
| 102 GetGLProcAddress("glXQueryExtension")); | 94 GetGLProcAddress("glXQueryExtension")); |
| 103 fn.glXQueryExtensionsStringFn = | 95 fn.glXQueryExtensionsStringFn = |
| 104 reinterpret_cast<glXQueryExtensionsStringProc>( | 96 reinterpret_cast<glXQueryExtensionsStringProc>( |
| 105 GetGLProcAddress("glXQueryExtensionsString")); | 97 GetGLProcAddress("glXQueryExtensionsString")); |
| 106 fn.glXQueryServerStringFn = reinterpret_cast<glXQueryServerStringProc>( | 98 fn.glXQueryServerStringFn = reinterpret_cast<glXQueryServerStringProc>( |
| 107 GetGLProcAddress("glXQueryServerString")); | 99 GetGLProcAddress("glXQueryServerString")); |
| 108 fn.glXQueryVersionFn = reinterpret_cast<glXQueryVersionProc>( | 100 fn.glXQueryVersionFn = reinterpret_cast<glXQueryVersionProc>( |
| 109 GetGLProcAddress("glXQueryVersion")); | 101 GetGLProcAddress("glXQueryVersion")); |
| 110 fn.glXReleaseTexImageEXTFn = reinterpret_cast<glXReleaseTexImageEXTProc>( | 102 fn.glXReleaseTexImageEXTFn = 0; |
| 111 GetGLProcAddress("glXReleaseTexImageEXT")); | |
| 112 fn.glXSelectEventFn = | 103 fn.glXSelectEventFn = |
| 113 reinterpret_cast<glXSelectEventProc>(GetGLProcAddress("glXSelectEvent")); | 104 reinterpret_cast<glXSelectEventProc>(GetGLProcAddress("glXSelectEvent")); |
| 114 fn.glXSwapBuffersFn = | 105 fn.glXSwapBuffersFn = |
| 115 reinterpret_cast<glXSwapBuffersProc>(GetGLProcAddress("glXSwapBuffers")); | 106 reinterpret_cast<glXSwapBuffersProc>(GetGLProcAddress("glXSwapBuffers")); |
| 116 fn.glXSwapIntervalEXTFn = reinterpret_cast<glXSwapIntervalEXTProc>( | 107 fn.glXSwapIntervalEXTFn = 0; |
| 117 GetGLProcAddress("glXSwapIntervalEXT")); | 108 fn.glXSwapIntervalMESAFn = 0; |
| 118 fn.glXSwapIntervalMESAFn = reinterpret_cast<glXSwapIntervalMESAProc>( | |
| 119 GetGLProcAddress("glXSwapIntervalMESA")); | |
| 120 fn.glXUseXFontFn = | 109 fn.glXUseXFontFn = |
| 121 reinterpret_cast<glXUseXFontProc>(GetGLProcAddress("glXUseXFont")); | 110 reinterpret_cast<glXUseXFontProc>(GetGLProcAddress("glXUseXFont")); |
| 122 fn.glXWaitGLFn = | 111 fn.glXWaitGLFn = |
| 123 reinterpret_cast<glXWaitGLProc>(GetGLProcAddress("glXWaitGL")); | 112 reinterpret_cast<glXWaitGLProc>(GetGLProcAddress("glXWaitGL")); |
| 124 fn.glXWaitVideoSyncSGIFn = reinterpret_cast<glXWaitVideoSyncSGIProc>( | 113 fn.glXWaitVideoSyncSGIFn = 0; |
| 125 GetGLProcAddress("glXWaitVideoSyncSGI")); | |
| 126 fn.glXWaitXFn = reinterpret_cast<glXWaitXProc>(GetGLProcAddress("glXWaitX")); | 114 fn.glXWaitXFn = reinterpret_cast<glXWaitXProc>(GetGLProcAddress("glXWaitX")); |
| 127 } | 115 std::string extensions(GetPlatformExtensions()); |
| 128 | 116 extensions += " "; |
| 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() + " "; | |
| 134 ALLOW_UNUSED_LOCAL(extensions); | 117 ALLOW_UNUSED_LOCAL(extensions); |
| 135 | 118 |
| 136 ext.b_GLX_ARB_create_context = | 119 ext.b_GLX_ARB_create_context = |
| 137 extensions.find("GLX_ARB_create_context ") != std::string::npos; | 120 extensions.find("GLX_ARB_create_context ") != std::string::npos; |
| 138 ext.b_GLX_EXT_swap_control = | 121 ext.b_GLX_EXT_swap_control = |
| 139 extensions.find("GLX_EXT_swap_control ") != std::string::npos; | 122 extensions.find("GLX_EXT_swap_control ") != std::string::npos; |
| 140 ext.b_GLX_EXT_texture_from_pixmap = | 123 ext.b_GLX_EXT_texture_from_pixmap = |
| 141 extensions.find("GLX_EXT_texture_from_pixmap ") != std::string::npos; | 124 extensions.find("GLX_EXT_texture_from_pixmap ") != std::string::npos; |
| 142 ext.b_GLX_MESA_copy_sub_buffer = | 125 ext.b_GLX_MESA_copy_sub_buffer = |
| 143 extensions.find("GLX_MESA_copy_sub_buffer ") != std::string::npos; | 126 extensions.find("GLX_MESA_copy_sub_buffer ") != std::string::npos; |
| 144 ext.b_GLX_MESA_swap_control = | 127 ext.b_GLX_MESA_swap_control = |
| 145 extensions.find("GLX_MESA_swap_control ") != std::string::npos; | 128 extensions.find("GLX_MESA_swap_control ") != std::string::npos; |
| 146 ext.b_GLX_OML_sync_control = | 129 ext.b_GLX_OML_sync_control = |
| 147 extensions.find("GLX_OML_sync_control ") != std::string::npos; | 130 extensions.find("GLX_OML_sync_control ") != std::string::npos; |
| 148 ext.b_GLX_SGIX_fbconfig = | 131 ext.b_GLX_SGIX_fbconfig = |
| 149 extensions.find("GLX_SGIX_fbconfig ") != std::string::npos; | 132 extensions.find("GLX_SGIX_fbconfig ") != std::string::npos; |
| 150 ext.b_GLX_SGI_video_sync = | 133 ext.b_GLX_SGI_video_sync = |
| 151 extensions.find("GLX_SGI_video_sync ") != std::string::npos; | 134 extensions.find("GLX_SGI_video_sync ") != std::string::npos; |
| 152 | 135 |
| 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 |
| 153 if (g_debugBindingsInitialized) | 208 if (g_debugBindingsInitialized) |
| 154 InitializeDebugBindings(); | 209 InitializeDebugBindings(); |
| 155 } | 210 } |
| 156 | 211 |
| 157 extern "C" { | 212 extern "C" { |
| 158 | 213 |
| 159 static void GL_BINDING_CALL Debug_glXBindTexImageEXT(Display* dpy, | 214 static void GL_BINDING_CALL Debug_glXBindTexImageEXT(Display* dpy, |
| 160 GLXDrawable drawable, | 215 GLXDrawable drawable, |
| 161 int buffer, | 216 int buffer, |
| 162 int* attribList) { | 217 int* attribList) { |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXWaitVideoSyncSGI") | 1509 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXWaitVideoSyncSGI") |
| 1455 return glx_api_->glXWaitVideoSyncSGIFn(divisor, remainder, count); | 1510 return glx_api_->glXWaitVideoSyncSGIFn(divisor, remainder, count); |
| 1456 } | 1511 } |
| 1457 | 1512 |
| 1458 void TraceGLXApi::glXWaitXFn(void) { | 1513 void TraceGLXApi::glXWaitXFn(void) { |
| 1459 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXWaitX") | 1514 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::glXWaitX") |
| 1460 glx_api_->glXWaitXFn(); | 1515 glx_api_->glXWaitXFn(); |
| 1461 } | 1516 } |
| 1462 | 1517 |
| 1463 } // namespace gfx | 1518 } // namespace gfx |
| OLD | NEW |