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
106 EGLName = FakeEnum(EGLint, [
107 "EGL_VENDOR", # 0x3053
108 "EGL_VERSION", # 0x3054
109 "EGL_EXTENSIONS", # 0x3055
110 "EGL_CLIENT_APIS", # 0x308D
113 EGLSurfaceAttrib = FakeEnum(EGLint, [
114 "EGL_HEIGHT", # 0x3056
115 "EGL_WIDTH", # 0x3057
116 "EGL_LARGEST_PBUFFER", # 0x3058
117 "EGL_TEXTURE_FORMAT", # 0x3080
118 "EGL_TEXTURE_TARGET", # 0x3081
119 "EGL_MIPMAP_TEXTURE", # 0x3082
120 "EGL_MIPMAP_LEVEL", # 0x3083
121 "EGL_RENDER_BUFFER", # 0x3086
122 "EGL_VG_COLORSPACE", # 0x3087
123 "EGL_VG_ALPHA_FORMAT", # 0x3088
124 "EGL_HORIZONTAL_RESOLUTION", # 0x3090
125 "EGL_VERTICAL_RESOLUTION", # 0x3091
126 "EGL_PIXEL_ASPECT_RATIO", # 0x3092
127 "EGL_SWAP_BEHAVIOR", # 0x3093
128 "EGL_MULTISAMPLE_RESOLVE", # 0x3099
132 EGLContextAttrib = FakeEnum(EGLint, [
133 "EGL_CONTEXT_CLIENT_TYPE", # 0x3097
134 "EGL_CONTEXT_CLIENT_VERSION", # 0x3098
138 EGLAPI = FakeEnum(EGLenum, [
139 "EGL_OPENGL_ES_API", # 0x30A0
140 "EGL_OPENVG_API", # 0x30A1
141 "EGL_OPENGL_API", # 0x30A2
144 EGLClientBufferType = FakeEnum(EGLenum, [
145 "EGL_OPENVG_IMAGE", # 0x3096
148 EGLBufferType = FakeEnum(EGLint, [
149 "EGL_BACK_BUFFER", # 0x3084
150 "EGL_SINGLE_BUFFER", # 0x3085
153 EGLEngine = FakeEnum(EGLint, [
154 "EGL_CORE_NATIVE_ENGINE", # 0x305B
159 PROC = Opaque("__eglMustCastToProperFunctionPointerType")
161 eglapi.add_functions([
163 Function(EGLError, "eglGetError", [], sideeffects=False),
165 Function(EGLDisplay, "eglGetDisplay", [(EGLNativeDisplayType, "display_id")]),
166 Function(EGLBoolean, "eglInitialize", [(EGLDisplay, "dpy"), Out(Pointer(EGLint), "major"), Out(Pointer(EGLint), "minor")]),
167 Function(EGLBoolean, "eglTerminate", [(EGLDisplay, "dpy")]),
169 Function(Const(String("char *")), "eglQueryString", [(EGLDisplay, "dpy"), (EGLName, "name")], sideeffects=False),
171 Function(EGLBoolean, "eglGetConfigs", [(EGLDisplay, "dpy"), (Array(EGLConfig, "config_size"), "configs"), (EGLint, "config_size"), Out(Pointer(EGLint), "num_config")]),
172 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")]),
173 Function(EGLBoolean, "eglGetConfigAttrib", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLConfigAttrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
175 Function(EGLSurface, "eglCreateWindowSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLNativeWindowType, "win"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
176 Function(EGLSurface, "eglCreatePbufferSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
177 Function(EGLSurface, "eglCreatePixmapSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLNativePixmapType, "pixmap"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
178 Function(EGLBoolean, "eglDestroySurface", [(EGLDisplay, "dpy"), (EGLSurface, "surface")]),
179 Function(EGLBoolean, "eglQuerySurface", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLSurfaceAttrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
181 Function(EGLBoolean, "eglBindAPI", [(EGLAPI, "api")]),
182 Function(EGLAPI, "eglQueryAPI", [], sideeffects=False),
184 Function(EGLBoolean, "eglWaitClient", []),
186 Function(EGLBoolean, "eglReleaseThread", []),
188 Function(EGLSurface, "eglCreatePbufferFromClientBuffer", [(EGLDisplay, "dpy"), (EGLClientBufferType, "buftype"), (EGLClientBuffer, "buffer"), (EGLConfig, "config"), (Array(Const(EGLSurfaceAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
190 Function(EGLBoolean, "eglSurfaceAttrib", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLSurfaceAttrib, "attribute"), (EGLint, "value")]),
191 Function(EGLBoolean, "eglBindTexImage", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLBufferType, "buffer")]),
192 Function(EGLBoolean, "eglReleaseTexImage", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLBufferType, "buffer")]),
194 Function(EGLBoolean, "eglSwapInterval", [(EGLDisplay, "dpy"), (EGLint, "interval")]),
196 Function(EGLContext, "eglCreateContext", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLContext, "share_context"), (Array(Const(EGLContextAttrib), "__AttribList_size(attrib_list, EGL_NONE)"), "attrib_list")]),
197 Function(EGLBoolean, "eglDestroyContext", [(EGLDisplay, "dpy"), (EGLContext, "ctx")]),
198 Function(EGLBoolean, "eglMakeCurrent", [(EGLDisplay, "dpy"), (EGLSurface, "draw"), (EGLSurface, "read"), (EGLContext, "ctx")]),
200 Function(EGLContext, "eglGetCurrentContext", [], sideeffects=False),
201 Function(EGLSurface, "eglGetCurrentSurface", [(EGLBufferType, "readdraw")], sideeffects=False),
202 Function(EGLDisplay, "eglGetCurrentDisplay", [], sideeffects=False),
204 Function(EGLBoolean, "eglQueryContext", [(EGLDisplay, "dpy"), (EGLContext, "ctx"), (EGLContextAttrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
206 Function(EGLBoolean, "eglWaitGL", []),
207 Function(EGLBoolean, "eglWaitNative", [(EGLEngine, "engine")]),
208 Function(EGLBoolean, "eglSwapBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface")]),
209 Function(EGLBoolean, "eglCopyBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLNativePixmapType, "target")]),
211 Function(PROC, "eglGetProcAddress", [(Const(CString), "procname")]),