blob: 625dac97315211b8364a45036699ba81cced3f1a [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_
7#pragma once
8
[email protected]b9363b22010-06-09 22:06:159// Includes the platform independent and platform dependent GL headers.
10// Only include this in cc files. It pulls in system headers, including
11// the X11 headers on linux, which define all kinds of macros that are
12// liable to cause conflicts.
13
[email protected]b9363b22010-06-09 22:06:1514#include <GL/gl.h>
15#include <GL/glext.h>
16
[email protected]218a5a22010-11-04 19:27:4917#include "base/logging.h"
[email protected]c9e2cbbb2012-05-12 21:17:2718#include "build/build_config.h"
19#include "ui/gl/gl_export.h"
[email protected]b9363b22010-06-09 22:06:1520
21// The standard OpenGL native extension headers are also included.
22#if defined(OS_WIN)
23#include <GL/wglext.h>
[email protected]2ec8df52011-05-25 23:44:5824#elif defined(OS_MACOSX)
25#include <OpenGL/OpenGL.h>
26#elif defined(USE_X11)
[email protected]b9363b22010-06-09 22:06:1527#include <GL/glx.h>
28#include <GL/glxext.h>
[email protected]31c31b2b2011-09-27 18:58:2929
30// Undefine some macros defined by X headers. This is why this file should only
31// be included in .cc files.
32#undef Bool
33#undef None
34#undef Status
[email protected]b9363b22010-06-09 22:06:1535#endif
36
37#if defined(OS_WIN)
38#define GL_BINDING_CALL WINAPI
39#else
40#define GL_BINDING_CALL
41#endif
42
[email protected]218a5a22010-11-04 19:27:4943#define GL_SERVICE_LOG(args) DLOG(INFO) << args;
[email protected]5a83fca2012-04-22 02:05:0844#if defined(NDEBUG)
[email protected]92afb772011-12-09 01:49:5645 #define GL_SERVICE_LOG_CODE_BLOCK(code)
46#else
47 #define GL_SERVICE_LOG_CODE_BLOCK(code) code
48#endif
[email protected]218a5a22010-11-04 19:27:4949
[email protected]b9363b22010-06-09 22:06:1550// Forward declare OSMesa types.
51typedef struct osmesa_context *OSMesaContext;
52typedef void (*OSMESAproc)();
53
[email protected]2ec8df52011-05-25 23:44:5854#if !defined(OS_MACOSX)
[email protected]b9363b22010-06-09 22:06:1555
56// Forward declare EGL types.
57typedef unsigned int EGLBoolean;
58typedef unsigned int EGLenum;
59typedef int EGLint;
60typedef void *EGLConfig;
61typedef void *EGLContext;
62typedef void *EGLDisplay;
[email protected]ae802342011-06-25 17:01:5563typedef void *EGLImageKHR;
[email protected]b9363b22010-06-09 22:06:1564typedef void *EGLSurface;
65typedef void *EGLClientBuffer;
66typedef void (*__eglMustCastToProperFunctionPointerType)(void);
[email protected]ae802342011-06-25 17:01:5567typedef void* GLeglImageOES;
[email protected]b9363b22010-06-09 22:06:1568
[email protected]0bec8e22010-06-21 22:20:0269#if defined(OS_WIN)
70typedef HDC EGLNativeDisplayType;
71typedef HBITMAP EGLNativePixmapType;
72typedef HWND EGLNativeWindowType;
[email protected]665ec132011-09-21 23:41:3973#elif defined(OS_ANDROID)
74typedef void *EGLNativeDisplayType;
75typedef struct egl_native_pixmap_t *EGLNativePixmapType;
76typedef struct ANativeWindow *EGLNativeWindowType;
[email protected]0bec8e22010-06-21 22:20:0277#else
78typedef Display *EGLNativeDisplayType;
79typedef Pixmap EGLNativePixmapType;
80typedef Window EGLNativeWindowType;
81#endif
82
[email protected]2ec8df52011-05-25 23:44:5883#endif // !OS_MACOSX
[email protected]b9363b22010-06-09 22:06:1584
85#include "gl_bindings_autogen_gl.h"
86#include "gl_bindings_autogen_osmesa.h"
87
88#if defined(OS_WIN)
89#include "gl_bindings_autogen_egl.h"
90#include "gl_bindings_autogen_wgl.h"
[email protected]2ec8df52011-05-25 23:44:5891#elif defined(USE_X11)
[email protected]0bec8e22010-06-21 22:20:0292#include "gl_bindings_autogen_egl.h"
[email protected]b9363b22010-06-09 22:06:1593#include "gl_bindings_autogen_glx.h"
[email protected]c8e295b2011-11-21 21:24:1494#elif defined(OS_ANDROID)
95#include "gl_bindings_autogen_egl.h"
[email protected]b9363b22010-06-09 22:06:1596#endif
97
98namespace gfx {
99
100// Find an entry point to the mock GL implementation.
101void* GL_BINDING_CALL GetMockGLProcAddress(const char* name);
102
103} // namespace gfx
104
[email protected]c9e2cbbb2012-05-12 21:17:27105#endif // UI_GL_GL_BINDINGS_H_