1848b8605Smrg#ifndef __eglplatform_h_ 2848b8605Smrg#define __eglplatform_h_ 3848b8605Smrg 4848b8605Smrg/* 5b8e80941Smrg** Copyright (c) 2007-2016 The Khronos Group Inc. 6848b8605Smrg** 7848b8605Smrg** Permission is hereby granted, free of charge, to any person obtaining a 8848b8605Smrg** copy of this software and/or associated documentation files (the 9848b8605Smrg** "Materials"), to deal in the Materials without restriction, including 10848b8605Smrg** without limitation the rights to use, copy, modify, merge, publish, 11848b8605Smrg** distribute, sublicense, and/or sell copies of the Materials, and to 12848b8605Smrg** permit persons to whom the Materials are furnished to do so, subject to 13848b8605Smrg** the following conditions: 14848b8605Smrg** 15848b8605Smrg** The above copyright notice and this permission notice shall be included 16848b8605Smrg** in all copies or substantial portions of the Materials. 17848b8605Smrg** 18848b8605Smrg** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19848b8605Smrg** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 20848b8605Smrg** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21848b8605Smrg** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22848b8605Smrg** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23848b8605Smrg** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24848b8605Smrg** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 25848b8605Smrg*/ 26848b8605Smrg 27848b8605Smrg/* Platform-specific types and definitions for egl.h 28b8e80941Smrg * $Revision: 1.1.1.2 $ on $Date: 2021/07/11 20:36:21 $ 29848b8605Smrg * 30848b8605Smrg * Adopters may modify khrplatform.h and this file to suit their platform. 31848b8605Smrg * You are encouraged to submit all modifications to the Khronos group so that 32848b8605Smrg * they can be included in future versions of this file. Please submit changes 33848b8605Smrg * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) 34848b8605Smrg * by filing a bug against product "EGL" component "Registry". 35848b8605Smrg */ 36848b8605Smrg 37848b8605Smrg#include <KHR/khrplatform.h> 38848b8605Smrg 39848b8605Smrg/* Macros used in EGL function prototype declarations. 40848b8605Smrg * 41848b8605Smrg * EGL functions should be prototyped as: 42848b8605Smrg * 43848b8605Smrg * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); 44848b8605Smrg * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); 45848b8605Smrg * 46848b8605Smrg * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h 47848b8605Smrg */ 48848b8605Smrg 49848b8605Smrg#ifndef EGLAPI 50848b8605Smrg#define EGLAPI KHRONOS_APICALL 51848b8605Smrg#endif 52848b8605Smrg 53848b8605Smrg#ifndef EGLAPIENTRY 54848b8605Smrg#define EGLAPIENTRY KHRONOS_APIENTRY 55848b8605Smrg#endif 56848b8605Smrg#define EGLAPIENTRYP EGLAPIENTRY* 57848b8605Smrg 58848b8605Smrg/* The types NativeDisplayType, NativeWindowType, and NativePixmapType 59848b8605Smrg * are aliases of window-system-dependent types, such as X Display * or 60848b8605Smrg * Windows Device Context. They must be defined in platform-specific 61848b8605Smrg * code below. The EGL-prefixed versions of Native*Type are the same 62848b8605Smrg * types, renamed in EGL 1.3 so all types in the API start with "EGL". 63848b8605Smrg * 64848b8605Smrg * Khronos STRONGLY RECOMMENDS that you use the default definitions 65848b8605Smrg * provided below, since these changes affect both binary and source 66848b8605Smrg * portability of applications using EGL running on different EGL 67848b8605Smrg * implementations. 68848b8605Smrg */ 69848b8605Smrg 70848b8605Smrg#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ 71848b8605Smrg#ifndef WIN32_LEAN_AND_MEAN 72848b8605Smrg#define WIN32_LEAN_AND_MEAN 1 73848b8605Smrg#endif 74848b8605Smrg#include <windows.h> 75848b8605Smrg 76848b8605Smrgtypedef HDC EGLNativeDisplayType; 77848b8605Smrgtypedef HBITMAP EGLNativePixmapType; 78848b8605Smrgtypedef HWND EGLNativeWindowType; 79848b8605Smrg 80848b8605Smrg#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ 81848b8605Smrg 82848b8605Smrgtypedef int EGLNativeDisplayType; 83848b8605Smrgtypedef void *EGLNativeWindowType; 84848b8605Smrgtypedef void *EGLNativePixmapType; 85848b8605Smrg 86848b8605Smrg#elif defined(WL_EGL_PLATFORM) 87848b8605Smrg 88848b8605Smrgtypedef struct wl_display *EGLNativeDisplayType; 89848b8605Smrgtypedef struct wl_egl_pixmap *EGLNativePixmapType; 90848b8605Smrgtypedef struct wl_egl_window *EGLNativeWindowType; 91848b8605Smrg 92848b8605Smrg#elif defined(__GBM__) 93848b8605Smrg 94848b8605Smrgtypedef struct gbm_device *EGLNativeDisplayType; 95848b8605Smrgtypedef struct gbm_bo *EGLNativePixmapType; 96848b8605Smrgtypedef void *EGLNativeWindowType; 97848b8605Smrg 98b8e80941Smrg#elif defined(__ANDROID__) || defined(ANDROID) 99848b8605Smrg 100848b8605Smrgstruct ANativeWindow; 101848b8605Smrgstruct egl_native_pixmap_t; 102848b8605Smrg 103b8e80941Smrgtypedef struct ANativeWindow* EGLNativeWindowType; 104b8e80941Smrgtypedef struct egl_native_pixmap_t* EGLNativePixmapType; 105b8e80941Smrgtypedef void* EGLNativeDisplayType; 106848b8605Smrg 107b8e80941Smrg#elif defined(USE_OZONE) 108848b8605Smrg 109b8e80941Smrgtypedef intptr_t EGLNativeDisplayType; 110b8e80941Smrgtypedef intptr_t EGLNativeWindowType; 111b8e80941Smrgtypedef intptr_t EGLNativePixmapType; 112b8e80941Smrg 113b8e80941Smrg#elif defined(__unix__) || defined(__APPLE__) 114b8e80941Smrg 115b8e80941Smrg#if defined(MESA_EGL_NO_X11_HEADERS) 116848b8605Smrg 117848b8605Smrgtypedef void *EGLNativeDisplayType; 118848b8605Smrgtypedef khronos_uintptr_t EGLNativePixmapType; 119848b8605Smrgtypedef khronos_uintptr_t EGLNativeWindowType; 120848b8605Smrg 121848b8605Smrg#else 122848b8605Smrg 123848b8605Smrg/* X11 (tentative) */ 124848b8605Smrg#include <X11/Xlib.h> 125848b8605Smrg#include <X11/Xutil.h> 126848b8605Smrg 127848b8605Smrgtypedef Display *EGLNativeDisplayType; 128848b8605Smrgtypedef Pixmap EGLNativePixmapType; 129848b8605Smrgtypedef Window EGLNativeWindowType; 130848b8605Smrg 131848b8605Smrg#endif /* MESA_EGL_NO_X11_HEADERS */ 132848b8605Smrg 133b8e80941Smrg#elif defined(__HAIKU__) 134b8e80941Smrg 135b8e80941Smrg#include <kernel/image.h> 136b8e80941Smrg 137b8e80941Smrgtypedef void *EGLNativeDisplayType; 138b8e80941Smrgtypedef khronos_uintptr_t EGLNativePixmapType; 139b8e80941Smrgtypedef khronos_uintptr_t EGLNativeWindowType; 140b8e80941Smrg 141848b8605Smrg#else 142848b8605Smrg#error "Platform not recognized" 143848b8605Smrg#endif 144848b8605Smrg 145848b8605Smrg/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ 146848b8605Smrgtypedef EGLNativeDisplayType NativeDisplayType; 147848b8605Smrgtypedef EGLNativePixmapType NativePixmapType; 148848b8605Smrgtypedef EGLNativeWindowType NativeWindowType; 149848b8605Smrg 150848b8605Smrg 151848b8605Smrg/* Define EGLint. This must be a signed integral type large enough to contain 152848b8605Smrg * all legal attribute names and values passed into and out of EGL, whether 153848b8605Smrg * their type is boolean, bitmask, enumerant (symbolic constant), integer, 154848b8605Smrg * handle, or other. While in general a 32-bit integer will suffice, if 155848b8605Smrg * handles are 64 bit types, then EGLint should be defined as a signed 64-bit 156848b8605Smrg * integer type. 157848b8605Smrg */ 158848b8605Smrgtypedef khronos_int32_t EGLint; 159848b8605Smrg 160b8e80941Smrg 161b8e80941Smrg/* C++ / C typecast macros for special EGL handle values */ 162b8e80941Smrg#if defined(__cplusplus) 163b8e80941Smrg#define EGL_CAST(type, value) (static_cast<type>(value)) 164b8e80941Smrg#else 165b8e80941Smrg#define EGL_CAST(type, value) ((type) (value)) 166b8e80941Smrg#endif 167b8e80941Smrg 168848b8605Smrg#endif /* __eglplatform_h */ 169