OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Includes the platform independent and platform dependent GL headers. | 5 // Includes the platform independent and platform dependent GL headers. |
6 // Only include this in cc files. It pulls in system headers, including | 6 // Only include this in cc files. It pulls in system headers, including |
7 // the X11 headers on linux, which define all kinds of macros that are | 7 // the X11 headers on linux, which define all kinds of macros that are |
8 // liable to cause conflicts. | 8 // liable to cause conflicts. |
9 | 9 |
10 #ifndef UI_GFX_GL_GL_BINDINGS_H_ | 10 #ifndef UI_GFX_GL_GL_BINDINGS_H_ |
11 #define UI_GFX_GL_GL_BINDINGS_H_ | 11 #define UI_GFX_GL_GL_BINDINGS_H_ |
12 #pragma once | 12 #pragma once |
13 | 13 |
14 #include <GL/gl.h> | 14 #include <GL/gl.h> |
15 #include <GL/glext.h> | 15 #include <GL/glext.h> |
16 | 16 |
17 #include "build/build_config.h" | 17 #include "build/build_config.h" |
18 #if defined(OS_WIN) | 18 #if defined(OS_WIN) |
19 #include "base/logging.h" | 19 #include "base/logging.h" |
20 #endif | 20 #endif |
21 | 21 |
22 // The standard OpenGL native extension headers are also included. | 22 // The standard OpenGL native extension headers are also included. |
23 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
24 #include <GL/wglext.h> | 24 #include <GL/wglext.h> |
25 #elif defined(OS_LINUX) | 25 #elif defined(OS_MACOSX) |
| 26 #include <OpenGL/OpenGL.h> |
| 27 #elif defined(USE_X11) |
26 #include <GL/glx.h> | 28 #include <GL/glx.h> |
27 #include <GL/glxext.h> | 29 #include <GL/glxext.h> |
28 | 30 |
29 // Undefine some macros defined by X headers. This is why this file should only | 31 // Undefine some macros defined by X headers. This is why this file should only |
30 // be included in .cc files. | 32 // be included in .cc files. |
31 #undef Bool | 33 #undef Bool |
32 #undef None | 34 #undef None |
33 #undef Status | 35 #undef Status |
34 | |
35 #elif defined(OS_MACOSX) | |
36 #include <OpenGL/OpenGL.h> | |
37 #endif | 36 #endif |
38 | 37 |
39 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
40 #define GL_BINDING_CALL WINAPI | 39 #define GL_BINDING_CALL WINAPI |
41 #else | 40 #else |
42 #define GL_BINDING_CALL | 41 #define GL_BINDING_CALL |
43 #endif | 42 #endif |
44 | 43 |
45 #if defined(OS_WIN) | 44 #if defined(OS_WIN) |
46 #define GL_SERVICE_LOG(args) DLOG(INFO) << args; | 45 #define GL_SERVICE_LOG(args) DLOG(INFO) << args; |
47 #else | 46 #else |
48 #define GL_SERVICE_LOG(args) | 47 #define GL_SERVICE_LOG(args) |
49 #endif | 48 #endif |
50 | 49 |
51 // Forward declare OSMesa types. | 50 // Forward declare OSMesa types. |
52 typedef struct osmesa_context *OSMesaContext; | 51 typedef struct osmesa_context *OSMesaContext; |
53 typedef void (*OSMESAproc)(); | 52 typedef void (*OSMESAproc)(); |
54 | 53 |
55 #if defined(OS_WIN) || defined(OS_LINUX) | 54 #if !defined(OS_MACOSX) |
56 | 55 |
57 // Forward declare EGL types. | 56 // Forward declare EGL types. |
58 typedef unsigned int EGLBoolean; | 57 typedef unsigned int EGLBoolean; |
59 typedef unsigned int EGLenum; | 58 typedef unsigned int EGLenum; |
60 typedef int EGLint; | 59 typedef int EGLint; |
61 typedef void *EGLConfig; | 60 typedef void *EGLConfig; |
62 typedef void *EGLContext; | 61 typedef void *EGLContext; |
63 typedef void *EGLDisplay; | 62 typedef void *EGLDisplay; |
64 typedef void *EGLSurface; | 63 typedef void *EGLSurface; |
65 typedef void *EGLClientBuffer; | 64 typedef void *EGLClientBuffer; |
66 typedef void (*__eglMustCastToProperFunctionPointerType)(void); | 65 typedef void (*__eglMustCastToProperFunctionPointerType)(void); |
67 | 66 |
68 #if defined(OS_WIN) | 67 #if defined(OS_WIN) |
69 typedef HDC EGLNativeDisplayType; | 68 typedef HDC EGLNativeDisplayType; |
70 typedef HBITMAP EGLNativePixmapType; | 69 typedef HBITMAP EGLNativePixmapType; |
71 typedef HWND EGLNativeWindowType; | 70 typedef HWND EGLNativeWindowType; |
72 #else | 71 #else |
73 typedef Display *EGLNativeDisplayType; | 72 typedef Display *EGLNativeDisplayType; |
74 typedef Pixmap EGLNativePixmapType; | 73 typedef Pixmap EGLNativePixmapType; |
75 typedef Window EGLNativeWindowType; | 74 typedef Window EGLNativeWindowType; |
76 #endif | 75 #endif |
77 | 76 |
78 #endif // OS_WIN || OS_LINUX | 77 #endif // !OS_MACOSX |
79 | 78 |
80 #include "gl_bindings_autogen_gl.h" | 79 #include "gl_bindings_autogen_gl.h" |
81 #include "gl_bindings_autogen_osmesa.h" | 80 #include "gl_bindings_autogen_osmesa.h" |
82 | 81 |
83 #if defined(OS_WIN) | 82 #if defined(OS_WIN) |
84 #include "gl_bindings_autogen_egl.h" | 83 #include "gl_bindings_autogen_egl.h" |
85 #include "gl_bindings_autogen_wgl.h" | 84 #include "gl_bindings_autogen_wgl.h" |
86 #elif defined(OS_LINUX) | 85 #elif defined(USE_X11) |
87 #include "gl_bindings_autogen_egl.h" | 86 #include "gl_bindings_autogen_egl.h" |
88 #include "gl_bindings_autogen_glx.h" | 87 #include "gl_bindings_autogen_glx.h" |
89 #endif | 88 #endif |
90 | 89 |
91 namespace gfx { | 90 namespace gfx { |
92 | 91 |
93 // Find an entry point to the mock GL implementation. | 92 // Find an entry point to the mock GL implementation. |
94 void* GL_BINDING_CALL GetMockGLProcAddress(const char* name); | 93 void* GL_BINDING_CALL GetMockGLProcAddress(const char* name); |
95 | 94 |
96 } // namespace gfx | 95 } // namespace gfx |
97 | 96 |
98 #endif // UI_GFX_GL_GL_BINDINGS_H_ | 97 #endif // UI_GFX_GL_GL_BINDINGS_H_ |
OLD | NEW |