eglplatform.h revision 076b1cc3a9b90aa5b381a1ed268ca0b548444c9b
1#ifndef __eglplatform_h_
2#define __eglplatform_h_
3
4/*
5** Copyright (c) 2007-2009 The Khronos Group Inc.
6**
7** Permission is hereby granted, free of charge, to any person obtaining a
8** copy of this software and/or associated documentation files (the
9** "Materials"), to deal in the Materials without restriction, including
10** without limitation the rights to use, copy, modify, merge, publish,
11** distribute, sublicense, and/or sell copies of the Materials, and to
12** permit persons to whom the Materials are furnished to do so, subject to
13** the following conditions:
14**
15** The above copyright notice and this permission notice shall be included
16** in all copies or substantial portions of the Materials.
17**
18** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
19** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
21** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
22** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
25*/
26
27/* Platform-specific types and definitions for egl.h
28 * $Revision: 7244 $ on $Date: 2009-01-20 17:06:59 -0800 (Tue, 20 Jan 2009) $
29 *
30 * Adopters may modify khrplatform.h and this file to suit their platform.
31 * You are encouraged to submit all modifications to the Khronos group so that
32 * they can be included in future versions of this file.  Please submit changes
33 * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
34 * by filing a bug against product "EGL" component "Registry".
35 */
36
37#include <KHR/khrplatform.h>
38
39/* Macros used in EGL function prototype declarations.
40 *
41 * EGL functions should be prototyped as:
42 *
43 * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
44 * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
45 *
46 * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
47 */
48
49#ifndef EGLAPI
50#define EGLAPI KHRONOS_APICALL
51#endif
52
53#define EGLAPIENTRY  KHRONOS_APIENTRY
54#define EGLAPIENTRYP KHRONOS_APIENTRY*
55
56/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
57 * are aliases of window-system-dependent types, such as X Display * or
58 * Windows Device Context. They must be defined in platform-specific
59 * code below. The EGL-prefixed versions of Native*Type are the same
60 * types, renamed in EGL 1.3 so all types in the API start with "EGL".
61 */
62
63#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
64#ifndef WIN32_LEAN_AND_MEAN
65#define WIN32_LEAN_AND_MEAN 1
66#endif
67#include <windows.h>
68
69typedef HDC     EGLNativeDisplayType;
70typedef HBITMAP EGLNativePixmapType;
71typedef HWND    EGLNativeWindowType;
72
73#elif defined(__WINSCW__) || defined(__SYMBIAN32__)  /* Symbian */
74
75typedef int   EGLNativeDisplayType;
76typedef void *EGLNativeWindowType;
77typedef void *EGLNativePixmapType;
78
79#elif defined(__unix__) && !defined(ANDROID)
80
81/* X11 (tentative)  */
82#include <X11/Xlib.h>
83#include <X11/Xutil.h>
84
85typedef Display *EGLNativeDisplayType;
86typedef Pixmap   EGLNativePixmapType;
87typedef Window   EGLNativeWindowType;
88
89
90#elif defined(ANDROID)
91
92#include <EGL/android_natives.h>
93
94typedef struct android_native_window_t* EGLNativeWindowType;
95typedef struct egl_native_pixmap_t*     EGLNativePixmapType;
96typedef void*                           EGLNativeDisplayType;
97
98#ifndef EGL_ANDROID_image_native_buffer
99#define EGL_ANDROID_image_native_buffer 1
100#define EGL_NATIVE_BUFFER_ANDROID       0x6000  /* eglCreateImageKHR target */
101#endif
102
103#else
104#error "Platform not recognized"
105#endif
106
107/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
108typedef EGLNativeDisplayType NativeDisplayType;
109typedef EGLNativePixmapType  NativePixmapType;
110typedef EGLNativeWindowType  NativeWindowType;
111
112
113/* Define EGLint. This must be a signed integral type large enough to contain
114 * all legal attribute names and values passed into and out of EGL, whether
115 * their type is boolean, bitmask, enumerant (symbolic constant), integer,
116 * handle, or other.  While in general a 32-bit integer will suffice, if
117 * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
118 * integer type.
119 */
120typedef khronos_int32_t EGLint;
121
122#endif /* __eglplatform_h */
123