OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef UI_GL_GL_BINDINGS_H_ | 5 #ifndef UI_GL_GL_BINDINGS_H_ |
6 #define UI_GL_GL_BINDINGS_H_ | 6 #define UI_GL_GL_BINDINGS_H_ |
7 | 7 |
8 // Includes the platform independent and platform dependent GL headers. | 8 // Includes the platform independent and platform dependent GL headers. |
9 // Only include this in cc files. It pulls in system headers, including | 9 // Only include this in cc files. It pulls in system headers, including |
10 // the X11 headers on linux, which define all kinds of macros that are | 10 // the X11 headers on linux, which define all kinds of macros that are |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 #if defined(OS_WIN) | 387 #if defined(OS_WIN) |
388 #include "gl_bindings_autogen_wgl.h" | 388 #include "gl_bindings_autogen_wgl.h" |
389 #endif | 389 #endif |
390 | 390 |
391 #if defined(USE_GLX) | 391 #if defined(USE_GLX) |
392 #include "gl_bindings_autogen_glx.h" | 392 #include "gl_bindings_autogen_glx.h" |
393 #endif | 393 #endif |
394 | 394 |
395 namespace gl { | 395 namespace gl { |
396 | 396 |
| 397 struct GLVersionInfo; |
| 398 |
397 struct GL_EXPORT DriverGL { | 399 struct GL_EXPORT DriverGL { |
398 void InitializeStaticBindings(); | 400 void InitializeStaticBindings(); |
399 void InitializeCustomDynamicBindings(GLContext* context); | 401 void InitializeDynamicBindings(const GLVersionInfo* ver, |
400 void InitializeDebugBindings(); | 402 const std::string& context_extensions); |
401 void InitializeNullDrawBindings(); | |
402 // TODO(danakj): Remove this when all test suites are using null-draw. | |
403 bool HasInitializedNullDrawBindings(); | |
404 bool SetNullDrawBindingsEnabled(bool enabled); | |
405 void ClearBindings(); | 403 void ClearBindings(); |
406 | 404 |
407 ProcsGL fn; | 405 ProcsGL fn; |
408 ProcsGL orig_fn; | |
409 ProcsGL debug_fn; | |
410 ExtensionsGL ext; | 406 ExtensionsGL ext; |
411 bool null_draw_bindings_enabled; | 407 }; |
412 | 408 |
413 private: | 409 struct GL_EXPORT CurrentGL { |
414 void InitializeDynamicBindings(GLContext* context); | 410 GLApi* Api = nullptr; |
| 411 DriverGL* Driver = nullptr; |
| 412 const GLVersionInfo* Version = nullptr; |
415 }; | 413 }; |
416 | 414 |
417 struct GL_EXPORT DriverOSMESA { | 415 struct GL_EXPORT DriverOSMESA { |
418 void InitializeStaticBindings(); | 416 void InitializeStaticBindings(); |
419 void InitializeExtensionBindings(); | 417 void InitializeExtensionBindings(); |
420 void InitializeDebugBindings(); | |
421 void ClearBindings(); | 418 void ClearBindings(); |
422 | 419 |
423 ProcsOSMESA fn; | 420 ProcsOSMESA fn; |
424 ProcsOSMESA debug_fn; | |
425 ExtensionsOSMESA ext; | 421 ExtensionsOSMESA ext; |
426 | 422 |
427 private: | 423 private: |
428 static std::string GetPlatformExtensions(); | 424 static std::string GetPlatformExtensions(); |
429 }; | 425 }; |
430 | 426 |
431 #if defined(OS_WIN) | 427 #if defined(OS_WIN) |
432 struct GL_EXPORT DriverWGL { | 428 struct GL_EXPORT DriverWGL { |
433 void InitializeStaticBindings(); | 429 void InitializeStaticBindings(); |
434 void InitializeExtensionBindings(); | 430 void InitializeExtensionBindings(); |
435 void InitializeDebugBindings(); | |
436 void ClearBindings(); | 431 void ClearBindings(); |
437 | 432 |
438 ProcsWGL fn; | 433 ProcsWGL fn; |
439 ProcsWGL debug_fn; | |
440 ExtensionsWGL ext; | 434 ExtensionsWGL ext; |
441 | 435 |
442 private: | 436 private: |
443 static std::string GetPlatformExtensions(); | 437 static std::string GetPlatformExtensions(); |
444 }; | 438 }; |
445 #endif | 439 #endif |
446 | 440 |
447 #if defined(USE_EGL) | 441 #if defined(USE_EGL) |
448 struct GL_EXPORT DriverEGL { | 442 struct GL_EXPORT DriverEGL { |
449 void InitializeStaticBindings(); | 443 void InitializeStaticBindings(); |
450 void InitializeClientExtensionBindings(); | 444 void InitializeClientExtensionBindings(); |
451 void InitializeExtensionBindings(); | 445 void InitializeExtensionBindings(); |
452 void InitializeDebugBindings(); | |
453 void ClearBindings(); | 446 void ClearBindings(); |
454 | 447 |
455 ProcsEGL fn; | 448 ProcsEGL fn; |
456 ProcsEGL debug_fn; | |
457 ExtensionsEGL ext; | 449 ExtensionsEGL ext; |
458 | 450 |
459 static std::string GetPlatformExtensions(); | 451 static std::string GetPlatformExtensions(); |
460 static std::string GetClientExtensions(); | 452 static std::string GetClientExtensions(); |
461 }; | 453 }; |
462 #endif | 454 #endif |
463 | 455 |
464 #if defined(USE_GLX) | 456 #if defined(USE_GLX) |
465 struct GL_EXPORT DriverGLX { | 457 struct GL_EXPORT DriverGLX { |
466 void InitializeStaticBindings(); | 458 void InitializeStaticBindings(); |
467 void InitializeExtensionBindings(); | 459 void InitializeExtensionBindings(); |
468 void InitializeDebugBindings(); | |
469 void ClearBindings(); | 460 void ClearBindings(); |
470 | 461 |
471 ProcsGLX fn; | 462 ProcsGLX fn; |
472 ProcsGLX debug_fn; | |
473 ExtensionsGLX ext; | 463 ExtensionsGLX ext; |
474 | 464 |
475 private: | 465 private: |
476 static std::string GetPlatformExtensions(); | 466 static std::string GetPlatformExtensions(); |
477 }; | 467 }; |
478 #endif | 468 #endif |
479 | 469 |
480 // This #define is here to support autogenerated code. | 470 // This #define is here to support autogenerated code. |
481 #define g_current_gl_context g_current_gl_context_tls->Get() | 471 #define g_current_gl_context g_current_gl_context_tls->Get()->Api |
482 GL_EXPORT extern base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls; | 472 #define g_current_gl_driver g_current_gl_context_tls->Get()->Driver |
| 473 #define g_current_gl_version g_current_gl_context_tls->Get()->Version |
| 474 GL_EXPORT extern base::ThreadLocalPointer<CurrentGL>* g_current_gl_context_tls; |
483 | 475 |
484 GL_EXPORT extern OSMESAApi* g_current_osmesa_context; | 476 GL_EXPORT extern OSMESAApi* g_current_osmesa_context; |
485 GL_EXPORT extern DriverGL g_driver_gl; | |
486 GL_EXPORT extern DriverOSMESA g_driver_osmesa; | 477 GL_EXPORT extern DriverOSMESA g_driver_osmesa; |
487 | 478 |
488 #if defined(USE_EGL) | 479 #if defined(USE_EGL) |
489 GL_EXPORT extern EGLApi* g_current_egl_context; | 480 GL_EXPORT extern EGLApi* g_current_egl_context; |
490 GL_EXPORT extern DriverEGL g_driver_egl; | 481 GL_EXPORT extern DriverEGL g_driver_egl; |
491 #endif | 482 #endif |
492 | 483 |
493 #if defined(OS_WIN) | 484 #if defined(OS_WIN) |
494 GL_EXPORT extern WGLApi* g_current_wgl_context; | 485 GL_EXPORT extern WGLApi* g_current_wgl_context; |
495 GL_EXPORT extern DriverWGL g_driver_wgl; | 486 GL_EXPORT extern DriverWGL g_driver_wgl; |
496 #endif | 487 #endif |
497 | 488 |
498 #if defined(USE_GLX) | 489 #if defined(USE_GLX) |
499 GL_EXPORT extern GLXApi* g_current_glx_context; | 490 GL_EXPORT extern GLXApi* g_current_glx_context; |
500 GL_EXPORT extern DriverGLX g_driver_glx; | 491 GL_EXPORT extern DriverGLX g_driver_glx; |
501 #endif | 492 #endif |
502 | 493 |
503 } // namespace gl | 494 } // namespace gl |
504 | 495 |
505 #endif // UI_GL_GL_BINDINGS_H_ | 496 #endif // UI_GL_GL_BINDINGS_H_ |
OLD | NEW |