eglplatform.h revision af69d88d
14a49301eSmrg#ifndef __eglplatform_h_ 24a49301eSmrg#define __eglplatform_h_ 34a49301eSmrg 4cdc920a0Smrg/* 5cdc920a0Smrg** Copyright (c) 2007-2009 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 28af69d88dSmrg * $Revision: 1.1.1.4 $ on $Date: 2014/12/18 06:02:09 $ 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 584a49301eSmrg/* The types NativeDisplayType, NativeWindowType, and NativePixmapType 594a49301eSmrg * are aliases of window-system-dependent types, such as X Display * or 604a49301eSmrg * Windows Device Context. They must be defined in platform-specific 614a49301eSmrg * code below. The EGL-prefixed versions of Native*Type are the same 624a49301eSmrg * types, renamed in EGL 1.3 so all types in the API start with "EGL". 63af69d88dSmrg * 64af69d88dSmrg * Khronos STRONGLY RECOMMENDS that you use the default definitions 65af69d88dSmrg * provided below, since these changes affect both binary and source 66af69d88dSmrg * portability of applications using EGL running on different EGL 67af69d88dSmrg * implementations. 684a49301eSmrg */ 694a49301eSmrg 70cdc920a0Smrg#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ 71cdc920a0Smrg#ifndef WIN32_LEAN_AND_MEAN 72cdc920a0Smrg#define WIN32_LEAN_AND_MEAN 1 734a49301eSmrg#endif 74cdc920a0Smrg#include <windows.h> 754a49301eSmrg 76cdc920a0Smrgtypedef HDC EGLNativeDisplayType; 77cdc920a0Smrgtypedef HBITMAP EGLNativePixmapType; 78cdc920a0Smrgtypedef HWND EGLNativeWindowType; 794a49301eSmrg 80cdc920a0Smrg#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ 814a49301eSmrg 82cdc920a0Smrgtypedef int EGLNativeDisplayType; 83cdc920a0Smrgtypedef void *EGLNativeWindowType; 84cdc920a0Smrgtypedef void *EGLNativePixmapType; 854a49301eSmrg 863464ebd5Sriastradh#elif defined(WL_EGL_PLATFORM) 873464ebd5Sriastradh 883464ebd5Sriastradhtypedef struct wl_display *EGLNativeDisplayType; 893464ebd5Sriastradhtypedef struct wl_egl_pixmap *EGLNativePixmapType; 903464ebd5Sriastradhtypedef struct wl_egl_window *EGLNativeWindowType; 913464ebd5Sriastradh 923464ebd5Sriastradh#elif defined(__GBM__) 933464ebd5Sriastradh 943464ebd5Sriastradhtypedef struct gbm_device *EGLNativeDisplayType; 953464ebd5Sriastradhtypedef struct gbm_bo *EGLNativePixmapType; 963464ebd5Sriastradhtypedef void *EGLNativeWindowType; 973464ebd5Sriastradh 98af69d88dSmrg#elif defined(ANDROID) /* Android */ 99af69d88dSmrg 100af69d88dSmrgstruct ANativeWindow; 101af69d88dSmrgstruct egl_native_pixmap_t; 102af69d88dSmrg 103af69d88dSmrgtypedef struct ANativeWindow *EGLNativeWindowType; 104af69d88dSmrgtypedef struct egl_native_pixmap_t *EGLNativePixmapType; 105af69d88dSmrgtypedef void *EGLNativeDisplayType; 106af69d88dSmrg 107af69d88dSmrg#elif defined(__unix__) 1084a49301eSmrg 1093464ebd5Sriastradh#ifdef MESA_EGL_NO_X11_HEADERS 1103464ebd5Sriastradh 1113464ebd5Sriastradhtypedef void *EGLNativeDisplayType; 112af69d88dSmrgtypedef khronos_uintptr_t EGLNativePixmapType; 113af69d88dSmrgtypedef khronos_uintptr_t EGLNativeWindowType; 1143464ebd5Sriastradh 1153464ebd5Sriastradh#else 1163464ebd5Sriastradh 117cdc920a0Smrg/* X11 (tentative) */ 1184a49301eSmrg#include <X11/Xlib.h> 119cdc920a0Smrg#include <X11/Xutil.h> 120cdc920a0Smrg 121cdc920a0Smrgtypedef Display *EGLNativeDisplayType; 122cdc920a0Smrgtypedef Pixmap EGLNativePixmapType; 123cdc920a0Smrgtypedef Window EGLNativeWindowType; 1244a49301eSmrg 1253464ebd5Sriastradh#endif /* MESA_EGL_NO_X11_HEADERS */ 1263464ebd5Sriastradh 127cdc920a0Smrg#else 128cdc920a0Smrg#error "Platform not recognized" 1294a49301eSmrg#endif 1304a49301eSmrg 1314a49301eSmrg/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ 132cdc920a0Smrgtypedef EGLNativeDisplayType NativeDisplayType; 133cdc920a0Smrgtypedef EGLNativePixmapType NativePixmapType; 134cdc920a0Smrgtypedef EGLNativeWindowType NativeWindowType; 135cdc920a0Smrg 136cdc920a0Smrg 137cdc920a0Smrg/* Define EGLint. This must be a signed integral type large enough to contain 138cdc920a0Smrg * all legal attribute names and values passed into and out of EGL, whether 139cdc920a0Smrg * their type is boolean, bitmask, enumerant (symbolic constant), integer, 140cdc920a0Smrg * handle, or other. While in general a 32-bit integer will suffice, if 141cdc920a0Smrg * handles are 64 bit types, then EGLint should be defined as a signed 64-bit 142cdc920a0Smrg * integer type. 143cdc920a0Smrg */ 144cdc920a0Smrgtypedef khronos_int32_t EGLint; 1454a49301eSmrg 1464a49301eSmrg#endif /* __eglplatform_h */ 147