mesa: bump version to 7.7.1-DEVEL
[mesa.git] / src / mesa / glapi / gl_apitemp.py
index 30ee6596ed386381ce54cb1c6507a00cb440677c..a37c08d6ce1744258d6a006a66a1e5f416671757 100644 (file)
@@ -25,7 +25,7 @@
 # Authors:
 #    Ian Romanick <idr@us.ibm.com>
 
-import gl_XML
+import gl_XML, glX_XML
 import license
 import sys, getopt
 
@@ -55,14 +55,17 @@ class PrintGlOffsets(gl_XML.gl_print_base):
                t_string = ""
                comma = ""
 
-               if f.static_dispatch:
-                       n = name
+               if f.is_static_entry_point(name):
                        keyword = "KEYWORD1"
                else:
-                       n = "_dispatch_stub_%u" % (f.offset)
                        keyword = "KEYWORD1_ALT"
 
+               n = f.static_name(name)
+
                for p in f.parameterIterator():
+                       if p.is_padding:
+                               continue
+
                        if p.is_pointer():
                                cast = "(const void *) "
                        else:
@@ -79,7 +82,10 @@ class PrintGlOffsets(gl_XML.gl_print_base):
                else:
                        dispatch = "DISPATCH"
 
-               if not f.static_dispatch:
+               if f.has_different_protocol(name):
+                       print '#ifndef GLX_INDIRECT_RENDERING'
+
+               if not f.is_static_entry_point(name):
                        print '%s %s KEYWORD2 NAME(%s)(%s);' % (keyword, f.return_type, n, f.get_parameter_string(name))
                        print ''
 
@@ -92,6 +98,8 @@ class PrintGlOffsets(gl_XML.gl_print_base):
                        print '   %s(%s, (%s), (F, "gl%s(%s);\\n", %s));' \
                                % (dispatch, f.name, p_string, name, t_string, o_string)
                print '}'
+               if f.has_different_protocol(name):
+                       print '#endif /* GLX_INDIRECT_RENDERING */'
                print ''
                return
 
@@ -166,12 +174,7 @@ class PrintGlOffsets(gl_XML.gl_print_base):
 
 static _glapi_proc DISPATCH_TABLE_NAME[] = {"""
                for f in api.functionIterateByOffset():
-                       if f.static_dispatch:
-                               n = f.name
-                       else:
-                               n = "_dispatch_stub_%u" % (f.offset)
-
-                       print '   TABLE_ENTRY(%s),' % (n)
+                       print '   TABLE_ENTRY(%s),' % (f.dispatch_name())
 
                print '   /* A whole bunch of no-op functions.  These might be called'
                print '    * when someone tries to call a dynamically-registered'
@@ -196,11 +199,17 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = {"""
 static _glapi_proc UNUSED_TABLE_NAME[] = {"""
 
                for f in api.functionIterateByOffset():
-                       if f.static_dispatch:
-                               for n in f.entry_points:
-                                       if n != f.name:
-                                               print '   TABLE_ENTRY(%s),' % (n)
-
+                       for n in f.entry_points:
+                               if n != f.name:
+                                       if f.is_static_entry_point(n):
+                                               text = '   TABLE_ENTRY(%s),' % (n)
+
+                                               if f.has_different_protocol(n):
+                                                       print '#ifndef GLX_INDIRECT_RENDERING'
+                                                       print text
+                                                       print '#endif'
+                                               else:
+                                                       print text
                print '};'
                print '#endif /*UNUSED_TABLE_NAME*/'
                print ''
@@ -209,11 +218,13 @@ static _glapi_proc UNUSED_TABLE_NAME[] = {"""
 
        def printBody(self, api):
                for func in api.functionIterateByOffset():
-                       if func.static_dispatch:
-                               for n in func.entry_points:
-                                       self.printFunction( func, n )
-                       else:
-                               self.printFunction(func, func.name)
+                       got_stub = 0
+                       for n in func.entry_points:
+                               if func.is_static_entry_point(n):
+                                       self.printFunction(func, n)
+                               elif not got_stub:
+                                       self.printFunction(func, n)
+                                       got_stub = 1
 
                self.printInitDispatch(api)
                self.printAliasedTable(api)
@@ -236,7 +247,7 @@ if __name__ == '__main__':
                if arg == "-f":
                        file_name = val
 
-       api = gl_XML.parse_GL_API( file_name )
+       api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
 
        printer = PrintGlOffsets()
        printer.Print(api)