Major rip-up of internal function insertion interface. The old
_glapi_add_entrypoint has been replaced by a new routine called
_glapi_add_dispatch. This new routine dynamically assignes dispatch offsets
to functions added. This allows IHVs to add support for extension functions
that do not have assigned dispatch offsets.
It also means that a driver has no idea what offset will be assigned to a
function. The vast majority of the changes in this commit account for that.
An additional table, driDispatchRemapTable, is added. Functions not in the
Linux OpenGL ABI (i.e., anything not in GL 1.2 + ARB_multitexture) has a
fixed offset in this new table. The entry in this table specifies the
offset in of the function in the real dispatch table.
The internal interface was also bumped from version 20050725 to 20050727.
This has been tested with various programs in progs/demos on:
radeon (Radeon Mobility M6)
r128 (Rage 128 Pro)
mga (G400)
diff --git a/src/mesa/glapi/extension_helper.py b/src/mesa/glapi/extension_helper.py
index 21f5b56..a2a16a8 100644
--- a/src/mesa/glapi/extension_helper.py
+++ b/src/mesa/glapi/extension_helper.py
@@ -102,6 +102,24 @@
"EvalMesh2", \
]
+def all_entrypoints_in_abi(f, abi, api):
+ for n in f.entry_points:
+ [category, num] = api.get_category_for_name( n )
+ if category not in abi:
+ return 0
+
+ return 1
+
+
+def any_entrypoints_in_abi(f, abi, api):
+ for n in f.entry_points:
+ [category, num] = api.get_category_for_name( n )
+ if category in abi:
+ return 1
+
+ return 0
+
+
def condition_for_function(f, abi, all_not_in_ABI):
"""Create a C-preprocessor condition for the function.
@@ -133,6 +151,7 @@
def printRealHeader(self):
print '#include "utils.h"'
+ print '#include "dispatch.h"'
print ''
return
@@ -178,7 +197,7 @@
if not category_list.has_key(c):
category_list[ c ] = []
- category_list[ c ].append( [f.name, f.offset] )
+ category_list[ c ].append( f )
print ' "";'
print '#endif'
@@ -190,9 +209,17 @@
for category in keys:
print '#if defined(need_%s)' % (category)
print 'static const struct dri_extension_function %s_functions[] = {' % (category)
- for [function, offset] in category_list[ category ]:
- print ' { %s_names, %d },' % (function, offset)
- print ' { NULL, 0 }'
+
+ for f in category_list[ category ]:
+ if any_entrypoints_in_abi(f, abi, api):
+ index_name = "-1"
+ else:
+ index_name = "%s_remap_index" % (f.name)
+
+ print ' { %s_names, %s, %d },' % (f.name, index_name, f.offset)
+
+
+ print ' { NULL, 0, 0 }'
print '};'
print '#endif'
print ''