14a49301eSmrg#ifndef __eglplatform_h_ 24a49301eSmrg#define __eglplatform_h_ 34a49301eSmrg 4cdc920a0Smrg/* 501e04c3fSmrg** Copyright (c) 2007-2016 The Khronos Group Inc. 6cdc920a0Smrg** 7cdc920a0Smrg** Permission is hereby granted, free of charge, to any person obtaining a 8cdc920a0Smrg** copy of this software and/or associated documentation files (the 9cdc920a0Smrg** "Materials"), to deal in the Materials without restriction, including 10cdc920a0Smrg** without limitation the rights to use, copy, modify, merge, publish, 11cdc920a0Smrg** distribute, sublicense, and/or sell copies of the Materials, and to 12cdc920a0Smrg** permit persons to whom the Materials are furnished to do so, subject to 13cdc920a0Smrg** the following conditions: 14cdc920a0Smrg** 15cdc920a0Smrg** The above copyright notice and this permission notice shall be included 16cdc920a0Smrg** in all copies or substantial portions of the Materials. 17cdc920a0Smrg** 18cdc920a0Smrg** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19cdc920a0Smrg** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20cdc920a0Smrg** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21cdc920a0Smrg** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22cdc920a0Smrg** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23cdc920a0Smrg** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24cdc920a0Smrg** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 25cdc920a0Smrg*/ 26cdc920a0Smrg 27cdc920a0Smrg/* Platform-specific types and definitions for egl.h 287ec681f3Smrg * $Revision: 1.1.1.6 $ on $Date: 2022/05/09 01:23:24 $ 29cdc920a0Smrg * 30cdc920a0Smrg * Adopters may modify khrplatform.h and this file to suit their platform. 31cdc920a0Smrg * You are encouraged to submit all modifications to the Khronos group so that 32cdc920a0Smrg * they can be included in future versions of this file. Please submit changes 33cdc920a0Smrg * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 34cdc920a0Smrg * by filing a bug against product "EGL" component "Registry". 35cdc920a0Smrg */ 364a49301eSmrg 37cdc920a0Smrg#include <KHR/khrplatform.h> 384a49301eSmrg 394a49301eSmrg/* Macros used in EGL function prototype declarations. 40cdc920a0Smrg * 41cdc920a0Smrg * EGL functions should be prototyped as: 424a49301eSmrg * 434a49301eSmrg * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); 444a49301eSmrg * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); 454a49301eSmrg * 46cdc920a0Smrg * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h 474a49301eSmrg */ 484a49301eSmrg 49cdc920a0Smrg#ifndef EGLAPI 50cdc920a0Smrg#define EGLAPI KHRONOS_APICALL 514a49301eSmrg#endif 52cdc920a0Smrg 53cdc920a0Smrg#ifndef EGLAPIENTRY 54cdc920a0Smrg#define EGLAPIENTRY KHRONOS_APIENTRY 554a49301eSmrg#endif 56cdc920a0Smrg#define EGLAPIENTRYP EGLAPIENTRY* 574a49301eSmrg 587ec681f3Smrg#if defined(MESA_EGL_NO_X11_HEADERS) && !defined(EGL_NO_X11) 597ec681f3Smrg#warning "`MESA_EGL_NO_X11_HEADERS` is deprecated, and doesn't work with the unmodified Khronos header" 607ec681f3Smrg#warning "Please use `EGL_NO_X11` instead, as `MESA_EGL_NO_X11_HEADERS` will be removed soon" 617ec681f3Smrg#define EGL_NO_X11 627ec681f3Smrg#endif 637ec681f3Smrg 644a49301eSmrg/* The types NativeDisplayType, NativeWindowType, and NativePixmapType 654a49301eSmrg * are aliases of window-system-dependent types, such as X Display * or 664a49301eSmrg * Windows Device Context. They must be defined in platform-specific 674a49301eSmrg * code below. The EGL-prefixed versions of Native*Type are the same 684a49301eSmrg * types, renamed in EGL 1.3 so all types in the API start with "EGL". 69af69d88dSmrg * 70af69d88dSmrg * Khronos STRONGLY RECOMMENDS that you use the default definitions 71af69d88dSmrg * provided below, since these changes affect both binary and source 72af69d88dSmrg * portability of applications using EGL running on different EGL 73af69d88dSmrg * implementations. 744a49301eSmrg */ 754a49301eSmrg 76cdc920a0Smrg#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ 77cdc920a0Smrg#ifndef WIN32_LEAN_AND_MEAN 78cdc920a0Smrg#define WIN32_LEAN_AND_MEAN 1 794a49301eSmrg#endif 80cdc920a0Smrg#include <windows.h> 814a49301eSmrg 82cdc920a0Smrgtypedef HDC EGLNativeDisplayType; 83cdc920a0Smrgtypedef HBITMAP EGLNativePixmapType; 84cdc920a0Smrgtypedef HWND EGLNativeWindowType; 854a49301eSmrg 867ec681f3Smrg#elif defined(__EMSCRIPTEN__) 877ec681f3Smrg 887ec681f3Smrgtypedef int EGLNativeDisplayType; 897ec681f3Smrgtypedef int EGLNativePixmapType; 907ec681f3Smrgtypedef int EGLNativeWindowType; 917ec681f3Smrg 92cdc920a0Smrg#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ 934a49301eSmrg 94cdc920a0Smrgtypedef int EGLNativeDisplayType; 95cdc920a0Smrgtypedef void *EGLNativePixmapType; 967ec681f3Smrgtypedef void *EGLNativeWindowType; 974a49301eSmrg 983464ebd5Sriastradh#elif defined(WL_EGL_PLATFORM) 993464ebd5Sriastradh 1003464ebd5Sriastradhtypedef struct wl_display *EGLNativeDisplayType; 1013464ebd5Sriastradhtypedef struct wl_egl_pixmap *EGLNativePixmapType; 1023464ebd5Sriastradhtypedef struct wl_egl_window *EGLNativeWindowType; 1033464ebd5Sriastradh 1043464ebd5Sriastradh#elif defined(__GBM__) 1053464ebd5Sriastradh 1063464ebd5Sriastradhtypedef struct gbm_device *EGLNativeDisplayType; 1073464ebd5Sriastradhtypedef struct gbm_bo *EGLNativePixmapType; 1083464ebd5Sriastradhtypedef void *EGLNativeWindowType; 1093464ebd5Sriastradh 11001e04c3fSmrg#elif defined(__ANDROID__) || defined(ANDROID) 111af69d88dSmrg 112af69d88dSmrgstruct ANativeWindow; 113af69d88dSmrgstruct egl_native_pixmap_t; 114af69d88dSmrg 11501e04c3fSmrgtypedef void* EGLNativeDisplayType; 1167ec681f3Smrgtypedef struct egl_native_pixmap_t* EGLNativePixmapType; 1177ec681f3Smrgtypedef struct ANativeWindow* EGLNativeWindowType; 118af69d88dSmrg 11901e04c3fSmrg#elif defined(USE_OZONE) 1204a49301eSmrg 12101e04c3fSmrgtypedef intptr_t EGLNativeDisplayType; 12201e04c3fSmrgtypedef intptr_t EGLNativePixmapType; 1237ec681f3Smrgtypedef intptr_t EGLNativeWindowType; 12401e04c3fSmrg 1257ec681f3Smrg#elif defined(__unix__) && defined(EGL_NO_X11) 1263464ebd5Sriastradh 1277ec681f3Smrgtypedef void *EGLNativeDisplayType; 128af69d88dSmrgtypedef khronos_uintptr_t EGLNativePixmapType; 129af69d88dSmrgtypedef khronos_uintptr_t EGLNativeWindowType; 1303464ebd5Sriastradh 1317ec681f3Smrg#elif defined(__unix__) || defined(USE_X11) 1323464ebd5Sriastradh 133cdc920a0Smrg/* X11 (tentative) */ 1344a49301eSmrg#include <X11/Xlib.h> 135cdc920a0Smrg#include <X11/Xutil.h> 136cdc920a0Smrg 137cdc920a0Smrgtypedef Display *EGLNativeDisplayType; 138cdc920a0Smrgtypedef Pixmap EGLNativePixmapType; 139cdc920a0Smrgtypedef Window EGLNativeWindowType; 1404a49301eSmrg 1417ec681f3Smrg#elif defined(__APPLE__) 1427ec681f3Smrg 1437ec681f3Smrgtypedef int EGLNativeDisplayType; 1447ec681f3Smrgtypedef void *EGLNativePixmapType; 1457ec681f3Smrgtypedef void *EGLNativeWindowType; 1463464ebd5Sriastradh 14701e04c3fSmrg#elif defined(__HAIKU__) 14801e04c3fSmrg 14901e04c3fSmrg#include <kernel/image.h> 15001e04c3fSmrg 15101e04c3fSmrgtypedef void *EGLNativeDisplayType; 15201e04c3fSmrgtypedef khronos_uintptr_t EGLNativePixmapType; 15301e04c3fSmrgtypedef khronos_uintptr_t EGLNativeWindowType; 15401e04c3fSmrg 155cdc920a0Smrg#else 156cdc920a0Smrg#error "Platform not recognized" 1574a49301eSmrg#endif 1584a49301eSmrg 1594a49301eSmrg/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ 160cdc920a0Smrgtypedef EGLNativeDisplayType NativeDisplayType; 161cdc920a0Smrgtypedef EGLNativePixmapType NativePixmapType; 162cdc920a0Smrgtypedef EGLNativeWindowType NativeWindowType; 163cdc920a0Smrg 164cdc920a0Smrg 165cdc920a0Smrg/* Define EGLint. This must be a signed integral type large enough to contain 166cdc920a0Smrg * all legal attribute names and values passed into and out of EGL, whether 167cdc920a0Smrg * their type is boolean, bitmask, enumerant (symbolic constant), integer, 168cdc920a0Smrg * handle, or other. While in general a 32-bit integer will suffice, if 169cdc920a0Smrg * handles are 64 bit types, then EGLint should be defined as a signed 64-bit 170cdc920a0Smrg * integer type. 171cdc920a0Smrg */ 172cdc920a0Smrgtypedef khronos_int32_t EGLint; 1734a49301eSmrg 17401e04c3fSmrg 17501e04c3fSmrg/* C++ / C typecast macros for special EGL handle values */ 17601e04c3fSmrg#if defined(__cplusplus) 17701e04c3fSmrg#define EGL_CAST(type, value) (static_cast<type>(value)) 17801e04c3fSmrg#else 17901e04c3fSmrg#define EGL_CAST(type, value) ((type) (value)) 18001e04c3fSmrg#endif 18101e04c3fSmrg 1824a49301eSmrg#endif /* __eglplatform_h */ 183