[PATCH v3 07/18] mt trace: wgl: track GL context on a per-thread basis
Imre Deak
imre.deak at intel.com
Wed May 23 02:05:21 PDT 2012
Wrap WGL 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/wgltrace.py | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/wrappers/wgltrace.py b/wrappers/wgltrace.py
index f345869..f7625c6 100644
--- a/wrappers/wgltrace.py
+++ b/wrappers/wgltrace.py
@@ -39,6 +39,29 @@ class WglTracer(GlTracer):
"wglGetProcAddress",
]
+ def traceFunctionImplBody(self, function):
+ GlTracer.traceFunctionImplBody(self, function)
+
+ if function.name == 'wglCreateContext':
+ print ' if (_result)'
+ print ' gltrace::createContext((uintptr_t)_result);'
+
+ if function.name == 'wglMakeCurrent':
+ print ' if (_result) {'
+ print ' if (hglrc != NULL)'
+ print ' gltrace::setContext((uintptr_t)hglrc);'
+ print ' else'
+ print ' gltrace::clearContext();'
+ print ' }'
+
+ if function.name == 'wglDeleteContext':
+ print ' gltrace::Context *current_ctx = gltrace::getContext();'
+ # Unlike other GL APIs like EGL or GLX, WGL will make the context
+ # inactive if it's currently the active context.
+ print ' if (current_ctx == (uintptr_t)hglrc)'
+ print ' gltrace::clearContext();'
+ print ' gltrace::destroyContext((uintptr_t)ctx);'
+
if __name__ == '__main__':
print
--
1.7.5.4
More information about the apitrace
mailing list