1#ifndef __eglplatform_h_
2#define __eglplatform_h_
3
4/*
5** Copyright (c) 2007-2016 The Khronos Group Inc.
6**
7** Permission is hereby granted, free of charge, to any person obtaining a
8** copy of this software and/or associated documentation files (the
9** "Materials"), to deal in the Materials without restriction, including
10** without limitation the rights to use, copy, modify, merge, publish,
11** distribute, sublicense, and/or sell copies of the Materials, and to
12** permit persons to whom the Materials are furnished to do so, subject to
13** the following conditions:
14**
15** The above copyright notice and this permission notice shall be included
16** in all copies or substantial portions of the Materials.
17**
18** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
25*/
26
27/* Platform-specific types and definitions for egl.h
28 * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $
29 *
30 * Adopters may modify khrplatform.h and this file to suit their platform.
31 * You are encouraged to submit all modifications to the Khronos group so that
32 * they can be included in future versions of this file. Please submit changes
33 * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
34 * by filing a bug against product "EGL" component "Registry".
35 */
36
37#include <KHR/khrplatform.h>
38
39/* Macros used in EGL function prototype declarations.
40 *
41 * EGL functions should be prototyped as:
42 *
43 * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
44 * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
45 *
46 * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
47 */
48
49#ifndef EGLAPI
50#define EGLAPI KHRONOS_APICALL
51#endif
52
53#ifndef EGLAPIENTRY
54#define EGLAPIENTRY KHRONOS_APIENTRY
55#endif
56#define EGLAPIENTRYP EGLAPIENTRY*
57
58/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
59 * are aliases of window-system-dependent types, such as X Display * or
60 * Windows Device Context. They must be defined in platform-specific
61 * code below. The EGL-prefixed versions of Native*Type are the same
62 * types, renamed in EGL 1.3 so all types in the API start with "EGL".
63 *
64 * Khronos STRONGLY RECOMMENDS that you use the default definitions
65 * provided below, since these changes affect both binary and source
66 * portability of applications using EGL running on different EGL
67 * implementations.
68 */
69
70#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
71#ifndef WIN32_LEAN_AND_MEAN
72#define WIN32_LEAN_AND_MEAN 1
73#endif
74#include <windows.h>
75
76typedef HDC EGLNativeDisplayType;
77typedef HBITMAP EGLNativePixmapType;
78
79#if !defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP) /* Windows Desktop */
80typedef HWND EGLNativeWindowType;
81#else /* Windows Store */
82#include <inspectable.h>
83typedef IInspectable* EGLNativeWindowType;
84#endif
85
86#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
87
88typedef int EGLNativeDisplayType;
89typedef void *EGLNativePixmapType;
90typedef void *EGLNativeWindowType;
91
92#elif defined(WL_EGL_PLATFORM)
93
94typedef struct wl_display *EGLNativeDisplayType;
95typedef struct wl_egl_pixmap *EGLNativePixmapType;
96typedef struct wl_egl_window *EGLNativeWindowType;
97
98#elif defined(__GBM__)
99
100typedef struct gbm_device *EGLNativeDisplayType;
101typedef struct gbm_bo *EGLNativePixmapType;
102typedef void *EGLNativeWindowType;
103
104#elif defined(__ANDROID__) || defined(ANDROID)
105
106struct ANativeWindow;
107struct egl_native_pixmap_t;
108
109typedef void* EGLNativeDisplayType;
110typedef struct egl_native_pixmap_t* EGLNativePixmapType;
111typedef struct ANativeWindow* EGLNativeWindowType;
112
113#elif defined(USE_OZONE) || defined(USE_SYSTEM_EGL)
114
115typedef intptr_t EGLNativeDisplayType;
116typedef intptr_t EGLNativePixmapType;
117typedef intptr_t EGLNativeWindowType;
118
119#elif defined(__unix__) || defined(USE_X11)
120
121/* X11 (tentative) */
122#include <X11/Xlib.h>
123#include <X11/Xutil.h>
124
125typedef Display *EGLNativeDisplayType;
126typedef Pixmap EGLNativePixmapType;
127typedef Window EGLNativeWindowType;
128
129#elif defined(__APPLE__)
130
131typedef int EGLNativeDisplayType;
132typedef void *EGLNativePixmapType;
133typedef void *EGLNativeWindowType;
134
135#elif defined(__HAIKU__)
136
137#include <kernel/image.h>
138
139typedef void *EGLNativeDisplayType;
140typedef khronos_uintptr_t EGLNativePixmapType;
141typedef khronos_uintptr_t EGLNativeWindowType;
142
143#elif defined(__Fuchsia__)
144
145typedef int EGLNativeDisplayType;
146typedef void *EGLNativePixmapType;
147typedef void *EGLNativeWindowType
148
149#else
150#error "Platform not recognized"
151#endif
152
153/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
154typedef EGLNativeDisplayType NativeDisplayType;
155typedef EGLNativePixmapType NativePixmapType;
156typedef EGLNativeWindowType NativeWindowType;
157
158
159/* Define EGLint. This must be a signed integral type large enough to contain
160 * all legal attribute names and values passed into and out of EGL, whether
161 * their type is boolean, bitmask, enumerant (symbolic constant), integer,
162 * handle, or other. While in general a 32-bit integer will suffice, if
163 * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
164 * integer type.
165 */
166typedef khronos_int32_t EGLint;
167
168
169/* C++ / C typecast macros for special EGL handle values */
170#if defined(__cplusplus)
171#define EGL_CAST(type, value) (static_cast<type>(value))
172#else
173#define EGL_CAST(type, value) ((type) (value))
174#endif
175
176#endif /* __eglplatform_h */
177