[PATCH v3 06/18] mt trace: glx: track GL context on a per-thread basis

Imre Deak imre.deak at intel.com
Wed May 23 02:05:20 PDT 2012


Wrap GLX context handling calls and keep our own per-thread basis track
of the context object.

Signed-off-by: Imre Deak <imre.deak at intel.com>
---
 wrappers/glxtrace.py |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)

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
-- 
1.7.5.4



More information about the apitrace mailing list