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)
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)
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
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
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:
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."""
t_string = ""
comma = ""
- if f.static_dispatch:
+ if f.is_static_entry_point(name):
n = name
keyword = "KEYWORD1"
else:
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 ''
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)
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 '};'
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)
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)
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)
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 ''
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)
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)'
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
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)
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)
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)