| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 1 | #ifndef __eglplatform_h_ | 
|  | 2 | #define __eglplatform_h_ | 
|  | 3 |  | 
|  | 4 | /* | 
| Ian Elliott | e7be42b | 2017-07-06 13:02:32 -0600 | [diff] [blame] | 5 | ** Copyright (c) 2007-2016 The Khronos Group Inc. | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 | 
| Ian Elliott | e7be42b | 2017-07-06 13:02:32 -0600 | [diff] [blame] | 28 | * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $ | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 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 |  | 
| Mathias Agopian | e81a3cb | 2010-06-09 18:46:35 -0700 | [diff] [blame] | 53 | #ifndef EGLAPIENTRY | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 54 | #define EGLAPIENTRY  KHRONOS_APIENTRY | 
| Mathias Agopian | e81a3cb | 2010-06-09 18:46:35 -0700 | [diff] [blame] | 55 | #endif | 
|  | 56 | #define EGLAPIENTRYP EGLAPIENTRY* | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 57 |  | 
|  | 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". | 
| Mathias Agopian | 12af3f6 | 2013-03-27 14:55:03 -0700 | [diff] [blame] | 63 | * | 
|  | 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 | 
|  | 67 | * implementations. | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 68 | */ | 
|  | 69 |  | 
|  | 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 | 
|  | 73 | #endif | 
|  | 74 | #include <windows.h> | 
|  | 75 |  | 
|  | 76 | typedef HDC     EGLNativeDisplayType; | 
|  | 77 | typedef HBITMAP EGLNativePixmapType; | 
|  | 78 | typedef HWND    EGLNativeWindowType; | 
|  | 79 |  | 
| Courtney Goeltzenleuchter | edf87c1 | 2018-07-18 09:32:50 -0600 | [diff] [blame] | 80 | #elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */ | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 81 |  | 
|  | 82 | typedef int   EGLNativeDisplayType; | 
|  | 83 | typedef void *EGLNativeWindowType; | 
|  | 84 | typedef void *EGLNativePixmapType; | 
|  | 85 |  | 
| Courtney Goeltzenleuchter | edf87c1 | 2018-07-18 09:32:50 -0600 | [diff] [blame] | 86 | #elif defined(WL_EGL_PLATFORM) | 
|  | 87 |  | 
|  | 88 | typedef struct wl_display     *EGLNativeDisplayType; | 
|  | 89 | typedef struct wl_egl_pixmap  *EGLNativePixmapType; | 
|  | 90 | typedef struct wl_egl_window  *EGLNativeWindowType; | 
|  | 91 |  | 
|  | 92 | #elif defined(__GBM__) | 
|  | 93 |  | 
|  | 94 | typedef struct gbm_device  *EGLNativeDisplayType; | 
|  | 95 | typedef struct gbm_bo      *EGLNativePixmapType; | 
|  | 96 | typedef void               *EGLNativeWindowType; | 
|  | 97 |  | 
| David 'Digit' Turner | dfd0759 | 2010-11-05 12:41:51 +0100 | [diff] [blame] | 98 | #elif defined(__ANDROID__) || defined(ANDROID) | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 99 |  | 
| Mathias Agopian | b0e76f4 | 2012-03-23 14:15:44 -0700 | [diff] [blame] | 100 | struct ANativeWindow; | 
| Mathias Agopian | 7189c00 | 2009-05-05 18:11:11 -0700 | [diff] [blame] | 101 | struct egl_native_pixmap_t; | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 102 |  | 
| Dianne Hackborn | 4b5e91e | 2010-06-30 13:56:17 -0700 | [diff] [blame] | 103 | typedef struct ANativeWindow*           EGLNativeWindowType; | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 104 | typedef struct egl_native_pixmap_t*     EGLNativePixmapType; | 
|  | 105 | typedef void*                           EGLNativeDisplayType; | 
|  | 106 |  | 
| Courtney Goeltzenleuchter | edf87c1 | 2018-07-18 09:32:50 -0600 | [diff] [blame] | 107 | #elif defined(USE_OZONE) | 
|  | 108 |  | 
|  | 109 | typedef intptr_t EGLNativeDisplayType; | 
|  | 110 | typedef intptr_t EGLNativeWindowType; | 
|  | 111 | typedef intptr_t EGLNativePixmapType; | 
|  | 112 |  | 
|  | 113 | #elif defined(__unix__) || defined(USE_X11) | 
| David 'Digit' Turner | dfd0759 | 2010-11-05 12:41:51 +0100 | [diff] [blame] | 114 |  | 
|  | 115 | /* X11 (tentative)  */ | 
|  | 116 | #include <X11/Xlib.h> | 
|  | 117 | #include <X11/Xutil.h> | 
|  | 118 |  | 
|  | 119 | typedef Display *EGLNativeDisplayType; | 
|  | 120 | typedef Pixmap   EGLNativePixmapType; | 
|  | 121 | typedef Window   EGLNativeWindowType; | 
|  | 122 |  | 
| Courtney Goeltzenleuchter | edf87c1 | 2018-07-18 09:32:50 -0600 | [diff] [blame] | 123 | #elif defined(__APPLE__) | 
|  | 124 |  | 
|  | 125 | typedef int   EGLNativeDisplayType; | 
|  | 126 | typedef void *EGLNativeWindowType; | 
|  | 127 | typedef void *EGLNativePixmapType; | 
|  | 128 |  | 
|  | 129 | #elif defined(__HAIKU__) | 
|  | 130 |  | 
|  | 131 | #include <kernel/image.h> | 
|  | 132 |  | 
|  | 133 | typedef void              *EGLNativeDisplayType; | 
|  | 134 | typedef khronos_uintptr_t  EGLNativePixmapType; | 
|  | 135 | typedef khronos_uintptr_t  EGLNativeWindowType; | 
|  | 136 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 137 | #else | 
|  | 138 | #error "Platform not recognized" | 
|  | 139 | #endif | 
|  | 140 |  | 
|  | 141 | /* EGL 1.2 types, renamed for consistency in EGL 1.3 */ | 
|  | 142 | typedef EGLNativeDisplayType NativeDisplayType; | 
|  | 143 | typedef EGLNativePixmapType  NativePixmapType; | 
|  | 144 | typedef EGLNativeWindowType  NativeWindowType; | 
|  | 145 |  | 
|  | 146 |  | 
|  | 147 | /* Define EGLint. This must be a signed integral type large enough to contain | 
|  | 148 | * all legal attribute names and values passed into and out of EGL, whether | 
|  | 149 | * their type is boolean, bitmask, enumerant (symbolic constant), integer, | 
|  | 150 | * handle, or other.  While in general a 32-bit integer will suffice, if | 
|  | 151 | * handles are 64 bit types, then EGLint should be defined as a signed 64-bit | 
|  | 152 | * integer type. | 
|  | 153 | */ | 
|  | 154 | typedef khronos_int32_t EGLint; | 
|  | 155 |  | 
| Ian Elliott | e7be42b | 2017-07-06 13:02:32 -0600 | [diff] [blame] | 156 |  | 
|  | 157 | /* C++ / C typecast macros for special EGL handle values */ | 
| Colin Cross | 0c7cc2e | 2016-11-03 17:36:46 -0700 | [diff] [blame] | 158 | #if defined(__cplusplus) | 
|  | 159 | #define EGL_CAST(type, value) (static_cast<type>(value)) | 
|  | 160 | #else | 
|  | 161 | #define EGL_CAST(type, value) ((type) (value)) | 
|  | 162 | #endif | 
|  | 163 |  | 
| The Android Open Source Project | edbf3b6 | 2009-03-03 19:31:44 -0800 | [diff] [blame] | 164 | #endif /* __eglplatform_h */ |