From 4f76773c5d6e9a1e73435555b16229fe9e0d7f00 Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Wed, 23 May 2012 10:56:57 +0300 Subject: [PATCH] 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 --- wrappers/glxtrace.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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 -- 2.43.0