blob: 08834ab8b6d6a4a516d057e20acb4ed9d65546f3 [file] [log] [blame]
The Android Open Source Project7c1b96a2008-10-21 07:00:00 -07001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_EGL_H
18#define ANDROID_EGL_H
19
20#include <GLES/gl.h>
21#include <GLES/egltypes.h>
22#include <GLES/eglnatives.h>
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#define EGL_VERSION_1_0 1
29#define EGL_VERSION_1_1 1
30#define EGL_VERSION_1_2 1
31
32#define EGL_FALSE 0
33#define EGL_TRUE 1
34
35/* Errors */
36#define EGL_SUCCESS 0x3000
37#define EGL_NOT_INITIALIZED 0x3001
38#define EGL_BAD_ACCESS 0x3002
39#define EGL_BAD_ALLOC 0x3003
40#define EGL_BAD_ATTRIBUTE 0x3004
41#define EGL_BAD_CONFIG 0x3005
42#define EGL_BAD_CONTEXT 0x3006
43#define EGL_BAD_CURRENT_SURFACE 0x3007
44#define EGL_BAD_DISPLAY 0x3008
45#define EGL_BAD_MATCH 0x3009
46#define EGL_BAD_NATIVE_PIXMAP 0x300A
47#define EGL_BAD_NATIVE_WINDOW 0x300B
48#define EGL_BAD_PARAMETER 0x300C
49#define EGL_BAD_SURFACE 0x300D
50#define EGL_CONTEXT_LOST 0x300E
51
52/* Config attributes */
53#define EGL_BUFFER_SIZE 0x3020
54#define EGL_ALPHA_SIZE 0x3021
55#define EGL_BLUE_SIZE 0x3022
56#define EGL_GREEN_SIZE 0x3023
57#define EGL_RED_SIZE 0x3024
58#define EGL_DEPTH_SIZE 0x3025
59#define EGL_STENCIL_SIZE 0x3026
60#define EGL_CONFIG_CAVEAT 0x3027
61#define EGL_CONFIG_ID 0x3028
62#define EGL_LEVEL 0x3029
63#define EGL_MAX_PBUFFER_HEIGHT 0x302A
64#define EGL_MAX_PBUFFER_PIXELS 0x302B
65#define EGL_MAX_PBUFFER_WIDTH 0x302C
66#define EGL_NATIVE_RENDERABLE 0x302D
67#define EGL_NATIVE_VISUAL_ID 0x302E
68#define EGL_NATIVE_VISUAL_TYPE 0x302F
69#define EGL_SAMPLES 0x3031
70#define EGL_SAMPLE_BUFFERS 0x3032
71#define EGL_SURFACE_TYPE 0x3033
72#define EGL_TRANSPARENT_TYPE 0x3034
73#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
74#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
75#define EGL_TRANSPARENT_RED_VALUE 0x3037
76#define EGL_NONE 0x3038
77#define EGL_BIND_TO_TEXTURE_RGB 0x3039
78#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
79#define EGL_MIN_SWAP_INTERVAL 0x303B
80#define EGL_MAX_SWAP_INTERVAL 0x303C
81#define EGL_LUMINANCE_SIZE 0x303D
82#define EGL_ALPHA_MASK_SIZE 0x303E
83#define EGL_COLOR_BUFFER_TYPE 0x303F
84#define EGL_RENDERABLE_TYPE 0x3040
85
86/* Config values */
87#define EGL_DONT_CARE ((EGLint)-1)
88
89#define EGL_SLOW_CONFIG 0x3050
90#define EGL_NON_CONFORMANT_CONFIG 0x3051
91#define EGL_TRANSPARENT_RGB 0x3052
92#define EGL_NO_TEXTURE 0x305C
93#define EGL_TEXTURE_RGB 0x305D
94#define EGL_TEXTURE_RGBA 0x305E
95#define EGL_TEXTURE_2D 0x305F
96#define EGL_RGB_BUFFER 0x308E
97#define EGL_LUMINANCE_BUFFER 0x308F
98
99/* Config attribute mask bits */
100#define EGL_PBUFFER_BIT 0x01
101#define EGL_PIXMAP_BIT 0x02
102#define EGL_WINDOW_BIT 0x04
103#define EGL_OPENGL_ES_BIT 0x01
104#define EGL_OPENVG_BIT 0x02
105
106/* String names */
107#define EGL_VENDOR 0x3053
108#define EGL_VERSION 0x3054
109#define EGL_EXTENSIONS 0x3055
110#define EGL_CLIENT_APIS 0x308D
111
112/* Surface attributes */
113#define EGL_HEIGHT 0x3056
114#define EGL_WIDTH 0x3057
115#define EGL_LARGEST_PBUFFER 0x3058
116#define EGL_TEXTURE_FORMAT 0x3080
117#define EGL_TEXTURE_TARGET 0x3081
118#define EGL_MIPMAP_TEXTURE 0x3082
119#define EGL_MIPMAP_LEVEL 0x3083
120#define EGL_RENDER_BUFFER 0x3086
121#define EGL_COLORSPACE 0x3087
122#define EGL_ALPHA_FORMAT 0x3088
123#define EGL_HORIZONTAL_RESOLUTION 0x3090
124#define EGL_VERTICAL_RESOLUTION 0x3091
125#define EGL_PIXEL_ASPECT_RATIO 0x3092
126#define EGL_SWAP_BEHAVIOR 0x3093
127
128#define EGL_BACK_BUFFER 0x3084
129#define EGL_SINGLE_BUFFER 0x3085
130
131#define EGL_DISPLAY_SCALING 10000
132
133#define EGL_UNKNOWN ((EGLint)-1)
134
135/* Back buffer swap behaviors */
136#define EGL_BUFFER_PRESERVED 0x3094
137#define EGL_BUFFER_DESTROYED 0x3095
138
139/* CreatePbufferFromClientBuffer buffer types */
140#define EGL_OPENVG_IMAGE 0x3096
141
142/* QueryContext targets */
143#define EGL_CONTEXT_CLIENT_TYPE 0x3097
144
145/* BindAPI/QueryAPI targets */
146#define EGL_OPENGL_ES_API 0x30A0
147#define EGL_OPENVG_API 0x30A1
148
149/* WaitNative engines */
150#define EGL_CORE_NATIVE_ENGINE 0x305B
151
152/* Current surfaces */
153#define EGL_DRAW 0x3059
154#define EGL_READ 0x305A
155
156
157EGLDisplay eglGetDisplay(NativeDisplayType display);
158EGLBoolean eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
159EGLBoolean eglTerminate(EGLDisplay dpy);
160
161EGLBoolean eglGetConfigs( EGLDisplay dpy,
162 EGLConfig *configs,
163 EGLint config_size, EGLint *num_config);
164
165EGLBoolean eglChooseConfig( EGLDisplay dpy, const EGLint *attrib_list,
166 EGLConfig *configs, EGLint config_size,
167 EGLint *num_config);
168
169EGLBoolean eglGetConfigAttrib( EGLDisplay dpy, EGLConfig config,
170 EGLint attribute, EGLint *value);
171
172EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config,
173 NativeWindowType window,
174 const EGLint *attrib_list);
175
176EGLSurface eglCreatePixmapSurface( EGLDisplay dpy, EGLConfig config,
177 NativePixmapType pixmap,
178 const EGLint *attrib_list);
179
180EGLSurface eglCreatePbufferSurface( EGLDisplay dpy, EGLConfig config,
181 const EGLint *attrib_list);
182
183EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface);
184
185EGLBoolean eglQuerySurface( EGLDisplay dpy, EGLSurface surface,
186 EGLint attribute, EGLint *value);
187
188EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config,
189 EGLContext share_list, const EGLint *attrib_list);
190
191EGLBoolean eglDestroyContext(EGLDisplay dpy, EGLContext ctx);
192
193EGLBoolean eglMakeCurrent( EGLDisplay dpy, EGLSurface draw,
194 EGLSurface read, EGLContext ctx);
195
196EGLContext eglGetCurrentContext(void);
197EGLSurface eglGetCurrentSurface(EGLint readdraw);
198EGLDisplay eglGetCurrentDisplay(void);
199EGLBoolean eglQueryContext( EGLDisplay dpy, EGLContext ctx,
200 EGLint attribute, EGLint *value);
201
202EGLBoolean eglWaitGL(void);
203EGLBoolean eglWaitNative(EGLint engine);
204EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw);
205EGLBoolean eglCopyBuffers( EGLDisplay dpy, EGLSurface surface,
206 NativePixmapType target);
207
208EGLint eglGetError(void);
209const char* eglQueryString(EGLDisplay dpy, EGLint name);
210void (*eglGetProcAddress (const char *procname))();
211
212/* ----------------------------------------------------------------------------
213 * EGL 1.1
214 * ----------------------------------------------------------------------------
215 */
216
217EGLBoolean eglSurfaceAttrib(
218 EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
219EGLBoolean eglBindTexImage(
220 EGLDisplay dpy, EGLSurface surface, EGLint buffer);
221EGLBoolean eglReleaseTexImage(
222 EGLDisplay dpy, EGLSurface surface, EGLint buffer);
223
224EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval);
225
226/* ----------------------------------------------------------------------------
227 * EGL 1.2
228 * ----------------------------------------------------------------------------
229 */
230
231EGLBoolean eglBindAPI(EGLenum api);
232EGLenum eglQueryAPI(void);
233EGLBoolean eglWaitClient(void);
234EGLBoolean eglReleaseThread(void);
235EGLSurface eglCreatePbufferFromClientBuffer(
236 EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer,
237 EGLConfig config, const EGLint *attrib_list);
238
239/* ----------------------------------------------------------------------------
240 * Android extentions
241 * ----------------------------------------------------------------------------
242 */
243
244EGLBoolean eglSwapRectangleANDROID(EGLDisplay dpy, EGLSurface draw,
245 EGLint l, EGLint t, EGLint w, EGLint h);
246
247EGLBoolean eglCopyFrontToBackANDROID(EGLDisplay dpy,
248 EGLSurface surface,
249 EGLint l, EGLint t, EGLint w, EGLint h);
250
251const char* eglQueryStringConfigANDROID(
252 EGLDisplay dpy, EGLConfig config, EGLint name);
253
254void* eglGetRenderBufferAddressANDROID(EGLDisplay dpy, EGLSurface surface);
255
256EGLBoolean eglCopyBitsANDROID(EGLDisplay dpy,
257 NativeWindowType draw, EGLint x, EGLint y,
258 NativeWindowType read,
259 EGLint crop_x, EGLint crop_y, EGLint crop_w, EGLint crop_h,
260 EGLint flags);
261
262
263#ifdef __cplusplus
264}
265#endif
266
267
268#endif /*ANDROID_EGL_H*/