]> git.cworth.org Git - apitrace/commitdiff
mt trace: egl: track GL context on a per-thread basis
authorImre Deak <imre.deak@intel.com>
Wed, 23 May 2012 07:56:35 +0000 (10:56 +0300)
committerImre Deak <imre.deak@intel.com>
Wed, 23 May 2012 08:28:24 +0000 (11:28 +0300)
Wrap EGL 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/egltrace.py

index f40b8a06a863e2875d8704d6c8f64d4f03d1e82c..fb8a3a0b3b362ff4fd61e0a5bff65909f2f7daec 100644 (file)
@@ -52,11 +52,16 @@ class EglTracer(GlTracer):
     def traceFunctionImplBody(self, function):
         GlTracer.traceFunctionImplBody(self, function)
 
+        if function.name == 'eglCreateContext':
+            print '    if (_result != EGL_NO_CONTEXT)'
+            print '        gltrace::createContext((uintptr_t)_result);'
+
         if function.name == 'eglMakeCurrent':
             print '    if (_result) {'
             print '        // update the profile'
             print '        if (ctx != EGL_NO_CONTEXT) {'
             print '            EGLint api = EGL_OPENGL_ES_API, version = 1;'
+            print '            gltrace::setContext((uintptr_t)ctx);'
             print '            gltrace::Context *tr = gltrace::getContext();'
             print '            _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_TYPE, &api);'
             print '            _eglQueryContext(dpy, ctx, EGL_CONTEXT_CLIENT_VERSION, &version);'
@@ -66,9 +71,14 @@ class EglTracer(GlTracer):
             print '                tr->profile = gltrace::PROFILE_ES1;'
             print '            else'
             print '                tr->profile = gltrace::PROFILE_ES2;'
+            print '        } else {'
+            print '            gltrace::clearContext();'
             print '        }'
             print '    }'
 
+        if function.name == 'eglDestroyContext':
+            print '    if (_result)'
+            print '        gltrace::destroyContext((uintptr_t)ctx);'
 
 if __name__ == '__main__':
     print '#include <stdlib.h>'