From: Imre Deak Date: Wed, 23 May 2012 07:56:57 +0000 (+0300) Subject: mt trace: glx: track GL context on a per-thread basis X-Git-Url: https://git.cworth.org/git?p=apitrace;a=commitdiff_plain;h=4f76773c5d6e9a1e73435555b16229fe9e0d7f00 mt trace: glx: track GL context on a per-thread basis Wrap GLX context handling calls and keep our own per-thread basis track of the context object. Signed-off-by: Imre Deak --- diff --git a/wrappers/glxtrace.py b/wrappers/glxtrace.py index 029582f..73e41b3 100644 --- a/wrappers/glxtrace.py +++ b/wrappers/glxtrace.py @@ -45,6 +45,24 @@ class GlxTracer(GlTracer): "glXGetProcAddressARB", ] + def traceFunctionImplBody(self, function): + GlTracer.traceFunctionImplBody(self, function) + + if function.name == 'glXCreateContext': + print ' if (_result != NULL)' + print ' gltrace::createContext((uintptr_t)_result);' + + if function.name == 'glXMakeCurrent': + print ' if (_result) {' + print ' if (ctx != NULL)' + print ' gltrace::setContext((uintptr_t)ctx);' + print ' else' + print ' gltrace::clearContext();' + print ' }' + + if function.name == 'glXDestroyContext': + print ' gltrace::destroyContext((uintptr_t)ctx);' + if __name__ == '__main__': print