1#ifndef __eglplatform_h_
2#define __eglplatform_h_
3
4/*
5** Copyright 2007-2020 The Khronos Group Inc.
6** SPDX-License-Identifier: Apache-2.0
7*/
8
9/* Platform-specific types and definitions for egl.h
10 *
11 * Adopters may modify khrplatform.h and this file to suit their platform.
12 * You are encouraged to submit all modifications to the Khronos group so that
13 * they can be included in future versions of this file. Please submit changes
14 * by filing an issue or pull request on the public Khronos EGL Registry, at
15 * https://www.github.com/KhronosGroup/EGL-Registry/
16 */
17
18#include <KHR/khrplatform.h>
19
20/* Macros used in EGL function prototype declarations.
21 *
22 * EGL functions should be prototyped as:
23 *
24 * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
25 * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
26 *
27 * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
28 */
29
30#ifndef EGLAPI
31#define EGLAPI KHRONOS_APICALL
32#endif
33
34#ifndef EGLAPIENTRY
35#define EGLAPIENTRY KHRONOS_APIENTRY
36#endif
37#define EGLAPIENTRYP EGLAPIENTRY*
38
39/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
40 * are aliases of window-system-dependent types, such as X Display * or
41 * Windows Device Context. They must be defined in platform-specific
42 * code below. The EGL-prefixed versions of Native*Type are the same
43 * types, renamed in EGL 1.3 so all types in the API start with "EGL".
44 *
45 * Khronos STRONGLY RECOMMENDS that you use the default definitions
46 * provided below, since these changes affect both binary and source
47 * portability of applications using EGL running on different EGL
48 * implementations.
49 */
50
51#if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES)
52
53typedef void *EGLNativeDisplayType;
54typedef void *EGLNativePixmapType;
55typedef void *EGLNativeWindowType;
56
57#elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
58#ifndef WIN32_LEAN_AND_MEAN
59#define WIN32_LEAN_AND_MEAN 1
60#endif
61#include <windows.h>
62
63typedef HDC EGLNativeDisplayType;
64typedef HBITMAP EGLNativePixmapType;
65typedef HWND EGLNativeWindowType;
66
67#elif defined(__EMSCRIPTEN__)
68
69typedef int EGLNativeDisplayType;
70typedef int EGLNativePixmapType;
71typedef int EGLNativeWindowType;
72
73#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
74
75typedef int EGLNativeDisplayType;
76typedef void *EGLNativePixmapType;
77typedef void *EGLNativeWindowType;
78
79#elif defined(WL_EGL_PLATFORM)
80
81typedef struct wl_display *EGLNativeDisplayType;
82typedef struct wl_egl_pixmap *EGLNativePixmapType;
83typedef struct wl_egl_window *EGLNativeWindowType;
84
85#elif defined(__GBM__)
86
87typedef struct gbm_device *EGLNativeDisplayType;
88typedef struct gbm_bo *EGLNativePixmapType;
89typedef void *EGLNativeWindowType;
90
91#elif defined(__ANDROID__) || defined(ANDROID)
92
93struct ANativeWindow;
94struct egl_native_pixmap_t;
95
96typedef void* EGLNativeDisplayType;
97typedef struct egl_native_pixmap_t* EGLNativePixmapType;
98typedef struct ANativeWindow* EGLNativeWindowType;
99
100#elif defined(USE_OZONE)
101
102typedef intptr_t EGLNativeDisplayType;
103typedef intptr_t EGLNativePixmapType;
104typedef intptr_t EGLNativeWindowType;
105
106#elif defined(USE_X11)
107
108/* X11 (tentative) */
109#include <X11/Xlib.h>
110#include <X11/Xutil.h>
111
112typedef Display *EGLNativeDisplayType;
113typedef Pixmap EGLNativePixmapType;
114typedef Window EGLNativeWindowType;
115
116#elif defined(__unix__)
117
118typedef void *EGLNativeDisplayType;
119typedef khronos_uintptr_t EGLNativePixmapType;
120typedef khronos_uintptr_t EGLNativeWindowType;
121
122#elif defined(__APPLE__)
123
124typedef int EGLNativeDisplayType;
125typedef void *EGLNativePixmapType;
126typedef void *EGLNativeWindowType;
127
128#elif defined(__HAIKU__)
129
130#include <kernel/image.h>
131
132typedef void *EGLNativeDisplayType;
133typedef khronos_uintptr_t EGLNativePixmapType;
134typedef khronos_uintptr_t EGLNativeWindowType;
135
136#elif defined(__Fuchsia__)
137
138typedef void *EGLNativeDisplayType;
139typedef khronos_uintptr_t EGLNativePixmapType;
140typedef khronos_uintptr_t EGLNativeWindowType;
141
142#else
143#error "Platform not recognized"
144#endif
145
146/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
147typedef EGLNativeDisplayType NativeDisplayType;
148typedef EGLNativePixmapType NativePixmapType;
149typedef EGLNativeWindowType NativeWindowType;
150
151
152/* Define EGLint. This must be a signed integral type large enough to contain
153 * all legal attribute names and values passed into and out of EGL, whether
154 * their type is boolean, bitmask, enumerant (symbolic constant), integer,
155 * handle, or other. While in general a 32-bit integer will suffice, if
156 * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
157 * integer type.
158 */
159typedef khronos_int32_t EGLint;
160
161
162/* C++ / C typecast macros for special EGL handle values */
163#if defined(__cplusplus)
164#define EGL_CAST(type, value) (static_cast<type>(value))
165#else
166#define EGL_CAST(type, value) ((type) (value))
167#endif
168
169#endif /* __eglplatform_h */
170

source code of include/EGL/eglplatform.h