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 10 matching lines...) Expand all Loading... |
21 #include "base/logging.h" | 21 #include "base/logging.h" |
22 #include "base/threading/thread_local.h" | 22 #include "base/threading/thread_local.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
24 #include "ui/gl/gl_export.h" | 24 #include "ui/gl/gl_export.h" |
25 | 25 |
26 // The standard OpenGL native extension headers are also included. | 26 // The standard OpenGL native extension headers are also included. |
27 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
28 #include <GL/wglext.h> | 28 #include <GL/wglext.h> |
29 #elif defined(OS_MACOSX) | 29 #elif defined(OS_MACOSX) |
30 #include <OpenGL/OpenGL.h> | 30 #include <OpenGL/OpenGL.h> |
31 #elif defined(USE_X11) | 31 #elif defined(USE_GLX) |
32 #include <GL/glx.h> | 32 #include <GL/glx.h> |
33 #include <GL/glxext.h> | 33 #include <GL/glxext.h> |
34 | 34 |
35 // Undefine some macros defined by X headers. This is why this file should only | 35 // Undefine some macros defined by X headers. This is why this file should only |
36 // be included in .cc files. | 36 // be included in .cc files. |
37 #undef Bool | 37 #undef Bool |
38 #undef None | 38 #undef None |
39 #undef Status | 39 #undef Status |
40 #endif | 40 #endif |
41 | 41 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 // Forward declare OSMesa types. | 365 // Forward declare OSMesa types. |
366 typedef struct osmesa_context *OSMesaContext; | 366 typedef struct osmesa_context *OSMesaContext; |
367 typedef void (*OSMESAproc)(); | 367 typedef void (*OSMESAproc)(); |
368 | 368 |
369 // Forward declare EGL types. | 369 // Forward declare EGL types. |
370 typedef uint64_t EGLuint64CHROMIUM; | 370 typedef uint64_t EGLuint64CHROMIUM; |
371 | 371 |
372 #include "gl_bindings_autogen_gl.h" | 372 #include "gl_bindings_autogen_gl.h" |
373 #include "gl_bindings_autogen_osmesa.h" | 373 #include "gl_bindings_autogen_osmesa.h" |
374 | 374 |
375 #if defined(OS_WIN) | 375 #if defined(USE_EGL) |
376 #include "gl_bindings_autogen_egl.h" | |
377 #include "gl_bindings_autogen_wgl.h" | |
378 #elif defined(USE_X11) | |
379 #include "gl_bindings_autogen_egl.h" | |
380 #include "gl_bindings_autogen_glx.h" | |
381 #elif defined(USE_OZONE) | |
382 #include "gl_bindings_autogen_egl.h" | |
383 #elif defined(OS_ANDROID) | |
384 #include "gl_bindings_autogen_egl.h" | 376 #include "gl_bindings_autogen_egl.h" |
385 #endif | 377 #endif |
386 | 378 |
| 379 #if defined(OS_WIN) |
| 380 #include "gl_bindings_autogen_wgl.h" |
| 381 #endif |
| 382 |
| 383 #if defined(USE_GLX) |
| 384 #include "gl_bindings_autogen_glx.h" |
| 385 #endif |
| 386 |
387 namespace gfx { | 387 namespace gfx { |
388 | 388 |
389 struct GL_EXPORT DriverGL { | 389 struct GL_EXPORT DriverGL { |
390 void InitializeStaticBindings(); | 390 void InitializeStaticBindings(); |
391 void InitializeCustomDynamicBindings(GLContext* context); | 391 void InitializeCustomDynamicBindings(GLContext* context); |
392 void InitializeDebugBindings(); | 392 void InitializeDebugBindings(); |
393 void InitializeNullDrawBindings(); | 393 void InitializeNullDrawBindings(); |
394 // TODO(danakj): Remove this when all test suites are using null-draw. | 394 // TODO(danakj): Remove this when all test suites are using null-draw. |
395 bool HasInitializedNullDrawBindings(); | 395 bool HasInitializedNullDrawBindings(); |
396 bool SetNullDrawBindingsEnabled(bool enabled); | 396 bool SetNullDrawBindingsEnabled(bool enabled); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 | 429 |
430 ProcsWGL fn; | 430 ProcsWGL fn; |
431 ProcsWGL debug_fn; | 431 ProcsWGL debug_fn; |
432 ExtensionsWGL ext; | 432 ExtensionsWGL ext; |
433 | 433 |
434 private: | 434 private: |
435 static std::string GetPlatformExtensions(); | 435 static std::string GetPlatformExtensions(); |
436 }; | 436 }; |
437 #endif | 437 #endif |
438 | 438 |
439 #if defined(OS_WIN) || defined(USE_X11) || defined(OS_ANDROID) || defined(USE_OZ
ONE) | 439 #if defined(USE_EGL) |
440 struct GL_EXPORT DriverEGL { | 440 struct GL_EXPORT DriverEGL { |
441 void InitializeStaticBindings(); | 441 void InitializeStaticBindings(); |
442 void InitializeExtensionBindings(); | 442 void InitializeExtensionBindings(); |
443 void InitializeDebugBindings(); | 443 void InitializeDebugBindings(); |
444 void ClearBindings(); | 444 void ClearBindings(); |
445 | 445 |
446 ProcsEGL fn; | 446 ProcsEGL fn; |
447 ProcsEGL debug_fn; | 447 ProcsEGL debug_fn; |
448 ExtensionsEGL ext; | 448 ExtensionsEGL ext; |
449 | 449 |
450 static std::string GetPlatformExtensions(); | 450 static std::string GetPlatformExtensions(); |
451 static std::string GetClientExtensions(); | 451 static std::string GetClientExtensions(); |
452 }; | 452 }; |
453 #endif | 453 #endif |
454 | 454 |
455 #if defined(USE_X11) | 455 #if defined(USE_GLX) |
456 struct GL_EXPORT DriverGLX { | 456 struct GL_EXPORT DriverGLX { |
457 void InitializeStaticBindings(); | 457 void InitializeStaticBindings(); |
458 void InitializeExtensionBindings(); | 458 void InitializeExtensionBindings(); |
459 void InitializeDebugBindings(); | 459 void InitializeDebugBindings(); |
460 void ClearBindings(); | 460 void ClearBindings(); |
461 | 461 |
462 ProcsGLX fn; | 462 ProcsGLX fn; |
463 ProcsGLX debug_fn; | 463 ProcsGLX debug_fn; |
464 ExtensionsGLX ext; | 464 ExtensionsGLX ext; |
465 | 465 |
466 private: | 466 private: |
467 static std::string GetPlatformExtensions(); | 467 static std::string GetPlatformExtensions(); |
468 }; | 468 }; |
469 #endif | 469 #endif |
470 | 470 |
471 // This #define is here to support autogenerated code. | 471 // This #define is here to support autogenerated code. |
472 #define g_current_gl_context g_current_gl_context_tls->Get() | 472 #define g_current_gl_context g_current_gl_context_tls->Get() |
473 GL_EXPORT extern base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls; | 473 GL_EXPORT extern base::ThreadLocalPointer<GLApi>* g_current_gl_context_tls; |
474 | 474 |
475 GL_EXPORT extern OSMESAApi* g_current_osmesa_context; | 475 GL_EXPORT extern OSMESAApi* g_current_osmesa_context; |
476 GL_EXPORT extern DriverGL g_driver_gl; | 476 GL_EXPORT extern DriverGL g_driver_gl; |
477 GL_EXPORT extern DriverOSMESA g_driver_osmesa; | 477 GL_EXPORT extern DriverOSMESA g_driver_osmesa; |
478 | 478 |
479 #if defined(OS_WIN) | 479 #if defined(USE_EGL) |
480 | |
481 GL_EXPORT extern EGLApi* g_current_egl_context; | |
482 GL_EXPORT extern WGLApi* g_current_wgl_context; | |
483 GL_EXPORT extern DriverEGL g_driver_egl; | |
484 GL_EXPORT extern DriverWGL g_driver_wgl; | |
485 | |
486 #elif defined(USE_X11) | |
487 | |
488 GL_EXPORT extern EGLApi* g_current_egl_context; | |
489 GL_EXPORT extern GLXApi* g_current_glx_context; | |
490 GL_EXPORT extern DriverEGL g_driver_egl; | |
491 GL_EXPORT extern DriverGLX g_driver_glx; | |
492 | |
493 #elif defined(USE_OZONE) | |
494 | |
495 GL_EXPORT extern EGLApi* g_current_egl_context; | 480 GL_EXPORT extern EGLApi* g_current_egl_context; |
496 GL_EXPORT extern DriverEGL g_driver_egl; | 481 GL_EXPORT extern DriverEGL g_driver_egl; |
| 482 #endif |
497 | 483 |
498 #elif defined(OS_ANDROID) | 484 #if defined(OS_WIN) |
| 485 GL_EXPORT extern WGLApi* g_current_wgl_context; |
| 486 GL_EXPORT extern DriverWGL g_driver_wgl; |
| 487 #endif |
499 | 488 |
500 GL_EXPORT extern EGLApi* g_current_egl_context; | 489 #if defined(USE_GLX) |
501 GL_EXPORT extern DriverEGL g_driver_egl; | 490 GL_EXPORT extern GLXApi* g_current_glx_context; |
502 | 491 GL_EXPORT extern DriverGLX g_driver_glx; |
503 #endif | 492 #endif |
504 | 493 |
505 } // namespace gfx | 494 } // namespace gfx |
506 | 495 |
507 #endif // UI_GL_GL_BINDINGS_H_ | 496 #endif // UI_GL_GL_BINDINGS_H_ |
OLD | NEW |