blob: cc9584087891833ced125d243587fc4f2eacfe3d [file] [log] [blame]
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +08001##########################################################################
2#
3# Copyright 2011 LunarG, Inc.
4# All Rights Reserved.
5#
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:
12#
13# The above copyright notice and this permission notice shall be included in
14# all copies or substantial portions of the Software.
15#
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
22# THE SOFTWARE.
23#
24##########################################################################/
25
26"""EGL API description."""
27
28
29from stdapi import *
Arnaud Vracfe93afd2011-12-19 02:42:15 +010030from gltypes import *
José Fonseca0765c822013-05-29 08:52:01 +010031from eglenum import *
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +080032
33EGLNativeDisplayType = Opaque("EGLNativeDisplayType")
34EGLNativeWindowType = Opaque("EGLNativeWindowType")
35EGLNativePixmapType = Opaque("EGLNativePixmapType")
36
37EGLDisplay = Opaque("EGLDisplay")
38EGLConfig = Opaque("EGLConfig")
39EGLContext = Opaque("EGLContext")
40EGLSurface = Opaque("EGLSurface")
41
42EGLClientBuffer = Opaque("EGLClientBuffer")
43
Chia-I Wu9b4e6d32011-12-07 17:03:23 +080044EGLBoolean = Enum("EGLBoolean", [
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +080045 "EGL_FALSE",
46 "EGL_TRUE",
47])
48
49EGLint = Alias("EGLint", Int32)
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +080050
Chia-I Wu76fe5272011-12-07 17:03:50 +080051# an alias of EGLenum
José Fonseca22ef2a52013-05-29 08:13:18 +010052EGLint_enum = Alias("EGLint", EGLenum)
53EGLattrib = EGLint_enum
Chia-I Wu76fe5272011-12-07 17:03:50 +080054
55# EGL_KHR_image_base
56EGLImageKHR = Opaque("EGLImageKHR")
57
Chia-I Wud6749322011-11-30 18:21:45 +080058# EGL_KHR_reusable_sync
59EGLSyncKHR = Opaque("EGLSyncKHR")
60EGLTimeKHR = Alias("EGLTimeKHR", UInt64)
61
Chia-I Wu4b1c8252011-11-30 18:43:23 +080062# EGL_NV_sync
63EGLSyncNV = Alias("EGLSyncNV", EGLSyncKHR)
Chia-I Wu76fe5272011-12-07 17:03:50 +080064EGLTimeNV = Alias("EGLTimeNV", EGLTimeKHR)
Chia-I Wu4b1c8252011-11-30 18:43:23 +080065
Chia-I Wucba18902011-12-01 14:14:36 +080066# EGL_HI_clientpixmap
67EGLClientPixmapHI = Struct("struct EGLClientPixmapHI", [
68 (OpaquePointer(Void), "pData"),
69 (EGLint, "iWidth"),
70 (EGLint, "iHeight"),
71 (EGLint, "iStride"),
72])
73
Chia-I Wueb7f1bd2011-12-01 14:57:24 +080074# EGL_NV_system_time
75EGLuint64NV = Alias("EGLuint64NV", UInt64)
76
José Fonseca81301932012-11-11 00:10:20 +000077eglapi = Module("EGL")
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +080078
José Fonseca632a78d2012-04-19 07:18:59 +010079EGLAttribList = Array(Const(EGLattrib), "_AttribPairList_size(attrib_list, EGL_NONE)")
Chia-I Wudaa43132011-12-07 17:23:41 +080080
José Fonsecad93791e2012-04-20 07:15:38 +010081EGLProc = Opaque("__eglMustCastToProperFunctionPointerType")
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +080082
Arnaud Vracfe93afd2011-12-19 02:42:15 +010083def GlFunction(*args, **kwargs):
84 kwargs.setdefault('call', 'GL_APIENTRY')
85 return Function(*args, **kwargs)
86
José Fonseca54f304a2012-01-14 19:33:08 +000087eglapi.addFunctions([
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +080088 # EGL 1.4
José Fonseca22ef2a52013-05-29 08:13:18 +010089 Function(EGLint_enum, "eglGetError", [], sideeffects=False),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +080090
91 Function(EGLDisplay, "eglGetDisplay", [(EGLNativeDisplayType, "display_id")]),
92 Function(EGLBoolean, "eglInitialize", [(EGLDisplay, "dpy"), Out(Pointer(EGLint), "major"), Out(Pointer(EGLint), "minor")]),
93 Function(EGLBoolean, "eglTerminate", [(EGLDisplay, "dpy")]),
94
José Fonseca22ef2a52013-05-29 08:13:18 +010095 Function(ConstCString, "eglQueryString", [(EGLDisplay, "dpy"), (EGLint_enum, "name")], sideeffects=False),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +080096
97 Function(EGLBoolean, "eglGetConfigs", [(EGLDisplay, "dpy"), (Array(EGLConfig, "config_size"), "configs"), (EGLint, "config_size"), Out(Pointer(EGLint), "num_config")]),
Chia-I Wudaa43132011-12-07 17:23:41 +080098 Function(EGLBoolean, "eglChooseConfig", [(EGLDisplay, "dpy"), (EGLAttribList, "attrib_list"), (Array(EGLConfig, "config_size"), "configs"), (EGLint, "config_size"), Out(Pointer(EGLint), "num_config")]),
Chia-I Wu76fe5272011-12-07 17:03:50 +080099 Function(EGLBoolean, "eglGetConfigAttrib", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLattrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +0800100
Chia-I Wudaa43132011-12-07 17:23:41 +0800101 Function(EGLSurface, "eglCreateWindowSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLNativeWindowType, "win"), (EGLAttribList, "attrib_list")]),
102 Function(EGLSurface, "eglCreatePbufferSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLAttribList, "attrib_list")]),
103 Function(EGLSurface, "eglCreatePixmapSurface", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLNativePixmapType, "pixmap"), (EGLAttribList, "attrib_list")]),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +0800104 Function(EGLBoolean, "eglDestroySurface", [(EGLDisplay, "dpy"), (EGLSurface, "surface")]),
Chia-I Wu76fe5272011-12-07 17:03:50 +0800105 Function(EGLBoolean, "eglQuerySurface", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLattrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +0800106
Chia-I Wu76fe5272011-12-07 17:03:50 +0800107 Function(EGLBoolean, "eglBindAPI", [(EGLenum, "api")]),
108 Function(EGLenum, "eglQueryAPI", [], sideeffects=False),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +0800109
110 Function(EGLBoolean, "eglWaitClient", []),
111
112 Function(EGLBoolean, "eglReleaseThread", []),
113
Chia-I Wudaa43132011-12-07 17:23:41 +0800114 Function(EGLSurface, "eglCreatePbufferFromClientBuffer", [(EGLDisplay, "dpy"), (EGLenum, "buftype"), (EGLClientBuffer, "buffer"), (EGLConfig, "config"), (EGLAttribList, "attrib_list")]),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +0800115
Chia-I Wu76fe5272011-12-07 17:03:50 +0800116 Function(EGLBoolean, "eglSurfaceAttrib", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLattrib, "attribute"), (EGLint, "value")]),
117 Function(EGLBoolean, "eglBindTexImage", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLattrib, "buffer")]),
118 Function(EGLBoolean, "eglReleaseTexImage", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLattrib, "buffer")]),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +0800119
120 Function(EGLBoolean, "eglSwapInterval", [(EGLDisplay, "dpy"), (EGLint, "interval")]),
121
Chia-I Wudaa43132011-12-07 17:23:41 +0800122 Function(EGLContext, "eglCreateContext", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLContext, "share_context"), (EGLAttribList, "attrib_list")]),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +0800123 Function(EGLBoolean, "eglDestroyContext", [(EGLDisplay, "dpy"), (EGLContext, "ctx")]),
124 Function(EGLBoolean, "eglMakeCurrent", [(EGLDisplay, "dpy"), (EGLSurface, "draw"), (EGLSurface, "read"), (EGLContext, "ctx")]),
125
126 Function(EGLContext, "eglGetCurrentContext", [], sideeffects=False),
Chia-I Wu76fe5272011-12-07 17:03:50 +0800127 Function(EGLSurface, "eglGetCurrentSurface", [(EGLattrib, "readdraw")], sideeffects=False),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +0800128 Function(EGLDisplay, "eglGetCurrentDisplay", [], sideeffects=False),
129
Chia-I Wu76fe5272011-12-07 17:03:50 +0800130 Function(EGLBoolean, "eglQueryContext", [(EGLDisplay, "dpy"), (EGLContext, "ctx"), (EGLattrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +0800131
132 Function(EGLBoolean, "eglWaitGL", []),
Chia-I Wu76fe5272011-12-07 17:03:50 +0800133 Function(EGLBoolean, "eglWaitNative", [(EGLattrib, "engine")]),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +0800134 Function(EGLBoolean, "eglSwapBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface")]),
135 Function(EGLBoolean, "eglCopyBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLNativePixmapType, "target")]),
136
José Fonsecabcfc81b2012-08-07 21:07:22 +0100137 Function(EGLProc, "eglGetProcAddress", [(ConstCString, "procname")]),
Chia-I Wu7fbacb72011-11-30 17:52:40 +0800138
139 # EGL_KHR_lock_surface
José Fonseca74ccf6e2013-05-30 10:26:04 +0100140 # EGL_KHR_lock_surface2
Chia-I Wudaa43132011-12-07 17:23:41 +0800141 Function(EGLBoolean, "eglLockSurfaceKHR", [(EGLDisplay, "display"), (EGLSurface, "surface"), (EGLAttribList, "attrib_list")]),
Chia-I Wu7fbacb72011-11-30 17:52:40 +0800142 Function(EGLBoolean, "eglUnlockSurfaceKHR", [(EGLDisplay, "display"), (EGLSurface, "surface")]),
Chia-I Wubc61ec32011-11-30 17:58:03 +0800143
144 # EGL_KHR_image_base
Chia-I Wudaa43132011-12-07 17:23:41 +0800145 Function(EGLImageKHR, "eglCreateImageKHR", [(EGLDisplay, "dpy"), (EGLContext, "ctx"), (EGLenum, "target"), (EGLClientBuffer, "buffer"), (EGLAttribList, "attrib_list")]),
Chia-I Wubc61ec32011-11-30 17:58:03 +0800146 Function(EGLBoolean, "eglDestroyImageKHR", [(EGLDisplay, "dpy"), (EGLImageKHR, "image")]),
Chia-I Wud6749322011-11-30 18:21:45 +0800147
José Fonseca74ccf6e2013-05-30 10:26:04 +0100148 # EGL_KHR_fence_sync
Chia-I Wud6749322011-11-30 18:21:45 +0800149 # EGL_KHR_reusable_sync
Chia-I Wudaa43132011-12-07 17:23:41 +0800150 Function(EGLSyncKHR, "eglCreateSyncKHR", [(EGLDisplay, "dpy"), (EGLenum, "type"), (EGLAttribList, "attrib_list")]),
Chia-I Wud6749322011-11-30 18:21:45 +0800151 Function(EGLBoolean, "eglDestroySyncKHR", [(EGLDisplay, "dpy"), (EGLSyncKHR, "sync")]),
152 Function(EGLint, "eglClientWaitSyncKHR", [(EGLDisplay, "dpy"), (EGLSyncKHR, "sync"), (EGLint, "flags"), (EGLTimeKHR, "timeout")]),
Chia-I Wu76fe5272011-12-07 17:03:50 +0800153 Function(EGLBoolean, "eglSignalSyncKHR", [(EGLDisplay, "dpy"), (EGLSyncKHR, "sync"), (EGLenum, "mode")]),
154 Function(EGLBoolean, "eglGetSyncAttribKHR", [(EGLDisplay, "dpy"), (EGLSyncKHR, "sync"), (EGLattrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
Chia-I Wu4b1c8252011-11-30 18:43:23 +0800155
156 # EGL_NV_sync
Chia-I Wudaa43132011-12-07 17:23:41 +0800157 Function(EGLSyncNV, "eglCreateFenceSyncNV", [(EGLDisplay, "dpy"), (EGLenum, "condition"), (EGLAttribList, "attrib_list")]),
Chia-I Wu4b1c8252011-11-30 18:43:23 +0800158 Function(EGLBoolean, "eglDestroySyncNV", [(EGLSyncNV, "sync")]),
159 Function(EGLBoolean, "eglFenceNV", [(EGLSyncNV, "sync")]),
160 Function(EGLint, "eglClientWaitSyncNV", [(EGLSyncNV, "sync"), (EGLint, "flags"), (EGLTimeNV, "timeout")]),
161 Function(EGLBoolean, "eglSignalSyncNV", [(EGLSyncNV, "sync"), (EGLenum, "mode")]),
Chia-I Wu76fe5272011-12-07 17:03:50 +0800162 Function(EGLBoolean, "eglGetSyncAttribNV", [(EGLSyncNV, "sync"), (EGLattrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
Chia-I Wucba18902011-12-01 14:14:36 +0800163
164 # EGL_HI_clientpixmap
165 Function(EGLSurface, "eglCreatePixmapSurfaceHI", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (Pointer(EGLClientPixmapHI), "pixmap")]),
Chia-I Wuf45b6472011-12-01 14:43:54 +0800166
167 # EGL_MESA_drm_image
Chia-I Wudaa43132011-12-07 17:23:41 +0800168 Function(EGLImageKHR, "eglCreateDRMImageMESA", [(EGLDisplay, "dpy"), (EGLAttribList, "attrib_list")]),
Chia-I Wuf45b6472011-12-01 14:43:54 +0800169 Function(EGLBoolean, "eglExportDRMImageMESA", [(EGLDisplay, "dpy"), (EGLImageKHR, "image"), Out(Pointer(EGLint), "name"), Out(Pointer(EGLint), "handle"), Out(Pointer(EGLint), "stride")]),
Chia-I Wu67be6f12011-12-01 14:47:02 +0800170
171 # EGL_NV_post_sub_buffer
172 Function(EGLBoolean, "eglPostSubBufferNV", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLint, "x"), (EGLint, "y"), (EGLint, "width"), (EGLint, "height")]),
Chia-I Wu991b5f52011-12-01 14:49:53 +0800173
174 # EGL_ANGLE_query_surface_pointer
Chia-I Wu76fe5272011-12-07 17:03:50 +0800175 Function(EGLBoolean, "eglQuerySurfacePointerANGLE", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLattrib, "attribute"), Out(Pointer(OpaquePointer(Void)), "value")], sideeffects=False),
Chia-I Wueb7f1bd2011-12-01 14:57:24 +0800176
177 # EGL_NV_system_time
178 Function(EGLuint64NV, "eglGetSystemTimeFrequencyNV", [], sideeffects=False),
179 Function(EGLuint64NV, "eglGetSystemTimeNV", [], sideeffects=False),
Arnaud Vracfe93afd2011-12-19 02:42:15 +0100180
181 # GL_OES_EGL_image
182 GlFunction(Void, "glEGLImageTargetTexture2DOES", [(GLenum, "target"), (EGLImageKHR, "image")]),
183 GlFunction(Void, "glEGLImageTargetRenderbufferStorageOES", [(GLenum, "target"), (EGLImageKHR, "image")]),
Chia-I Wuc1d4c4d2011-11-03 12:23:21 +0800184])