Just use stddef.h to get ptrdiff_t instead of obsolete malloc.h.
[mesa.git] / include / GLES / egl.h
1 #ifndef _EGL_H
2 #define _EGL_H
3
4 /*
5 ** License Applicability. Except to the extent portions of this file are
6 ** made subject to an alternative license as permitted in the SGI Free
7 ** Software License B, Version 1.0 (the "License"), the contents of this
8 ** file are subject only to the provisions of the License. You may not use
9 ** this file except in compliance with the License. You may obtain a copy
10 ** of the License at Silicon Graphics, Inc., attn: Legal Services, 1600
11 ** Amphitheatre Parkway, Mountain View, CA 94043-1351, or at:
12 **
13 ** http://oss.sgi.com/projects/FreeB
14 **
15 ** Note that, as provided in the License, the Software is distributed on an
16 ** "AS IS" basis, with ALL EXPRESS AND IMPLIED WARRANTIES AND CONDITIONS
17 ** DISCLAIMED, INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES AND
18 ** CONDITIONS OF MERCHANTABILITY, SATISFACTORY QUALITY, FITNESS FOR A
19 ** PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
20 **
21 ** Original Code. The Original Code is: OpenGL Sample Implementation,
22 ** Version 1.2.1, released January 26, 2000, developed by Silicon Graphics,
23 ** Inc. The Original Code is Copyright (c) 1991-2004 Silicon Graphics, Inc.
24 ** Copyright in any portions created by third parties is as indicated
25 ** elsewhere herein. All Rights Reserved.
26 **
27 ** Additional Notice Provisions: The application programming interfaces
28 ** established by SGI in conjunction with the Original Code are The
29 ** OpenGL(R) Graphics System: A Specification (Version 1.2.1), released
30 ** April 1, 1999; The OpenGL(R) Graphics System Utility Library (Version
31 ** 1.3), released November 4, 1998; and OpenGL(R) Graphics with the X
32 ** Window System(R) (Version 1.3), released October 19, 1998. This software
33 ** was created using the OpenGL(R) version 1.2.1 Sample Implementation
34 ** published by SGI, but has not been independently verified as being
35 ** compliant with the OpenGL(R) version 1.2.1 Specification.
36 */
37
38 #if 0/*XXX TEMPORARY HACK*/
39 #include <GLES/gl.h>
40 #else
41 #include <GL/gl.h>
42 #endif
43 #include <GLES/egltypes.h>
44
45 /* XXX should go in eglext.h */
46 #define GL_OES_VERSION_1_0 1
47 #define GL_OES_read_format 1
48 #define GL_OES_compressed_paletted_texture 1
49 #define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
50 #define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
51 #define GL_PALETTE4_RGB8_OES 0x8B90
52 #define GL_PALETTE4_RGBA8_OES 0x8B91
53 #define GL_PALETTE4_R5_G6_B5_OES 0x8B92
54 #define GL_PALETTE4_RGBA4_OES 0x8B93
55 #define GL_PALETTE4_RGB5_A1_OES 0x8B94
56 #define GL_PALETTE8_RGB8_OES 0x8B95
57 #define GL_PALETTE8_RGBA8_OES 0x8B96
58 #define GL_PALETTE8_R5_G6_B5_OES 0x8B97
59 #define GL_PALETTE8_RGBA4_OES 0x8B98
60 #define GL_PALETTE8_RGB5_A1_OES 0x8B99
61 /* XXX */
62
63 /*
64 ** Versioning and extensions
65 */
66 #define EGL_VERSION_1_0 1
67 #define EGL_VERSION_1_1 1
68
69 /*
70 ** Boolean
71 */
72 #define EGL_FALSE 0
73 #define EGL_TRUE 1
74
75 /*
76 ** Errors
77 */
78 #define EGL_SUCCESS 0x3000
79 #define EGL_NOT_INITIALIZED 0x3001
80 #define EGL_BAD_ACCESS 0x3002
81 #define EGL_BAD_ALLOC 0x3003
82 #define EGL_BAD_ATTRIBUTE 0x3004
83 #define EGL_BAD_CONFIG 0x3005
84 #define EGL_BAD_CONTEXT 0x3006
85 #define EGL_BAD_CURRENT_SURFACE 0x3007
86 #define EGL_BAD_DISPLAY 0x3008
87 #define EGL_BAD_MATCH 0x3009
88 #define EGL_BAD_NATIVE_PIXMAP 0x300A
89 #define EGL_BAD_NATIVE_WINDOW 0x300B
90 #define EGL_BAD_PARAMETER 0x300C
91 #define EGL_BAD_SURFACE 0x300D
92 #define EGL_CONTEXT_LOST 0x300E
93 /* 0x300F - 0x301F reserved for additional errors. */
94
95 /*
96 ** Config attributes
97 */
98 #define EGL_BUFFER_SIZE 0x3020
99 #define EGL_ALPHA_SIZE 0x3021
100 #define EGL_BLUE_SIZE 0x3022
101 #define EGL_GREEN_SIZE 0x3023
102 #define EGL_RED_SIZE 0x3024
103 #define EGL_DEPTH_SIZE 0x3025
104 #define EGL_STENCIL_SIZE 0x3026
105 #define EGL_CONFIG_CAVEAT 0x3027
106 #define EGL_CONFIG_ID 0x3028
107 #define EGL_LEVEL 0x3029
108 #define EGL_MAX_PBUFFER_HEIGHT 0x302A
109 #define EGL_MAX_PBUFFER_PIXELS 0x302B
110 #define EGL_MAX_PBUFFER_WIDTH 0x302C
111 #define EGL_NATIVE_RENDERABLE 0x302D
112 #define EGL_NATIVE_VISUAL_ID 0x302E
113 #define EGL_NATIVE_VISUAL_TYPE 0x302F
114 /*#define EGL_PRESERVED_RESOURCES 0x3030*/
115 #define EGL_SAMPLES 0x3031
116 #define EGL_SAMPLE_BUFFERS 0x3032
117 #define EGL_SURFACE_TYPE 0x3033
118 #define EGL_TRANSPARENT_TYPE 0x3034
119 #define EGL_TRANSPARENT_BLUE_VALUE 0x3035
120 #define EGL_TRANSPARENT_GREEN_VALUE 0x3036
121 #define EGL_TRANSPARENT_RED_VALUE 0x3037
122 #define EGL_NONE 0x3038 /* Also a config value */
123 #define EGL_BIND_TO_TEXTURE_RGB 0x3039
124 #define EGL_BIND_TO_TEXTURE_RGBA 0x303A
125 #define EGL_MIN_SWAP_INTERVAL 0x303B
126 #define EGL_MAX_SWAP_INTERVAL 0x303C
127
128 /*
129 ** Config values
130 */
131 #define EGL_DONT_CARE ((EGLint) -1)
132
133 #define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */
134 #define EGL_NON_CONFORMANT_CONFIG 0x3051 /* " */
135 #define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */
136 #define EGL_NO_TEXTURE 0x305C /* EGL_TEXTURE_FORMAT/TARGET value */
137 #define EGL_TEXTURE_RGB 0x305D /* EGL_TEXTURE_FORMAT value */
138 #define EGL_TEXTURE_RGBA 0x305E /* " */
139 #define EGL_TEXTURE_2D 0x305F /* EGL_TEXTURE_TARGET value */
140
141 /*
142 ** Config attribute mask bits
143 */
144 #define EGL_PBUFFER_BIT 0x01 /* EGL_SURFACE_TYPE mask bit */
145 #define EGL_PIXMAP_BIT 0x02 /* " */
146 #define EGL_WINDOW_BIT 0x04 /* " */
147
148 /*
149 ** String names
150 */
151 #define EGL_VENDOR 0x3053 /* eglQueryString target */
152 #define EGL_VERSION 0x3054 /* " */
153 #define EGL_EXTENSIONS 0x3055 /* " */
154
155 /*
156 ** Surface attributes
157 */
158 #define EGL_HEIGHT 0x3056
159 #define EGL_WIDTH 0x3057
160 #define EGL_LARGEST_PBUFFER 0x3058
161 #define EGL_TEXTURE_FORMAT 0x3080 /* For pbuffers bound as textures */
162 #define EGL_TEXTURE_TARGET 0x3081 /* " */
163 #define EGL_MIPMAP_TEXTURE 0x3082 /* " */
164 #define EGL_MIPMAP_LEVEL 0x3083 /* " */
165
166 /*
167 ** BindTexImage / ReleaseTexImage buffer target
168 */
169 #define EGL_BACK_BUFFER 0x3084
170
171 /*
172 ** Current surfaces
173 */
174 #define EGL_DRAW 0x3059
175 #define EGL_READ 0x305A
176
177 /*
178 ** Engines
179 */
180 #define EGL_CORE_NATIVE_ENGINE 0x305B
181
182 /* 0x305C-0x3FFFF reserved for future use */
183
184 /*
185 ** Functions
186 */
187 #ifdef __cplusplus
188 extern "C" {
189 #endif
190
191 GLAPI EGLint APIENTRY eglGetError (void);
192
193 GLAPI EGLDisplay APIENTRY eglGetDisplay (NativeDisplayType display);
194 GLAPI EGLBoolean APIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
195 GLAPI EGLBoolean APIENTRY eglTerminate (EGLDisplay dpy);
196 GLAPI const char * APIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
197 GLAPI void (* APIENTRY eglGetProcAddress (const char *procname))(void);
198
199 GLAPI EGLBoolean APIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
200 GLAPI EGLBoolean APIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
201 GLAPI EGLBoolean APIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
202
203 GLAPI EGLSurface APIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list);
204 GLAPI EGLSurface APIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, NativePixmapType pixmap, const EGLint *attrib_list);
205 GLAPI EGLSurface APIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
206 GLAPI EGLBoolean APIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
207 GLAPI EGLBoolean APIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
208
209 /* EGL 1.1 render-to-texture APIs */
210 GLAPI EGLBoolean APIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
211 GLAPI EGLBoolean APIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
212 GLAPI EGLBoolean APIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
213
214 /* EGL 1.1 swap control API */
215 GLAPI EGLBoolean APIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval);
216
217 GLAPI EGLContext APIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_list, const EGLint *attrib_list);
218 GLAPI EGLBoolean APIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
219 GLAPI EGLBoolean APIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
220 GLAPI EGLContext APIENTRY eglGetCurrentContext (void);
221 GLAPI EGLSurface APIENTRY eglGetCurrentSurface (EGLint readdraw);
222 GLAPI EGLDisplay APIENTRY eglGetCurrentDisplay (void);
223 GLAPI EGLBoolean APIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
224
225 GLAPI EGLBoolean APIENTRY eglWaitGL (void);
226 GLAPI EGLBoolean APIENTRY eglWaitNative (EGLint engine);
227 GLAPI EGLBoolean APIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface draw);
228 GLAPI EGLBoolean APIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, NativePixmapType target);
229
230
231
232 /* EGL_MESA_screen extension >>> PRELIMINARY <<< */
233 #ifndef EGL_MESA_screen_surface
234 #define EGL_MESA_screen_surface 1
235
236 #define EGL_BAD_SCREEN_MESA 0x4000
237 #define EGL_BAD_MODE_MESA 0x4001
238 #define EGL_SCREEN_COUNT_MESA 0x4002
239 #define EGL_SCREEN_POSITION_MESA 0x4003
240 #define EGL_SCREEN_POSITION_GRANULARITY_MESA 0x4004
241 #define EGL_MODE_ID_MESA 0x4005
242 #define EGL_REFRESH_RATE_MESA 0x4006
243 #define EGL_OPTIMAL_MESA 0x4007
244 #define EGL_INTERLACED_MESA 0x4008
245 #define EGL_SCREEN_BIT_MESA 0x08
246
247 GLAPI EGLBoolean APIENTRY eglChooseModeMESA(EGLDisplay dpy, EGLScreenMESA screen, const EGLint *attrib_list, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
248 GLAPI EGLBoolean APIENTRY eglGetModesMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *modes, EGLint modes_size, EGLint *num_modes);
249 GLAPI EGLBoolean APIENTRY eglGetModeAttribMESA(EGLDisplay dpy, EGLModeMESA mode, EGLint attribute, EGLint *value);
250 GLAPI EGLBoolean APIENTRY eglGetScreensMESA(EGLDisplay dpy, EGLScreenMESA *screens, EGLint max_screens, EGLint *num_screens);
251 GLAPI EGLSurface APIENTRY eglCreateScreenSurfaceMESA(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
252 GLAPI EGLBoolean APIENTRY eglShowScreenSurfaceMESA(EGLDisplay dpy, EGLint screen, EGLSurface surface, EGLModeMESA mode);
253 GLAPI EGLBoolean APIENTRY eglScreenPositionMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint x, EGLint y);
254 GLAPI EGLBoolean APIENTRY eglQueryScreenMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLint attribute, EGLint *value);
255 GLAPI EGLBoolean APIENTRY eglQueryScreenSurfaceMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLSurface *surface);
256 GLAPI EGLBoolean APIENTRY eglQueryScreenModeMESA(EGLDisplay dpy, EGLScreenMESA screen, EGLModeMESA *mode);
257 GLAPI const char * APIENTRY eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode);
258
259 #endif /* EGL_MESA_screen_surface */
260
261
262 #ifndef EGL_MESA_copy_context
263 #define EGL_MESA_copy_context 1
264
265 GLAPI EGLBoolean APIENTRY eglCopyContextMESA(EGLDisplay dpy, EGLContext source, EGLContext dest, EGLint mask);
266
267 #endif /* EGL_MESA_copy_context */
268
269
270 /* XXX this is preliminary! */
271 #ifndef EGL_VERSION_1_2
272 #define EGL_VERSION_1_2 1
273
274 typedef int EGLenum;
275 typedef int EGLClientBuffer;
276
277 #define EGL_DISPLAY_SCALING 10000
278 #define EGL_UNKNOWN ((EGLint)-1)
279
280 #define EGL_OPENGL_ES_BIT 0x1
281 #define EGL_OPENVG_BIT 0x2
282
283 #define EGL_OPENGL_ES_API 0x30A0
284 #define EGL_OPENVG_API 0x30A1
285
286 #define EGL_LUMINANCE_SIZE 0x303D
287 #define EGL_ALPHA_MASK_SIZE 0x303E
288 #define EGL_COLOR_BUFFER_TYPE 0x303F
289 #define EGL_RENDERABLE_TYPE 0x3040
290
291 #define EGL_SINGLE_BUFFER 0x3085
292 #define EGL_RENDER_BUFFER 0x3086
293 #define EGL_COLORSPACE 0x3087
294 #define EGL_ALPHA_FORMAT 0x3088
295 #define EGL_COLORSPACE_sRGB 0x3089
296 #define EGL_COLORSPACE_LINEAR 0x308A
297 #define EGL_ALPHA_FORMAT_NONPRE 0x308B
298 #define EGL_ALPHA_FORMAT_PRE 0x308C
299 #define EGL_CLIENT_APIS 0x308D
300 #define EGL_RGB_BUFFER 0x308E
301 #define EGL_LUMINANCE_BUFFER 0x308F
302 #define EGL_HORIZONTAL_RESOLUTION 0x3090
303 #define EGL_VERTICAL_RESOLUTION 0x3091
304 #define EGL_PIXEL_ASPECT_RATIO 0x3092
305 #define EGL_SWAP_BEHAVIOR 0x3093
306 #define EGL_BUFFER_PRESERVED 0x3094
307 #define EGL_BUFFER_DESTROYED 0x3095
308 #define EGL_OPENVG_IMAGE 0x3096
309 #define EGL_CONTEXT_CLIENT_TYPE 0x3097
310
311 GLAPI EGLBoolean APIENTRY eglBindAPI(EGLenum api);
312 GLAPI EGLenum APIENTRY eglQueryAPI(void);
313 GLAPI EGLBoolean APIENTRY eglWaitClient(void);
314 GLAPI EGLBoolean APIENTRY eglReleaseThread(void);
315 GLAPI EGLSurface APIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
316
317 #endif /* EGL_VERSION_1_2 */
318
319
320 #ifdef __cplusplus
321 }
322 #endif
323
324 #endif /* _EGL_H */