summaryrefslogtreecommitdiffstats
path: root/src/mesa/glapi/gl_apitemp.py
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2006-08-22 16:34:38 +0000
committerIan Romanick <[email protected]>2006-08-22 16:34:38 +0000
commit4e4b5f40081cb3e4cefe4dce30712d8d330c0774 (patch)
tree65b722305bb81a0c014903d20cf7d3715fbde83f /src/mesa/glapi/gl_apitemp.py
parent6423ec914530a84ee16977d95b64116e63eca22c (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_apitemp.py')
-rw-r--r--src/mesa/glapi/gl_apitemp.py42
1 files changed, 34 insertions, 8 deletions
diff --git a/src/mesa/glapi/gl_apitemp.py b/src/mesa/glapi/gl_apitemp.py
index 7cc434fa89b..30ee6596ed3 100644
--- a/src/mesa/glapi/gl_apitemp.py
+++ b/src/mesa/glapi/gl_apitemp.py
@@ -39,6 +39,7 @@ class PrintGlOffsets(gl_XML.gl_print_base):
(C) Copyright IBM Corporation 2004""", "BRIAN PAUL, IBM")
self.undef_list.append( "KEYWORD1" )
+ self.undef_list.append( "KEYWORD1_ALT" )
self.undef_list.append( "KEYWORD2" )
self.undef_list.append( "NAME" )
self.undef_list.append( "DISPATCH" )
@@ -54,6 +55,13 @@ class PrintGlOffsets(gl_XML.gl_print_base):
t_string = ""
comma = ""
+ if f.static_dispatch:
+ n = name
+ keyword = "KEYWORD1"
+ else:
+ n = "_dispatch_stub_%u" % (f.offset)
+ keyword = "KEYWORD1_ALT"
+
for p in f.parameterIterator():
if p.is_pointer():
cast = "(const void *) "
@@ -71,8 +79,11 @@ class PrintGlOffsets(gl_XML.gl_print_base):
else:
dispatch = "DISPATCH"
- print 'KEYWORD1 %s KEYWORD2 NAME(%s)(%s)' \
- % (f.return_type, name, f.get_parameter_string(name))
+ if not f.static_dispatch:
+ print '%s %s KEYWORD2 NAME(%s)(%s);' % (keyword, f.return_type, n, f.get_parameter_string(name))
+ print ''
+
+ print '%s %s KEYWORD2 NAME(%s)(%s)' % (keyword, f.return_type, n, f.get_parameter_string(name))
print '{'
if p_string == "":
print ' %s(%s, (), (F, "gl%s();\\n"));' \
@@ -85,6 +96,8 @@ class PrintGlOffsets(gl_XML.gl_print_base):
return
def printRealHeader(self):
+ print ''
+ self.printVisibility( "HIDDEN", "hidden" )
print """
/*
* This file is a template which generates the OpenGL API entry point
@@ -116,6 +129,10 @@ class PrintGlOffsets(gl_XML.gl_print_base):
#define KEYWORD1
#endif
+#ifndef KEYWORD1_ALT
+#define KEYWORD1_ALT HIDDEN
+#endif
+
#ifndef KEYWORD2
#define KEYWORD2
#endif
@@ -149,7 +166,12 @@ class PrintGlOffsets(gl_XML.gl_print_base):
static _glapi_proc DISPATCH_TABLE_NAME[] = {"""
for f in api.functionIterateByOffset():
- print ' TABLE_ENTRY(%s),' % (f.name)
+ if f.static_dispatch:
+ n = f.name
+ else:
+ n = "_dispatch_stub_%u" % (f.offset)
+
+ print ' TABLE_ENTRY(%s),' % (n)
print ' /* A whole bunch of no-op functions. These might be called'
print ' * when someone tries to call a dynamically-registered'
@@ -174,9 +196,10 @@ static _glapi_proc DISPATCH_TABLE_NAME[] = {"""
static _glapi_proc UNUSED_TABLE_NAME[] = {"""
for f in api.functionIterateByOffset():
- for n in f.entry_points:
- if n != f.name:
- print ' TABLE_ENTRY(%s),' % (n)
+ if f.static_dispatch:
+ for n in f.entry_points:
+ if n != f.name:
+ print ' TABLE_ENTRY(%s),' % (n)
print '};'
print '#endif /*UNUSED_TABLE_NAME*/'
@@ -186,8 +209,11 @@ static _glapi_proc UNUSED_TABLE_NAME[] = {"""
def printBody(self, api):
for func in api.functionIterateByOffset():
- for n in func.entry_points:
- self.printFunction( func, n )
+ if func.static_dispatch:
+ for n in func.entry_points:
+ self.printFunction( func, n )
+ else:
+ self.printFunction(func, func.name)
self.printInitDispatch(api)
self.printAliasedTable(api)