1 #ifndef __eglplatform_h_
2 #define __eglplatform_h_
5 ** Copyright (c) 2007-2016 The Khronos Group Inc.
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:
15 ** The above copyright notice and this permission notice shall be included
16 ** in all copies or substantial portions of the Materials.
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.
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) $
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".
37 #include <KHR/khrplatform.h>
39 /* Macros used in EGL function prototype declarations.
41 * EGL functions should be prototyped as:
43 * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
44 * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
46 * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
50 #define EGLAPI KHRONOS_APICALL
54 #define EGLAPIENTRY KHRONOS_APIENTRY
56 #define EGLAPIENTRYP EGLAPIENTRY*
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".
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
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
76 typedef HDC EGLNativeDisplayType
;
77 typedef HBITMAP EGLNativePixmapType
;
78 typedef HWND EGLNativeWindowType
;
80 #elif defined(__EMSCRIPTEN__)
82 typedef int EGLNativeDisplayType
;
83 typedef int EGLNativePixmapType
;
84 typedef int EGLNativeWindowType
;
86 #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
88 typedef int EGLNativeDisplayType
;
89 typedef void *EGLNativePixmapType
;
90 typedef void *EGLNativeWindowType
;
92 #elif defined(WL_EGL_PLATFORM)
94 typedef struct wl_display
*EGLNativeDisplayType
;
95 typedef struct wl_egl_pixmap
*EGLNativePixmapType
;
96 typedef struct wl_egl_window
*EGLNativeWindowType
;
98 #elif defined(__GBM__)
100 typedef struct gbm_device
*EGLNativeDisplayType
;
101 typedef struct gbm_bo
*EGLNativePixmapType
;
102 typedef void *EGLNativeWindowType
;
104 #elif defined(__ANDROID__) || defined(ANDROID)
106 struct ANativeWindow
;
107 struct egl_native_pixmap_t
;
109 typedef void* EGLNativeDisplayType
;
110 typedef struct egl_native_pixmap_t
* EGLNativePixmapType
;
111 typedef struct ANativeWindow
* EGLNativeWindowType
;
113 #elif defined(USE_OZONE)
115 typedef intptr_t EGLNativeDisplayType
;
116 typedef intptr_t EGLNativePixmapType
;
117 typedef intptr_t EGLNativeWindowType
;
119 #elif defined(__unix__) || defined(__APPLE__)
121 #if defined(MESA_EGL_NO_X11_HEADERS)
123 typedef void *EGLNativeDisplayType
;
124 typedef khronos_uintptr_t EGLNativePixmapType
;
125 typedef khronos_uintptr_t EGLNativeWindowType
;
129 /* X11 (tentative) */
130 #include <X11/Xlib.h>
131 #include <X11/Xutil.h>
133 typedef Display
*EGLNativeDisplayType
;
134 typedef Pixmap EGLNativePixmapType
;
135 typedef Window EGLNativeWindowType
;
137 #endif /* MESA_EGL_NO_X11_HEADERS */
139 #elif defined(__HAIKU__)
141 #include <kernel/image.h>
143 typedef void *EGLNativeDisplayType
;
144 typedef khronos_uintptr_t EGLNativePixmapType
;
145 typedef khronos_uintptr_t EGLNativeWindowType
;
148 #error "Platform not recognized"
151 /* EGL 1.2 types, renamed for consistency in EGL 1.3 */
152 typedef EGLNativeDisplayType NativeDisplayType
;
153 typedef EGLNativePixmapType NativePixmapType
;
154 typedef EGLNativeWindowType NativeWindowType
;
157 /* Define EGLint. This must be a signed integral type large enough to contain
158 * all legal attribute names and values passed into and out of EGL, whether
159 * their type is boolean, bitmask, enumerant (symbolic constant), integer,
160 * handle, or other. While in general a 32-bit integer will suffice, if
161 * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
164 typedef khronos_int32_t EGLint
;
167 /* C++ / C typecast macros for special EGL handle values */
168 #if defined(__cplusplus)
169 #define EGL_CAST(type, value) (static_cast<type>(value))
171 #define EGL_CAST(type, value) ((type) (value))
174 #endif /* __eglplatform_h */