]> git.cworth.org Git - apitrace/blob - specs/eglapi.py
glstate: Better support for integer textures dumps.
[apitrace] / specs / eglapi.py
1 ##########################################################################
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
29 from stdapi import *
30 from gltypes import *
31 from eglenum import *
32
33 EGLNativeDisplayType = Opaque("EGLNativeDisplayType")
34 EGLNativeWindowType = Opaque("EGLNativeWindowType")
35 EGLNativePixmapType = Opaque("EGLNativePixmapType")
36
37 EGLDisplay = Opaque("EGLDisplay")
38 EGLConfig = Opaque("EGLConfig")
39 EGLContext = Opaque("EGLContext")
40 EGLSurface = Opaque("EGLSurface")
41
42 EGLClientBuffer = Opaque("EGLClientBuffer")
43
44 EGLBoolean = Enum("EGLBoolean", [
45     "EGL_FALSE",
46     "EGL_TRUE",
47 ])
48
49 EGLint = Alias("EGLint", Int32)
50
51 # an alias of EGLenum
52 EGLint_enum = Alias("EGLint", EGLenum)
53 EGLattrib = EGLint_enum
54
55 # EGL_KHR_image_base
56 EGLImageKHR = Opaque("EGLImageKHR")
57
58 # EGL_KHR_reusable_sync
59 EGLSyncKHR = Opaque("EGLSyncKHR")
60 EGLTimeKHR = Alias("EGLTimeKHR", UInt64)
61
62 # EGL_NV_sync
63 EGLSyncNV = Alias("EGLSyncNV", EGLSyncKHR)
64 EGLTimeNV = Alias("EGLTimeNV", EGLTimeKHR)
65
66 # EGL_HI_clientpixmap
67 EGLClientPixmapHI = Struct("struct EGLClientPixmapHI", [
68   (OpaquePointer(Void), "pData"),
69   (EGLint, "iWidth"),
70   (EGLint, "iHeight"),
71   (EGLint, "iStride"),
72 ])
73
74 # EGL_NV_system_time
75 EGLuint64NV = Alias("EGLuint64NV", UInt64)
76
77 eglapi = Module("EGL")
78
79 EGLAttribList = Array(Const(EGLattrib), "_AttribPairList_size(attrib_list, EGL_NONE)")
80
81 EGLProc = Opaque("__eglMustCastToProperFunctionPointerType")
82
83 def GlFunction(*args, **kwargs):
84     kwargs.setdefault('call', 'GL_APIENTRY')
85     return Function(*args, **kwargs)
86
87 eglapi.addFunctions([
88     # EGL 1.4
89     Function(EGLint_enum, "eglGetError", [], sideeffects=False),
90
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
95     Function(ConstCString, "eglQueryString", [(EGLDisplay, "dpy"), (EGLint_enum, "name")], sideeffects=False),
96
97     Function(EGLBoolean, "eglGetConfigs", [(EGLDisplay, "dpy"), (Array(EGLConfig, "config_size"), "configs"), (EGLint, "config_size"), Out(Pointer(EGLint), "num_config")]),
98     Function(EGLBoolean, "eglChooseConfig", [(EGLDisplay, "dpy"), (EGLAttribList, "attrib_list"), (Array(EGLConfig, "config_size"), "configs"), (EGLint, "config_size"), Out(Pointer(EGLint), "num_config")]),
99     Function(EGLBoolean, "eglGetConfigAttrib", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLattrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
100
101     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")]),
104     Function(EGLBoolean, "eglDestroySurface", [(EGLDisplay, "dpy"), (EGLSurface, "surface")]),
105     Function(EGLBoolean, "eglQuerySurface", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLattrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
106
107     Function(EGLBoolean, "eglBindAPI", [(EGLenum, "api")]),
108     Function(EGLenum, "eglQueryAPI", [], sideeffects=False),
109
110     Function(EGLBoolean, "eglWaitClient", []),
111
112     Function(EGLBoolean, "eglReleaseThread", []),
113
114     Function(EGLSurface, "eglCreatePbufferFromClientBuffer", [(EGLDisplay, "dpy"), (EGLenum, "buftype"), (EGLClientBuffer, "buffer"), (EGLConfig, "config"), (EGLAttribList, "attrib_list")]),
115
116     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")]),
119
120     Function(EGLBoolean, "eglSwapInterval", [(EGLDisplay, "dpy"), (EGLint, "interval")]),
121
122     Function(EGLContext, "eglCreateContext", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLContext, "share_context"), (EGLAttribList, "attrib_list")]),
123     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),
127     Function(EGLSurface, "eglGetCurrentSurface", [(EGLattrib, "readdraw")], sideeffects=False),
128     Function(EGLDisplay, "eglGetCurrentDisplay", [], sideeffects=False),
129
130     Function(EGLBoolean, "eglQueryContext", [(EGLDisplay, "dpy"), (EGLContext, "ctx"), (EGLattrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
131
132     Function(EGLBoolean, "eglWaitGL", []),
133     Function(EGLBoolean, "eglWaitNative", [(EGLattrib, "engine")]),
134     Function(EGLBoolean, "eglSwapBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface")]),
135     Function(EGLBoolean, "eglCopyBuffers", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLNativePixmapType, "target")]),
136
137     Function(EGLProc, "eglGetProcAddress", [(ConstCString, "procname")]),
138
139     # EGL_KHR_lock_surface
140     # EGL_KHR_lock_surface2
141     Function(EGLBoolean, "eglLockSurfaceKHR", [(EGLDisplay, "display"), (EGLSurface, "surface"), (EGLAttribList, "attrib_list")]),
142     Function(EGLBoolean, "eglUnlockSurfaceKHR", [(EGLDisplay, "display"), (EGLSurface, "surface")]),
143
144     # EGL_KHR_image_base
145     Function(EGLImageKHR, "eglCreateImageKHR", [(EGLDisplay, "dpy"), (EGLContext, "ctx"), (EGLenum, "target"), (EGLClientBuffer, "buffer"), (EGLAttribList, "attrib_list")]),
146     Function(EGLBoolean, "eglDestroyImageKHR", [(EGLDisplay, "dpy"), (EGLImageKHR, "image")]),
147
148     # EGL_KHR_fence_sync
149     # EGL_KHR_reusable_sync
150     Function(EGLSyncKHR, "eglCreateSyncKHR", [(EGLDisplay, "dpy"), (EGLenum, "type"), (EGLAttribList, "attrib_list")]),
151     Function(EGLBoolean, "eglDestroySyncKHR", [(EGLDisplay, "dpy"), (EGLSyncKHR, "sync")]),
152     Function(EGLint, "eglClientWaitSyncKHR", [(EGLDisplay, "dpy"), (EGLSyncKHR, "sync"), (EGLint, "flags"), (EGLTimeKHR, "timeout")]),
153     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),
155
156     # EGL_NV_sync
157     Function(EGLSyncNV, "eglCreateFenceSyncNV", [(EGLDisplay, "dpy"), (EGLenum, "condition"), (EGLAttribList, "attrib_list")]),
158     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")]),
162     Function(EGLBoolean, "eglGetSyncAttribNV", [(EGLSyncNV, "sync"), (EGLattrib, "attribute"), Out(Pointer(EGLint), "value")], sideeffects=False),
163
164     # EGL_HI_clientpixmap
165     Function(EGLSurface, "eglCreatePixmapSurfaceHI", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (Pointer(EGLClientPixmapHI), "pixmap")]),
166
167     # EGL_MESA_drm_image
168     Function(EGLImageKHR, "eglCreateDRMImageMESA", [(EGLDisplay, "dpy"), (EGLAttribList, "attrib_list")]),
169     Function(EGLBoolean, "eglExportDRMImageMESA", [(EGLDisplay, "dpy"), (EGLImageKHR, "image"), Out(Pointer(EGLint), "name"), Out(Pointer(EGLint), "handle"), Out(Pointer(EGLint), "stride")]),
170
171     # EGL_NV_post_sub_buffer
172     Function(EGLBoolean, "eglPostSubBufferNV", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLint, "x"), (EGLint, "y"), (EGLint, "width"), (EGLint, "height")]),
173
174     # EGL_ANGLE_query_surface_pointer
175     Function(EGLBoolean, "eglQuerySurfacePointerANGLE", [(EGLDisplay, "dpy"), (EGLSurface, "surface"), (EGLattrib, "attribute"), Out(Pointer(OpaquePointer(Void)), "value")], sideeffects=False),
176
177     # EGL_NV_system_time
178     Function(EGLuint64NV, "eglGetSystemTimeFrequencyNV", [], sideeffects=False),
179     Function(EGLuint64NV, "eglGetSystemTimeNV", [], sideeffects=False),
180
181     # GL_OES_EGL_image
182     GlFunction(Void, "glEGLImageTargetTexture2DOES", [(GLenum, "target"), (EGLImageKHR, "image")]),
183     GlFunction(Void, "glEGLImageTargetRenderbufferStorageOES", [(GLenum, "target"), (EGLImageKHR, "image")]),
184 ])