hw/xwin/glx: Create a new dispatch table rather than modifying the existing one

Create a new dispatch table rather than modifying the existing one

struct _glapi_table is not a complete type after including glapi.h, so we use
glapi_get_dispatch_table_size() to determine it's size (alternatively, we could
include glapitable.h, to complete the type)

This could possibly be written to use _glapi_create_table_from_handle() instead, but
that requires making all the wrapper functions exports

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon TURNEY 2011-06-24 13:32:10 +01:00
parent 3ef3ce069d
commit c08c7c8f65

View File

@ -308,12 +308,20 @@ for w in sorted(wrappers.keys()) :
if dispatchheader :
print 'void glWinSetupDispatchTable(void)'
print '{'
print ' struct _glapi_table *disp = _glapi_get_dispatch();'
print ' static struct _glapi_table *disp = NULL;'
print ''
print ' if (!disp)'
print ' {'
print ' disp = calloc(sizeof(void *), _glapi_get_dispatch_table_size());'
print ' assert(disp);'
for d in sorted(dispatch.keys()) :
if wrappers.has_key(d) :
print ' SET_'+ d + '(disp, (void *)' + prefix + d + 'Wrapper);'
print ' SET_'+ d + '(disp, (void *)' + prefix + d + 'Wrapper);'
else :
print '#warning No wrapper for ' + prefix + d + ' !'
print ' }'
print ''
print ' _glapi_set_dispatch(disp);'
print '}'