17777dab0Sopenharmony_ci#ifndef __eglplatform_h_ 27777dab0Sopenharmony_ci#define __eglplatform_h_ 37777dab0Sopenharmony_ci 47777dab0Sopenharmony_ci/* 57777dab0Sopenharmony_ci** Copyright 2007-2020 The Khronos Group Inc. 67777dab0Sopenharmony_ci** SPDX-License-Identifier: Apache-2.0 77777dab0Sopenharmony_ci*/ 87777dab0Sopenharmony_ci 97777dab0Sopenharmony_ci/* Platform-specific types and definitions for egl.h 107777dab0Sopenharmony_ci * 117777dab0Sopenharmony_ci * Adopters may modify khrplatform.h and this file to suit their platform. 127777dab0Sopenharmony_ci * You are encouraged to submit all modifications to the Khronos group so that 137777dab0Sopenharmony_ci * they can be included in future versions of this file. Please submit changes 147777dab0Sopenharmony_ci * by filing an issue or pull request on the public Khronos EGL Registry, at 157777dab0Sopenharmony_ci * https://www.github.com/KhronosGroup/EGL-Registry/ 167777dab0Sopenharmony_ci */ 177777dab0Sopenharmony_ci 187777dab0Sopenharmony_ci#include <KHR/khrplatform.h> 197777dab0Sopenharmony_ci 207777dab0Sopenharmony_ci/* Macros used in EGL function prototype declarations. 217777dab0Sopenharmony_ci * 227777dab0Sopenharmony_ci * EGL functions should be prototyped as: 237777dab0Sopenharmony_ci * 247777dab0Sopenharmony_ci * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); 257777dab0Sopenharmony_ci * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); 267777dab0Sopenharmony_ci * 277777dab0Sopenharmony_ci * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h 287777dab0Sopenharmony_ci */ 297777dab0Sopenharmony_ci 307777dab0Sopenharmony_ci#ifndef EGLAPI 317777dab0Sopenharmony_ci#define EGLAPI KHRONOS_APICALL 327777dab0Sopenharmony_ci#endif 337777dab0Sopenharmony_ci 347777dab0Sopenharmony_ci#ifndef EGLAPIENTRY 357777dab0Sopenharmony_ci#define EGLAPIENTRY KHRONOS_APIENTRY 367777dab0Sopenharmony_ci#endif 377777dab0Sopenharmony_ci#define EGLAPIENTRYP EGLAPIENTRY* 387777dab0Sopenharmony_ci 397777dab0Sopenharmony_ci/* The types NativeDisplayType, NativeWindowType, and NativePixmapType 407777dab0Sopenharmony_ci * are aliases of window-system-dependent types, such as X Display * or 417777dab0Sopenharmony_ci * Windows Device Context. They must be defined in platform-specific 427777dab0Sopenharmony_ci * code below. The EGL-prefixed versions of Native*Type are the same 437777dab0Sopenharmony_ci * types, renamed in EGL 1.3 so all types in the API start with "EGL". 447777dab0Sopenharmony_ci * 457777dab0Sopenharmony_ci * Khronos STRONGLY RECOMMENDS that you use the default definitions 467777dab0Sopenharmony_ci * provided below, since these changes affect both binary and source 477777dab0Sopenharmony_ci * portability of applications using EGL running on different EGL 487777dab0Sopenharmony_ci * implementations. 497777dab0Sopenharmony_ci */ 507777dab0Sopenharmony_ci 517777dab0Sopenharmony_ci#if defined(EGL_NO_PLATFORM_SPECIFIC_TYPES) 527777dab0Sopenharmony_ci 537777dab0Sopenharmony_citypedef void *EGLNativeDisplayType; 547777dab0Sopenharmony_citypedef void *EGLNativePixmapType; 557777dab0Sopenharmony_citypedef void *EGLNativeWindowType; 567777dab0Sopenharmony_ci 577777dab0Sopenharmony_ci#elif defined(OHOS_PLATFORM) 587777dab0Sopenharmony_ci 597777dab0Sopenharmony_cistruct NativeWindow; 607777dab0Sopenharmony_ci 617777dab0Sopenharmony_citypedef void* EGLNativeDisplayType; 627777dab0Sopenharmony_citypedef void* EGLNativePixmapType; 637777dab0Sopenharmony_citypedef struct NativeWindow* EGLNativeWindowType; 647777dab0Sopenharmony_ci 657777dab0Sopenharmony_ci#elif defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ 667777dab0Sopenharmony_ci#ifndef WIN32_LEAN_AND_MEAN 677777dab0Sopenharmony_ci#define WIN32_LEAN_AND_MEAN 1 687777dab0Sopenharmony_ci#endif 697777dab0Sopenharmony_ci#include <windows.h> 707777dab0Sopenharmony_ci 717777dab0Sopenharmony_citypedef HDC EGLNativeDisplayType; 727777dab0Sopenharmony_citypedef HBITMAP EGLNativePixmapType; 737777dab0Sopenharmony_citypedef HWND EGLNativeWindowType; 747777dab0Sopenharmony_ci 757777dab0Sopenharmony_ci#elif defined(__EMSCRIPTEN__) 767777dab0Sopenharmony_ci 777777dab0Sopenharmony_citypedef int EGLNativeDisplayType; 787777dab0Sopenharmony_citypedef int EGLNativePixmapType; 797777dab0Sopenharmony_citypedef int EGLNativeWindowType; 807777dab0Sopenharmony_ci 817777dab0Sopenharmony_ci#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ 827777dab0Sopenharmony_ci 837777dab0Sopenharmony_citypedef int EGLNativeDisplayType; 847777dab0Sopenharmony_citypedef void *EGLNativePixmapType; 857777dab0Sopenharmony_citypedef void *EGLNativeWindowType; 867777dab0Sopenharmony_ci 877777dab0Sopenharmony_ci#elif defined(WL_EGL_PLATFORM) 887777dab0Sopenharmony_ci 897777dab0Sopenharmony_citypedef struct wl_display *EGLNativeDisplayType; 907777dab0Sopenharmony_citypedef struct wl_egl_pixmap *EGLNativePixmapType; 917777dab0Sopenharmony_citypedef struct wl_egl_window *EGLNativeWindowType; 927777dab0Sopenharmony_ci 937777dab0Sopenharmony_ci#elif defined(__GBM__) 947777dab0Sopenharmony_ci 957777dab0Sopenharmony_citypedef struct gbm_device *EGLNativeDisplayType; 967777dab0Sopenharmony_citypedef struct gbm_bo *EGLNativePixmapType; 977777dab0Sopenharmony_citypedef void *EGLNativeWindowType; 987777dab0Sopenharmony_ci 997777dab0Sopenharmony_ci#elif defined(__ANDROID__) || defined(ANDROID) 1007777dab0Sopenharmony_ci 1017777dab0Sopenharmony_cistruct ANativeWindow; 1027777dab0Sopenharmony_cistruct egl_native_pixmap_t; 1037777dab0Sopenharmony_ci 1047777dab0Sopenharmony_citypedef void* EGLNativeDisplayType; 1057777dab0Sopenharmony_citypedef struct egl_native_pixmap_t* EGLNativePixmapType; 1067777dab0Sopenharmony_citypedef struct ANativeWindow* EGLNativeWindowType; 1077777dab0Sopenharmony_ci 1087777dab0Sopenharmony_ci#elif defined(USE_OZONE) 1097777dab0Sopenharmony_ci 1107777dab0Sopenharmony_citypedef intptr_t EGLNativeDisplayType; 1117777dab0Sopenharmony_citypedef intptr_t EGLNativePixmapType; 1127777dab0Sopenharmony_citypedef intptr_t EGLNativeWindowType; 1137777dab0Sopenharmony_ci 1147777dab0Sopenharmony_ci#elif defined(USE_X11) 1157777dab0Sopenharmony_ci 1167777dab0Sopenharmony_ci/* X11 (tentative) */ 1177777dab0Sopenharmony_ci#include <X11/Xlib.h> 1187777dab0Sopenharmony_ci#include <X11/Xutil.h> 1197777dab0Sopenharmony_ci 1207777dab0Sopenharmony_citypedef Display *EGLNativeDisplayType; 1217777dab0Sopenharmony_citypedef Pixmap EGLNativePixmapType; 1227777dab0Sopenharmony_citypedef Window EGLNativeWindowType; 1237777dab0Sopenharmony_ci 1247777dab0Sopenharmony_ci#elif defined(__unix__) 1257777dab0Sopenharmony_ci 1267777dab0Sopenharmony_citypedef void *EGLNativeDisplayType; 1277777dab0Sopenharmony_citypedef khronos_uintptr_t EGLNativePixmapType; 1287777dab0Sopenharmony_citypedef khronos_uintptr_t EGLNativeWindowType; 1297777dab0Sopenharmony_ci 1307777dab0Sopenharmony_ci#elif defined(__APPLE__) 1317777dab0Sopenharmony_ci 1327777dab0Sopenharmony_citypedef int EGLNativeDisplayType; 1337777dab0Sopenharmony_citypedef void *EGLNativePixmapType; 1347777dab0Sopenharmony_citypedef void *EGLNativeWindowType; 1357777dab0Sopenharmony_ci 1367777dab0Sopenharmony_ci#elif defined(__HAIKU__) 1377777dab0Sopenharmony_ci 1387777dab0Sopenharmony_ci#include <kernel/image.h> 1397777dab0Sopenharmony_ci 1407777dab0Sopenharmony_citypedef void *EGLNativeDisplayType; 1417777dab0Sopenharmony_citypedef khronos_uintptr_t EGLNativePixmapType; 1427777dab0Sopenharmony_citypedef khronos_uintptr_t EGLNativeWindowType; 1437777dab0Sopenharmony_ci 1447777dab0Sopenharmony_ci#elif defined(__Fuchsia__) 1457777dab0Sopenharmony_ci 1467777dab0Sopenharmony_citypedef void *EGLNativeDisplayType; 1477777dab0Sopenharmony_citypedef khronos_uintptr_t EGLNativePixmapType; 1487777dab0Sopenharmony_citypedef khronos_uintptr_t EGLNativeWindowType; 1497777dab0Sopenharmony_ci 1507777dab0Sopenharmony_ci#else 1517777dab0Sopenharmony_ci#error "Platform not recognized" 1527777dab0Sopenharmony_ci#endif 1537777dab0Sopenharmony_ci 1547777dab0Sopenharmony_ci/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ 1557777dab0Sopenharmony_citypedef EGLNativeDisplayType NativeDisplayType; 1567777dab0Sopenharmony_citypedef EGLNativePixmapType NativePixmapType; 1577777dab0Sopenharmony_citypedef EGLNativeWindowType NativeWindowType; 1587777dab0Sopenharmony_ci 1597777dab0Sopenharmony_ci 1607777dab0Sopenharmony_ci/* Define EGLint. This must be a signed integral type large enough to contain 1617777dab0Sopenharmony_ci * all legal attribute names and values passed into and out of EGL, whether 1627777dab0Sopenharmony_ci * their type is boolean, bitmask, enumerant (symbolic constant), integer, 1637777dab0Sopenharmony_ci * handle, or other. While in general a 32-bit integer will suffice, if 1647777dab0Sopenharmony_ci * handles are 64 bit types, then EGLint should be defined as a signed 64-bit 1657777dab0Sopenharmony_ci * integer type. 1667777dab0Sopenharmony_ci */ 1677777dab0Sopenharmony_citypedef khronos_int32_t EGLint; 1687777dab0Sopenharmony_ci 1697777dab0Sopenharmony_ci 1707777dab0Sopenharmony_ci/* C++ / C typecast macros for special EGL handle values */ 1717777dab0Sopenharmony_ci#if defined(__cplusplus) 1727777dab0Sopenharmony_ci#define EGL_CAST(type, value) (static_cast<type>(value)) 1737777dab0Sopenharmony_ci#else 1747777dab0Sopenharmony_ci#define EGL_CAST(type, value) ((type) (value)) 1757777dab0Sopenharmony_ci#endif 1767777dab0Sopenharmony_ci 1777777dab0Sopenharmony_ci#endif /* __eglplatform_h */ 178