[email protected] | 328ce55f | 2012-04-07 00:33:04 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame^] | 5 | #ifndef UI_GL_GL_BINDINGS_H_ |
6 | #define UI_GL_GL_BINDINGS_H_ | ||||
7 | #pragma once | ||||
8 | |||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 9 | // 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] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 14 | #include <GL/gl.h> |
15 | #include <GL/glext.h> | ||||
16 | |||||
[email protected] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 17 | #include "base/logging.h" |
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame^] | 18 | #include "build/build_config.h" |
19 | #include "ui/gl/gl_export.h" | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 20 | |
21 | // The standard OpenGL native extension headers are also included. | ||||
22 | #if defined(OS_WIN) | ||||
23 | #include <GL/wglext.h> | ||||
[email protected] | 2ec8df5 | 2011-05-25 23:44:58 | [diff] [blame] | 24 | #elif defined(OS_MACOSX) |
25 | #include <OpenGL/OpenGL.h> | ||||
26 | #elif defined(USE_X11) | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 27 | #include <GL/glx.h> |
28 | #include <GL/glxext.h> | ||||
[email protected] | 31c31b2b | 2011-09-27 18:58:29 | [diff] [blame] | 29 | |
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] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 35 | #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] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 43 | #define GL_SERVICE_LOG(args) DLOG(INFO) << args; |
[email protected] | 5a83fca | 2012-04-22 02:05:08 | [diff] [blame] | 44 | #if defined(NDEBUG) |
[email protected] | 92afb77 | 2011-12-09 01:49:56 | [diff] [blame] | 45 | #define GL_SERVICE_LOG_CODE_BLOCK(code) |
46 | #else | ||||
47 | #define GL_SERVICE_LOG_CODE_BLOCK(code) code | ||||
48 | #endif | ||||
[email protected] | 218a5a2 | 2010-11-04 19:27:49 | [diff] [blame] | 49 | |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 50 | // Forward declare OSMesa types. |
51 | typedef struct osmesa_context *OSMesaContext; | ||||
52 | typedef void (*OSMESAproc)(); | ||||
53 | |||||
[email protected] | 2ec8df5 | 2011-05-25 23:44:58 | [diff] [blame] | 54 | #if !defined(OS_MACOSX) |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 55 | |
56 | // Forward declare EGL types. | ||||
57 | typedef unsigned int EGLBoolean; | ||||
58 | typedef unsigned int EGLenum; | ||||
59 | typedef int EGLint; | ||||
60 | typedef void *EGLConfig; | ||||
61 | typedef void *EGLContext; | ||||
62 | typedef void *EGLDisplay; | ||||
[email protected] | ae80234 | 2011-06-25 17:01:55 | [diff] [blame] | 63 | typedef void *EGLImageKHR; |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 64 | typedef void *EGLSurface; |
65 | typedef void *EGLClientBuffer; | ||||
66 | typedef void (*__eglMustCastToProperFunctionPointerType)(void); | ||||
[email protected] | ae80234 | 2011-06-25 17:01:55 | [diff] [blame] | 67 | typedef void* GLeglImageOES; |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 68 | |
[email protected] | 0bec8e2 | 2010-06-21 22:20:02 | [diff] [blame] | 69 | #if defined(OS_WIN) |
70 | typedef HDC EGLNativeDisplayType; | ||||
71 | typedef HBITMAP EGLNativePixmapType; | ||||
72 | typedef HWND EGLNativeWindowType; | ||||
[email protected] | 665ec13 | 2011-09-21 23:41:39 | [diff] [blame] | 73 | #elif defined(OS_ANDROID) |
74 | typedef void *EGLNativeDisplayType; | ||||
75 | typedef struct egl_native_pixmap_t *EGLNativePixmapType; | ||||
76 | typedef struct ANativeWindow *EGLNativeWindowType; | ||||
[email protected] | 0bec8e2 | 2010-06-21 22:20:02 | [diff] [blame] | 77 | #else |
78 | typedef Display *EGLNativeDisplayType; | ||||
79 | typedef Pixmap EGLNativePixmapType; | ||||
80 | typedef Window EGLNativeWindowType; | ||||
81 | #endif | ||||
82 | |||||
[email protected] | 2ec8df5 | 2011-05-25 23:44:58 | [diff] [blame] | 83 | #endif // !OS_MACOSX |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 84 | |
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] | 2ec8df5 | 2011-05-25 23:44:58 | [diff] [blame] | 91 | #elif defined(USE_X11) |
[email protected] | 0bec8e2 | 2010-06-21 22:20:02 | [diff] [blame] | 92 | #include "gl_bindings_autogen_egl.h" |
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 93 | #include "gl_bindings_autogen_glx.h" |
[email protected] | c8e295b | 2011-11-21 21:24:14 | [diff] [blame] | 94 | #elif defined(OS_ANDROID) |
95 | #include "gl_bindings_autogen_egl.h" | ||||
[email protected] | b9363b2 | 2010-06-09 22:06:15 | [diff] [blame] | 96 | #endif |
97 | |||||
98 | namespace gfx { | ||||
99 | |||||
100 | // Find an entry point to the mock GL implementation. | ||||
101 | void* GL_BINDING_CALL GetMockGLProcAddress(const char* name); | ||||
102 | |||||
103 | } // namespace gfx | ||||
104 | |||||
[email protected] | c9e2cbbb | 2012-05-12 21:17:27 | [diff] [blame^] | 105 | #endif // UI_GL_GL_BINDINGS_H_ |