From 8f34d34693077e6377a8e75ba537069ac368f35b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 15 Jul 2011 20:16:40 +0100 Subject: [PATCH] Fix the *GREMEDY proc address return. --- gltrace.py | 19 ++++++++++++++++++- glxtrace.py | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/gltrace.py b/gltrace.py index 32e77a7..af57142 100644 --- a/gltrace.py +++ b/gltrace.py @@ -494,13 +494,30 @@ class GlTracer(Tracer): Tracer.trace_function_impl_body(self, function) + gremedy_functions = [ + 'glStringMarkerGREMEDY', + 'glFrameTerminatorGREMEDY', + ] + def dispatch_function(self, function): if function.name in ('glLinkProgram', 'glLinkProgramARB'): # These functions have been dispatched already return # We implement the GREMEDY extensions, not the driver - if function.name in ('glStringMarkerGREMEDY', 'glFrameTerminatorGREMEDY'): + if function.name in self.gremedy_functions: + return + + if function.name in ('glXGetProcAddress', 'glXGetProcAddressARB', 'wglGetProcAddress'): + if_ = 'if' + for gremedy_function in self.gremedy_functions: + print ' %s (strcmp("%s", (const char *)%s) == 0) {' % (if_, gremedy_function, function.args[0].name) + print ' __result = (%s)&%s;' % (function.type, gremedy_function) + print ' }' + if_ = 'else if' + print ' else {' + Tracer.dispatch_function(self, function) + print ' }' return Tracer.dispatch_function(self, function) diff --git a/glxtrace.py b/glxtrace.py index 7511f0a..6b5d786 100644 --- a/glxtrace.py +++ b/glxtrace.py @@ -101,7 +101,7 @@ if __name__ == '__main__': for f in api.functions: ptype = function_pointer_type(f) pvalue = function_pointer_value(f) - print ' if (!strcmp("%s", (const char *)procName)) {' % f.name + print ' if (strcmp("%s", (const char *)procName) == 0) {' % f.name print ' %s = (%s)procPtr;' % (pvalue, ptype) print ' return (__GLXextFuncPtr)&%s;' % (f.name,) print ' }' -- 2.43.0