From c08c7c8f655d7721c1e02bfeeb965b6379f72553 Mon Sep 17 00:00:00 2001 From: Jon TURNEY Date: Fri, 24 Jun 2011 13:32:10 +0100 Subject: [PATCH] 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 Reviewed-by: Colin Harrison --- hw/xwin/glx/gen_gl_wrappers.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hw/xwin/glx/gen_gl_wrappers.py b/hw/xwin/glx/gen_gl_wrappers.py index e2d960ec6..d86acc88d 100755 --- a/hw/xwin/glx/gen_gl_wrappers.py +++ b/hw/xwin/glx/gen_gl_wrappers.py @@ -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 '}'