]> git.cworth.org Git - apitrace/commitdiff
Proper AttribArray / attrib_list support for applicable GLX functions.
authorAndreas Hartmetz <ahartmetz@gmail.com>
Mon, 8 Jul 2013 10:36:11 +0000 (12:36 +0200)
committerAndreas Hartmetz <ahartmetz@gmail.com>
Mon, 8 Jul 2013 11:24:23 +0000 (13:24 +0200)
The functions are:

glXChooseFBConfig
glXCreateWindow
glXCreatePixmap
glXCreatePbuffer
glXChooseFBConfigSGIX
glXCreateGLXPbufferSGIX
glXBindTexImageEXT
glXBindVideoDeviceNV

specs/glxapi.py
specs/stdapi.py

index b06082d57a55b51d2c28d1406fa6c052b8d621f1..bde57d80ec7881dbaa7c9db29afe79fba710fb0e 100644 (file)
@@ -206,6 +206,50 @@ GLXbuffer = Flags(Int, [
     "GLX_PBUFFER_CLOBBER_MASK",
 ])
 
+UnusedAttribs = AttribArray(GLXEnum, [])
+
+GLXFBConfigCommonAttribs = [
+    ('GLX_BUFFER_SIZE', UInt),
+    ('GLX_LEVEL', Int),
+    ('GLX_DOUBLEBUFFER', Bool),
+    ('GLX_STEREO', Bool),
+    ('GLX_AUX_BUFFERS', UInt),
+    ('GLX_RED_SIZE', UInt),
+    ('GLX_GREEN_SIZE', UInt),
+    ('GLX_BLUE_SIZE', UInt),
+    ('GLX_ALPHA_SIZE', UInt),
+    ('GLX_DEPTH_SIZE', UInt),
+    ('GLX_STENCIL_SIZE', UInt),
+    ('GLX_ACCUM_RED_SIZE', UInt),
+    ('GLX_ACCUM_GREEN_SIZE', UInt),
+    ('GLX_ACCUM_BLUE_SIZE', UInt),
+    ('GLX_ACCUM_ALPHA_SIZE', UInt),
+    ('GLX_RENDER_TYPE', Flags(Int, ["GLX_RGBA_BIT", "GLX_COLOR_INDEX_BIT"])),
+    ('GLX_DRAWABLE_TYPE', Flags(Int, ["GLX_WINDOW_BIT", "GLX_PIXMAP_BIT", "GLX_PBUFFER_BIT"])),
+    ('GLX_X_RENDERABLE', Bool),
+    ('GLX_X_VISUAL_TYPE', FakeEnum(Int, ["GLX_TRUE_COLOR", "GLX_DIRECT_COLOR", "GLX_PSEUDO_COLOR", "GLX_STATIC_COLOR"])),
+    ('GLX_CONFIG_CAVEAT', FakeEnum(Int, ["GLX_NONE", "GLX_SLOW_CONFIG", "GLX_NON_CONFORMANT_CONFIG"])),
+    ('GLX_TRANSPARENT_TYPE', FakeEnum(Int, ["GLX_NONE", "GLX_TRANSPARENT_RGB", "GLX_TRANSPARENT_INDEX"])),
+    ('GLX_TRANSPARENT_INDEX_VALUE', Int),
+    ('GLX_TRANSPARENT_RED_VALUE', Int),
+    ('GLX_TRANSPARENT_GREEN_VALUE', Int),
+    ('GLX_TRANSPARENT_BLUE_VALUE', Int),
+    ('GLX_TRANSPARENT_ALPHA_VALUE', Int)
+
+]
+
+GLXFBConfigGLXAttribs = GLXFBConfigCommonAttribs + [
+    ('GLX_FBCONFIG_ID', Int), # an XID, can we do better than int?
+]
+
+GLXFBConfigSGIXAttribs = GLXFBConfigCommonAttribs + [
+    ('GLX_SAMPLE_BUFFERS', UInt),
+    ('GLX_SAMPLES', UInt)
+]
+
+GLXFBConfigAttribs = AttribArray(GLXEnum, GLXFBConfigGLXAttribs)
+GLXFBConfigSGIXAttribs = AttribArray(GLXEnum, GLXFBConfigSGIXAttribs, isConst = False)
+
 GLXContextAttribs = AttribArray(GLXEnum, [
     ('GLX_CONTEXT_MAJOR_VERSION_ARB', Int),
     ('GLX_CONTEXT_MINOR_VERSION_ARB', Int),
@@ -213,6 +257,20 @@ GLXContextAttribs = AttribArray(GLXEnum, [
     ('GLX_CONTEXT_PROFILE_MASK_ARB', Flags(Int, ["GLX_CONTEXT_CORE_PROFILE_BIT_ARB", "GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB"]))
 ])
 
+GLXPbufferAttribs = AttribArray(GLXEnum, [
+    ('GLX_PBUFFER_WIDTH', Int),
+    ('GLX_PBUFFER_HEIGHT', Int),
+    ('GLX_LARGEST_PBUFFER', Bool),
+    ('GLX_PRESERVED_CONTENTS', Bool)
+])
+
+GLXPbufferSGIXAttribs = AttribArray(GLXEnum, [
+    ('GLX_PRESERVED_CONTENTS_SGIX', Bool),
+    ('GLX_LARGEST_PBUFFER', Bool),
+    ('GLX_DIGITAL_MEDIA_PBUFFER_SGIX', Bool)],
+    isConst = False
+)
+
 glxapi = Module("GLX")
 
 PROC = Opaque("__GLXextFuncPtr")
@@ -249,20 +307,20 @@ glxapi.addFunctions([
     Function(Display, "glXGetCurrentDisplay", [], sideeffects=False),
 
     # GLX 1.3 and later
-    Function(Array(GLXFBConfig, "*nitems"), "glXChooseFBConfig", [(Display, "dpy"), (Int, "screen"), (Array(Const(GLXEnum), "_AttribPairList_size(attribList)"), "attribList"), Out(Pointer(Int), "nitems")]),
+    Function(Array(GLXFBConfig, "*nitems"), "glXChooseFBConfig", [(Display, "dpy"), (Int, "screen"), (GLXFBConfigAttribs, "attribList"), Out(Pointer(Int), "nitems")]),
     Function(Int, "glXGetFBConfigAttrib", [(Display, "dpy"), (GLXFBConfig, "config"), (GLXEnum, "attribute"), Out(Pointer(Int), "value")]),
     Function(Array(GLXFBConfig, "*nelements"), "glXGetFBConfigs", [(Display, "dpy"), (Int, "screen"), 
                                                                    Out(Pointer(Int), "nelements")]),
     Function(Pointer(XVisualInfo), "glXGetVisualFromFBConfig", [(Display, "dpy"),
                                                                 (GLXFBConfig, "config")]),
     Function(GLXWindow, "glXCreateWindow", [(Display, "dpy"), (GLXFBConfig, "config"),
-                                            (Window, "win"), (Array(Const(GLXEnum), "_AttribPairList_size(attribList)"), "attribList")]),
+                                            (Window, "win"), (UnusedAttribs, "attribList")]),
     Function(Void, "glXDestroyWindow", [(Display, "dpy"), (GLXWindow, "window")]),
     Function(GLXPixmap, "glXCreatePixmap", [(Display, "dpy"), (GLXFBConfig, "config"),
-                                            (Pixmap, "pixmap"), (Array(Const(GLXEnum), "_AttribPairList_size(attribList)"), "attribList")]),
+                                            (Pixmap, "pixmap"), (UnusedAttribs, "attribList")]),
     Function(Void, "glXDestroyPixmap", [(Display, "dpy"), (GLXPixmap, "pixmap")]),
     Function(GLXPbuffer, "glXCreatePbuffer", [(Display, "dpy"), (GLXFBConfig, "config"),
-                                              (Array(Const(GLXEnum), "_AttribPairList_size(attribList)"), "attribList")]),
+                                              (GLXPbufferAttribs, "attribList")]),
     Function(Void, "glXDestroyPbuffer", [(Display, "dpy"), (GLXPbuffer, "pbuf")]),
     Function(Void, "glXQueryDrawable", [(Display, "dpy"), (GLXDrawable, "draw"), (GLXEnum, "attribute"),
                                         Out(Pointer(UInt), "value")]),
@@ -308,14 +366,14 @@ glxapi.addFunctions([
 
     # GLX_SGIX_fbconfig
     Function(Int, "glXGetFBConfigAttribSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config"), (Int, "attribute"), Out(Pointer(Int), "value")]),
-    Function(OpaquePointer(GLXFBConfigSGIX), "glXChooseFBConfigSGIX", [(Display, "dpy"), (Int, "screen"), (Array(GLXEnum, "_AttribPairList_size(attrib_list)"), "attrib_list"), Out(Pointer(Int), "nelements")]),
+    Function(OpaquePointer(GLXFBConfigSGIX), "glXChooseFBConfigSGIX", [(Display, "dpy"), (Int, "screen"), (GLXFBConfigSGIXAttribs, "attrib_list"), Out(Pointer(Int), "nelements")]),
     Function(GLXPixmap, "glXCreateGLXPixmapWithConfigSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config"), (Pixmap, "pixmap")]),
     Function(GLXContext, "glXCreateContextWithConfigSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config"), (Int, "render_type"), (GLXContext, "share_list"), (Bool, "direct")]),
     Function(Pointer(XVisualInfo), "glXGetVisualFromFBConfigSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config")]),
     Function(GLXFBConfigSGIX, "glXGetFBConfigFromVisualSGIX", [(Display, "dpy"), Out(Pointer(XVisualInfo), "vis")]),
 
     # GLX_SGIX_pbuffer
-    Function(GLXPbufferSGIX, "glXCreateGLXPbufferSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config"), (UInt, "width"), (UInt, "height"), (Array(Int, "_AttribPairList_size(attrib_list)"), "attrib_list")]),
+    Function(GLXPbufferSGIX, "glXCreateGLXPbufferSGIX", [(Display, "dpy"), (GLXFBConfigSGIX, "config"), (UInt, "width"), (UInt, "height"), (GLXPbufferSGIXAttribs, "attrib_list")]),
     Function(Void, "glXDestroyGLXPbufferSGIX", [(Display, "dpy"), (GLXPbufferSGIX, "pbuf")]),
     Function(Int, "glXQueryGLXPbufferSGIX", [(Display, "dpy"), (GLXPbufferSGIX, "pbuf"), (Int, "attribute"), Out(Pointer(UInt), "value")]),
     Function(Void, "glXSelectEventSGIX", [(Display, "dpy"), (GLXDrawable, "drawable"), (ULong, "mask")]),
@@ -381,12 +439,12 @@ glxapi.addFunctions([
     Function(UInt, "glXGetAGPOffsetMESA", [(OpaquePointer(Const(Void)), "pointer")]),
     
     # EXT_texture_from_pixmap
-    Function(Void, "glXBindTexImageEXT", [(Display, "display"), (GLXDrawable, "drawable"), (GLXEnum, "buffer"), (Array(Const(GLXEnum), "_AttribPairList_size(attrib_list)"), "attrib_list")]),
+    Function(Void, "glXBindTexImageEXT", [(Display, "display"), (GLXDrawable, "drawable"), (GLXEnum, "buffer"), (GLXFBConfigAttribs, "attrib_list")]),
     Function(Void, "glXReleaseTexImageEXT", [(Display, "display"), (GLXDrawable, "drawable"), (GLXEnum, "buffer")]),
 
     # GLX_NV_present_video
     #Function(OpaquePointer(UInt), "glXEnumerateVideoDevicesNV", [(Display, "dpy"), (Int, "screen"), (OpaquePointer(Int), "nelements")]),
-    #Function(Int, "glXBindVideoDeviceNV", [(Display, "dpy"), (UInt, "video_slot"), (UInt, "video_device"), (Array(Const(Int), "_AttribPairList_size(attrib_list)"), "attrib_list")]),
+    #Function(Int, "glXBindVideoDeviceNV", [(Display, "dpy"), (UInt, "video_slot"), (UInt, "video_device"), (UnusedAttribs, "attrib_list")]),
 
     # GLX_NV_video_output
     #Function(Int, "glXGetVideoDeviceNV", [(Display, "dpy"), (Int, "screen"), (Int, "numVideoDevices"), (OpaquePointer(GLXVideoDeviceNV), "pVideoDevice")]),
index 795f0cfa2776f7e7f24c7cf0803f85cad2e8f8b8..5d5d57004a148d66a0e96885ed16f0dd266a71b6 100644 (file)
@@ -272,8 +272,11 @@ class Array(Type):
 
 class AttribArray(Type):
 
-    def __init__(self, keyType, valueTypes):
-        Type.__init__(self, (Pointer(Const(Int))).expr)
+    def __init__(self, keyType, valueTypes, isConst = True):
+        if isConst:
+            Type.__init__(self, (Pointer(Const(Int))).expr)
+        else:
+            Type.__init__(self, (Pointer(Int)).expr)
         self.type = (Pointer(Const(Int))) # for function prototypes and such
         self.keyType = keyType
         self.valueTypes = valueTypes