1 ##########################################################################
3 # Copyright 2011 LunarG, Inc.
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:
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
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
24 ##########################################################################/
26 """EGL API description."""
31 EGLNativeDisplayType = Opaque("EGLNativeDisplayType")
32 EGLNativeWindowType = Opaque("EGLNativeWindowType")
33 EGLNativePixmapType = Opaque("EGLNativePixmapType")
35 EGLDisplay = Opaque("EGLDisplay")
36 EGLConfig = Opaque("EGLConfig")
37 EGLContext = Opaque("EGLContext")
38 EGLSurface = Opaque("EGLSurface")
40 EGLClientBuffer = Opaque("EGLClientBuffer")
42 _EGLBoolean = Alias("EGLBoolean", UInt)
43 EGLBoolean = FakeEnum(_EGLBoolean, [
48 EGLint = Alias("EGLint", Int32)
49 EGLenum = Alias("EGLenum", UInt)
51 EGLError = FakeEnum(EGLint, [
52 "EGL_SUCCESS", # 0x3000
53 "EGL_NOT_INITIALIZED", # 0x3001
54 "EGL_BAD_ACCESS", # 0x3002
55 "EGL_BAD_ALLOC", # 0x3003
56 "EGL_BAD_ATTRIBUTE", # 0x3004
57 "EGL_BAD_CONFIG", # 0x3005
58 "EGL_BAD_CONTEXT", # 0x3006
59 "EGL_BAD_CURRENT_SURFACE", # 0x3007
60 "EGL_BAD_DISPLAY", # 0x3008
61 "EGL_BAD_MATCH", # 0x3009
62 "EGL_BAD_NATIVE_PIXMAP", # 0x300A
63 "EGL_BAD_NATIVE_WINDOW", # 0x300B
64 "EGL_BAD_PARAMETER", # 0x300C
65 "EGL_BAD_SURFACE", # 0x300D
66 "EGL_CONTEXT_LOST", # 0x300E /* EGL 1.1 - IMG_power_management */
69 EGLConfigAttrib = FakeEnum(EGLint, [
70 "EGL_BUFFER_SIZE", # 0x3020
71 "EGL_ALPHA_SIZE", # 0x3021
72 "EGL_BLUE_SIZE", # 0x3022
73 "EGL_GREEN_SIZE", # 0x3023
74 "EGL_RED_SIZE", # 0x3024
75 "EGL_DEPTH_SIZE", # 0x3025
76 "EGL_STENCIL_SIZE", # 0x3026
77 "EGL_CONFIG_CAVEAT", # 0x3027
78 "EGL_CONFIG_ID", # 0x3028
80 "EGL_MAX_PBUFFER_HEIGHT", # 0x302A
81 "EGL_MAX_PBUFFER_PIXELS", # 0x302B
82 "EGL_MAX_PBUFFER_WIDTH", # 0x302C
83 "EGL_NATIVE_RENDERABLE", # 0x302D
84 "EGL_NATIVE_VISUAL_ID", # 0x302E
85 "EGL_NATIVE_VISUAL_TYPE", # 0x302F
86 "EGL_SAMPLES", # 0x3031
87 "EGL_SAMPLE_BUFFERS", # 0x3032
88 "EGL_SURFACE_TYPE", # 0x3033
89 "EGL_TRANSPARENT_TYPE", # 0x3034
90 "EGL_TRANSPARENT_BLUE_VALUE", # 0x3035
91 "EGL_TRANSPARENT_GREEN_VALUE", # 0x3036
92 "EGL_TRANSPARENT_RED_VALUE", # 0x3037
93 "EGL_NONE", # 0x3038 /* Attrib list terminator */
94 "EGL_BIND_TO_TEXTURE_RGB", # 0x3039
95 "EGL_BIND_TO_TEXTURE_RGBA", # 0x303A
96 "EGL_MIN_SWAP_INTERVAL", # 0x303B
97 "EGL_MAX_SWAP_INTERVAL", # 0x303C
98 "EGL_LUMINANCE_SIZE", # 0x303D
99 "EGL_ALPHA_MASK_SIZE", # 0x303E
100 "EGL_COLOR_BUFFER_TYPE", # 0x303F
101 "EGL_RENDERABLE_TYPE", # 0x3040
102 "EGL_MATCH_NATIVE_PIXMAP", # 0x3041 /* Pseudo-attribute (not queryable) */
103 "EGL_CONFORMANT", # 0x3042
105 # EGL_KHR_lock_surface
106 "EGL_MATCH_FORMAT_KHR", # 0x3043
109 EGLName = FakeEnum(EGLint, [
110 "EGL_VENDOR", # 0x3053
111 "EGL_VERSION", # 0x3054
112 "EGL_EXTENSIONS", # 0x3055
113 "EGL_CLIENT_APIS", # 0x308D
116 EGLSurfaceAttrib = FakeEnum(EGLint, [
117 "EGL_HEIGHT", # 0x3056
118 "EGL_WIDTH", # 0x3057
119 "EGL_LARGEST_PBUFFER", # 0x3058
120 "EGL_TEXTURE_FORMAT", # 0x3080
121 "EGL_TEXTURE_TARGET", # 0x3081
122 "EGL_MIPMAP_TEXTURE", # 0x3082
123 "EGL_MIPMAP_LEVEL", # 0x3083
124 "EGL_RENDER_BUFFER", # 0x3086
125 "EGL_VG_COLORSPACE", # 0x3087
126 "EGL_VG_ALPHA_FORMAT", # 0x3088
127 "EGL_HORIZONTAL_RESOLUTION", # 0x3090
128 "EGL_VERTICAL_RESOLUTION", # 0x3091
129 "EGL_PIXEL_ASPECT_RATIO", # 0x3092
130 "EGL_SWAP_BEHAVIOR", # 0x3093
131 "EGL_MULTISAMPLE_RESOLVE", # 0x3099
134 # EGL_KHR_lock_surface
135 "EGL_BITMAP_POINTER_KHR", # 0x30C6
136 "EGL_BITMAP_PITCH_KHR", # 0x30C7
137 "EGL_BITMAP_ORIGIN_KHR", # 0x30C8
138 "EGL_BITMAP_PIXEL_RED_OFFSET_KHR", # 0x30C9
139 "EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR", # 0x30CA
140 "EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR", # 0x30CB
141 "EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR", # 0x30CC
142 "EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR", # 0x30CD
143 # EGL_KHR_lock_surface2
144 "EGL_BITMAP_PIXEL_SIZE_KHR", # 0x3110
147 EGLContextAttrib = FakeEnum(EGLint, [
148 "EGL_CONTEXT_CLIENT_TYPE", # 0x3097
149 "EGL_CONTEXT_CLIENT_VERSION", # 0x3098
151 # EGL_IMG_context_priority
152 "EGL_CONTEXT_PRIORITY_LEVEL_IMG", # 0x3100
157 EGLAPI = FakeEnum(EGLenum, [
158 "EGL_OPENGL_ES_API", # 0x30A0
159 "EGL_OPENVG_API", # 0x30A1
160 "EGL_OPENGL_API", # 0x30A2
163 EGLClientBufferType = FakeEnum(EGLenum, [
164 "EGL_OPENVG_IMAGE", # 0x3096
167 EGLBufferType = FakeEnum(EGLint, [
168 "EGL_BACK_BUFFER", # 0x3084
169 "EGL_SINGLE_BUFFER", # 0x3085
172 EGLEngine = FakeEnum(EGLint, [
173 "EGL_CORE_NATIVE_ENGINE", # 0x305B
176 # EGL_KHR_lock_surface
177 EGLLockSurfaceAttrib = FakeEnum(EGLint, [
178 "EGL_MAP_PRESERVE_PIXELS_KHR", # 0x30C4
179 "EGL_LOCK_USAGE_HINT_KHR", # 0x30C5
183 EGLImageKHR = Opaque("EGLImageKHR")
185 EGLImageKHRAttrib = FakeEnum(EGLint, [
186 "EGL_IMAGE_PRESERVED_KHR", # 0x30D2
189 "EGL_GL_TEXTURE_LEVEL_KHR", # 0x30BC
190 "EGL_GL_TEXTURE_ZOFFSET_KHR", # 0x30BD
195 EGLImageKHRTarget = FakeEnum(EGLenum, [
196 # EGL_KHR_image_pixmap
197 "EGL_NATIVE_PIXMAP_KHR", # 0x30B0
199 # EGL_KHR_vg_parent_image
200 "EGL_VG_PARENT_IMAGE_KHR", # 0x30BA
203 "EGL_GL_TEXTURE_2D_KHR", # 0x30B1
204 "EGL_GL_TEXTURE_3D_KHR", # 0x30B2
205 "EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR", # 0x30B3
206 "EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR", # 0x30B4
207 "EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR", # 0x30B5
208 "EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR", # 0x30B6
209 "EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR", # 0x30B7
210 "EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR", # 0x30B8
211 "EGL_GL_RENDERBUFFER_KHR", # 0x30B9
214 # EGL_KHR_reusable_sync
215 EGLSyncKHR = Opaque("EGLSyncKHR")
216 EGLTimeKHR = Alias("EGLTimeKHR", UInt64)
218 EGLSyncKHRType = FakeEnum(EGLenum, [
219 "EGL_SYNC_REUSABLE_KHR", # 0x30FA
222 "EGL_SYNC_FENCE_KHR", # 0x30F9
225 EGLSyncKHRAttrib = FakeEnum(EGLint, [
226 "EGL_SYNC_STATUS_KHR", # 0x30F1
227 "EGL_SYNC_TYPE_KHR", # 0x30F7
230 "EGL_SYNC_CONDITION_KHR", # 0x30F8
235 EGLSyncKHRMode = FakeEnum(EGLenum, [
236 "EGL_SIGNALED_KHR", # 0x30F2
237 "EGL_UNSIGNALED_KHR", # 0x30F3
242 PROC = Opaque("__eglMustCastToProperFunctionPointerType")
244 eglapi.add_functions([
246 Function(EGLError, "eglGetError", [], sideeffects=False),
248 Function(EGLDisplay, "eglGetDisplay", [(EGLNativeDisplayType, "display_id")]),
249 Function(EGLBoolean, "eglInitialize", [(EGLDisplay, "dpy"), Out(Pointer(EGLint), "major"), Out(Pointer(EGLint), "minor")]),
250 Function(EGLBoolean, "eglTerminate", [(EGLDisplay, "dpy")]),
252 Function(Const(String("char *")), "eglQueryString", [(EGLDisplay, "dpy"), (EGLName, "name")], sideeffects=False),
254 Function(EGLBoolean, "eglGetConfigs", [(EGLDisplay, "dpy"), (Array(EGLConfig, "config_size"), "configs"), (EGLint, "config_size"), Out(Pointer(EGLint), "num_config")]),
255 Function(EGLBoolean, "eglChooseConfig", [(EGLDisplay, "dpy"), (Array(Const(EGLConfigAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list"), (Array(EGLConfig, "config_size"), "configs"), (EGLint, "config_size"), Out(Pointer(EGLint), "num_config")]),
256 Function(EGLBoolean, "eglGetConfigAttrib", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLConfigAttrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
258 Function(EGLSurface, "eglCreateWindowSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLNativeWindowType, "win"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
259 Function(EGLSurface, "eglCreatePbufferSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
260 Function(EGLSurface, "eglCreatePixmapSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLNativePixmapType, "pixmap"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
261 Function(EGLBoolean, "eglDestroySurface", [(EGLDisplay, "dpy"), (EGLSurface, "surface")]),
262 Function(EGLBoolean, "eglQuerySurface", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLSurfaceAttrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
264 Function(EGLBoolean, "eglBindAPI", [(EGLAPI, "api")]),
265 Function(EGLAPI, "eglQueryAPI", [], sideeffects=False),
267 Function(EGLBoolean, "eglWaitClient", []),
269 Function(EGLBoolean, "eglReleaseThread", []),
271 Function(EGLSurface, "eglCreatePbufferFromClientBuffer", [(EGLDisplay, "dpy"), (EGLClientBufferType, "buftype"), (EGLClientBuffer, "buffer"), (EGLConfig, "config"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
273 Function(EGLBoolean, "eglSurfaceAttrib", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLSurfaceAttrib, "attribute"), (EGLint, "value")]),
274 Function(EGLBoolean, "eglBindTexImage", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLBufferType, "buffer")]),
275 Function(EGLBoolean, "eglReleaseTexImage", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLBufferType, "buffer")]),
277 Function(EGLBoolean, "eglSwapInterval", [(EGLDisplay, "dpy"), (EGLint, "interval")]),
279 Function(EGLContext, "eglCreateContext", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLContext, "share_context"), (Array(Const(EGLContextAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
280 Function(EGLBoolean, "eglDestroyContext", [(EGLDisplay, "dpy"), (EGLContext, "ctx")]),
281 Function(EGLBoolean, "eglMakeCurrent", [(EGLDisplay, "dpy"), (EGLSurface, "draw"), (EGLSurface, "read"), (EGLContext, "ctx")]),
283 Function(EGLContext, "eglGetCurrentContext", [], sideeffects=False),
284 Function(EGLSurface, "eglGetCurrentSurface", [(EGLBufferType, "readdraw")], sideeffects=False),
285 Function(EGLDisplay, "eglGetCurrentDisplay", [], sideeffects=False),
287 Function(EGLBoolean, "eglQueryContext", [(EGLDisplay, "dpy"), (EGLContext, "ctx"), (EGLContextAttrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
289 Function(EGLBoolean, "eglWaitGL", []),
290 Function(EGLBoolean, "eglWaitNative", [(EGLEngine, "engine")]),
291 Function(EGLBoolean, "eglSwapBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface")]),
292 Function(EGLBoolean, "eglCopyBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLNativePixmapType, "target")]),
294 Function(PROC, "eglGetProcAddress", [(Const(CString), "procname")]),
296 # EGL_KHR_lock_surface
297 Function(EGLBoolean, "eglLockSurfaceKHR", [(EGLDisplay, "display"), (EGLSurface, "surface"), (Array(Const(EGLLockSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
298 Function(EGLBoolean, "eglUnlockSurfaceKHR", [(EGLDisplay, "display"), (EGLSurface, "surface")]),
301 Function(EGLImageKHR, "eglCreateImageKHR", [(EGLDisplay, "dpy"), (EGLContext, "ctx"), (EGLImageKHRTarget, "target"), (EGLClientBuffer, "buffer"), (Array(Const(EGLImageKHRAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
302 Function(EGLBoolean, "eglDestroyImageKHR", [(EGLDisplay, "dpy"), (EGLImageKHR, "image")]),
304 # EGL_KHR_reusable_sync
305 Function(EGLSyncKHR, "eglCreateSyncKHR", [(EGLDisplay, "dpy"), (EGLSyncKHRType, "type"), (Array(Const(EGLSyncKHRAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
306 Function(EGLBoolean, "eglDestroySyncKHR", [(EGLDisplay, "dpy"), (EGLSyncKHR, "sync")]),
307 Function(EGLint, "eglClientWaitSyncKHR", [(EGLDisplay, "dpy"), (EGLSyncKHR, "sync"), (EGLint, "flags"), (EGLTimeKHR, "timeout")]),
308 Function(EGLBoolean, "eglSignalSyncKHR", [(EGLDisplay, "dpy"), (EGLSyncKHR, "sync"), (EGLSyncKHRMode, "mode")]),
309 Function(EGLBoolean, "eglGetSyncAttribKHR", [(EGLDisplay, "dpy"), (EGLSyncKHR, "sync"), (EGLSyncKHRAttrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),