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