diff options
author | Ian Romanick <[email protected]> | 2005-07-28 00:29:51 +0000 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2005-07-28 00:29:51 +0000 |
commit | 1585c234e0db4bfb7cd85c4111594f6da1582e6f (patch) | |
tree | 75ead6349c299291829a8a47fe437f6c22bc50da /src/mesa/glapi/gl_table.py | |
parent | 9f23a3a1bff6c8af93e651273c9887bbf119f555 (diff) |
Major rip-up of internal function insertion interface. The oldmesa_6_3_1
_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)
Diffstat (limited to 'src/mesa/glapi/gl_table.py')
-rw-r--r-- | src/mesa/glapi/gl_table.py | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/src/mesa/glapi/gl_table.py b/src/mesa/glapi/gl_table.py index d585b43cde5..864ac8a8c3e 100644 --- a/src/mesa/glapi/gl_table.py +++ b/src/mesa/glapi/gl_table.py @@ -52,6 +52,8 @@ class PrintGlTable(gl_XML.gl_print_base): print '#define GLAPIENTRYP' print '#endif' print '' + print 'typedef void (*_glapi_proc)(void); /* generic function pointer */' + print '' print 'struct _glapi_table' print '{' return @@ -93,15 +95,9 @@ class PrintRemapTable(gl_XML.gl_print_base): print '#define GET_by_offset(disp, offset) \\' print ' (((_glapi_proc *)(disp))[offset])' print '#define SET_by_offset(disp, offset, fn) \\' - print ' ((((_glapi_proc *)(disp))[offset]) = fn)' + print ' ((((_glapi_proc *)(disp))[offset]) = (_glapi_proc) fn)' print '' - for f in api.functionIterateByOffset(): - print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name) - print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name) - print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name) - return - abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ] functions = [] @@ -116,26 +112,44 @@ class PrintRemapTable(gl_XML.gl_print_base): abi_functions.append( f ) - print 'struct _mesa_dispatch_remap_table {' + for f in abi_functions: + print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name) + print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name) + print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name) + + + print '' + print '#if !defined(IN_DRI_DRIVER)' + print '' for [f, index] in functions: - print ' unsigned %s;' % (f.name) + print '#define CALL_%s(disp, parameters) (*((disp)->%s)) parameters' % (f.name, f.name) + print '#define GET_%s(disp) ((disp)->%s)' % (f.name, f.name) + print '#define SET_%s(disp, fn) ((disp)->%s = fn)' % (f.name, f.name) - print '};' print '' - print '/* %u functions need remapping. */' % (count) + print '#else' + print '' + print '#define driDispatchRemapTable_size %u' % (count) + print 'extern unsigned driDispatchRemapTable[ driDispatchRemapTable_size ];' print '' - for f in abi_functions: - print '#define CALL_%s(disp, parameters) (*disp->%s) parameters' % (f.name, f.name) + for [f, index] in functions: + print '#define %s_remap_index %u' % (f.name, index) + print '' for [f, index] in functions: arg_string = gl_XML.create_parameter_string( f.parameters, 0 ) cast = '%s (GLAPIENTRYP)(%s)' % (f.return_type, arg_string) - print '#define CALL_%s(disp, parameters) (* (%s) (((_glapi_proc *)disp)[dispatch_remap.%s])) parameters' % (f.name, cast, f.name) + print '#define CALL_%s(disp, parameters) CALL_by_offset(disp, (%s), driDispatchRemapTable[%s_remap_index], parameters)' % (f.name, cast, f.name) + print '#define GET_%s(disp) GET_by_offset(disp, driDispatchRemapTable[%s_remap_index])' % (f.name, f.name) + print '#define SET_%s(disp, fn) SET_by_offset(disp, driDispatchRemapTable[%s_remap_index], fn)' % (f.name, f.name) + + print '' + print '#endif /* !defined(IN_DRI_DRIVER) */' return |