]> git.cworth.org Git - apitrace/blobdiff - wrappers/glxtrace.py
Cleanup strings constness.
[apitrace] / wrappers / glxtrace.py
index 73e41b3641222e09fdaead8048685431b7062da5..670f8f39a1785254d3b9d8bc497777e22b846a38 100644 (file)
@@ -45,14 +45,34 @@ class GlxTracer(GlTracer):
         "glXGetProcAddressARB",
     ]
 
+    createContextFunctionNames = [
+        'glXCreateContext',
+        'glXCreateContextAttribsARB',
+        'glXCreateContextWithConfigSGIX',
+        'glXCreateNewContext',
+    ]
+
+    destroyContextFunctionNames = [
+        'glXDestroyContext',
+    ]
+
+    makeCurrentFunctionNames = [
+        'glXMakeCurrent',
+        'glXMakeContextCurrent',
+        'glXMakeCurrentReadSGI',
+    ]
+
     def traceFunctionImplBody(self, function):
+        if function.name in self.destroyContextFunctionNames:
+            print '    gltrace::releaseContext((uintptr_t)ctx);'
+
         GlTracer.traceFunctionImplBody(self, function)
 
-        if function.name == 'glXCreateContext':
+        if function.name in self.createContextFunctionNames:
             print '    if (_result != NULL)'
             print '        gltrace::createContext((uintptr_t)_result);'
 
-        if function.name == 'glXMakeCurrent':
+        if function.name in self.makeCurrentFunctionNames:
             print '    if (_result) {'
             print '        if (ctx != NULL)'
             print '            gltrace::setContext((uintptr_t)ctx);'
@@ -60,9 +80,6 @@ class GlxTracer(GlTracer):
             print '            gltrace::clearContext();'
             print '    }'
 
-        if function.name == 'glXDestroyContext':
-            print '    gltrace::destroyContext((uintptr_t)ctx);'
-
 
 if __name__ == '__main__':
     print