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