From 0621bb35f6b0973f437c17defa10d357c06b2806 Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Wed, 23 May 2012 10:56:35 +0300 Subject: [PATCH] mt trace: egl: track GL context on a per-thread basis Wrap EGL context handling calls and keep our own per-thread basis track of the context object. Signed-off-by: Imre Deak --- wrappers/egltrace.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/wrappers/egltrace.py b/wrappers/egltrace.py index f40b8a0..fb8a3a0 100644 --- a/wrappers/egltrace.py +++ b/wrappers/egltrace.py @@ -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 ' -- 2.43.0