diff options
author | Ian Romanick <[email protected]> | 2006-08-22 16:34:38 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2006-08-22 16:34:38 +0000 |
commit | 4e4b5f40081cb3e4cefe4dce30712d8d330c0774 (patch) | |
tree | 65b722305bb81a0c014903d20cf7d3715fbde83f /src/mesa/glapi/gl_procs.py | |
parent | 6423ec914530a84ee16977d95b64116e63eca22c (diff) |
Add new attribute called static_dispatch to the <function> element. This
boolean attribute, which defaults to true, determines whether or not a
static dispatch function is available in libGL for applications to link
against.
Ideally, any new functions that are not part of the ABI should not have
directly accessable dispatch functions. This forces applications to use
glXGetProcAddress to access these functions. By doing this we can
gracefully remove functions from libGL without breaking the linkage of
applications.
Note that the static dispatch functions are still generated. However, they
are given names like gl_dispatch_stub_820 and are marked with the "hidden"
linker attribute.
All extension functions added since the previous Mesa release (6.5) have
been marked as 'static_dispatch="false"'.
Diffstat (limited to 'src/mesa/glapi/gl_procs.py')
-rw-r--r-- | src/mesa/glapi/gl_procs.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/mesa/glapi/gl_procs.py b/src/mesa/glapi/gl_procs.py index 76131b83a0b..145243ee0e9 100644 --- a/src/mesa/glapi/gl_procs.py +++ b/src/mesa/glapi/gl_procs.py @@ -87,8 +87,13 @@ class PrintGlProcs(gl_XML.gl_print_base): base_offset = 0 table = [] for func in api.functionIterateByOffset(): + if func.static_dispatch: + name = func.name + else: + name = "_dispatch_stub_%u" % (func.offset) + self.printFunctionString( func.name ) - table.append((base_offset, func.name, func.name)) + table.append((base_offset, name, func.name)) # The length of the function's name, plus 2 for "gl", # plus 1 for the NUL. @@ -99,8 +104,13 @@ 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: + name = n + else: + name = "_dispatch_stub_%u" % (func.offset) + self.printFunctionString( n ) - table.append((base_offset, n, func.name)) + table.append((base_offset, name, func.name)) base_offset += len(n) + 3 @@ -110,6 +120,14 @@ class PrintGlProcs(gl_XML.gl_print_base): print '};' print '' + 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) + print '#endif /* NEED_FUNCTION_POINTER */' + + print '' print 'static const glprocs_table_t static_functions[] = {' for (offset, disp_name, real_name) in table: |