From 7e9737b3704b92865242d7564825cdc57db5c4c9 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sat, 26 Aug 2006 21:26:55 +0000 Subject: [PATCH] Explicitly store the names for each function that should have a static entry point generated. This allows us to do things like generate a static entry point for glPointParameterfvARB but not for glPointParameterfvSGIS. --- src/mesa/glapi/gl_SPARC_asm.py | 10 +++++----- src/mesa/glapi/gl_XML.py | 8 +++++++- src/mesa/glapi/gl_apitemp.py | 24 +++++++++++++----------- src/mesa/glapi/gl_procs.py | 11 +++++++---- src/mesa/glapi/gl_x86-64_asm.py | 10 +++++----- src/mesa/glapi/gl_x86_asm.py | 8 ++++---- 6 files changed, 41 insertions(+), 30 deletions(-) diff --git a/src/mesa/glapi/gl_SPARC_asm.py b/src/mesa/glapi/gl_SPARC_asm.py index 1368e24a087..14db678210b 100644 --- a/src/mesa/glapi/gl_SPARC_asm.py +++ b/src/mesa/glapi/gl_SPARC_asm.py @@ -82,7 +82,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): def printBody(self, api): for f in api.functionIterateByOffset(): - if f.static_dispatch: + if f.is_static_entry_point(f.name): name = f.name else: name = "_dispatch_stub_%u" % (f.offset) @@ -94,7 +94,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): print '' for f in api.functionIterateByOffset(): - if f.static_dispatch: + if f.is_static_entry_point(f.name): name = f.name else: name = "_dispatch_stub_%u" % (f.offset) @@ -108,9 +108,9 @@ class PrintGenericStubs(gl_XML.gl_print_base): for f in api.functionIterateByOffset(): - if f.static_dispatch: - for n in f.entry_points: - if n != f.name: + for n in f.entry_points: + if n != f.name: + if f.is_static_entry_point(n): print '\t.globl gl%s ; .type gl%s,#function ; gl%s = gl%s' % (n, n, n, f.name) return diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py index eef29072572..868a7cd1bda 100644 --- a/src/mesa/glapi/gl_XML.py +++ b/src/mesa/glapi/gl_XML.py @@ -614,6 +614,8 @@ class gl_function( gl_item ): self.assign_offset = 0 + self.static_entry_points = [] + # Track the parameter string (for the function prototype) # for each entry-point. This is done because some functions # change their prototype slightly when promoted from extension @@ -634,7 +636,8 @@ class gl_function( gl_item ): name = element.nsProp( "name", None ) alias = element.nsProp( "alias", None ) - self.static_dispatch = is_attr_true(element, "static_dispatch") + if is_attr_true(element, "static_dispatch"): + self.static_entry_points.append(name) self.entry_points.append( name ) if alias: @@ -731,6 +734,9 @@ class gl_function( gl_item ): return create_parameter_string( self.parameters, 1 ) + def is_static_entry_point(self, name): + return name in self.static_entry_points + class gl_item_factory: """Factory to create objects derived from gl_item.""" diff --git a/src/mesa/glapi/gl_apitemp.py b/src/mesa/glapi/gl_apitemp.py index 30ee6596ed3..04a3ff32555 100644 --- a/src/mesa/glapi/gl_apitemp.py +++ b/src/mesa/glapi/gl_apitemp.py @@ -55,7 +55,7 @@ class PrintGlOffsets(gl_XML.gl_print_base): t_string = "" comma = "" - if f.static_dispatch: + if f.is_static_entry_point(name): n = name keyword = "KEYWORD1" else: @@ -79,7 +79,7 @@ class PrintGlOffsets(gl_XML.gl_print_base): else: dispatch = "DISPATCH" - if not f.static_dispatch: + 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 '' @@ -166,7 +166,7 @@ class PrintGlOffsets(gl_XML.gl_print_base): static _glapi_proc DISPATCH_TABLE_NAME[] = {""" for f in api.functionIterateByOffset(): - if f.static_dispatch: + if f.is_static_entry_point(f.name): n = f.name else: n = "_dispatch_stub_%u" % (f.offset) @@ -196,9 +196,9 @@ 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: + for n in f.entry_points: + if n != f.name: + if f.is_static_entry_point(n): print ' TABLE_ENTRY(%s),' % (n) print '};' @@ -209,11 +209,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) diff --git a/src/mesa/glapi/gl_procs.py b/src/mesa/glapi/gl_procs.py index 145243ee0e9..4a540e2d386 100644 --- a/src/mesa/glapi/gl_procs.py +++ b/src/mesa/glapi/gl_procs.py @@ -87,7 +87,7 @@ class PrintGlProcs(gl_XML.gl_print_base): base_offset = 0 table = [] for func in api.functionIterateByOffset(): - if func.static_dispatch: + if func.is_static_entry_point(func.name): name = func.name else: name = "_dispatch_stub_%u" % (func.offset) @@ -104,7 +104,7 @@ class PrintGlProcs(gl_XML.gl_print_base): for func in api.functionIterateByOffset(): for n in func.entry_points: if n != func.name: - if func.static_dispatch: + if func.is_static_entry_point(n): name = n else: name = "_dispatch_stub_%u" % (func.offset) @@ -123,8 +123,11 @@ class PrintGlProcs(gl_XML.gl_print_base): print '/* FIXME: Having these (incorrect) prototypes here is ugly. */' print '#ifdef NEED_FUNCTION_POINTER' for func in api.functionIterateByOffset(): - if not func.static_dispatch: - print 'extern void gl_dispatch_stub_%u(void);' % (func.offset) + for n in func.entry_points: + if not func.is_static_entry_point(n): + print 'extern void gl_dispatch_stub_%u(void);' % (func.offset) + break + print '#endif /* NEED_FUNCTION_POINTER */' print '' diff --git a/src/mesa/glapi/gl_x86-64_asm.py b/src/mesa/glapi/gl_x86-64_asm.py index eb440009b2f..33943bce934 100644 --- a/src/mesa/glapi/gl_x86-64_asm.py +++ b/src/mesa/glapi/gl_x86-64_asm.py @@ -236,7 +236,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): registers.append( ["%rbp", 0] ) - if f.static_dispatch: + if f.is_static_entry_point(f.name): name = f.name else: name = "_dispatch_stub_%u" % (f.offset) @@ -244,7 +244,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): print '\t.p2align\t4,,15' print '\t.globl\tGL_PREFIX(%s)' % (name) print '\t.type\tGL_PREFIX(%s), @function' % (name) - if not f.static_dispatch: + if not f.is_static_entry_point(f.name): print '\tHIDDEN(GL_PREFIX(%s))' % (name) print 'GL_PREFIX(%s):' % (name) print '#if defined(GLX_USE_TLS)' @@ -291,9 +291,9 @@ class PrintGenericStubs(gl_XML.gl_print_base): for f in api.functionIterateByOffset(): - if f.static_dispatch: - for n in f.entry_points: - if n != f.name: + for n in f.entry_points: + if n != f.name: + if f.is_static_entry_point(n): print '\t.globl GL_PREFIX(%s) ; .set GL_PREFIX(%s), GL_PREFIX(%s)' % (n, n, f.name) return diff --git a/src/mesa/glapi/gl_x86_asm.py b/src/mesa/glapi/gl_x86_asm.py index 3ce8404f8c9..2ebe4e8b247 100644 --- a/src/mesa/glapi/gl_x86_asm.py +++ b/src/mesa/glapi/gl_x86_asm.py @@ -197,7 +197,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): def printBody(self, api): for f in api.functionIterateByOffset(): - if f.static_dispatch: + if f.is_static_entry_point(f.name): name = f.name else: name = "_dispatch_stub_%u" % (f.offset) @@ -207,12 +207,12 @@ class PrintGenericStubs(gl_XML.gl_print_base): alt = "%s@%u" % (name, stack) print '\tGL_STUB(%s, _gloffset_%s, %s)' % (name, f.name, alt) - if not f.static_dispatch: + if not f.is_static_entry_point(f.name): print '\tHIDDEN(GL_PREFIX(%s, %s))' % (name, alt) for f in api.functionIterateByOffset(): - if f.static_dispatch: + if f.is_static_entry_point(f.name): name = f.name else: name = "_dispatch_stub_%u" % (f.offset) @@ -221,7 +221,7 @@ class PrintGenericStubs(gl_XML.gl_print_base): alt = "%s@%u" % (name, stack) - if f.static_dispatch: + if f.is_static_entry_point(f.name): for n in f.entry_points: if n != f.name: alt2 = "%s@%u" % (n, stack) -- 2.30.2