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