summaryrefslogtreecommitdiff
path: root/hw/xwin/glx
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2011-06-24 13:32:10 +0100
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-06-21 18:36:17 +0100
commitc08c7c8f655d7721c1e02bfeeb965b6379f72553 (patch)
tree67fb1935ca2d585892d4818a6a0b2b26594bd1c2 /hw/xwin/glx
parent3ef3ce069d52dcfa932c90ccd30854a8d9daa15a (diff)
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>
Diffstat (limited to 'hw/xwin/glx')
-rwxr-xr-xhw/xwin/glx/gen_gl_wrappers.py12
1 files 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 '}'