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 #if defined(MESA_EGL_NO_X11_HEADERS) && !defined(EGL_NO_X11) 59 #warning "`MESA_EGL_NO_X11_HEADERS` is deprecated, and doesn't work with the unmodified Khronos header" 60 #warning "Please use `EGL_NO_X11` instead, as `MESA_EGL_NO_X11_HEADERS` will be removed soon" 61 #define EGL_NO_X11 62 #endif 63 64 /* The types NativeDisplayType, NativeWindowType, and NativePixmapType 65 * are aliases of window-system-dependent types, such as X Display * or 66 * Windows Device Context. They must be defined in platform-specific 67 * code below. The EGL-prefixed versions of Native*Type are the same 68 * types, renamed in EGL 1.3 so all types in the API start with "EGL". 69 * 70 * Khronos STRONGLY RECOMMENDS that you use the default definitions 71 * provided below, since these changes affect both binary and source 72 * portability of applications using EGL running on different EGL 73 * implementations. 74 */ 75 76 #if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ 77 #ifndef WIN32_LEAN_AND_MEAN 78 #define WIN32_LEAN_AND_MEAN 1 79 #endif 80 #include <windows.h> 81 82 typedef HDC EGLNativeDisplayType; 83 typedef HBITMAP EGLNativePixmapType; 84 typedef HWND EGLNativeWindowType; 85 86 #elif defined(__EMSCRIPTEN__) 87 88 typedef int EGLNativeDisplayType; 89 typedef int EGLNativePixmapType; 90 typedef int EGLNativeWindowType; 91 92 #elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ 93 94 typedef int EGLNativeDisplayType; 95 typedef void *EGLNativePixmapType; 96 typedef void *EGLNativeWindowType; 97 98 #elif defined(WL_EGL_PLATFORM) 99 100 typedef struct wl_display *EGLNativeDisplayType; 101 typedef struct wl_egl_pixmap *EGLNativePixmapType; 102 typedef struct wl_egl_window *EGLNativeWindowType; 103 104 #elif defined(__GBM__) 105 106 typedef struct gbm_device *EGLNativeDisplayType; 107 typedef struct gbm_bo *EGLNativePixmapType; 108 typedef void *EGLNativeWindowType; 109 110 #elif defined(__ANDROID__) || defined(ANDROID) 111 112 struct ANativeWindow; 113 struct egl_native_pixmap_t; 114 115 typedef void* EGLNativeDisplayType; 116 typedef struct egl_native_pixmap_t* EGLNativePixmapType; 117 typedef struct ANativeWindow* EGLNativeWindowType; 118 119 #elif defined(USE_OZONE) 120 121 typedef intptr_t EGLNativeDisplayType; 122 typedef intptr_t EGLNativePixmapType; 123 typedef intptr_t EGLNativeWindowType; 124 125 #elif defined(__unix__) && defined(EGL_NO_X11) 126 127 typedef void *EGLNativeDisplayType; 128 typedef khronos_uintptr_t EGLNativePixmapType; 129 typedef khronos_uintptr_t EGLNativeWindowType; 130 131 #elif defined(__unix__) || defined(USE_X11) 132 133 /* X11 (tentative) */ 134 #include <X11/Xlib.h> 135 #include <X11/Xutil.h> 136 137 typedef Display *EGLNativeDisplayType; 138 typedef Pixmap EGLNativePixmapType; 139 typedef Window EGLNativeWindowType; 140 141 #elif defined(__APPLE__) 142 143 typedef int EGLNativeDisplayType; 144 typedef void *EGLNativePixmapType; 145 typedef void *EGLNativeWindowType; 146 147 #elif defined(__HAIKU__) 148 149 #include <kernel/image.h> 150 151 typedef void *EGLNativeDisplayType; 152 typedef khronos_uintptr_t EGLNativePixmapType; 153 typedef khronos_uintptr_t EGLNativeWindowType; 154 155 #else 156 #error "Platform not recognized" 157 #endif 158 159 /* EGL 1.2 types, renamed for consistency in EGL 1.3 */ 160 typedef EGLNativeDisplayType NativeDisplayType; 161 typedef EGLNativePixmapType NativePixmapType; 162 typedef EGLNativeWindowType NativeWindowType; 163 164 165 /* Define EGLint. This must be a signed integral type large enough to contain 166 * all legal attribute names and values passed into and out of EGL, whether 167 * their type is boolean, bitmask, enumerant (symbolic constant), integer, 168 * handle, or other. While in general a 32-bit integer will suffice, if 169 * handles are 64 bit types, then EGLint should be defined as a signed 64-bit 170 * integer type. 171 */ 172 typedef khronos_int32_t EGLint; 173 174 175 /* C++ / C typecast macros for special EGL handle values */ 176 #if defined(__cplusplus) 177 #define EGL_CAST(type, value) (static_cast<type>(value)) 178 #else 179 #define EGL_CAST(type, value) ((type) (value)) 180 #endif 181 182 #endif /* __eglplatform_h */ 183