]> git.cworth.org Git - apitrace/blob - glxapi.py
Merge remote-tracking branch 'origin/drawarrays'
[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_ = Alias("Bool", Int)
62
63 glxapi = API("GLX")
64
65 PROC = Opaque("__GLXextFuncPtr")
66
67 glxapi.add_functions([
68     # GLX
69     Function(Pointer(XVisualInfo), "glXChooseVisual", [(Display, "dpy"), (Int, "screen"), (Pointer(Int), "attribList")]),
70     Function(GLXContext, "glXCreateContext", [(Display, "dpy"), (Pointer(XVisualInfo), "vis"), (GLXContext, "shareList"), (Bool_, "direct")]),
71     Function(Void, "glXDestroyContext",  [(Display, "dpy"), (GLXContext, "ctx")]),
72     Function(Bool_, "glXMakeCurrent", [(Display, "dpy"), (GLXDrawable, "drawable"), (GLXContext, "ctx")]),
73     Function(Void, "glXCopyContext", [(Display, "dpy"), (GLXContext, "src"), (GLXContext, "dst"),
74                                       (ULong, "mask")]),
75     Function(Void, "glXSwapBuffers", [(Display, "dpy"), (GLXDrawable, "drawable")]),
76     Function(GLXPixmap, "glXCreateGLXPixmap", [(Display, "dpy"), (Pointer(XVisualInfo), "visual"),
77                                                (Pixmap, "pixmap")]),
78     Function(Void, "glXDestroyGLXPixmap", [(Display, "dpy"), (GLXPixmap, "pixmap")]),
79     Function(Bool_, "glXQueryExtension", [(Display, "dpy"), (Pointer(Int), "errorb"), (Pointer(Int), "event")]),
80     Function(Bool_, "glXQueryVersion", [(Display, "dpy"), (Pointer(Int), "maj"), (Pointer(Int), "min")]),
81     Function(Bool_, "glXIsDirect", [(Display, "dpy"), (GLXContext, "ctx")]),
82     Function(Int, "glXGetConfig", [(Display, "dpy"), (Pointer(XVisualInfo), "visual"),
83                                     (Int, "attrib"), (Pointer(Int), "value")]),
84     Function(GLXContext, "glXGetCurrentContext", [], sideeffects=False),
85     Function(GLXDrawable, "glXGetCurrentDrawable", [], sideeffects=False),
86     Function(Void, "glXWaitGL", []),
87     Function(Void, "glXWaitX", []),
88     Function(Void, "glXUseXFont", [(Font, "font"), (Int, "first"), (Int, "count"), (Int, "list")]),
89
90     # GLX 1.1 and later
91     Function((Const(String("char *"))), "glXQueryExtensionsString", [(Display, "dpy"), (Int, "screen")]),
92     Function((Const(String("char *"))), "glXQueryServerString",  [(Display, "dpy"), (Int, "screen"), (Int, "name")]),
93     Function((Const(String("char *"))), "glXGetClientString", [(Display, "dpy"), (Int, "name")]),
94
95     # GLX 1.2 and later
96     Function(Display, "glXGetCurrentDisplay", [], sideeffects=False),
97
98     # GLX 1.3 and later
99     Function(Pointer(GLXFBConfig), "glXChooseFBConfig", [(Display, "dpy"), (Int, "screen"),
100                                                          (Pointer(Const(Int)), "attribList"), (Pointer(Int), "nitems")]),
101     Function(Int, "glXGetFBConfigAttrib", [(Display, "dpy"), (GLXFBConfig, "config"),
102                                             (Int, "attribute"), (Pointer(Int), "value")]),
103     Function(Pointer(GLXFBConfig), "glXGetFBConfigs", [(Display, "dpy"), (Int, "screen"),
104                                               (Pointer(Int), "nelements")]),
105     Function(Pointer(XVisualInfo), "glXGetVisualFromFBConfig", [(Display, "dpy"),
106                                                                 (GLXFBConfig, "config")]),
107     Function(GLXWindow, "glXCreateWindow", [(Display, "dpy"), (GLXFBConfig, "config"),
108                                             (Window, "win"), (Pointer(Const(Int)), "attribList")]),
109     Function(Void, "glXDestroyWindow", [(Display, "dpy"), (GLXWindow, "window")]),
110     Function(GLXPixmap, "glXCreatePixmap", [(Display, "dpy"), (GLXFBConfig, "config"),
111                                             (Pixmap, "pixmap"), (Pointer(Const(Int)), "attribList")]),
112     Function(Void, "glXDestroyPixmap", [(Display, "dpy"), (GLXPixmap, "pixmap")]),
113     Function(GLXPbuffer, "glXCreatePbuffer", [(Display, "dpy"), (GLXFBConfig, "config"),
114                                               (Pointer(Const(Int)), "attribList")]),
115     Function(Void, "glXDestroyPbuffer", [(Display, "dpy"), (GLXPbuffer, "pbuf")]),
116     Function(Void, "glXQueryDrawable", [(Display, "dpy"), (GLXDrawable, "draw"), (Int, "attribute"),
117                                         (Pointer(UInt), "value")]),
118     Function(GLXContext, "glXCreateNewContext", [(Display, "dpy"), (GLXFBConfig, "config"),
119                                                  (Int, "renderType"), (GLXContext, "shareList"),
120                                                  (Bool_, "direct")]),
121     Function(Bool_, "glXMakeContextCurrent", [(Display, "dpy"), (GLXDrawable, "draw"),
122                                              (GLXDrawable, "read"), (GLXContext, "ctx")]),
123     Function(GLXDrawable, "glXGetCurrentReadDrawable", []),
124     Function(Int, "glXQueryContext", [(Display, "dpy"), (GLXContext, "ctx"), (Int, "attribute"),
125                                       (Pointer(Int), "value")]),
126     Function(Void, "glXSelectEvent", [(Display, "dpy"), (GLXDrawable, "drawable"),
127                                       (ULong, "mask")]),
128     Function(Void, "glXGetSelectedEvent", [(Display, "dpy"), (GLXDrawable, "drawable"),
129                                            (Pointer(ULong), "mask")]),
130     # TODO: extensions
131
132     # Must be last
133     Function(PROC, "glXGetProcAddressARB", [(Alias("const GLubyte *", CString), "procName")]),
134     Function(PROC, "glXGetProcAddress", [(Alias("const GLubyte *", CString), "procName")]),
135 ])
136
137