From 417927e2ebea79f52f65e63e2524c01a351960ee Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Dec 2013 10:17:17 -0800 Subject: [PATCH] win32: Start wrapping the 1.0 wgl functions. I want to have a chance to intercept wglMakeCurrent for WGL's context-dependent function pointer handling. --- src/gen_dispatch.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/gen_dispatch.py b/src/gen_dispatch.py index 35c74de..ce3f948 100755 --- a/src/gen_dispatch.py +++ b/src/gen_dispatch.py @@ -306,14 +306,18 @@ class Generator(object): def process_require_statements(self, feature, condition, loader, human_name): for command in feature.findall('require/command'): name = command.get('name') + + # wgl.xml describes 6 functions in WGL 1.0 that are in + # gdi32.dll instead of opengl32.dll, and we would need to + # change up our symbol loading to support that. Just + # don't wrap those functions. + if self.target == 'wgl' and 'wgl' not in name: + del self.functions[name] + continue; + func = self.functions[name] func.add_provider(condition, loader, human_name) - def delete_require_statements(self, feature): - for command in feature.findall('require/command'): - name = command.get('name') - del self.functions[name] - def parse_function_providers(self, reg): for feature in reg.findall('feature'): api = feature.get('api') # string gl, gles1, gles2, glx @@ -362,14 +366,9 @@ class Generator(object): # eglGetProcAdddress() will return NULL. loader = 'epoxy_egl_dlsym({0})' elif api == 'wgl': - # There's no reason for us to interpose the - # non-extension WGL symbols, which we know are always - # available. The registry lists WGL 1.0 symbols both - # from opengl32.dll and gdi32.dll, so our dlsym() - # would have to know which came from where, if we were - # to interpose. - self.delete_require_statements(feature) - continue + human_name = 'WGL {0}'.format(version) + condition = 'true' + loader = 'epoxy_gl_dlsym({0})' else: sys.exit('unknown API: "{0}"'.format(api))