eglplatform.h revision 4a49301e
1/* -*- mode: c; tab-width: 8; -*- */
2/* vi: set sw=4 ts=8: */
3/* Platform-specific types and definitions for egl.h */
4
5#ifndef __eglplatform_h_
6#define __eglplatform_h_
7
8/* Windows calling convention boilerplate */
9#if (defined(WIN32) || defined(_WIN32_WCE))
10#ifndef WIN32_LEAN_AND_MEAN
11#define WIN32_LEAN_AND_MEAN		/* Exclude rarely-used stuff from Windows headers */
12#endif
13#include <windows.h>
14#endif
15
16#if !defined(_WIN32_WCE)
17#include <sys/types.h>
18#include <stdint.h>
19#endif
20
21/* Macros used in EGL function prototype declarations.
22 *
23 * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
24 * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
25 *
26 * On Windows, EGLAPIENTRY can be defined like APIENTRY.
27 * On most other platforms, it should be empty.
28 */
29
30#ifndef EGLAPIENTRY
31#define EGLAPIENTRY
32#endif
33#ifndef EGLAPIENTRYP
34#define EGLAPIENTRYP EGLAPIENTRY *
35#endif
36
37/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
38 * are aliases of window-system-dependent types, such as X Display * or
39 * Windows Device Context. They must be defined in platform-specific
40 * code below. The EGL-prefixed versions of Native*Type are the same
41 * types, renamed in EGL 1.3 so all types in the API start with "EGL".
42 */
43
44/* Unix (tentative)
45    #include <X headers>
46    typedef Display *NativeDisplayType;
47      - or maybe, if encoding "hostname:display.head"
48    typedef const char *NativeWindowType;
49	etc.
50 */
51
52
53#if (defined(WIN32) || defined(_WIN32_WCE))
54
55/** BEGIN Added for Windows **/
56#ifndef EGLAPI
57#define EGLAPI __declspec(dllexport)
58#endif
59
60typedef long	int32_t;
61typedef unsigned long uint32_t;
62typedef unsigned char uint8_t;
63#define snprintf _snprintf
64#define strcasecmp _stricmp
65#define vsnprintf _vsnprintf
66
67typedef HDC		NativeDisplayType;
68typedef HWND	NativeWindowType;
69typedef HBITMAP NativePixmapType;
70/** END Added for Windows **/
71
72#elif defined(__gnu_linux__) || defined(__FreeBSD__) || defined(__sun) || defined(__APPLE__)
73
74
75/** BEGIN Added for X (Mesa) **/
76#ifndef EGLAPI
77#define EGLAPI extern
78#endif
79
80#include <X11/Xlib.h>
81typedef Display *NativeDisplayType;
82typedef Window NativeWindowType;
83typedef Pixmap NativePixmapType;
84/** END Added for X (Mesa) **/
85
86#endif
87
88/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
89typedef NativeDisplayType EGLNativeDisplayType;
90typedef NativePixmapType EGLNativePixmapType;
91typedef NativeWindowType EGLNativeWindowType;
92
93#endif /* __eglplatform_h */
94