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