eglplatform.h revision 848b8605
1848b8605Smrg#ifndef __eglplatform_h_
2848b8605Smrg#define __eglplatform_h_
3848b8605Smrg
4848b8605Smrg/*
5848b8605Smrg** Copyright (c) 2007-2009 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
28848b8605Smrg * $Revision: 1.1.1.1 $ on $Date: 2019/03/08 10:19:24 $
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
98848b8605Smrg#elif defined(ANDROID) /* Android */
99848b8605Smrg
100848b8605Smrgstruct ANativeWindow;
101848b8605Smrgstruct egl_native_pixmap_t;
102848b8605Smrg
103848b8605Smrgtypedef struct ANativeWindow        *EGLNativeWindowType;
104848b8605Smrgtypedef struct egl_native_pixmap_t  *EGLNativePixmapType;
105848b8605Smrgtypedef void                        *EGLNativeDisplayType;
106848b8605Smrg
107848b8605Smrg#elif defined(__unix__)
108848b8605Smrg
109848b8605Smrg#ifdef MESA_EGL_NO_X11_HEADERS
110848b8605Smrg
111848b8605Smrgtypedef void            *EGLNativeDisplayType;
112848b8605Smrgtypedef khronos_uintptr_t EGLNativePixmapType;
113848b8605Smrgtypedef khronos_uintptr_t EGLNativeWindowType;
114848b8605Smrg
115848b8605Smrg#else
116848b8605Smrg
117848b8605Smrg/* X11 (tentative)  */
118848b8605Smrg#include <X11/Xlib.h>
119848b8605Smrg#include <X11/Xutil.h>
120848b8605Smrg
121848b8605Smrgtypedef Display *EGLNativeDisplayType;
122848b8605Smrgtypedef Pixmap   EGLNativePixmapType;
123848b8605Smrgtypedef Window   EGLNativeWindowType;
124848b8605Smrg
125848b8605Smrg#endif /* MESA_EGL_NO_X11_HEADERS */
126848b8605Smrg
127848b8605Smrg#else
128848b8605Smrg#error "Platform not recognized"
129848b8605Smrg#endif
130848b8605Smrg
131848b8605Smrg/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
132848b8605Smrgtypedef EGLNativeDisplayType NativeDisplayType;
133848b8605Smrgtypedef EGLNativePixmapType  NativePixmapType;
134848b8605Smrgtypedef EGLNativeWindowType  NativeWindowType;
135848b8605Smrg
136848b8605Smrg
137848b8605Smrg/* Define EGLint. This must be a signed integral type large enough to contain
138848b8605Smrg * all legal attribute names and values passed into and out of EGL, whether
139848b8605Smrg * their type is boolean, bitmask, enumerant (symbolic constant), integer,
140848b8605Smrg * handle, or other.  While in general a 32-bit integer will suffice, if
141848b8605Smrg * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
142848b8605Smrg * integer type.
143848b8605Smrg */
144848b8605Smrgtypedef khronos_int32_t EGLint;
145848b8605Smrg
146848b8605Smrg#endif /* __eglplatform_h */
147