X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=gltrace.py;h=af5714242e5a7a148a1befc4d928bd929000405b;hb=a26cf3eea71454aa5cc466a2abbe01537c95c31c;hp=8c29a7bb0d833ec2591d1b0ae7e3ee86b183730b;hpb=d5b95b3be2e2232624ec84f6774042a389a88213;p=apitrace diff --git a/gltrace.py b/gltrace.py index 8c29a7b..af57142 100644 --- a/gltrace.py +++ b/gltrace.py @@ -107,6 +107,8 @@ class GlTracer(Tracer): def header(self, api): Tracer.header(self, api) + print '#include "gltrace.hpp"' + print print '// Whether user arrays were used' print 'static bool __user_arrays = false;' print 'static bool __user_arrays_arb = false;' @@ -492,11 +494,32 @@ 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 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) def emit_memcpy(self, dest, src, length): @@ -523,6 +546,17 @@ class GlTracer(Tracer): def wrap_ret(self, function, instance): Tracer.wrap_ret(self, function, instance) + + if function.name == 'glGetString': + print ' if (__result) {' + print ' switch (name) {' + print ' case GL_EXTENSIONS:' + print ' __result = gltrace::translateExtensionsString(__result);' + print ' break;' + print ' default:' + print ' break;' + print ' }' + print ' }' if function.name in ('glMapBuffer', 'glMapBufferARB'): print ' struct buffer_mapping *mapping = get_buffer_mapping(target);'