OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 // |
| 5 // This file is auto-generated from |
| 6 // ui/gl/generate_bindings.py |
| 7 // It's formatted by clang-format using chromium coding style: |
| 8 // clang-format -i -style=chromium filename |
| 9 // DO NOT EDIT! |
| 10 |
| 11 #include <string> |
| 12 |
| 13 #include "base/debug/trace_event.h" |
| 14 #include "ui/gl/gl_bindings.h" |
| 15 #include "ui/gl/gl_context.h" |
| 16 #include "ui/gl/gl_enums.h" |
| 17 #include "ui/gl/gl_implementation.h" |
| 18 #include "ui/gl/gl_osmesa_api_implementation.h" |
| 19 #include "ui/gl/gl_version_info.h" |
| 20 |
| 21 namespace gfx { |
| 22 |
| 23 static bool g_debugBindingsInitialized; |
| 24 DriverOSMESA g_driver_osmesa; |
| 25 |
| 26 void DriverOSMESA::InitializeStaticBindings() { |
| 27 fn.OSMesaColorClampFn = reinterpret_cast<OSMesaColorClampProc>( |
| 28 GetGLProcAddress("OSMesaColorClamp")); |
| 29 fn.OSMesaCreateContextFn = reinterpret_cast<OSMesaCreateContextProc>( |
| 30 GetGLProcAddress("OSMesaCreateContext")); |
| 31 fn.OSMesaCreateContextExtFn = reinterpret_cast<OSMesaCreateContextExtProc>( |
| 32 GetGLProcAddress("OSMesaCreateContextExt")); |
| 33 fn.OSMesaDestroyContextFn = reinterpret_cast<OSMesaDestroyContextProc>( |
| 34 GetGLProcAddress("OSMesaDestroyContext")); |
| 35 fn.OSMesaGetColorBufferFn = reinterpret_cast<OSMesaGetColorBufferProc>( |
| 36 GetGLProcAddress("OSMesaGetColorBuffer")); |
| 37 fn.OSMesaGetCurrentContextFn = reinterpret_cast<OSMesaGetCurrentContextProc>( |
| 38 GetGLProcAddress("OSMesaGetCurrentContext")); |
| 39 fn.OSMesaGetDepthBufferFn = reinterpret_cast<OSMesaGetDepthBufferProc>( |
| 40 GetGLProcAddress("OSMesaGetDepthBuffer")); |
| 41 fn.OSMesaGetIntegervFn = reinterpret_cast<OSMesaGetIntegervProc>( |
| 42 GetGLProcAddress("OSMesaGetIntegerv")); |
| 43 fn.OSMesaGetProcAddressFn = reinterpret_cast<OSMesaGetProcAddressProc>( |
| 44 GetGLProcAddress("OSMesaGetProcAddress")); |
| 45 fn.OSMesaMakeCurrentFn = reinterpret_cast<OSMesaMakeCurrentProc>( |
| 46 GetGLProcAddress("OSMesaMakeCurrent")); |
| 47 fn.OSMesaPixelStoreFn = reinterpret_cast<OSMesaPixelStoreProc>( |
| 48 GetGLProcAddress("OSMesaPixelStore")); |
| 49 } |
| 50 |
| 51 void DriverOSMESA::InitializeDynamicBindings(GLContext* context) { |
| 52 DCHECK(context && context->IsCurrent(NULL)); |
| 53 const GLVersionInfo* ver = context->GetVersionInfo(); |
| 54 ALLOW_UNUSED_LOCAL(ver); |
| 55 std::string extensions = context->GetExtensions() + " "; |
| 56 ALLOW_UNUSED_LOCAL(extensions); |
| 57 |
| 58 if (g_debugBindingsInitialized) |
| 59 InitializeDebugBindings(); |
| 60 } |
| 61 |
| 62 extern "C" { |
| 63 |
| 64 static void GL_BINDING_CALL Debug_OSMesaColorClamp(GLboolean enable) { |
| 65 GL_SERVICE_LOG("OSMesaColorClamp" |
| 66 << "(" << GLEnums::GetStringBool(enable) << ")"); |
| 67 g_driver_osmesa.debug_fn.OSMesaColorClampFn(enable); |
| 68 } |
| 69 |
| 70 static OSMesaContext GL_BINDING_CALL |
| 71 Debug_OSMesaCreateContext(GLenum format, OSMesaContext sharelist) { |
| 72 GL_SERVICE_LOG("OSMesaCreateContext" |
| 73 << "(" << GLEnums::GetStringEnum(format) << ", " << sharelist |
| 74 << ")"); |
| 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 OSMesaContext result = g_driver_osmesa.debug_fn.OSMesaCreateContextExtFn( |
| 92 format, depthBits, stencilBits, accumBits, sharelist); |
| 93 GL_SERVICE_LOG("GL_RESULT: " << result); |
| 94 return result; |
| 95 } |
| 96 |
| 97 static void GL_BINDING_CALL Debug_OSMesaDestroyContext(OSMesaContext ctx) { |
| 98 GL_SERVICE_LOG("OSMesaDestroyContext" |
| 99 << "(" << ctx << ")"); |
| 100 g_driver_osmesa.debug_fn.OSMesaDestroyContextFn(ctx); |
| 101 } |
| 102 |
| 103 static GLboolean GL_BINDING_CALL Debug_OSMesaGetColorBuffer(OSMesaContext c, |
| 104 GLint* width, |
| 105 GLint* height, |
| 106 GLint* format, |
| 107 void** buffer) { |
| 108 GL_SERVICE_LOG("OSMesaGetColorBuffer" |
| 109 << "(" << c << ", " << static_cast<const void*>(width) << ", " |
| 110 << static_cast<const void*>(height) << ", " |
| 111 << static_cast<const void*>(format) << ", " << buffer << ")"); |
| 112 GLboolean result = g_driver_osmesa.debug_fn.OSMesaGetColorBufferFn( |
| 113 c, width, height, format, buffer); |
| 114 GL_SERVICE_LOG("GL_RESULT: " << result); |
| 115 return result; |
| 116 } |
| 117 |
| 118 static OSMesaContext GL_BINDING_CALL Debug_OSMesaGetCurrentContext(void) { |
| 119 GL_SERVICE_LOG("OSMesaGetCurrentContext" |
| 120 << "(" |
| 121 << ")"); |
| 122 OSMesaContext result = g_driver_osmesa.debug_fn.OSMesaGetCurrentContextFn(); |
| 123 GL_SERVICE_LOG("GL_RESULT: " << result); |
| 124 return result; |
| 125 } |
| 126 |
| 127 static GLboolean GL_BINDING_CALL |
| 128 Debug_OSMesaGetDepthBuffer(OSMesaContext c, |
| 129 GLint* width, |
| 130 GLint* height, |
| 131 GLint* bytesPerValue, |
| 132 void** buffer) { |
| 133 GL_SERVICE_LOG("OSMesaGetDepthBuffer" |
| 134 << "(" << c << ", " << static_cast<const void*>(width) << ", " |
| 135 << static_cast<const void*>(height) << ", " |
| 136 << static_cast<const void*>(bytesPerValue) << ", " << buffer |
| 137 << ")"); |
| 138 GLboolean result = g_driver_osmesa.debug_fn.OSMesaGetDepthBufferFn( |
| 139 c, width, height, bytesPerValue, buffer); |
| 140 GL_SERVICE_LOG("GL_RESULT: " << result); |
| 141 return result; |
| 142 } |
| 143 |
| 144 static void GL_BINDING_CALL Debug_OSMesaGetIntegerv(GLint pname, GLint* value) { |
| 145 GL_SERVICE_LOG("OSMesaGetIntegerv" |
| 146 << "(" << pname << ", " << static_cast<const void*>(value) |
| 147 << ")"); |
| 148 g_driver_osmesa.debug_fn.OSMesaGetIntegervFn(pname, value); |
| 149 } |
| 150 |
| 151 static OSMESAproc GL_BINDING_CALL |
| 152 Debug_OSMesaGetProcAddress(const char* funcName) { |
| 153 GL_SERVICE_LOG("OSMesaGetProcAddress" |
| 154 << "(" << funcName << ")"); |
| 155 OSMESAproc result = g_driver_osmesa.debug_fn.OSMesaGetProcAddressFn(funcName); |
| 156 GL_SERVICE_LOG("GL_RESULT: " << result); |
| 157 return result; |
| 158 } |
| 159 |
| 160 static GLboolean GL_BINDING_CALL Debug_OSMesaMakeCurrent(OSMesaContext ctx, |
| 161 void* buffer, |
| 162 GLenum type, |
| 163 GLsizei width, |
| 164 GLsizei height) { |
| 165 GL_SERVICE_LOG("OSMesaMakeCurrent" |
| 166 << "(" << ctx << ", " << static_cast<const void*>(buffer) |
| 167 << ", " << GLEnums::GetStringEnum(type) << ", " << width |
| 168 << ", " << height << ")"); |
| 169 GLboolean result = g_driver_osmesa.debug_fn.OSMesaMakeCurrentFn( |
| 170 ctx, buffer, type, width, height); |
| 171 GL_SERVICE_LOG("GL_RESULT: " << result); |
| 172 return result; |
| 173 } |
| 174 |
| 175 static void GL_BINDING_CALL Debug_OSMesaPixelStore(GLint pname, GLint value) { |
| 176 GL_SERVICE_LOG("OSMesaPixelStore" |
| 177 << "(" << pname << ", " << value << ")"); |
| 178 g_driver_osmesa.debug_fn.OSMesaPixelStoreFn(pname, value); |
| 179 } |
| 180 } // extern "C" |
| 181 |
| 182 void DriverOSMESA::InitializeDebugBindings() { |
| 183 if (!debug_fn.OSMesaColorClampFn) { |
| 184 debug_fn.OSMesaColorClampFn = fn.OSMesaColorClampFn; |
| 185 fn.OSMesaColorClampFn = Debug_OSMesaColorClamp; |
| 186 } |
| 187 if (!debug_fn.OSMesaCreateContextFn) { |
| 188 debug_fn.OSMesaCreateContextFn = fn.OSMesaCreateContextFn; |
| 189 fn.OSMesaCreateContextFn = Debug_OSMesaCreateContext; |
| 190 } |
| 191 if (!debug_fn.OSMesaCreateContextExtFn) { |
| 192 debug_fn.OSMesaCreateContextExtFn = fn.OSMesaCreateContextExtFn; |
| 193 fn.OSMesaCreateContextExtFn = Debug_OSMesaCreateContextExt; |
| 194 } |
| 195 if (!debug_fn.OSMesaDestroyContextFn) { |
| 196 debug_fn.OSMesaDestroyContextFn = fn.OSMesaDestroyContextFn; |
| 197 fn.OSMesaDestroyContextFn = Debug_OSMesaDestroyContext; |
| 198 } |
| 199 if (!debug_fn.OSMesaGetColorBufferFn) { |
| 200 debug_fn.OSMesaGetColorBufferFn = fn.OSMesaGetColorBufferFn; |
| 201 fn.OSMesaGetColorBufferFn = Debug_OSMesaGetColorBuffer; |
| 202 } |
| 203 if (!debug_fn.OSMesaGetCurrentContextFn) { |
| 204 debug_fn.OSMesaGetCurrentContextFn = fn.OSMesaGetCurrentContextFn; |
| 205 fn.OSMesaGetCurrentContextFn = Debug_OSMesaGetCurrentContext; |
| 206 } |
| 207 if (!debug_fn.OSMesaGetDepthBufferFn) { |
| 208 debug_fn.OSMesaGetDepthBufferFn = fn.OSMesaGetDepthBufferFn; |
| 209 fn.OSMesaGetDepthBufferFn = Debug_OSMesaGetDepthBuffer; |
| 210 } |
| 211 if (!debug_fn.OSMesaGetIntegervFn) { |
| 212 debug_fn.OSMesaGetIntegervFn = fn.OSMesaGetIntegervFn; |
| 213 fn.OSMesaGetIntegervFn = Debug_OSMesaGetIntegerv; |
| 214 } |
| 215 if (!debug_fn.OSMesaGetProcAddressFn) { |
| 216 debug_fn.OSMesaGetProcAddressFn = fn.OSMesaGetProcAddressFn; |
| 217 fn.OSMesaGetProcAddressFn = Debug_OSMesaGetProcAddress; |
| 218 } |
| 219 if (!debug_fn.OSMesaMakeCurrentFn) { |
| 220 debug_fn.OSMesaMakeCurrentFn = fn.OSMesaMakeCurrentFn; |
| 221 fn.OSMesaMakeCurrentFn = Debug_OSMesaMakeCurrent; |
| 222 } |
| 223 if (!debug_fn.OSMesaPixelStoreFn) { |
| 224 debug_fn.OSMesaPixelStoreFn = fn.OSMesaPixelStoreFn; |
| 225 fn.OSMesaPixelStoreFn = Debug_OSMesaPixelStore; |
| 226 } |
| 227 g_debugBindingsInitialized = true; |
| 228 } |
| 229 |
| 230 void DriverOSMESA::ClearBindings() { |
| 231 memset(this, 0, sizeof(*this)); |
| 232 } |
| 233 |
| 234 void OSMESAApiBase::OSMesaColorClampFn(GLboolean enable) { |
| 235 driver_->fn.OSMesaColorClampFn(enable); |
| 236 } |
| 237 |
| 238 OSMesaContext OSMESAApiBase::OSMesaCreateContextFn(GLenum format, |
| 239 OSMesaContext sharelist) { |
| 240 return driver_->fn.OSMesaCreateContextFn(format, sharelist); |
| 241 } |
| 242 |
| 243 OSMesaContext OSMESAApiBase::OSMesaCreateContextExtFn(GLenum format, |
| 244 GLint depthBits, |
| 245 GLint stencilBits, |
| 246 GLint accumBits, |
| 247 OSMesaContext sharelist) { |
| 248 return driver_->fn.OSMesaCreateContextExtFn(format, depthBits, stencilBits, |
| 249 accumBits, sharelist); |
| 250 } |
| 251 |
| 252 void OSMESAApiBase::OSMesaDestroyContextFn(OSMesaContext ctx) { |
| 253 driver_->fn.OSMesaDestroyContextFn(ctx); |
| 254 } |
| 255 |
| 256 GLboolean OSMESAApiBase::OSMesaGetColorBufferFn(OSMesaContext c, |
| 257 GLint* width, |
| 258 GLint* height, |
| 259 GLint* format, |
| 260 void** buffer) { |
| 261 return driver_->fn.OSMesaGetColorBufferFn(c, width, height, format, buffer); |
| 262 } |
| 263 |
| 264 OSMesaContext OSMESAApiBase::OSMesaGetCurrentContextFn(void) { |
| 265 return driver_->fn.OSMesaGetCurrentContextFn(); |
| 266 } |
| 267 |
| 268 GLboolean OSMESAApiBase::OSMesaGetDepthBufferFn(OSMesaContext c, |
| 269 GLint* width, |
| 270 GLint* height, |
| 271 GLint* bytesPerValue, |
| 272 void** buffer) { |
| 273 return driver_->fn.OSMesaGetDepthBufferFn(c, width, height, bytesPerValue, |
| 274 buffer); |
| 275 } |
| 276 |
| 277 void OSMESAApiBase::OSMesaGetIntegervFn(GLint pname, GLint* value) { |
| 278 driver_->fn.OSMesaGetIntegervFn(pname, value); |
| 279 } |
| 280 |
| 281 OSMESAproc OSMESAApiBase::OSMesaGetProcAddressFn(const char* funcName) { |
| 282 return driver_->fn.OSMesaGetProcAddressFn(funcName); |
| 283 } |
| 284 |
| 285 GLboolean OSMESAApiBase::OSMesaMakeCurrentFn(OSMesaContext ctx, |
| 286 void* buffer, |
| 287 GLenum type, |
| 288 GLsizei width, |
| 289 GLsizei height) { |
| 290 return driver_->fn.OSMesaMakeCurrentFn(ctx, buffer, type, width, height); |
| 291 } |
| 292 |
| 293 void OSMESAApiBase::OSMesaPixelStoreFn(GLint pname, GLint value) { |
| 294 driver_->fn.OSMesaPixelStoreFn(pname, value); |
| 295 } |
| 296 |
| 297 void TraceOSMESAApi::OSMesaColorClampFn(GLboolean enable) { |
| 298 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaColorClamp") |
| 299 osmesa_api_->OSMesaColorClampFn(enable); |
| 300 } |
| 301 |
| 302 OSMesaContext TraceOSMESAApi::OSMesaCreateContextFn(GLenum format, |
| 303 OSMesaContext sharelist) { |
| 304 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaCreateContext") |
| 305 return osmesa_api_->OSMesaCreateContextFn(format, sharelist); |
| 306 } |
| 307 |
| 308 OSMesaContext TraceOSMESAApi::OSMesaCreateContextExtFn( |
| 309 GLenum format, |
| 310 GLint depthBits, |
| 311 GLint stencilBits, |
| 312 GLint accumBits, |
| 313 OSMesaContext sharelist) { |
| 314 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaCreateContextExt") |
| 315 return osmesa_api_->OSMesaCreateContextExtFn(format, depthBits, stencilBits, |
| 316 accumBits, sharelist); |
| 317 } |
| 318 |
| 319 void TraceOSMESAApi::OSMesaDestroyContextFn(OSMesaContext ctx) { |
| 320 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaDestroyContext") |
| 321 osmesa_api_->OSMesaDestroyContextFn(ctx); |
| 322 } |
| 323 |
| 324 GLboolean TraceOSMESAApi::OSMesaGetColorBufferFn(OSMesaContext c, |
| 325 GLint* width, |
| 326 GLint* height, |
| 327 GLint* format, |
| 328 void** buffer) { |
| 329 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaGetColorBuffer") |
| 330 return osmesa_api_->OSMesaGetColorBufferFn(c, width, height, format, buffer); |
| 331 } |
| 332 |
| 333 OSMesaContext TraceOSMESAApi::OSMesaGetCurrentContextFn(void) { |
| 334 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaGetCurrentContext") |
| 335 return osmesa_api_->OSMesaGetCurrentContextFn(); |
| 336 } |
| 337 |
| 338 GLboolean TraceOSMESAApi::OSMesaGetDepthBufferFn(OSMesaContext c, |
| 339 GLint* width, |
| 340 GLint* height, |
| 341 GLint* bytesPerValue, |
| 342 void** buffer) { |
| 343 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaGetDepthBuffer") |
| 344 return osmesa_api_->OSMesaGetDepthBufferFn(c, width, height, bytesPerValue, |
| 345 buffer); |
| 346 } |
| 347 |
| 348 void TraceOSMESAApi::OSMesaGetIntegervFn(GLint pname, GLint* value) { |
| 349 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaGetIntegerv") |
| 350 osmesa_api_->OSMesaGetIntegervFn(pname, value); |
| 351 } |
| 352 |
| 353 OSMESAproc TraceOSMESAApi::OSMesaGetProcAddressFn(const char* funcName) { |
| 354 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaGetProcAddress") |
| 355 return osmesa_api_->OSMesaGetProcAddressFn(funcName); |
| 356 } |
| 357 |
| 358 GLboolean TraceOSMESAApi::OSMesaMakeCurrentFn(OSMesaContext ctx, |
| 359 void* buffer, |
| 360 GLenum type, |
| 361 GLsizei width, |
| 362 GLsizei height) { |
| 363 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaMakeCurrent") |
| 364 return osmesa_api_->OSMesaMakeCurrentFn(ctx, buffer, type, width, height); |
| 365 } |
| 366 |
| 367 void TraceOSMESAApi::OSMesaPixelStoreFn(GLint pname, GLint value) { |
| 368 TRACE_EVENT_BINARY_EFFICIENT0("gpu", "TraceGLAPI::OSMesaPixelStore") |
| 369 osmesa_api_->OSMesaPixelStoreFn(pname, value); |
| 370 } |
| 371 |
| 372 } // namespace gfx |
OLD | NEW |