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_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 BOOL wglChoosePixelFormatARBNotBound(HDC dc, |
| 27 const int* int_attrib_list, |
| 28 const float* float_attrib_list, |
| 29 UINT max_formats, |
| 30 int* formats, |
| 31 UINT* num_formats) { |
| 32 NOTREACHED(); |
| 33 return 0; |
| 34 } |
| 35 HPBUFFERARB wglCreatePbufferARBNotBound(HDC hDC, |
| 36 int iPixelFormat, |
| 37 int iWidth, |
| 38 int iHeight, |
| 39 const int* piAttribList) { |
| 40 NOTREACHED(); |
| 41 return 0; |
| 42 } |
| 43 BOOL wglDestroyPbufferARBNotBound(HPBUFFERARB hPbuffer) { |
| 44 NOTREACHED(); |
| 45 return 0; |
| 46 } |
| 47 HDC wglGetPbufferDCARBNotBound(HPBUFFERARB hPbuffer) { |
| 48 NOTREACHED(); |
| 49 return 0; |
| 50 } |
| 51 BOOL wglQueryPbufferARBNotBound(HPBUFFERARB hPbuffer, |
| 52 int iAttribute, |
| 53 int* piValue) { |
| 54 NOTREACHED(); |
| 55 return 0; |
| 56 } |
| 57 int wglReleasePbufferDCARBNotBound(HPBUFFERARB hPbuffer, HDC hDC) { |
| 58 NOTREACHED(); |
| 59 return 0; |
| 60 } |
| 61 BOOL wglSwapIntervalEXTNotBound(int interval) { |
| 62 NOTREACHED(); |
| 63 return 0; |
| 64 } |
| 65 |
26 void DriverWGL::InitializeStaticBindings() { | 66 void DriverWGL::InitializeStaticBindings() { |
27 fn.wglChoosePixelFormatARBFn = reinterpret_cast<wglChoosePixelFormatARBProc>( | 67 fn.wglChoosePixelFormatARBFn = reinterpret_cast<wglChoosePixelFormatARBProc>( |
28 GetGLProcAddress("wglChoosePixelFormatARB")); | 68 wglChoosePixelFormatARBNotBound); |
29 fn.wglCopyContextFn = | 69 fn.wglCopyContextFn = |
30 reinterpret_cast<wglCopyContextProc>(GetGLProcAddress("wglCopyContext")); | 70 reinterpret_cast<wglCopyContextProc>(GetGLProcAddress("wglCopyContext")); |
31 fn.wglCreateContextFn = reinterpret_cast<wglCreateContextProc>( | 71 fn.wglCreateContextFn = reinterpret_cast<wglCreateContextProc>( |
32 GetGLProcAddress("wglCreateContext")); | 72 GetGLProcAddress("wglCreateContext")); |
33 fn.wglCreateLayerContextFn = reinterpret_cast<wglCreateLayerContextProc>( | 73 fn.wglCreateLayerContextFn = reinterpret_cast<wglCreateLayerContextProc>( |
34 GetGLProcAddress("wglCreateLayerContext")); | 74 GetGLProcAddress("wglCreateLayerContext")); |
35 fn.wglCreatePbufferARBFn = reinterpret_cast<wglCreatePbufferARBProc>( | 75 fn.wglCreatePbufferARBFn = |
36 GetGLProcAddress("wglCreatePbufferARB")); | 76 reinterpret_cast<wglCreatePbufferARBProc>(wglCreatePbufferARBNotBound); |
37 fn.wglDeleteContextFn = reinterpret_cast<wglDeleteContextProc>( | 77 fn.wglDeleteContextFn = reinterpret_cast<wglDeleteContextProc>( |
38 GetGLProcAddress("wglDeleteContext")); | 78 GetGLProcAddress("wglDeleteContext")); |
39 fn.wglDestroyPbufferARBFn = reinterpret_cast<wglDestroyPbufferARBProc>( | 79 fn.wglDestroyPbufferARBFn = |
40 GetGLProcAddress("wglDestroyPbufferARB")); | 80 reinterpret_cast<wglDestroyPbufferARBProc>(wglDestroyPbufferARBNotBound); |
41 fn.wglGetCurrentContextFn = reinterpret_cast<wglGetCurrentContextProc>( | 81 fn.wglGetCurrentContextFn = reinterpret_cast<wglGetCurrentContextProc>( |
42 GetGLProcAddress("wglGetCurrentContext")); | 82 GetGLProcAddress("wglGetCurrentContext")); |
43 fn.wglGetCurrentDCFn = reinterpret_cast<wglGetCurrentDCProc>( | 83 fn.wglGetCurrentDCFn = reinterpret_cast<wglGetCurrentDCProc>( |
44 GetGLProcAddress("wglGetCurrentDC")); | 84 GetGLProcAddress("wglGetCurrentDC")); |
45 fn.wglGetExtensionsStringARBFn = | 85 fn.wglGetExtensionsStringARBFn = |
46 reinterpret_cast<wglGetExtensionsStringARBProc>( | 86 reinterpret_cast<wglGetExtensionsStringARBProc>( |
47 GetGLProcAddress("wglGetExtensionsStringARB")); | 87 GetGLProcAddress("wglGetExtensionsStringARB")); |
48 fn.wglGetExtensionsStringEXTFn = | 88 fn.wglGetExtensionsStringEXTFn = |
49 reinterpret_cast<wglGetExtensionsStringEXTProc>( | 89 reinterpret_cast<wglGetExtensionsStringEXTProc>( |
50 GetGLProcAddress("wglGetExtensionsStringEXT")); | 90 GetGLProcAddress("wglGetExtensionsStringEXT")); |
51 fn.wglGetPbufferDCARBFn = reinterpret_cast<wglGetPbufferDCARBProc>( | 91 fn.wglGetPbufferDCARBFn = |
52 GetGLProcAddress("wglGetPbufferDCARB")); | 92 reinterpret_cast<wglGetPbufferDCARBProc>(wglGetPbufferDCARBNotBound); |
53 fn.wglMakeCurrentFn = | 93 fn.wglMakeCurrentFn = |
54 reinterpret_cast<wglMakeCurrentProc>(GetGLProcAddress("wglMakeCurrent")); | 94 reinterpret_cast<wglMakeCurrentProc>(GetGLProcAddress("wglMakeCurrent")); |
55 fn.wglQueryPbufferARBFn = reinterpret_cast<wglQueryPbufferARBProc>( | 95 fn.wglQueryPbufferARBFn = |
56 GetGLProcAddress("wglQueryPbufferARB")); | 96 reinterpret_cast<wglQueryPbufferARBProc>(wglQueryPbufferARBNotBound); |
57 fn.wglReleasePbufferDCARBFn = reinterpret_cast<wglReleasePbufferDCARBProc>( | 97 fn.wglReleasePbufferDCARBFn = reinterpret_cast<wglReleasePbufferDCARBProc>( |
58 GetGLProcAddress("wglReleasePbufferDCARB")); | 98 wglReleasePbufferDCARBNotBound); |
59 fn.wglShareListsFn = | 99 fn.wglShareListsFn = |
60 reinterpret_cast<wglShareListsProc>(GetGLProcAddress("wglShareLists")); | 100 reinterpret_cast<wglShareListsProc>(GetGLProcAddress("wglShareLists")); |
61 fn.wglSwapIntervalEXTFn = reinterpret_cast<wglSwapIntervalEXTProc>( | 101 fn.wglSwapIntervalEXTFn = |
62 GetGLProcAddress("wglSwapIntervalEXT")); | 102 reinterpret_cast<wglSwapIntervalEXTProc>(wglSwapIntervalEXTNotBound); |
63 fn.wglSwapLayerBuffersFn = reinterpret_cast<wglSwapLayerBuffersProc>( | 103 fn.wglSwapLayerBuffersFn = reinterpret_cast<wglSwapLayerBuffersProc>( |
64 GetGLProcAddress("wglSwapLayerBuffers")); | 104 GetGLProcAddress("wglSwapLayerBuffers")); |
65 } | 105 std::string extensions(GetPlatformExtensions()); |
66 | 106 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); | 107 ALLOW_UNUSED_LOCAL(extensions); |
73 | 108 |
74 ext.b_WGL_ARB_extensions_string = | 109 ext.b_WGL_ARB_extensions_string = |
75 extensions.find("WGL_ARB_extensions_string ") != std::string::npos; | 110 extensions.find("WGL_ARB_extensions_string ") != std::string::npos; |
76 ext.b_WGL_ARB_pbuffer = | 111 ext.b_WGL_ARB_pbuffer = |
77 extensions.find("WGL_ARB_pbuffer ") != std::string::npos; | 112 extensions.find("WGL_ARB_pbuffer ") != std::string::npos; |
78 ext.b_WGL_ARB_pixel_format = | 113 ext.b_WGL_ARB_pixel_format = |
79 extensions.find("WGL_ARB_pixel_format ") != std::string::npos; | 114 extensions.find("WGL_ARB_pixel_format ") != std::string::npos; |
80 ext.b_WGL_EXT_extensions_string = | 115 ext.b_WGL_EXT_extensions_string = |
81 extensions.find("WGL_EXT_extensions_string ") != std::string::npos; | 116 extensions.find("WGL_EXT_extensions_string ") != std::string::npos; |
82 ext.b_WGL_EXT_swap_control = | 117 ext.b_WGL_EXT_swap_control = |
83 extensions.find("WGL_EXT_swap_control ") != std::string::npos; | 118 extensions.find("WGL_EXT_swap_control ") != std::string::npos; |
84 | 119 |
| 120 debug_fn.wglChoosePixelFormatARBFn = 0; |
| 121 if (ext.b_WGL_ARB_pixel_format) { |
| 122 fn.wglChoosePixelFormatARBFn = |
| 123 reinterpret_cast<wglChoosePixelFormatARBProc>( |
| 124 GetGLProcAddress("wglChoosePixelFormatARB")); |
| 125 } |
| 126 DCHECK(fn.wglChoosePixelFormatARBFn); |
| 127 |
| 128 debug_fn.wglCreatePbufferARBFn = 0; |
| 129 if (ext.b_WGL_ARB_pbuffer) { |
| 130 fn.wglCreatePbufferARBFn = reinterpret_cast<wglCreatePbufferARBProc>( |
| 131 GetGLProcAddress("wglCreatePbufferARB")); |
| 132 } |
| 133 DCHECK(fn.wglCreatePbufferARBFn); |
| 134 |
| 135 debug_fn.wglDestroyPbufferARBFn = 0; |
| 136 if (ext.b_WGL_ARB_pbuffer) { |
| 137 fn.wglDestroyPbufferARBFn = reinterpret_cast<wglDestroyPbufferARBProc>( |
| 138 GetGLProcAddress("wglDestroyPbufferARB")); |
| 139 } |
| 140 DCHECK(fn.wglDestroyPbufferARBFn); |
| 141 |
| 142 debug_fn.wglGetPbufferDCARBFn = 0; |
| 143 if (ext.b_WGL_ARB_pbuffer) { |
| 144 fn.wglGetPbufferDCARBFn = reinterpret_cast<wglGetPbufferDCARBProc>( |
| 145 GetGLProcAddress("wglGetPbufferDCARB")); |
| 146 } |
| 147 DCHECK(fn.wglGetPbufferDCARBFn); |
| 148 |
| 149 debug_fn.wglQueryPbufferARBFn = 0; |
| 150 if (ext.b_WGL_ARB_pbuffer) { |
| 151 fn.wglQueryPbufferARBFn = reinterpret_cast<wglQueryPbufferARBProc>( |
| 152 GetGLProcAddress("wglQueryPbufferARB")); |
| 153 } |
| 154 DCHECK(fn.wglQueryPbufferARBFn); |
| 155 |
| 156 debug_fn.wglReleasePbufferDCARBFn = 0; |
| 157 if (ext.b_WGL_ARB_pbuffer) { |
| 158 fn.wglReleasePbufferDCARBFn = reinterpret_cast<wglReleasePbufferDCARBProc>( |
| 159 GetGLProcAddress("wglReleasePbufferDCARB")); |
| 160 } |
| 161 DCHECK(fn.wglReleasePbufferDCARBFn); |
| 162 |
| 163 debug_fn.wglSwapIntervalEXTFn = 0; |
| 164 if (ext.b_WGL_EXT_swap_control) { |
| 165 fn.wglSwapIntervalEXTFn = reinterpret_cast<wglSwapIntervalEXTProc>( |
| 166 GetGLProcAddress("wglSwapIntervalEXT")); |
| 167 } |
| 168 DCHECK(fn.wglSwapIntervalEXTFn); |
| 169 |
85 if (g_debugBindingsInitialized) | 170 if (g_debugBindingsInitialized) |
86 InitializeDebugBindings(); | 171 InitializeDebugBindings(); |
87 } | 172 } |
88 | 173 |
89 extern "C" { | 174 extern "C" { |
90 | 175 |
91 static BOOL GL_BINDING_CALL | 176 static BOOL GL_BINDING_CALL |
92 Debug_wglChoosePixelFormatARB(HDC dc, | 177 Debug_wglChoosePixelFormatARB(HDC dc, |
93 const int* int_attrib_list, | 178 const int* int_attrib_list, |
94 const float* float_attrib_list, | 179 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") | 613 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapIntervalEXT") |
529 return wgl_api_->wglSwapIntervalEXTFn(interval); | 614 return wgl_api_->wglSwapIntervalEXTFn(interval); |
530 } | 615 } |
531 | 616 |
532 BOOL TraceWGLApi::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { | 617 BOOL TraceWGLApi::wglSwapLayerBuffersFn(HDC hdc, UINT fuPlanes) { |
533 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapLayerBuffers") | 618 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::wglSwapLayerBuffers") |
534 return wgl_api_->wglSwapLayerBuffersFn(hdc, fuPlanes); | 619 return wgl_api_->wglSwapLayerBuffersFn(hdc, fuPlanes); |
535 } | 620 } |
536 | 621 |
537 } // namespace gfx | 622 } // namespace gfx |
OLD | NEW |