summaryrefslogtreecommitdiff
path: root/src/gen_dispatch.py
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2014-03-19 14:18:26 -0700
committerEric Anholt <eric@anholt.net>2014-03-28 16:45:26 -0700
commit3e09de7550cd901b8d3ecbf27e0128f0dc0f0b99 (patch)
tree07a11826a31ddba7a89b37e2de98def1859bbadb /src/gen_dispatch.py
parent370c49d5cdd8060ea2fee1e777311f86b495aa94 (diff)
downloadlibepoxy-3e09de7550cd901b8d3ecbf27e0128f0dc0f0b99.tar.gz
win32: Delay using dispatch tables until the second MakeCurrent.
Fixes #11.
Diffstat (limited to 'src/gen_dispatch.py')
-rwxr-xr-xsrc/gen_dispatch.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py
index 5af23d6..072a0fe 100755
--- a/src/gen_dispatch.py
+++ b/src/gen_dispatch.py
@@ -611,18 +611,12 @@ class Generator(object):
func.args_decl,
func.args_list))
- def write_linux_function_pointer(self, func):
+ def write_function_pointer(self, func):
self.outln('{0}{1} epoxy_{2} = epoxy_{2}_global_rewrite_ptr;'.format(func.public,
func.ptr_type,
func.wrapped_name))
self.outln('')
- def write_win32_function_pointer(self, func):
- self.outln('{0}{1} epoxy_{2} = epoxy_{2}_dispatch_table_thunk;'.format(func.public,
- func.ptr_type,
- func.wrapped_name))
- self.outln('')
-
def write_provider_enums(self):
# Writes the enum declaration for the list of providers
# supported by gl_provider_resolver()
@@ -728,6 +722,7 @@ class Generator(object):
self.outln(' */')
self.outln('')
self.outln('#include <stdlib.h>')
+ self.outln('#include <string.h>')
self.outln('#include <stdio.h>')
self.outln('')
self.outln('#include "dispatch_common.h"')
@@ -788,16 +783,21 @@ class Generator(object):
self.outln('}')
self.outln('')
- for func in self.sorted_functions:
- self.write_win32_function_pointer(func)
-
- self.outln('#else /* !USING_DISPATCH_TABLE */')
+ self.outln('void')
+ self.outln('{0}_switch_to_dispatch_table(void)'.format(self.target))
+ self.outln('{')
for func in self.sorted_functions:
- self.write_linux_function_pointer(func)
+ self.outln(' epoxy_{0} = epoxy_{0}_dispatch_table_thunk;'.format(func.wrapped_name))
+
+ self.outln('}')
+ self.outln('')
self.outln('#endif /* !USING_DISPATCH_TABLE */')
+ for func in self.sorted_functions:
+ self.write_function_pointer(func)
+
argparser = argparse.ArgumentParser(description='Generate GL dispatch wrappers.')
argparser.add_argument('files', metavar='file.xml', nargs='+', help='GL API XML files to be parsed')
argparser.add_argument('--dir', metavar='dir', required=True, help='Destination directory')