| 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/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 = reinterpret_cast<wglChoosePixelFormatARBProc>( | 27 fn.wglChoosePixelFormatARBFn = 0; |
| 28 GetGLProcAddress("wglChoosePixelFormatARB")); | |
| 29 fn.wglCopyContextFn = | 28 fn.wglCopyContextFn = |
| 30 reinterpret_cast<wglCopyContextProc>(GetGLProcAddress("wglCopyContext")); | 29 reinterpret_cast<wglCopyContextProc>(GetGLProcAddress("wglCopyContext")); |
| 31 fn.wglCreateContextFn = reinterpret_cast<wglCreateContextProc>( | 30 fn.wglCreateContextFn = reinterpret_cast<wglCreateContextProc>( |
| 32 GetGLProcAddress("wglCreateContext")); | 31 GetGLProcAddress("wglCreateContext")); |
| 33 fn.wglCreateLayerContextFn = reinterpret_cast<wglCreateLayerContextProc>( | 32 fn.wglCreateLayerContextFn = reinterpret_cast<wglCreateLayerContextProc>( |
| 34 GetGLProcAddress("wglCreateLayerContext")); | 33 GetGLProcAddress("wglCreateLayerContext")); |
| 35 fn.wglCreatePbufferARBFn = reinterpret_cast<wglCreatePbufferARBProc>( | 34 fn.wglCreatePbufferARBFn = 0; |
| 36 GetGLProcAddress("wglCreatePbufferARB")); | |
| 37 fn.wglDeleteContextFn = reinterpret_cast<wglDeleteContextProc>( | 35 fn.wglDeleteContextFn = reinterpret_cast<wglDeleteContextProc>( |
| 38 GetGLProcAddress("wglDeleteContext")); | 36 GetGLProcAddress("wglDeleteContext")); |
| 39 fn.wglDestroyPbufferARBFn = reinterpret_cast<wglDestroyPbufferARBProc>( | 37 fn.wglDestroyPbufferARBFn = 0; |
| 40 GetGLProcAddress("wglDestroyPbufferARB")); | |
| 41 fn.wglGetCurrentContextFn = reinterpret_cast<wglGetCurrentContextProc>( | 38 fn.wglGetCurrentContextFn = reinterpret_cast<wglGetCurrentContextProc>( |
| 42 GetGLProcAddress("wglGetCurrentContext")); | 39 GetGLProcAddress("wglGetCurrentContext")); |
| 43 fn.wglGetCurrentDCFn = reinterpret_cast<wglGetCurrentDCProc>( | 40 fn.wglGetCurrentDCFn = reinterpret_cast<wglGetCurrentDCProc>( |
| 44 GetGLProcAddress("wglGetCurrentDC")); | 41 GetGLProcAddress("wglGetCurrentDC")); |
| 45 fn.wglGetExtensionsStringARBFn = | 42 fn.wglGetExtensionsStringARBFn = |
| 46 reinterpret_cast<wglGetExtensionsStringARBProc>( | 43 reinterpret_cast<wglGetExtensionsStringARBProc>( |
| 47 GetGLProcAddress("wglGetExtensionsStringARB")); | 44 GetGLProcAddress("wglGetExtensionsStringARB")); |
| 48 fn.wglGetExtensionsStringEXTFn = | 45 fn.wglGetExtensionsStringEXTFn = |
| 49 reinterpret_cast<wglGetExtensionsStringEXTProc>( | 46 reinterpret_cast<wglGetExtensionsStringEXTProc>( |
| 50 GetGLProcAddress("wglGetExtensionsStringEXT")); | 47 GetGLProcAddress("wglGetExtensionsStringEXT")); |
| 51 fn.wglGetPbufferDCARBFn = reinterpret_cast<wglGetPbufferDCARBProc>( | 48 fn.wglGetPbufferDCARBFn = 0; |
| 52 GetGLProcAddress("wglGetPbufferDCARB")); | |
| 53 fn.wglMakeCurrentFn = | 49 fn.wglMakeCurrentFn = |
| 54 reinterpret_cast<wglMakeCurrentProc>(GetGLProcAddress("wglMakeCurrent")); | 50 reinterpret_cast<wglMakeCurrentProc>(GetGLProcAddress("wglMakeCurrent")); |
| 55 fn.wglQueryPbufferARBFn = reinterpret_cast<wglQueryPbufferARBProc>( | 51 fn.wglQueryPbufferARBFn = 0; |
| 56 GetGLProcAddress("wglQueryPbufferARB")); | 52 fn.wglReleasePbufferDCARBFn = 0; |
| 57 fn.wglReleasePbufferDCARBFn = reinterpret_cast<wglReleasePbufferDCARBProc>( | |
| 58 GetGLProcAddress("wglReleasePbufferDCARB")); | |
| 59 fn.wglShareListsFn = | 53 fn.wglShareListsFn = |
| 60 reinterpret_cast<wglShareListsProc>(GetGLProcAddress("wglShareLists")); | 54 reinterpret_cast<wglShareListsProc>(GetGLProcAddress("wglShareLists")); |
| 61 fn.wglSwapIntervalEXTFn = reinterpret_cast<wglSwapIntervalEXTProc>( | 55 fn.wglSwapIntervalEXTFn = 0; |
| 62 GetGLProcAddress("wglSwapIntervalEXT")); | |
| 63 fn.wglSwapLayerBuffersFn = reinterpret_cast<wglSwapLayerBuffersProc>( | 56 fn.wglSwapLayerBuffersFn = reinterpret_cast<wglSwapLayerBuffersProc>( |
| 64 GetGLProcAddress("wglSwapLayerBuffers")); | 57 GetGLProcAddress("wglSwapLayerBuffers")); |
| 65 } | 58 std::string extensions(GetPlatformExtensions()); |
| 66 | 59 extensions += " "; |
| 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() + " "; | |
| 72 ALLOW_UNUSED_LOCAL(extensions); | 60 ALLOW_UNUSED_LOCAL(extensions); |
| 73 | 61 |
| 74 ext.b_WGL_ARB_extensions_string = | 62 ext.b_WGL_ARB_extensions_string = |
| 75 extensions.find("WGL_ARB_extensions_string ") != std::string::npos; | 63 extensions.find("WGL_ARB_extensions_string ") != std::string::npos; |
| 76 ext.b_WGL_ARB_pbuffer = | 64 ext.b_WGL_ARB_pbuffer = |
| 77 extensions.find("WGL_ARB_pbuffer ") != std::string::npos; | 65 extensions.find("WGL_ARB_pbuffer ") != std::string::npos; |
| 78 ext.b_WGL_ARB_pixel_format = | 66 ext.b_WGL_ARB_pixel_format = |
| 79 extensions.find("WGL_ARB_pixel_format ") != std::string::npos; | 67 extensions.find("WGL_ARB_pixel_format ") != std::string::npos; |
| 80 ext.b_WGL_EXT_extensions_string = | 68 ext.b_WGL_EXT_extensions_string = |
| 81 extensions.find("WGL_EXT_extensions_string ") != std::string::npos; | 69 extensions.find("WGL_EXT_extensions_string ") != std::string::npos; |
| 82 ext.b_WGL_EXT_swap_control = | 70 ext.b_WGL_EXT_swap_control = |
| 83 extensions.find("WGL_EXT_swap_control ") != std::string::npos; | 71 extensions.find("WGL_EXT_swap_control ") != std::string::npos; |
| 84 | 72 |
| 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 |
| 85 if (g_debugBindingsInitialized) | 123 if (g_debugBindingsInitialized) |
| 86 InitializeDebugBindings(); | 124 InitializeDebugBindings(); |
| 87 } | 125 } |
| 88 | 126 |
| 89 extern "C" { | 127 extern "C" { |
| 90 | 128 |
| 91 static BOOL GL_BINDING_CALL | 129 static BOOL GL_BINDING_CALL |
| 92 Debug_wglChoosePixelFormatARB(HDC dc, | 130 Debug_wglChoosePixelFormatARB(HDC dc, |
| 93 const int* int_attrib_list, | 131 const int* int_attrib_list, |
| 94 const float* float_attrib_list, | 132 const float* float_attrib_list, |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapIntervalEXT") | 566 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapIntervalEXT") |
| 529 return wgl_api_->wglSwapIntervalEXTFn(interval); | 567 return wgl_api_->wglSwapIntervalEXTFn(interval); |
| 530 } | 568 } |
| 531 | 569 |
| 532 BOOL TraceWGLApi::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { | 570 BOOL TraceWGLApi::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { |
| 533 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapLayerBuffers") | 571 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapLayerBuffers") |
| 534 return wgl_api_->wglSwapLayerBuffersFn(hdc, fuPlanes); | 572 return wgl_api_->wglSwapLayerBuffersFn(hdc, fuPlanes); |
| 535 } | 573 } |
| 536 | 574 |
| 537 } // namespace gfx | 575 } // namespace gfx |
| OLD | NEW |