]> git.cworth.org Git - apitrace/blob - glxapi.py
Dump the full set of constants on D3D.
[apitrace] / glxapi.py
1 ##########################################################################
2 #
3 # Copyright 2008-2009 VMware, 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 """GLX API description."""
27
28
29 from stdapi import *
30 from glapi import glapi
31
32 VisualID = Alias("VisualID", UInt32)
33 Display = Opaque("Display *")
34 Visual = Opaque("Visual *")
35 Font = Alias("Font", UInt32)
36 Pixmap = Alias("Pixmap", UInt32)
37 Window = Alias("Window", UInt32)
38
39 GLXContext = Opaque("GLXContext")
40 GLXPixmap = Alias("GLXPixmap", UInt32)
41 GLXDrawable = Alias("GLXDrawable", UInt32)
42 GLXFBConfig = Opaque("GLXFBConfig")
43 GLXFBConfigID = Alias("GLXFBConfigID", UInt32)
44 GLXContextID = Alias("GLXContextID", UInt32)
45 GLXWindow = Alias("GLXWindow", UInt32)
46 GLXPbuffer = Alias("GLXPbuffer", UInt32)
47
48 XVisualInfo = Struct("XVisualInfo", [
49   (Visual, "visual"),
50   (VisualID, "visualid"),
51   (Int, "screen"),
52   (Int, "depth"),
53   (Int, "c_class"),
54   (ULong, "red_mask"),
55   (ULong, "green_mask"),
56   (ULong, "blue_mask"),
57   (Int, "colormap_size"),
58   (Int, "bits_per_rgb"),
59 ])
60
61 Bool_ = FakeEnum(Int, [
62     "False",
63     "True",
64 ])
65
66 GLXAttrib = FakeEnum(Int, [
67     "GLX_USE_GL",
68     "GLX_BUFFER_SIZE",
69     "GLX_LEVEL",
70     "GLX_RGBA",
71     "GLX_DOUBLEBUFFER",
72     "GLX_STEREO",
73     "GLX_AUX_BUFFERS",
74     "GLX_RED_SIZE",
75     "GLX_GREEN_SIZE",
76     "GLX_BLUE_SIZE",
77     "GLX_ALPHA_SIZE",
78     "GLX_DEPTH_SIZE",
79     "GLX_STENCIL_SIZE",
80     "GLX_ACCUM_RED_SIZE",
81     "GLX_ACCUM_GREEN_SIZE",
82     "GLX_ACCUM_BLUE_SIZE",
83     "GLX_ACCUM_ALPHA_SIZE",
84     "GLX_CONFIG_CAVEAT",
85     "GLX_X_VISUAL_TYPE",
86     "GLX_TRANSPARENT_TYPE",
87     "GLX_TRANSPARENT_INDEX_VALUE",
88     "GLX_TRANSPARENT_RED_VALUE",
89     "GLX_TRANSPARENT_GREEN_VALUE",
90     "GLX_TRANSPARENT_BLUE_VALUE",
91     "GLX_TRANSPARENT_ALPHA_VALUE",
92     "GLX_DONT_CARE",
93 ])
94
95 GLXError = FakeEnum(Int, [
96     "GLX_BAD_SCREEN",
97     "GLX_BAD_ATTRIBUTE",
98     "GLX_NO_EXTENSION",
99     "GLX_BAD_VISUAL",
100     "GLX_BAD_CONTEXT",
101     "GLX_BAD_VALUE",
102     "GLX_BAD_ENUM",
103 ])
104
105
106 GLXbuffer = Flags(Int, [
107     "GLX_WINDOW_BIT",
108     "GLX_PIXMAP_BIT",
109     "GLX_PBUFFER_BIT",
110     "GLX_AUX_BUFFERS_BIT",
111     "GLX_FRONT_LEFT_BUFFER_BIT",
112     "GLX_FRONT_RIGHT_BUFFER_BIT",
113     "GLX_BACK_LEFT_BUFFER_BIT",
114     "GLX_BACK_RIGHT_BUFFER_BIT",
115     "GLX_DEPTH_BUFFER_BIT",
116     "GLX_STENCIL_BUFFER_BIT",
117     "GLX_ACCUM_BUFFER_BIT",
118 ])
119
120 GLXEnum = FakeEnum(Int, [
121     "GLX_NONE",
122     "GLX_SLOW_CONFIG",
123     "GLX_TRUE_COLOR",
124     "GLX_DIRECT_COLOR",
125     "GLX_PSEUDO_COLOR",
126     "GLX_STATIC_COLOR",
127     "GLX_GRAY_SCALE",
128     "GLX_STATIC_GRAY",
129     "GLX_TRANSPARENT_RGB",
130     "GLX_TRANSPARENT_INDEX",
131     "GLX_VISUAL_ID",
132     "GLX_SCREEN",
133     "GLX_NON_CONFORMANT_CONFIG",
134     "GLX_DRAWABLE_TYPE",
135     "GLX_RENDER_TYPE",
136     "GLX_X_RENDERABLE",
137     "GLX_FBCONFIG_ID",
138     "GLX_RGBA_TYPE",
139     "GLX_COLOR_INDEX_TYPE",
140     "GLX_MAX_PBUFFER_WIDTH",
141     "GLX_MAX_PBUFFER_HEIGHT",
142     "GLX_MAX_PBUFFER_PIXELS",
143     "GLX_PRESERVED_CONTENTS",
144     "GLX_LARGEST_PBUFFER",
145     "GLX_WIDTH",
146     "GLX_HEIGHT",
147     "GLX_EVENT_MASK",
148     "GLX_DAMAGED",
149     "GLX_SAVED",
150     "GLX_WINDOW",
151     "GLX_PBUFFER",
152     "GLX_PBUFFER_HEIGHT",
153     "GLX_PBUFFER_WIDTH",
154 ])
155
156 GLXbuffer = Flags(Int, [
157     "GLX_RGBA_BIT",
158     "GLX_COLOR_INDEX_BIT",
159     "GLX_PBUFFER_CLOBBER_MASK",
160 ])
161
162 glxapi = API("GLX")
163
164 PROC = Opaque("__GLXextFuncPtr")
165
166 glxapi.add_functions([
167     # GLX
168     Function(Pointer(XVisualInfo), "glXChooseVisual", [(Display, "dpy"), (Int, "screen"), (Array(GLXAttrib, "__AttribList_size(attribList)"), "attribList")]),
169     Function(GLXContext, "glXCreateContext", [(Display, "dpy"), (Pointer(XVisualInfo), "vis"), (GLXContext, "shareList"), (Bool_, "direct")]),
170     Function(Void, "glXDestroyContext",  [(Display, "dpy"), (GLXContext, "ctx")]),
171     Function(Bool_, "glXMakeCurrent", [(Display, "dpy"), (GLXDrawable, "drawable"), (GLXContext, "ctx")]),
172     Function(Void, "glXCopyContext", [(Display, "dpy"), (GLXContext, "src"), (GLXContext, "dst"),
173                                       (ULong, "mask")]),
174     Function(Void, "glXSwapBuffers", [(Display, "dpy"), (GLXDrawable, "drawable")]),
175     Function(GLXPixmap, "glXCreateGLXPixmap", [(Display, "dpy"), (Pointer(XVisualInfo), "visual"),
176                                                (Pixmap, "pixmap")]),
177     Function(Void, "glXDestroyGLXPixmap", [(Display, "dpy"), (GLXPixmap, "pixmap")]),
178     Function(Bool_, "glXQueryExtension", [(Display, "dpy"), Out(Pointer(Int), "errorb"), Out(Pointer(Int), "event")]),
179     Function(Bool_, "glXQueryVersion", [(Display, "dpy"), Out(Pointer(Int), "maj"), Out(Pointer(Int), "min")]),
180     Function(Bool_, "glXIsDirect", [(Display, "dpy"), (GLXContext, "ctx")]),
181     Function(GLXError, "glXGetConfig", [(Display, "dpy"), (Pointer(XVisualInfo), "visual"),
182                                     (GLXAttrib, "attrib"), Out(Pointer(Int), "value")]),
183     Function(GLXContext, "glXGetCurrentContext", [], sideeffects=False),
184     Function(GLXDrawable, "glXGetCurrentDrawable", [], sideeffects=False),
185     Function(Void, "glXWaitGL", []),
186     Function(Void, "glXWaitX", []),
187     Function(Void, "glXUseXFont", [(Font, "font"), (Int, "first"), (Int, "count"), (Int, "list")]),
188
189     # GLX 1.1 and later
190     Function((Const(String("char *"))), "glXQueryExtensionsString", [(Display, "dpy"), (Int, "screen")]),
191     Function((Const(String("char *"))), "glXQueryServerString",  [(Display, "dpy"), (Int, "screen"), (Int, "name")]),
192     Function((Const(String("char *"))), "glXGetClientString", [(Display, "dpy"), (Int, "name")]),
193
194     # GLX 1.2 and later
195     Function(Display, "glXGetCurrentDisplay", [], sideeffects=False),
196
197     # GLX 1.3 and later
198     Function(Array(GLXFBConfig, "*nitems"), "glXChooseFBConfig", [(Display, "dpy"), (Int, "screen"), (Const(Array(GLXAttrib, "__AttribList_size(attribList)")), "attribList"), Out(Pointer(Int), "nitems")]),
199     Function(Int, "glXGetFBConfigAttrib", [(Display, "dpy"), (GLXFBConfig, "config"), (GLXAttrib, "attribute"), Out(Pointer(Int), "value")]),
200     Function(Array(GLXFBConfig, "*nelements"), "glXGetFBConfigs", [(Display, "dpy"), (Int, "screen"), 
201                                                                    Out(Pointer(Int), "nelements")]),
202     Function(Pointer(XVisualInfo), "glXGetVisualFromFBConfig", [(Display, "dpy"),
203                                                                 (GLXFBConfig, "config")]),
204     Function(GLXWindow, "glXCreateWindow", [(Display, "dpy"), (GLXFBConfig, "config"),
205                                             (Window, "win"), (Const(Array(Int, "__AttribList_size(attribList)")), "attribList")]),
206     Function(Void, "glXDestroyWindow", [(Display, "dpy"), (GLXWindow, "window")]),
207     Function(GLXPixmap, "glXCreatePixmap", [(Display, "dpy"), (GLXFBConfig, "config"),
208                                             (Pixmap, "pixmap"), (Const(Array(Int, "__AttribList_size(attribList)")), "attribList")]),
209     Function(Void, "glXDestroyPixmap", [(Display, "dpy"), (GLXPixmap, "pixmap")]),
210     Function(GLXPbuffer, "glXCreatePbuffer", [(Display, "dpy"), (GLXFBConfig, "config"),
211                                               (Const(Array(GLXEnum, "__AttribList_size(attribList)")), "attribList")]),
212     Function(Void, "glXDestroyPbuffer", [(Display, "dpy"), (GLXPbuffer, "pbuf")]),
213     Function(Void, "glXQueryDrawable", [(Display, "dpy"), (GLXDrawable, "draw"), (GLXEnum, "attribute"),
214                                         Out(Pointer(UInt), "value")]),
215     Function(GLXContext, "glXCreateNewContext", [(Display, "dpy"), (GLXFBConfig, "config"),
216                                                  (GLXEnum, "renderType"), (GLXContext, "shareList"),
217                                                  (Bool_, "direct")]),
218     Function(Bool_, "glXMakeContextCurrent", [(Display, "dpy"), (GLXDrawable, "draw"),
219                                              (GLXDrawable, "read"), (GLXContext, "ctx")]),
220     Function(GLXDrawable, "glXGetCurrentReadDrawable", []),
221     Function(Int, "glXQueryContext", [(Display, "dpy"), (GLXContext, "ctx"), (GLXEnum, "attribute"),
222                                       Out(Pointer(Int), "value")]),
223     Function(Void, "glXSelectEvent", [(Display, "dpy"), (GLXDrawable, "drawable"),
224                                       (ULong, "mask")]),
225     Function(Void, "glXGetSelectedEvent", [(Display, "dpy"), (GLXDrawable, "drawable"),
226                                            Out(Pointer(ULong), "mask")]),
227     # TODO: extensions
228
229     # Must be last
230     Function(PROC, "glXGetProcAddressARB", [(Alias("const GLubyte *", CString), "procName")]),
231     Function(PROC, "glXGetProcAddress", [(Alias("const GLubyte *", CString), "procName")]),
232 ])
233
234