Fix bug #4681.
[mesa.git] / src / mesa / glapi / gl_SPARC_asm.py
index 1a8823cc4058d5b172e621e6cdfdfdbd228a9bd7..178c00a227f50e809bb26ba0147ff2bfb6cbdd9e 100644 (file)
@@ -25,7 +25,8 @@
 # Authors:
 #    Ian Romanick <idr@us.ibm.com>
 
-import gl_XML, license
+import license
+import gl_XML, glX_XML
 import sys, getopt
 
 class PrintGenericStubs(gl_XML.gl_print_base):
@@ -82,14 +83,24 @@ class PrintGenericStubs(gl_XML.gl_print_base):
 
        def printBody(self, api):
                for f in api.functionIterateByOffset():
-                       print '\t\t.globl gl%s ; .type gl%s,#function' % (f.name, f.name)
+                       if f.is_static_entry_point(f.name):
+                               name = f.name
+                       else:
+                               name = "_dispatch_stub_%u" % (f.offset)
+
+                       print '\t\t.globl gl%s ; .type gl%s,#function' % (name, name)
 
                print '\t\t.globl _mesa_sparc_glapi_begin ; .type _mesa_sparc_glapi_begin,#function'
                print '_mesa_sparc_glapi_begin:'
                print ''
 
                for f in api.functionIterateByOffset():
-                       print '\tGL_STUB(gl%s, _gloffset_%s)' % (f.name, f.name)
+                       if f.is_static_entry_point(f.name):
+                               name = f.name
+                       else:
+                               name = "_dispatch_stub_%u" % (f.offset)
+
+                       print '\tGL_STUB(gl%s, _gloffset_%s)' % (name, name)
 
                print ''
                print '\t\t.globl _mesa_sparc_glapi_end ; .type _mesa_sparc_glapi_end,#function'
@@ -100,7 +111,15 @@ class PrintGenericStubs(gl_XML.gl_print_base):
                for f in api.functionIterateByOffset():
                        for n in f.entry_points:
                                if n != f.name:
-                                       print '\t.globl gl%s ; .type gl%s,#function ; gl%s = gl%s' % (n, n, n, f.name)
+                                       if f.is_static_entry_point(n):
+                                               text = '\t.globl gl%s ; .type gl%s,#function ; gl%s = gl%s' % (n, n, n, f.name)
+
+                                               if f.has_different_protocol(n):
+                                                       print '#ifndef GLX_INDIRECT_RENDERING'
+                                                       print text
+                                                       print '#endif'
+                                               else:
+                                                       print text
 
                return
 
@@ -130,6 +149,5 @@ if __name__ == '__main__':
                print "ERROR: Invalid mode \"%s\" specified." % mode
                show_usage()
 
-       api = gl_XML.parse_GL_API( file_name )
-
-       printer.Print( api )
+       api = gl_XML.parse_GL_API(file_name, glX_XML.glx_item_factory())
+       printer.Print(api)