|
1 /* |
|
2 ** Copyright (c) 2007-2009 The Khronos Group Inc. |
|
3 ** |
|
4 ** Permission is hereby granted, free of charge, to any person obtaining a |
|
5 ** copy of this software and/or associated documentation files (the |
|
6 ** "Materials"), to deal in the Materials without restriction, including |
|
7 ** without limitation the rights to use, copy, modify, merge, publish, |
|
8 ** distribute, sublicense, and/or sell copies of the Materials, and to |
|
9 ** permit persons to whom the Materials are furnished to do so, subject to |
|
10 ** the following conditions: |
|
11 ** |
|
12 ** The above copyright notice and this permission notice shall be included |
|
13 ** in all copies or substantial portions of the Materials. |
|
14 ** |
|
15 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|
16 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|
17 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|
18 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|
19 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|
20 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
|
21 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. |
|
22 */ |
|
23 |
|
24 #ifndef __egl_h_ |
|
25 #define __egl_h_ |
|
26 |
|
27 /** |
|
28 @publishedAll |
|
29 @released |
|
30 */ |
|
31 |
|
32 |
|
33 /* differences from the actual sample implemtation provided by Khronos: |
|
34 - this comment |
|
35 - the Doxygen comment with tag 'publishedAll', and tag 'released' |
|
36 - changing platform-dependant header name from <EGL/eglplatform.h> to <EGL/egltypes.h> |
|
37 - exclude via #if 0 ... #endif some native types defined in egltypes.h |
|
38 - include eglext.h file by default |
|
39 */ |
|
40 |
|
41 |
|
42 /* All platform-dependent types and macro boilerplate (such as EGLAPI |
|
43 * and EGLAPIENTRY) should go in egltypes.h. |
|
44 */ |
|
45 #include <EGL/egltypes.h> |
|
46 |
|
47 /* The user of this API can use own extension by defining EGLEXT_LOCAL macro */ |
|
48 #ifndef EGLEXT_LOCAL |
|
49 #include <EGL/eglext.h> |
|
50 #endif /* ifndef EGLEXT_LOCAL */ |
|
51 |
|
52 #ifdef __cplusplus |
|
53 extern "C" { |
|
54 #endif |
|
55 |
|
56 /* EGL Versioning */ |
|
57 #define EGL_VERSION_1_0 1 |
|
58 #define EGL_VERSION_1_1 1 |
|
59 #define EGL_VERSION_1_2 1 |
|
60 #define EGL_VERSION_1_3 1 |
|
61 #define EGL_VERSION_1_4 1 |
|
62 |
|
63 /* EGL Enumerants. Bitmasks and other exceptional cases aside, most |
|
64 * enums are assigned unique values starting at 0x3000. |
|
65 */ |
|
66 |
|
67 /* EGL aliases */ |
|
68 #define EGL_FALSE 0 |
|
69 #define EGL_TRUE 1 |
|
70 |
|
71 /* Out-of-band attribute value */ |
|
72 #define EGL_DONT_CARE ((EGLint)-1) |
|
73 |
|
74 /* Errors / GetError return values */ |
|
75 #define EGL_SUCCESS 0x3000 |
|
76 #define EGL_NOT_INITIALIZED 0x3001 |
|
77 #define EGL_BAD_ACCESS 0x3002 |
|
78 #define EGL_BAD_ALLOC 0x3003 |
|
79 #define EGL_BAD_ATTRIBUTE 0x3004 |
|
80 #define EGL_BAD_CONFIG 0x3005 |
|
81 #define EGL_BAD_CONTEXT 0x3006 |
|
82 #define EGL_BAD_CURRENT_SURFACE 0x3007 |
|
83 #define EGL_BAD_DISPLAY 0x3008 |
|
84 #define EGL_BAD_MATCH 0x3009 |
|
85 #define EGL_BAD_NATIVE_PIXMAP 0x300A |
|
86 #define EGL_BAD_NATIVE_WINDOW 0x300B |
|
87 #define EGL_BAD_PARAMETER 0x300C |
|
88 #define EGL_BAD_SURFACE 0x300D |
|
89 #define EGL_CONTEXT_LOST 0x300E /* EGL 1.1 - IMG_power_management */ |
|
90 |
|
91 /* Reserved 0x300F-0x301F for additional errors */ |
|
92 |
|
93 /* Config attributes */ |
|
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 /* Attrib list terminator */ |
|
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 #define EGL_LUMINANCE_SIZE 0x303D |
|
124 #define EGL_ALPHA_MASK_SIZE 0x303E |
|
125 #define EGL_COLOR_BUFFER_TYPE 0x303F |
|
126 #define EGL_RENDERABLE_TYPE 0x3040 |
|
127 #define EGL_MATCH_NATIVE_PIXMAP 0x3041 /* Pseudo-attribute (not queryable) */ |
|
128 #define EGL_CONFORMANT 0x3042 |
|
129 |
|
130 /* Reserved 0x3041-0x304F for additional config attributes */ |
|
131 |
|
132 /* Config attribute values */ |
|
133 #define EGL_SLOW_CONFIG 0x3050 /* EGL_CONFIG_CAVEAT value */ |
|
134 #define EGL_NON_CONFORMANT_CONFIG 0x3051 /* EGL_CONFIG_CAVEAT value */ |
|
135 #define EGL_TRANSPARENT_RGB 0x3052 /* EGL_TRANSPARENT_TYPE value */ |
|
136 #define EGL_RGB_BUFFER 0x308E /* EGL_COLOR_BUFFER_TYPE value */ |
|
137 #define EGL_LUMINANCE_BUFFER 0x308F /* EGL_COLOR_BUFFER_TYPE value */ |
|
138 |
|
139 /* More config attribute values, for EGL_TEXTURE_FORMAT */ |
|
140 #define EGL_NO_TEXTURE 0x305C |
|
141 #define EGL_TEXTURE_RGB 0x305D |
|
142 #define EGL_TEXTURE_RGBA 0x305E |
|
143 #define EGL_TEXTURE_2D 0x305F |
|
144 |
|
145 /* Config attribute mask bits */ |
|
146 #define EGL_PBUFFER_BIT 0x0001 /* EGL_SURFACE_TYPE mask bits */ |
|
147 #define EGL_PIXMAP_BIT 0x0002 /* EGL_SURFACE_TYPE mask bits */ |
|
148 #define EGL_WINDOW_BIT 0x0004 /* EGL_SURFACE_TYPE mask bits */ |
|
149 #define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 /* EGL_SURFACE_TYPE mask bits */ |
|
150 #define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 /* EGL_SURFACE_TYPE mask bits */ |
|
151 #define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 /* EGL_SURFACE_TYPE mask bits */ |
|
152 #define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 /* EGL_SURFACE_TYPE mask bits */ |
|
153 |
|
154 #define EGL_OPENGL_ES_BIT 0x0001 /* EGL_RENDERABLE_TYPE mask bits */ |
|
155 #define EGL_OPENVG_BIT 0x0002 /* EGL_RENDERABLE_TYPE mask bits */ |
|
156 #define EGL_OPENGL_ES2_BIT 0x0004 /* EGL_RENDERABLE_TYPE mask bits */ |
|
157 #define EGL_OPENGL_BIT 0x0008 /* EGL_RENDERABLE_TYPE mask bits */ |
|
158 |
|
159 /* QueryString targets */ |
|
160 #define EGL_VENDOR 0x3053 |
|
161 #define EGL_VERSION 0x3054 |
|
162 #define EGL_EXTENSIONS 0x3055 |
|
163 #define EGL_CLIENT_APIS 0x308D |
|
164 |
|
165 /* QuerySurface / SurfaceAttrib / CreatePbufferSurface targets */ |
|
166 #define EGL_HEIGHT 0x3056 |
|
167 #define EGL_WIDTH 0x3057 |
|
168 #define EGL_LARGEST_PBUFFER 0x3058 |
|
169 #define EGL_TEXTURE_FORMAT 0x3080 |
|
170 #define EGL_TEXTURE_TARGET 0x3081 |
|
171 #define EGL_MIPMAP_TEXTURE 0x3082 |
|
172 #define EGL_MIPMAP_LEVEL 0x3083 |
|
173 #define EGL_RENDER_BUFFER 0x3086 |
|
174 #define EGL_VG_COLORSPACE 0x3087 |
|
175 #define EGL_VG_ALPHA_FORMAT 0x3088 |
|
176 #define EGL_HORIZONTAL_RESOLUTION 0x3090 |
|
177 #define EGL_VERTICAL_RESOLUTION 0x3091 |
|
178 #define EGL_PIXEL_ASPECT_RATIO 0x3092 |
|
179 #define EGL_SWAP_BEHAVIOR 0x3093 |
|
180 #define EGL_MULTISAMPLE_RESOLVE 0x3099 |
|
181 |
|
182 /* EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets */ |
|
183 #define EGL_BACK_BUFFER 0x3084 |
|
184 #define EGL_SINGLE_BUFFER 0x3085 |
|
185 |
|
186 /* OpenVG color spaces */ |
|
187 #define EGL_VG_COLORSPACE_sRGB 0x3089 /* EGL_VG_COLORSPACE value */ |
|
188 #define EGL_VG_COLORSPACE_LINEAR 0x308A /* EGL_VG_COLORSPACE value */ |
|
189 |
|
190 /* OpenVG alpha formats */ |
|
191 #define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B /* EGL_ALPHA_FORMAT value */ |
|
192 #define EGL_VG_ALPHA_FORMAT_PRE 0x308C /* EGL_ALPHA_FORMAT value */ |
|
193 |
|
194 /* Constant scale factor by which fractional display resolutions & |
|
195 * aspect ratio are scaled when queried as integer values. |
|
196 */ |
|
197 #define EGL_DISPLAY_SCALING 10000 |
|
198 |
|
199 /* Unknown display resolution/aspect ratio */ |
|
200 #define EGL_UNKNOWN ((EGLint)-1) |
|
201 |
|
202 /* Back buffer swap behaviors */ |
|
203 #define EGL_BUFFER_PRESERVED 0x3094 /* EGL_SWAP_BEHAVIOR value */ |
|
204 #define EGL_BUFFER_DESTROYED 0x3095 /* EGL_SWAP_BEHAVIOR value */ |
|
205 |
|
206 /* CreatePbufferFromClientBuffer buffer types */ |
|
207 #define EGL_OPENVG_IMAGE 0x3096 |
|
208 |
|
209 /* QueryContext targets */ |
|
210 #define EGL_CONTEXT_CLIENT_TYPE 0x3097 |
|
211 |
|
212 /* CreateContext attributes */ |
|
213 #define EGL_CONTEXT_CLIENT_VERSION 0x3098 |
|
214 |
|
215 /* Multisample resolution behaviors */ |
|
216 #define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A /* EGL_MULTISAMPLE_RESOLVE value */ |
|
217 #define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B /* EGL_MULTISAMPLE_RESOLVE value */ |
|
218 |
|
219 /* BindAPI/QueryAPI targets */ |
|
220 #define EGL_OPENGL_ES_API 0x30A0 |
|
221 #define EGL_OPENVG_API 0x30A1 |
|
222 #define EGL_OPENGL_API 0x30A2 |
|
223 |
|
224 /* GetCurrentSurface targets */ |
|
225 #define EGL_DRAW 0x3059 |
|
226 #define EGL_READ 0x305A |
|
227 |
|
228 /* WaitNative engines */ |
|
229 #define EGL_CORE_NATIVE_ENGINE 0x305B |
|
230 |
|
231 /* EGL 1.2 tokens renamed for consistency in EGL 1.3 */ |
|
232 #define EGL_COLORSPACE EGL_VG_COLORSPACE |
|
233 #define EGL_ALPHA_FORMAT EGL_VG_ALPHA_FORMAT |
|
234 #define EGL_COLORSPACE_sRGB EGL_VG_COLORSPACE_sRGB |
|
235 #define EGL_COLORSPACE_LINEAR EGL_VG_COLORSPACE_LINEAR |
|
236 #define EGL_ALPHA_FORMAT_NONPRE EGL_VG_ALPHA_FORMAT_NONPRE |
|
237 #define EGL_ALPHA_FORMAT_PRE EGL_VG_ALPHA_FORMAT_PRE |
|
238 |
|
239 /* EGL extensions must request enum blocks from the Khronos |
|
240 * API Registrar, who maintains the enumerant registry. Submit |
|
241 * a bug in Khronos Bugzilla against task "Registry". |
|
242 */ |
|
243 |
|
244 |
|
245 |
|
246 /* EGL Functions */ |
|
247 |
|
248 EGLAPI EGLint EGLAPIENTRY eglGetError(void); |
|
249 |
|
250 EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id); |
|
251 EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor); |
|
252 EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy); |
|
253 |
|
254 EGLAPI const char * EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name); |
|
255 |
|
256 EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, |
|
257 EGLint config_size, EGLint *num_config); |
|
258 EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, |
|
259 EGLConfig *configs, EGLint config_size, |
|
260 EGLint *num_config); |
|
261 EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, |
|
262 EGLint attribute, EGLint *value); |
|
263 |
|
264 EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, |
|
265 EGLNativeWindowType win, |
|
266 const EGLint *attrib_list); |
|
267 EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, |
|
268 const EGLint *attrib_list); |
|
269 EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, |
|
270 EGLNativePixmapType pixmap, |
|
271 const EGLint *attrib_list); |
|
272 EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface); |
|
273 EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, |
|
274 EGLint attribute, EGLint *value); |
|
275 |
|
276 EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api); |
|
277 EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void); |
|
278 |
|
279 EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void); |
|
280 |
|
281 EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void); |
|
282 |
|
283 EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer( |
|
284 EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, |
|
285 EGLConfig config, const EGLint *attrib_list); |
|
286 |
|
287 EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, |
|
288 EGLint attribute, EGLint value); |
|
289 EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); |
|
290 EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); |
|
291 |
|
292 |
|
293 EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval); |
|
294 |
|
295 |
|
296 EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, |
|
297 EGLContext share_context, |
|
298 const EGLint *attrib_list); |
|
299 EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx); |
|
300 EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, |
|
301 EGLSurface read, EGLContext ctx); |
|
302 |
|
303 EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void); |
|
304 EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw); |
|
305 EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void); |
|
306 EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, |
|
307 EGLint attribute, EGLint *value); |
|
308 |
|
309 EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void); |
|
310 EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine); |
|
311 EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface); |
|
312 EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, |
|
313 EGLNativePixmapType target); |
|
314 |
|
315 #ifdef __cplusplus |
|
316 EGLAPI void (* EGLAPIENTRY eglGetProcAddress (const char *procname))(...); |
|
317 #else |
|
318 EGLAPI void (* EGLAPIENTRY eglGetProcAddress (const char *procname))(); |
|
319 #endif |
|
320 |
|
321 #ifdef __cplusplus |
|
322 } |
|
323 #endif |
|
324 |
|
325 #endif /* __egl_h_ */ |