egl.h revision dc8058c3370588bfcad49fadace1691da47d58cd
1#ifndef _EGL_H
2#define _EGL_H
3
4/*
5 * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
6 * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice including the dates of first publication and
16 * either this permission notice or a reference to
17 * http://oss.sgi.com/projects/FreeB/
18 * shall be included in all copies or substantial portions of the Software.
19 *
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23 * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
25 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 * SOFTWARE.
27 *
28 * Except as contained in this notice, the name of Silicon Graphics, Inc.
29 * shall not be used in advertising or otherwise to promote the sale, use or
30 * other dealings in this Software without prior written authorization from
31 * Silicon Graphics, Inc.
32 */
33
34#if 0/*XXX TEMPORARY HACK*/
35#include <GLES/gl.h>
36#else
37#include <GL/gl.h>
38#endif
39#include <GLES/egltypes.h>
40
41/* XXX should go in eglext.h */
42#define GL_OES_VERSION_1_0  1
43#define GL_OES_read_format  1
44#define GL_OES_compressed_paletted_texture 1
45#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
46#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
47#define GL_PALETTE4_RGB8_OES        0x8B90
48#define GL_PALETTE4_RGBA8_OES       0x8B91
49#define GL_PALETTE4_R5_G6_B5_OES    0x8B92
50#define GL_PALETTE4_RGBA4_OES       0x8B93
51#define GL_PALETTE4_RGB5_A1_OES     0x8B94
52#define GL_PALETTE8_RGB8_OES        0x8B95
53#define GL_PALETTE8_RGBA8_OES       0x8B96
54#define GL_PALETTE8_R5_G6_B5_OES    0x8B97
55#define GL_PALETTE8_RGBA4_OES       0x8B98
56#define GL_PALETTE8_RGB5_A1_OES     0x8B99
57/* XXX */
58
59/*
60** Versioning and extensions
61*/
62#define EGL_VERSION_1_0		       1
63#define EGL_VERSION_1_1		       1
64
65/*
66** Boolean
67*/
68#define EGL_FALSE		       0
69#define EGL_TRUE		       1
70
71/*
72** Errors
73*/
74#define EGL_SUCCESS		       0x3000
75#define EGL_NOT_INITIALIZED	       0x3001
76#define EGL_BAD_ACCESS		       0x3002
77#define EGL_BAD_ALLOC		       0x3003
78#define EGL_BAD_ATTRIBUTE	       0x3004
79#define EGL_BAD_CONFIG		       0x3005
80#define EGL_BAD_CONTEXT		       0x3006
81#define EGL_BAD_CURRENT_SURFACE        0x3007
82#define EGL_BAD_DISPLAY		       0x3008
83#define EGL_BAD_MATCH		       0x3009
84#define EGL_BAD_NATIVE_PIXMAP	       0x300A
85#define EGL_BAD_NATIVE_WINDOW	       0x300B
86#define EGL_BAD_PARAMETER	       0x300C
87#define EGL_BAD_SURFACE		       0x300D
88#define EGL_CONTEXT_LOST	       0x300E
89/* 0x300F - 0x301F reserved for additional errors. */
90
91/*
92** Config attributes
93*/
94#define EGL_BUFFER_SIZE		       0x3020
95#define EGL_ALPHA_SIZE		       0x3021
96#define EGL_BLUE_SIZE		       0x3022
97#define EGL_GREEN_SIZE		       0x3023
98#define EGL_RED_SIZE		       0x3024
99#define EGL_DEPTH_SIZE		       0x3025
100#define EGL_STENCIL_SIZE	       0x3026
101#define EGL_CONFIG_CAVEAT	       0x3027
102#define EGL_CONFIG_ID		       0x3028
103#define EGL_LEVEL		       0x3029
104#define EGL_MAX_PBUFFER_HEIGHT	       0x302A
105#define EGL_MAX_PBUFFER_PIXELS	       0x302B
106#define EGL_MAX_PBUFFER_WIDTH	       0x302C
107#define EGL_NATIVE_RENDERABLE	       0x302D
108#define EGL_NATIVE_VISUAL_ID	       0x302E
109#define EGL_NATIVE_VISUAL_TYPE	       0x302F
110/*#define EGL_PRESERVED_RESOURCES	 0x3030*/
111#define EGL_SAMPLES		       0x3031
112#define EGL_SAMPLE_BUFFERS	       0x3032
113#define EGL_SURFACE_TYPE	       0x3033
114#define EGL_TRANSPARENT_TYPE	       0x3034
115#define EGL_TRANSPARENT_BLUE_VALUE     0x3035
116#define EGL_TRANSPARENT_GREEN_VALUE    0x3036
117#define EGL_TRANSPARENT_RED_VALUE      0x3037
118#define EGL_NONE		       0x3038	/* Also a config value */
119#define EGL_BIND_TO_TEXTURE_RGB        0x3039
120#define EGL_BIND_TO_TEXTURE_RGBA       0x303A
121#define EGL_MIN_SWAP_INTERVAL	       0x303B
122#define EGL_MAX_SWAP_INTERVAL	       0x303C
123
124/*
125** Config values
126*/
127#define EGL_DONT_CARE		       ((EGLint) -1)
128
129#define EGL_SLOW_CONFIG		       0x3050	/* EGL_CONFIG_CAVEAT value */
130#define EGL_NON_CONFORMANT_CONFIG      0x3051	/* " */
131#define EGL_TRANSPARENT_RGB	       0x3052	/* EGL_TRANSPARENT_TYPE value */
132#define EGL_NO_TEXTURE		       0x305C	/* EGL_TEXTURE_FORMAT/TARGET value */
133#define EGL_TEXTURE_RGB		       0x305D	/* EGL_TEXTURE_FORMAT value */
134#define EGL_TEXTURE_RGBA	       0x305E	/* " */
135#define EGL_TEXTURE_2D		       0x305F	/* EGL_TEXTURE_TARGET value */
136
137/*
138** Config attribute mask bits
139*/
140#define EGL_PBUFFER_BIT		       0x01	/* EGL_SURFACE_TYPE mask bit */
141#define EGL_PIXMAP_BIT		       0x02	/* " */
142#define EGL_WINDOW_BIT		       0x04	/* " */
143
144/*
145** String names
146*/
147#define EGL_VENDOR		       0x3053	/* eglQueryString target */
148#define EGL_VERSION		       0x3054	/* " */
149#define EGL_EXTENSIONS		       0x3055	/* " */
150
151/*
152** Surface attributes
153*/
154#define EGL_HEIGHT		       0x3056
155#define EGL_WIDTH		       0x3057
156#define EGL_LARGEST_PBUFFER	       0x3058
157#define EGL_TEXTURE_FORMAT	       0x3080	/* For pbuffers bound as textures */
158#define EGL_TEXTURE_TARGET	       0x3081	/* " */
159#define EGL_MIPMAP_TEXTURE	       0x3082	/* " */
160#define EGL_MIPMAP_LEVEL	       0x3083	/* " */
161
162/*
163** BindTexImage / ReleaseTexImage buffer target
164*/
165#define EGL_BACK_BUFFER		       0x3084
166
167/*
168** Current surfaces
169*/
170#define EGL_DRAW		       0x3059
171#define EGL_READ		       0x305A
172
173/*
174** Engines
175*/
176#define EGL_CORE_NATIVE_ENGINE	       0x305B
177
178/* 0x305C-0x3FFFF reserved for future use */
179
180/*
181** Functions
182*/
183#ifdef __cplusplus
184extern "C" {
185#endif
186
187GLAPI EGLint APIENTRY eglGetError (void);
188
189GLAPI EGLDisplay APIENTRY eglGetDisplay (NativeDisplayType display);
190GLAPI EGLBoolean APIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
191GLAPI EGLBoolean APIENTRY eglTerminate (EGLDisplay dpy);
192GLAPI const char * APIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
193GLAPI void (* APIENTRY eglGetProcAddress (const char *procname))(void);
194
195GLAPI EGLBoolean APIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
196GLAPI EGLBoolean APIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
197GLAPI EGLBoolean APIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
198
199GLAPI EGLSurface APIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
200GLAPI EGLSurface APIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
201GLAPI EGLSurface APIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
202GLAPI EGLBoolean APIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
203GLAPI EGLBoolean APIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
204
205/* EGL 1.1 render-to-texture APIs */
206GLAPI EGLBoolean APIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
207GLAPI EGLBoolean APIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
208GLAPI EGLBoolean APIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
209
210/* EGL 1.1 swap control API */
211GLAPI EGLBoolean APIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
212
213GLAPI EGLContext APIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
214GLAPI EGLBoolean APIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
215GLAPI EGLBoolean APIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
216GLAPI EGLContext APIENTRY eglGetCurrentContext (void);
217GLAPI EGLSurface APIENTRY eglGetCurrentSurface (EGLint readdraw);
218GLAPI EGLDisplay APIENTRY eglGetCurrentDisplay (void);
219GLAPI EGLBoolean APIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
220
221GLAPI EGLBoolean APIENTRY eglWaitGL (void);
222GLAPI EGLBoolean APIENTRY eglWaitNative (EGLint engine);
223GLAPI EGLBoolean APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface draw);
224GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
225
226
227
228/* EGL_MESA_screen extension  >>> PRELIMINARY <<< */
229#ifndef EGL_MESA_screen_surface
230#define EGL_MESA_screen_surface 1
231
232#define EGL_BAD_SCREEN_MESA                    0x4000
233#define EGL_BAD_MODE_MESA                      0x4001
234#define EGL_SCREEN_COUNT_MESA                  0x4002
235#define EGL_SCREEN_POSITION_MESA               0x4003
236#define EGL_SCREEN_POSITION_GRANULARITY_MESA   0x4004
237#define EGL_MODE_ID_MESA                       0x4005
238#define EGL_REFRESH_RATE_MESA                  0x4006
239#define EGL_OPTIMAL_MESA                       0x4007
240#define EGL_INTERLACED_MESA                    0x4008
241#define EGL_SCREEN_BIT_MESA                    0x08
242
243GLAPI EGLBoolean APIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
244GLAPI EGLBoolean APIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
245GLAPI EGLBoolean APIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
246GLAPI EGLBoolean APIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
247GLAPI EGLSurface APIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
248GLAPI EGLBoolean APIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
249GLAPI EGLBoolean APIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
250GLAPI EGLBoolean APIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
251GLAPI EGLBoolean APIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
252GLAPI EGLBoolean APIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
253GLAPI const char * APIENTRY eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode);
254
255#endif /* EGL_MESA_screen_surface */
256
257
258#ifndef EGL_MESA_copy_context
259#define EGL_MESA_copy_context 1
260
261GLAPI EGLBoolean APIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
262
263#endif /* EGL_MESA_copy_context */
264
265
266/* XXX this is preliminary! */
267#ifndef EGL_VERSION_1_2
268#define EGL_VERSION_1_2 1
269
270typedef int EGLenum;
271typedef int EGLClientBuffer;
272
273#define EGL_DISPLAY_SCALING		10000
274#define EGL_UNKNOWN			((EGLint)-1)
275
276#define EGL_OPENGL_ES_BIT               0x1
277#define EGL_OPENVG_BIT                  0x2
278
279#define EGL_OPENGL_ES_API               0x30A0
280#define EGL_OPENVG_API                  0x30A1
281
282#define EGL_LUMINANCE_SIZE		0x303D
283#define EGL_ALPHA_MASK_SIZE		0x303E
284#define EGL_COLOR_BUFFER_TYPE		0x303F
285#define EGL_RENDERABLE_TYPE		0x3040
286
287#define EGL_SINGLE_BUFFER		0x3085
288#define EGL_RENDER_BUFFER		0x3086
289#define EGL_COLORSPACE			0x3087
290#define EGL_ALPHA_FORMAT		0x3088
291#define EGL_COLORSPACE_sRGB		0x3089
292#define EGL_COLORSPACE_LINEAR		0x308A
293#define EGL_ALPHA_FORMAT_NONPRE		0x308B
294#define EGL_ALPHA_FORMAT_PRE		0x308C
295#define EGL_CLIENT_APIS			0x308D
296#define EGL_RGB_BUFFER			0x308E
297#define EGL_LUMINANCE_BUFFER		0x308F
298#define EGL_HORIZONTAL_RESOLUTION	0x3090
299#define EGL_VERTICAL_RESOLUTION		0x3091
300#define EGL_PIXEL_ASPECT_RATIO		0x3092
301#define EGL_SWAP_BEHAVIOR		0x3093
302#define EGL_BUFFER_PRESERVED		0x3094
303#define EGL_BUFFER_DESTROYED		0x3095
304#define EGL_OPENVG_IMAGE		0x3096
305#define EGL_CONTEXT_CLIENT_TYPE		0x3097
306
307GLAPI EGLBoolean APIENTRY eglBindAPI(EGLenum api);
308GLAPI EGLenum APIENTRY eglQueryAPI(void);
309GLAPI EGLBoolean APIENTRY eglWaitClient(void);
310GLAPI EGLBoolean APIENTRY eglReleaseThread(void);
311GLAPI EGLSurface APIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
312
313#endif /* EGL_VERSION_1_2 */
314
315
316#ifdef __cplusplus
317}
318#endif
319
320#endif /* _EGL_H */
321