| 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_implementation.h" | 17 #include "ui/gl/gl_implementation.h" |
| 18 #include "ui/gl/gl_version_info.h" | 18 #include "ui/gl/gl_version_info.h" |
| 19 #include "ui/gl/gl_wgl_api_implementation.h" | 19 #include "ui/gl/gl_wgl_api_implementation.h" |
| 20 | 20 |
| 21 namespace gfx { | 21 namespace gfx { |
| 22 | 22 |
| 23 static bool g_debugBindingsInitialized; | 23 static bool g_debugBindingsInitialized; |
| 24 DriverWGL g_driver_wgl; | 24 DriverWGL g_driver_wgl; |
| 25 | 25 |
| 26 void DriverWGL::InitializeStaticBindings() { | 26 void DriverWGL::InitializeStaticBindings() { |
| 27 fn.wglChoosePixelFormatARBFn = 0; | 27 fn.wglChoosePixelFormatARBFn = reinterpret_cast<wglChoosePixelFormatARBProc>( |
| 28 GetGLProcAddress("wglChoosePixelFormatARB")); |
| 28 fn.wglCopyContextFn = | 29 fn.wglCopyContextFn = |
| 29 reinterpret_cast<wglCopyContextProc>(GetGLProcAddress("wglCopyContext")); | 30 reinterpret_cast<wglCopyContextProc>(GetGLProcAddress("wglCopyContext")); |
| 30 fn.wglCreateContextFn = reinterpret_cast<wglCreateContextProc>( | 31 fn.wglCreateContextFn = reinterpret_cast<wglCreateContextProc>( |
| 31 GetGLProcAddress("wglCreateContext")); | 32 GetGLProcAddress("wglCreateContext")); |
| 32 fn.wglCreateLayerContextFn = reinterpret_cast<wglCreateLayerContextProc>( | 33 fn.wglCreateLayerContextFn = reinterpret_cast<wglCreateLayerContextProc>( |
| 33 GetGLProcAddress("wglCreateLayerContext")); | 34 GetGLProcAddress("wglCreateLayerContext")); |
| 34 fn.wglCreatePbufferARBFn = 0; | 35 fn.wglCreatePbufferARBFn = reinterpret_cast<wglCreatePbufferARBProc>( |
| 36 GetGLProcAddress("wglCreatePbufferARB")); |
| 35 fn.wglDeleteContextFn = reinterpret_cast<wglDeleteContextProc>( | 37 fn.wglDeleteContextFn = reinterpret_cast<wglDeleteContextProc>( |
| 36 GetGLProcAddress("wglDeleteContext")); | 38 GetGLProcAddress("wglDeleteContext")); |
| 37 fn.wglDestroyPbufferARBFn = 0; | 39 fn.wglDestroyPbufferARBFn = reinterpret_cast<wglDestroyPbufferARBProc>( |
| 40 GetGLProcAddress("wglDestroyPbufferARB")); |
| 38 fn.wglGetCurrentContextFn = reinterpret_cast<wglGetCurrentContextProc>( | 41 fn.wglGetCurrentContextFn = reinterpret_cast<wglGetCurrentContextProc>( |
| 39 GetGLProcAddress("wglGetCurrentContext")); | 42 GetGLProcAddress("wglGetCurrentContext")); |
| 40 fn.wglGetCurrentDCFn = reinterpret_cast<wglGetCurrentDCProc>( | 43 fn.wglGetCurrentDCFn = reinterpret_cast<wglGetCurrentDCProc>( |
| 41 GetGLProcAddress("wglGetCurrentDC")); | 44 GetGLProcAddress("wglGetCurrentDC")); |
| 42 fn.wglGetExtensionsStringARBFn = | 45 fn.wglGetExtensionsStringARBFn = |
| 43 reinterpret_cast<wglGetExtensionsStringARBProc>( | 46 reinterpret_cast<wglGetExtensionsStringARBProc>( |
| 44 GetGLProcAddress("wglGetExtensionsStringARB")); | 47 GetGLProcAddress("wglGetExtensionsStringARB")); |
| 45 fn.wglGetExtensionsStringEXTFn = | 48 fn.wglGetExtensionsStringEXTFn = |
| 46 reinterpret_cast<wglGetExtensionsStringEXTProc>( | 49 reinterpret_cast<wglGetExtensionsStringEXTProc>( |
| 47 GetGLProcAddress("wglGetExtensionsStringEXT")); | 50 GetGLProcAddress("wglGetExtensionsStringEXT")); |
| 48 fn.wglGetPbufferDCARBFn = 0; | 51 fn.wglGetPbufferDCARBFn = reinterpret_cast<wglGetPbufferDCARBProc>( |
| 52 GetGLProcAddress("wglGetPbufferDCARB")); |
| 49 fn.wglMakeCurrentFn = | 53 fn.wglMakeCurrentFn = |
| 50 reinterpret_cast<wglMakeCurrentProc>(GetGLProcAddress("wglMakeCurrent")); | 54 reinterpret_cast<wglMakeCurrentProc>(GetGLProcAddress("wglMakeCurrent")); |
| 51 fn.wglQueryPbufferARBFn = 0; | 55 fn.wglQueryPbufferARBFn = reinterpret_cast<wglQueryPbufferARBProc>( |
| 52 fn.wglReleasePbufferDCARBFn = 0; | 56 GetGLProcAddress("wglQueryPbufferARB")); |
| 57 fn.wglReleasePbufferDCARBFn = reinterpret_cast<wglReleasePbufferDCARBProc>( |
| 58 GetGLProcAddress("wglReleasePbufferDCARB")); |
| 53 fn.wglShareListsFn = | 59 fn.wglShareListsFn = |
| 54 reinterpret_cast<wglShareListsProc>(GetGLProcAddress("wglShareLists")); | 60 reinterpret_cast<wglShareListsProc>(GetGLProcAddress("wglShareLists")); |
| 55 fn.wglSwapIntervalEXTFn = 0; | 61 fn.wglSwapIntervalEXTFn = reinterpret_cast<wglSwapIntervalEXTProc>( |
| 62 GetGLProcAddress("wglSwapIntervalEXT")); |
| 56 fn.wglSwapLayerBuffersFn = reinterpret_cast<wglSwapLayerBuffersProc>( | 63 fn.wglSwapLayerBuffersFn = reinterpret_cast<wglSwapLayerBuffersProc>( |
| 57 GetGLProcAddress("wglSwapLayerBuffers")); | 64 GetGLProcAddress("wglSwapLayerBuffers")); |
| 58 std::string extensions(GetPlatformExtensions()); | 65 } |
| 59 extensions += " "; | 66 |
| 67 void DriverWGL::InitializeDynamicBindings(GLContext* context) { |
| 68 DCHECK(context && context->IsCurrent(NULL)); |
| 69 const GLVersionInfo* ver = context->GetVersionInfo(); |
| 70 ALLOW_UNUSED_LOCAL(ver); |
| 71 std::string extensions = context->GetExtensions() + " "; |
| 60 ALLOW_UNUSED_LOCAL(extensions); | 72 ALLOW_UNUSED_LOCAL(extensions); |
| 61 | 73 |
| 62 ext.b_WGL_ARB_extensions_string = | 74 ext.b_WGL_ARB_extensions_string = |
| 63 extensions.find("WGL_ARB_extensions_string ") != std::string::npos; | 75 extensions.find("WGL_ARB_extensions_string ") != std::string::npos; |
| 64 ext.b_WGL_ARB_pbuffer = | 76 ext.b_WGL_ARB_pbuffer = |
| 65 extensions.find("WGL_ARB_pbuffer ") != std::string::npos; | 77 extensions.find("WGL_ARB_pbuffer ") != std::string::npos; |
| 66 ext.b_WGL_ARB_pixel_format = | 78 ext.b_WGL_ARB_pixel_format = |
| 67 extensions.find("WGL_ARB_pixel_format ") != std::string::npos; | 79 extensions.find("WGL_ARB_pixel_format ") != std::string::npos; |
| 68 ext.b_WGL_EXT_extensions_string = | 80 ext.b_WGL_EXT_extensions_string = |
| 69 extensions.find("WGL_EXT_extensions_string ") != std::string::npos; | 81 extensions.find("WGL_EXT_extensions_string ") != std::string::npos; |
| 70 ext.b_WGL_EXT_swap_control = | 82 ext.b_WGL_EXT_swap_control = |
| 71 extensions.find("WGL_EXT_swap_control ") != std::string::npos; | 83 extensions.find("WGL_EXT_swap_control ") != std::string::npos; |
| 72 | 84 |
| 73 debug_fn.wglChoosePixelFormatARBFn = 0; | |
| 74 if (ext.b_WGL_ARB_pixel_format) { | |
| 75 fn.wglChoosePixelFormatARBFn = | |
| 76 reinterpret_cast<wglChoosePixelFormatARBProc>( | |
| 77 GetGLProcAddress("wglChoosePixelFormatARB")); | |
| 78 DCHECK(fn.wglChoosePixelFormatARBFn); | |
| 79 } | |
| 80 | |
| 81 debug_fn.wglCreatePbufferARBFn = 0; | |
| 82 if (ext.b_WGL_ARB_pbuffer) { | |
| 83 fn.wglCreatePbufferARBFn = reinterpret_cast<wglCreatePbufferARBProc>( | |
| 84 GetGLProcAddress("wglCreatePbufferARB")); | |
| 85 DCHECK(fn.wglCreatePbufferARBFn); | |
| 86 } | |
| 87 | |
| 88 debug_fn.wglDestroyPbufferARBFn = 0; | |
| 89 if (ext.b_WGL_ARB_pbuffer) { | |
| 90 fn.wglDestroyPbufferARBFn = reinterpret_cast<wglDestroyPbufferARBProc>( | |
| 91 GetGLProcAddress("wglDestroyPbufferARB")); | |
| 92 DCHECK(fn.wglDestroyPbufferARBFn); | |
| 93 } | |
| 94 | |
| 95 debug_fn.wglGetPbufferDCARBFn = 0; | |
| 96 if (ext.b_WGL_ARB_pbuffer) { | |
| 97 fn.wglGetPbufferDCARBFn = reinterpret_cast<wglGetPbufferDCARBProc>( | |
| 98 GetGLProcAddress("wglGetPbufferDCARB")); | |
| 99 DCHECK(fn.wglGetPbufferDCARBFn); | |
| 100 } | |
| 101 | |
| 102 debug_fn.wglQueryPbufferARBFn = 0; | |
| 103 if (ext.b_WGL_ARB_pbuffer) { | |
| 104 fn.wglQueryPbufferARBFn = reinterpret_cast<wglQueryPbufferARBProc>( | |
| 105 GetGLProcAddress("wglQueryPbufferARB")); | |
| 106 DCHECK(fn.wglQueryPbufferARBFn); | |
| 107 } | |
| 108 | |
| 109 debug_fn.wglReleasePbufferDCARBFn = 0; | |
| 110 if (ext.b_WGL_ARB_pbuffer) { | |
| 111 fn.wglReleasePbufferDCARBFn = reinterpret_cast<wglReleasePbufferDCARBProc>( | |
| 112 GetGLProcAddress("wglReleasePbufferDCARB")); | |
| 113 DCHECK(fn.wglReleasePbufferDCARBFn); | |
| 114 } | |
| 115 | |
| 116 debug_fn.wglSwapIntervalEXTFn = 0; | |
| 117 if (ext.b_WGL_EXT_swap_control) { | |
| 118 fn.wglSwapIntervalEXTFn = reinterpret_cast<wglSwapIntervalEXTProc>( | |
| 119 GetGLProcAddress("wglSwapIntervalEXT")); | |
| 120 DCHECK(fn.wglSwapIntervalEXTFn); | |
| 121 } | |
| 122 | |
| 123 if (g_debugBindingsInitialized) | 85 if (g_debugBindingsInitialized) |
| 124 InitializeDebugBindings(); | 86 InitializeDebugBindings(); |
| 125 } | 87 } |
| 126 | 88 |
| 127 extern "C" { | 89 extern "C" { |
| 128 | 90 |
| 129 static BOOL GL_BINDING_CALL | 91 static BOOL GL_BINDING_CALL |
| 130 Debug_wglChoosePixelFormatARB(HDC dc, | 92 Debug_wglChoosePixelFormatARB(HDC dc, |
| 131 const int* int_attrib_list, | 93 const int* int_attrib_list, |
| 132 const float* float_attrib_list, | 94 const float* float_attrib_list, |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapIntervalEXT") | 528 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapIntervalEXT") |
| 567 return wgl_api_->wglSwapIntervalEXTFn(interval); | 529 return wgl_api_->wglSwapIntervalEXTFn(interval); |
| 568 } | 530 } |
| 569 | 531 |
| 570 BOOL TraceWGLApi::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { | 532 BOOL TraceWGLApi::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { |
| 571 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapLayerBuffers") | 533 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapLayerBuffers") |
| 572 return wgl_api_->wglSwapLayerBuffersFn(hdc, fuPlanes); | 534 return wgl_api_->wglSwapLayerBuffersFn(hdc, fuPlanes); |
| 573 } | 535 } |
| 574 | 536 |
| 575 } // namespace gfx | 537 } // namespace gfx |
| OLD | NEW |