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.
This commit is contained in:
Ian Romanick 2006-08-26 21:26:55 +00:00
parent 092d14be92
commit 7e9737b370
6 changed files with 41 additions and 30 deletions

View file

@ -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

View file

@ -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."""

View file

@ -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)

View file

@ -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 ''

View file

@ -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

View file

@ -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)