blob: 9fd0697ea9059ff41afeadcd6647d3e0812b025e [file] [log] [blame]
[email protected]328ce55f2012-04-07 00:33:041// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]b9363b22010-06-09 22:06:152// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]c9e2cbbb2012-05-12 21:17:275#ifndef UI_GL_GL_BINDINGS_H_
6#define UI_GL_GL_BINDINGS_H_
[email protected]c9e2cbbb2012-05-12 21:17:277
[email protected]b9363b22010-06-09 22:06:158// Includes the platform independent and platform dependent GL headers.
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
11// liable to cause conflicts.
12
[email protected]b9363b22010-06-09 22:06:1513#include <GL/gl.h>
14#include <GL/glext.h>
[email protected]b040f9d2013-01-19 04:27:0015#include <EGL/egl.h>
16#include <EGL/eglext.h>
[email protected]b9363b22010-06-09 22:06:1517
[email protected]218a5a22010-11-04 19:27:4918#include "base/logging.h"
[email protected]c9e2cbbb2012-05-12 21:17:2719#include "build/build_config.h"
20#include "ui/gl/gl_export.h"
[email protected]b9363b22010-06-09 22:06:1521
22// The standard OpenGL native extension headers are also included.
23#if defined(OS_WIN)
24#include <GL/wglext.h>
[email protected]2ec8df52011-05-25 23:44:5825#elif defined(OS_MACOSX)
26#include <OpenGL/OpenGL.h>
27#elif defined(USE_X11)
[email protected]b9363b22010-06-09 22:06:1528#include <GL/glx.h>
29#include <GL/glxext.h>
[email protected]31c31b2b2011-09-27 18:58:2930
31// Undefine some macros defined by X headers. This is why this file should only
32// be included in .cc files.
33#undef Bool
34#undef None
35#undef Status
[email protected]b9363b22010-06-09 22:06:1536#endif
37
38#if defined(OS_WIN)
39#define GL_BINDING_CALL WINAPI
40#else
41#define GL_BINDING_CALL
42#endif
43
[email protected]218a5a22010-11-04 19:27:4944#define GL_SERVICE_LOG(args) DLOG(INFO) << args;
[email protected]5a83fca2012-04-22 02:05:0845#if defined(NDEBUG)
[email protected]92afb772011-12-09 01:49:5646 #define GL_SERVICE_LOG_CODE_BLOCK(code)
47#else
48 #define GL_SERVICE_LOG_CODE_BLOCK(code) code
49#endif
[email protected]218a5a22010-11-04 19:27:4950
[email protected]b9363b22010-06-09 22:06:1551// Forward declare OSMesa types.
52typedef struct osmesa_context *OSMesaContext;
53typedef void (*OSMESAproc)();
54
[email protected]b9363b22010-06-09 22:06:1555// Forward declare EGL types.
[email protected]83f48ae2013-01-14 14:12:5356typedef uint64 EGLuint64CHROMIUM;
[email protected]b9363b22010-06-09 22:06:1557
58#include "gl_bindings_autogen_gl.h"
59#include "gl_bindings_autogen_osmesa.h"
60
61#if defined(OS_WIN)
62#include "gl_bindings_autogen_egl.h"
63#include "gl_bindings_autogen_wgl.h"
[email protected]2ec8df52011-05-25 23:44:5864#elif defined(USE_X11)
[email protected]0bec8e22010-06-21 22:20:0265#include "gl_bindings_autogen_egl.h"
[email protected]b9363b22010-06-09 22:06:1566#include "gl_bindings_autogen_glx.h"
[email protected]c8e295b2011-11-21 21:24:1467#elif defined(OS_ANDROID)
68#include "gl_bindings_autogen_egl.h"
[email protected]b9363b22010-06-09 22:06:1569#endif
70
71namespace gfx {
72
[email protected]b97c9082012-10-25 17:21:3873GL_EXPORT extern GLApi* g_current_gl_context;
74GL_EXPORT extern OSMESAApi* g_current_osmesa_context;
75GL_EXPORT extern DriverGL g_driver_gl;
76GL_EXPORT extern DriverOSMESA g_driver_osmesa;
77
78#if defined(OS_WIN)
79
80GL_EXPORT extern EGLApi* g_current_egl_context;
81GL_EXPORT extern WGLApi* g_current_wgl_context;
82GL_EXPORT extern DriverEGL g_driver_egl;
83GL_EXPORT extern DriverWGL g_driver_wgl;
84
85#elif defined(USE_X11)
86
87GL_EXPORT extern EGLApi* g_current_egl_context;
88GL_EXPORT extern GLXApi* g_current_glx_context;
89GL_EXPORT extern DriverEGL g_driver_egl;
90GL_EXPORT extern DriverGLX g_driver_glx;
91
92#elif defined(OS_ANDROID)
93
94GL_EXPORT extern EGLApi* g_current_egl_context;
95GL_EXPORT extern DriverEGL g_driver_egl;
96
97#endif
98
[email protected]b9363b22010-06-09 22:06:1599// Find an entry point to the mock GL implementation.
100void* GL_BINDING_CALL GetMockGLProcAddress(const char* name);
101
102} // namespace gfx
103
[email protected]c9e2cbbb2012-05-12 21:17:27104#endif // UI_GL_GL_BINDINGS_H_