]> git.cworth.org Git - apitrace/commitdiff
mt trace: glx: track GL context on a per-thread basis
authorImre Deak <imre.deak@intel.com>
Wed, 23 May 2012 07:56:57 +0000 (10:56 +0300)
committerImre Deak <imre.deak@intel.com>
Wed, 23 May 2012 08:29:50 +0000 (11:29 +0300)
Wrap GLX context handling calls and keep our own per-thread basis track
of the context object.

Signed-off-by: Imre Deak <imre.deak@intel.com>
wrappers/glxtrace.py

index 029582f8981da99b5da3e725fcaf2af42f3efc1b..73e41b3641222e09fdaead8048685431b7062da5 100644 (file)
@@ -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