Core commit. Compile and run on the OpenPandora
[mupen64plus-pandora.git] / source / mupen64plus-core / src / api / eglport.h
CommitLineData
451ab91e 1/**
2 *
3 * EGLPORT.H
4 * Copyright (C) 2011-2013 Scott R. Smith
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 *
24 */
25
26#ifndef EGLPORT_H
27#define EGLPORT_H
28
29#include <stdint.h>
30#include "EGL/egl.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36/** Defines (in every case choose only one) */
37/** Common: */
38/** DEBUG : enable additional error monitoring per EGL function call */
39/** Native display and window system for use with EGL */
40/** USE_EGL_SDL : used for access to a SDL X11 window */
41/** Platform: settings that are specific to that device */
42/** PANDORA (USE_GLES1 or USE_GLES2) */
43/** WIZ (USE_GLES1) */
44/** CAANOO (USE_GLES1) */
45/** RPI (USE_GLES1 or USE_GLES2) */
46/** GLES Version */
47/** USE_GLES1 : EGL for use with OpenGL-ES 1.X contexts */
48/** USE_GLES2 : EGL for use with OpenGL-ES 2.0 contexts */
49
50/** Public API */
51void EGL_Close ( void );
52int8_t EGL_Open ( uint16_t width, uint16_t height );
53void EGL_SwapBuffers ( void );
54
55extern int8_t eglColorbits;
56extern int8_t eglDepthbits;
57extern int8_t eglStencilbits;
58
59/** Simple Examples */
60/** Raw mode:
61 EGL_Open( window_width, window_height );
62 do while(!quit) {
63 ... run app
64 EGL_SwapBuffers();
65 }
66 EGL_Close();
67*/
68/** X11/SDL mode:
69 SDL_Init( SDL_INIT_VIDEO );
70 SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16, SDL_SWSURFACE|SDL_FULLSCREEN);
71 EGL_Open( window_width, window_height );
72 do while(!quit) {
73 ... run app
74 EGL_SwapBuffers();
75 }
76 EGL_Close();
77 SDL_Quit();
78*/
79
80#if defined(DEBUG)
81#define GET_EGLERROR(FUNCTION) \
82 FUNCTION; \
83 { \
84 CheckEGLErrors(__FILE__, __LINE__); \
85 }
86#else
87#define GET_EGLERROR(FUNCTION) FUNCTION;
88#endif
89
90#define peglQueryString(A,B) GET_EGLERROR(eglQueryString(A,B))
91#define peglDestroyContext(A,B) GET_EGLERROR(eglDestroyContext(A,B))
92#define peglDestroySurface(A,B) GET_EGLERROR(eglDestroySurface(A,B))
93#define peglTerminate(A) GET_EGLERROR(eglTerminate(A))
94#define peglSwapBuffers(A,B) GET_EGLERROR(eglSwapBuffers(A,B))
95#define peglGetDisplay(A) GET_EGLERROR(eglGetDisplay(A))
96#define peglBindAPI(A) GET_EGLERROR(eglBindAPI(A))
97#define peglCreateContext(A,B,C,D) GET_EGLERROR(eglCreateContext(A,B,C,D))
98#define peglCreateWindowSurface(A,B,C,D) GET_EGLERROR(eglCreateWindowSurface(A,B,C,D))
99#define peglInitialize(A,B,C) GET_EGLERROR(eglInitialize(A,B,C))
100#define peglMakeCurrent(A,B,C,D) GET_EGLERROR(eglMakeCurrent(A,B,C,D))
101#define peglChooseConfig(A,B,C,D,E) GET_EGLERROR(eglChooseConfig(A,B,C,D,E))
102#define peglSwapInterval(A,B) GET_EGLERROR(eglSwapInterval(A,B))
103
104#ifdef __cplusplus
105}
106#endif
107
108#endif /* EGLPORT_H */