]> git.cworth.org Git - apitrace/blobdiff - wrappers/wgltrace.py
Fix build. Add copyright header to new files.
[apitrace] / wrappers / wgltrace.py
index f345869b684f4e6090ad5c169d02f2699a272903..52fd05182f62c3a664d68b378b4ea360591ceaad 100644 (file)
@@ -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':
+            # Unlike other GL APIs like EGL or GLX, WGL will make the context
+            # inactive if it's currently the active context.
+            print '    if (_wglGetCurrentContext() == hglrc) {'
+            print '        gltrace::clearContext();'
+            print '    }'
+            print '    gltrace::destroyContext((uintptr_t)hglrc);'
+
 
 if __name__ == '__main__':
     print