Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: ui/gl/gl_bindings_autogen_osmesa.cc

Issue 2629633003: Refactor GL bindings so there is no global GLApi or DriverGL. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_bindings_autogen_glx.cc ('k') | ui/gl/gl_bindings_autogen_wgl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_osmesa_api_implementation.h" 18 #include "ui/gl/gl_osmesa_api_implementation.h"
19 #include "ui/gl/gl_version_info.h" 19 #include "ui/gl/gl_version_info.h"
20 20
21 namespace gl { 21 namespace gl {
22 22
23 static bool g_debugBindingsInitialized;
24 DriverOSMESA g_driver_osmesa; 23 DriverOSMESA g_driver_osmesa;
25 24
26 void DriverOSMESA::InitializeStaticBindings() { 25 void DriverOSMESA::InitializeStaticBindings() {
27 fn.OSMesaColorClampFn = reinterpret_cast<OSMesaColorClampProc>( 26 fn.OSMesaColorClampFn = reinterpret_cast<OSMesaColorClampProc>(
28 GetGLProcAddress("OSMesaColorClamp")); 27 GetGLProcAddress("OSMesaColorClamp"));
29 fn.OSMesaCreateContextFn = reinterpret_cast<OSMesaCreateContextProc>( 28 fn.OSMesaCreateContextFn = reinterpret_cast<OSMesaCreateContextProc>(
30 GetGLProcAddress("OSMesaCreateContext")); 29 GetGLProcAddress("OSMesaCreateContext"));
31 fn.OSMesaCreateContextExtFn = reinterpret_cast<OSMesaCreateContextExtProc>( 30 fn.OSMesaCreateContextExtFn = reinterpret_cast<OSMesaCreateContextExtProc>(
32 GetGLProcAddress("OSMesaCreateContextExt")); 31 GetGLProcAddress("OSMesaCreateContextExt"));
33 fn.OSMesaDestroyContextFn = reinterpret_cast<OSMesaDestroyContextProc>( 32 fn.OSMesaDestroyContextFn = reinterpret_cast<OSMesaDestroyContextProc>(
(...skipping 11 matching lines...) Expand all
45 fn.OSMesaMakeCurrentFn = reinterpret_cast<OSMesaMakeCurrentProc>( 44 fn.OSMesaMakeCurrentFn = reinterpret_cast<OSMesaMakeCurrentProc>(
46 GetGLProcAddress("OSMesaMakeCurrent")); 45 GetGLProcAddress("OSMesaMakeCurrent"));
47 fn.OSMesaPixelStoreFn = reinterpret_cast<OSMesaPixelStoreProc>( 46 fn.OSMesaPixelStoreFn = reinterpret_cast<OSMesaPixelStoreProc>(
48 GetGLProcAddress("OSMesaPixelStore")); 47 GetGLProcAddress("OSMesaPixelStore"));
49 } 48 }
50 49
51 void DriverOSMESA::InitializeExtensionBindings() { 50 void DriverOSMESA::InitializeExtensionBindings() {
52 std::string extensions(GetPlatformExtensions()); 51 std::string extensions(GetPlatformExtensions());
53 extensions += " "; 52 extensions += " ";
54 ALLOW_UNUSED_LOCAL(extensions); 53 ALLOW_UNUSED_LOCAL(extensions);
55
56 if (g_debugBindingsInitialized)
57 InitializeDebugBindings();
58 }
59
60 extern "C" {
61
62 static void GL_BINDING_CALL Debug_OSMesaColorClamp(GLboolean enable) {
63 GL_SERVICE_LOG("OSMesaColorClamp"
64 << "(" << GLEnums::GetStringBool(enable) << ")");
65 DCHECK(g_driver_osmesa.debug_fn.OSMesaColorClampFn != nullptr);
66 g_driver_osmesa.debug_fn.OSMesaColorClampFn(enable);
67 }
68
69 static OSMesaContext GL_BINDING_CALL
70 Debug_OSMesaCreateContext(GLenum format, OSMesaContext sharelist) {
71 GL_SERVICE_LOG("OSMesaCreateContext"
72 << "(" << GLEnums::GetStringEnum(format) << ", " << sharelist
73 << ")");
74 DCHECK(g_driver_osmesa.debug_fn.OSMesaCreateContextFn != nullptr);
75 OSMesaContext result =
76 g_driver_osmesa.debug_fn.OSMesaCreateContextFn(format, sharelist);
77 GL_SERVICE_LOG("GL_RESULT: " << result);
78 return result;
79 }
80
81 static OSMesaContext GL_BINDING_CALL
82 Debug_OSMesaCreateContextExt(GLenum format,
83 GLint depthBits,
84 GLint stencilBits,
85 GLint accumBits,
86 OSMesaContext sharelist) {
87 GL_SERVICE_LOG("OSMesaCreateContextExt"
88 << "(" << GLEnums::GetStringEnum(format) << ", " << depthBits
89 << ", " << stencilBits << ", " << accumBits << ", "
90 << sharelist << ")");
91 DCHECK(g_driver_osmesa.debug_fn.OSMesaCreateContextExtFn != nullptr);
92 OSMesaContext result = g_driver_osmesa.debug_fn.OSMesaCreateContextExtFn(
93 format, depthBits, stencilBits, accumBits, sharelist);
94 GL_SERVICE_LOG("GL_RESULT: " << result);
95 return result;
96 }
97
98 static void GL_BINDING_CALL Debug_OSMesaDestroyContext(OSMesaContext ctx) {
99 GL_SERVICE_LOG("OSMesaDestroyContext"
100 << "(" << ctx << ")");
101 DCHECK(g_driver_osmesa.debug_fn.OSMesaDestroyContextFn != nullptr);
102 g_driver_osmesa.debug_fn.OSMesaDestroyContextFn(ctx);
103 }
104
105 static GLboolean GL_BINDING_CALL Debug_OSMesaGetColorBuffer(OSMesaContext c,
106 GLint* width,
107 GLint* height,
108 GLint* format,
109 void** buffer) {
110 GL_SERVICE_LOG("OSMesaGetColorBuffer"
111 << "(" << c << ", " << static_cast<const void*>(width) << ", "
112 << static_cast<const void*>(height) << ", "
113 << static_cast<const void*>(format) << ", " << buffer << ")");
114 DCHECK(g_driver_osmesa.debug_fn.OSMesaGetColorBufferFn != nullptr);
115 GLboolean result = g_driver_osmesa.debug_fn.OSMesaGetColorBufferFn(
116 c, width, height, format, buffer);
117 GL_SERVICE_LOG("GL_RESULT: " << result);
118 return result;
119 }
120
121 static OSMesaContext GL_BINDING_CALL Debug_OSMesaGetCurrentContext(void) {
122 GL_SERVICE_LOG("OSMesaGetCurrentContext"
123 << "("
124 << ")");
125 DCHECK(g_driver_osmesa.debug_fn.OSMesaGetCurrentContextFn != nullptr);
126 OSMesaContext result = g_driver_osmesa.debug_fn.OSMesaGetCurrentContextFn();
127 GL_SERVICE_LOG("GL_RESULT: " << result);
128 return result;
129 }
130
131 static GLboolean GL_BINDING_CALL
132 Debug_OSMesaGetDepthBuffer(OSMesaContext c,
133 GLint* width,
134 GLint* height,
135 GLint* bytesPerValue,
136 void** buffer) {
137 GL_SERVICE_LOG("OSMesaGetDepthBuffer"
138 << "(" << c << ", " << static_cast<const void*>(width) << ", "
139 << static_cast<const void*>(height) << ", "
140 << static_cast<const void*>(bytesPerValue) << ", " << buffer
141 << ")");
142 DCHECK(g_driver_osmesa.debug_fn.OSMesaGetDepthBufferFn != nullptr);
143 GLboolean result = g_driver_osmesa.debug_fn.OSMesaGetDepthBufferFn(
144 c, width, height, bytesPerValue, buffer);
145 GL_SERVICE_LOG("GL_RESULT: " << result);
146 return result;
147 }
148
149 static void GL_BINDING_CALL Debug_OSMesaGetIntegerv(GLint pname, GLint* value) {
150 GL_SERVICE_LOG("OSMesaGetIntegerv"
151 << "(" << pname << ", " << static_cast<const void*>(value)
152 << ")");
153 DCHECK(g_driver_osmesa.debug_fn.OSMesaGetIntegervFn != nullptr);
154 g_driver_osmesa.debug_fn.OSMesaGetIntegervFn(pname, value);
155 }
156
157 static OSMESAproc GL_BINDING_CALL
158 Debug_OSMesaGetProcAddress(const char* funcName) {
159 GL_SERVICE_LOG("OSMesaGetProcAddress"
160 << "(" << funcName << ")");
161 DCHECK(g_driver_osmesa.debug_fn.OSMesaGetProcAddressFn != nullptr);
162 OSMESAproc result = g_driver_osmesa.debug_fn.OSMesaGetProcAddressFn(funcName);
163 GL_SERVICE_LOG("GL_RESULT: " << result);
164 return result;
165 }
166
167 static GLboolean GL_BINDING_CALL Debug_OSMesaMakeCurrent(OSMesaContext ctx,
168 void* buffer,
169 GLenum type,
170 GLsizei width,
171 GLsizei height) {
172 GL_SERVICE_LOG("OSMesaMakeCurrent"
173 << "(" << ctx << ", " << static_cast<const void*>(buffer)
174 << ", " << GLEnums::GetStringEnum(type) << ", " << width
175 << ", " << height << ")");
176 DCHECK(g_driver_osmesa.debug_fn.OSMesaMakeCurrentFn != nullptr);
177 GLboolean result = g_driver_osmesa.debug_fn.OSMesaMakeCurrentFn(
178 ctx, buffer, type, width, height);
179 GL_SERVICE_LOG("GL_RESULT: " << result);
180 return result;
181 }
182
183 static void GL_BINDING_CALL Debug_OSMesaPixelStore(GLint pname, GLint value) {
184 GL_SERVICE_LOG("OSMesaPixelStore"
185 << "(" << pname << ", " << value << ")");
186 DCHECK(g_driver_osmesa.debug_fn.OSMesaPixelStoreFn != nullptr);
187 g_driver_osmesa.debug_fn.OSMesaPixelStoreFn(pname, value);
188 }
189 } // extern "C"
190
191 void DriverOSMESA::InitializeDebugBindings() {
192 if (!debug_fn.OSMesaColorClampFn) {
193 debug_fn.OSMesaColorClampFn = fn.OSMesaColorClampFn;
194 fn.OSMesaColorClampFn = Debug_OSMesaColorClamp;
195 }
196 if (!debug_fn.OSMesaCreateContextFn) {
197 debug_fn.OSMesaCreateContextFn = fn.OSMesaCreateContextFn;
198 fn.OSMesaCreateContextFn = Debug_OSMesaCreateContext;
199 }
200 if (!debug_fn.OSMesaCreateContextExtFn) {
201 debug_fn.OSMesaCreateContextExtFn = fn.OSMesaCreateContextExtFn;
202 fn.OSMesaCreateContextExtFn = Debug_OSMesaCreateContextExt;
203 }
204 if (!debug_fn.OSMesaDestroyContextFn) {
205 debug_fn.OSMesaDestroyContextFn = fn.OSMesaDestroyContextFn;
206 fn.OSMesaDestroyContextFn = Debug_OSMesaDestroyContext;
207 }
208 if (!debug_fn.OSMesaGetColorBufferFn) {
209 debug_fn.OSMesaGetColorBufferFn = fn.OSMesaGetColorBufferFn;
210 fn.OSMesaGetColorBufferFn = Debug_OSMesaGetColorBuffer;
211 }
212 if (!debug_fn.OSMesaGetCurrentContextFn) {
213 debug_fn.OSMesaGetCurrentContextFn = fn.OSMesaGetCurrentContextFn;
214 fn.OSMesaGetCurrentContextFn = Debug_OSMesaGetCurrentContext;
215 }
216 if (!debug_fn.OSMesaGetDepthBufferFn) {
217 debug_fn.OSMesaGetDepthBufferFn = fn.OSMesaGetDepthBufferFn;
218 fn.OSMesaGetDepthBufferFn = Debug_OSMesaGetDepthBuffer;
219 }
220 if (!debug_fn.OSMesaGetIntegervFn) {
221 debug_fn.OSMesaGetIntegervFn = fn.OSMesaGetIntegervFn;
222 fn.OSMesaGetIntegervFn = Debug_OSMesaGetIntegerv;
223 }
224 if (!debug_fn.OSMesaGetProcAddressFn) {
225 debug_fn.OSMesaGetProcAddressFn = fn.OSMesaGetProcAddressFn;
226 fn.OSMesaGetProcAddressFn = Debug_OSMesaGetProcAddress;
227 }
228 if (!debug_fn.OSMesaMakeCurrentFn) {
229 debug_fn.OSMesaMakeCurrentFn = fn.OSMesaMakeCurrentFn;
230 fn.OSMesaMakeCurrentFn = Debug_OSMesaMakeCurrent;
231 }
232 if (!debug_fn.OSMesaPixelStoreFn) {
233 debug_fn.OSMesaPixelStoreFn = fn.OSMesaPixelStoreFn;
234 fn.OSMesaPixelStoreFn = Debug_OSMesaPixelStore;
235 }
236 g_debugBindingsInitialized = true;
237 } 54 }
238 55
239 void DriverOSMESA::ClearBindings() { 56 void DriverOSMESA::ClearBindings() {
240 memset(this, 0, sizeof(*this)); 57 memset(this, 0, sizeof(*this));
241 } 58 }
242 59
243 void OSMESAApiBase::OSMesaColorClampFn(GLboolean enable) { 60 void OSMESAApiBase::OSMesaColorClampFn(GLboolean enable) {
244 driver_->fn.OSMesaColorClampFn(enable); 61 driver_->fn.OSMesaColorClampFn(enable);
245 } 62 }
246 63
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 GLsizei height) { 188 GLsizei height) {
372 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaMakeCurrent") 189 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaMakeCurrent")
373 return osmesa_api_->OSMesaMakeCurrentFn(ctx, buffer, type, width, height); 190 return osmesa_api_->OSMesaMakeCurrentFn(ctx, buffer, type, width, height);
374 } 191 }
375 192
376 void TraceOSMESAApi::OSMesaPixelStoreFn(GLint pname, GLint value) { 193 void TraceOSMESAApi::OSMesaPixelStoreFn(GLint pname, GLint value) {
377 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaPixelStore") 194 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaPixelStore")
378 osmesa_api_->OSMesaPixelStoreFn(pname, value); 195 osmesa_api_->OSMesaPixelStoreFn(pname, value);
379 } 196 }
380 197
198 void DebugOSMESAApi::OSMesaColorClampFn(GLboolean enable) {
199 GL_SERVICE_LOG("OSMesaColorClamp"
200 << "(" << GLEnums::GetStringBool(enable) << ")");
201 osmesa_api_->OSMesaColorClampFn(enable);
202 }
203
204 OSMesaContext DebugOSMESAApi::OSMesaCreateContextFn(GLenum format,
205 OSMesaContext sharelist) {
206 GL_SERVICE_LOG("OSMesaCreateContext"
207 << "(" << GLEnums::GetStringEnum(format) << ", " << sharelist
208 << ")");
209 OSMesaContext result = osmesa_api_->OSMesaCreateContextFn(format, sharelist);
210 GL_SERVICE_LOG("GL_RESULT: " << result);
211 return result;
212 }
213
214 OSMesaContext DebugOSMESAApi::OSMesaCreateContextExtFn(
215 GLenum format,
216 GLint depthBits,
217 GLint stencilBits,
218 GLint accumBits,
219 OSMesaContext sharelist) {
220 GL_SERVICE_LOG("OSMesaCreateContextExt"
221 << "(" << GLEnums::GetStringEnum(format) << ", " << depthBits
222 << ", " << stencilBits << ", " << accumBits << ", "
223 << sharelist << ")");
224 OSMesaContext result = osmesa_api_->OSMesaCreateContextExtFn(
225 format, depthBits, stencilBits, accumBits, sharelist);
226 GL_SERVICE_LOG("GL_RESULT: " << result);
227 return result;
228 }
229
230 void DebugOSMESAApi::OSMesaDestroyContextFn(OSMesaContext ctx) {
231 GL_SERVICE_LOG("OSMesaDestroyContext"
232 << "(" << ctx << ")");
233 osmesa_api_->OSMesaDestroyContextFn(ctx);
234 }
235
236 GLboolean DebugOSMESAApi::OSMesaGetColorBufferFn(OSMesaContext c,
237 GLint* width,
238 GLint* height,
239 GLint* format,
240 void** buffer) {
241 GL_SERVICE_LOG("OSMesaGetColorBuffer"
242 << "(" << c << ", " << static_cast<const void*>(width) << ", "
243 << static_cast<const void*>(height) << ", "
244 << static_cast<const void*>(format) << ", " << buffer << ")");
245 GLboolean result =
246 osmesa_api_->OSMesaGetColorBufferFn(c, width, height, format, buffer);
247 GL_SERVICE_LOG("GL_RESULT: " << result);
248 return result;
249 }
250
251 OSMesaContext DebugOSMESAApi::OSMesaGetCurrentContextFn(void) {
252 GL_SERVICE_LOG("OSMesaGetCurrentContext"
253 << "("
254 << ")");
255 OSMesaContext result = osmesa_api_->OSMesaGetCurrentContextFn();
256 GL_SERVICE_LOG("GL_RESULT: " << result);
257 return result;
258 }
259
260 GLboolean DebugOSMESAApi::OSMesaGetDepthBufferFn(OSMesaContext c,
261 GLint* width,
262 GLint* height,
263 GLint* bytesPerValue,
264 void** buffer) {
265 GL_SERVICE_LOG("OSMesaGetDepthBuffer"
266 << "(" << c << ", " << static_cast<const void*>(width) << ", "
267 << static_cast<const void*>(height) << ", "
268 << static_cast<const void*>(bytesPerValue) << ", " << buffer
269 << ")");
270 GLboolean result = osmesa_api_->OSMesaGetDepthBufferFn(c, width, height,
271 bytesPerValue, buffer);
272 GL_SERVICE_LOG("GL_RESULT: " << result);
273 return result;
274 }
275
276 void DebugOSMESAApi::OSMesaGetIntegervFn(GLint pname, GLint* value) {
277 GL_SERVICE_LOG("OSMesaGetIntegerv"
278 << "(" << pname << ", " << static_cast<const void*>(value)
279 << ")");
280 osmesa_api_->OSMesaGetIntegervFn(pname, value);
281 }
282
283 OSMESAproc DebugOSMESAApi::OSMesaGetProcAddressFn(const char* funcName) {
284 GL_SERVICE_LOG("OSMesaGetProcAddress"
285 << "(" << funcName << ")");
286 OSMESAproc result = osmesa_api_->OSMesaGetProcAddressFn(funcName);
287 GL_SERVICE_LOG("GL_RESULT: " << result);
288 return result;
289 }
290
291 GLboolean DebugOSMESAApi::OSMesaMakeCurrentFn(OSMesaContext ctx,
292 void* buffer,
293 GLenum type,
294 GLsizei width,
295 GLsizei height) {
296 GL_SERVICE_LOG("OSMesaMakeCurrent"
297 << "(" << ctx << ", " << static_cast<const void*>(buffer)
298 << ", " << GLEnums::GetStringEnum(type) << ", " << width
299 << ", " << height << ")");
300 GLboolean result =
301 osmesa_api_->OSMesaMakeCurrentFn(ctx, buffer, type, width, height);
302 GL_SERVICE_LOG("GL_RESULT: " << result);
303 return result;
304 }
305
306 void DebugOSMESAApi::OSMesaPixelStoreFn(GLint pname, GLint value) {
307 GL_SERVICE_LOG("OSMesaPixelStore"
308 << "(" << pname << ", " << value << ")");
309 osmesa_api_->OSMesaPixelStoreFn(pname, value);
310 }
311
381 } // namespace gl 312 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_bindings_autogen_glx.cc ('k') | ui/gl/gl_bindings_autogen_wgl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698