]> git.cworth.org Git - apitrace/commitdiff
Recognize for context creation/destruction/binding functions (issue #90).
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 2 Aug 2012 19:00:28 +0000 (20:00 +0100)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Thu, 2 Aug 2012 19:00:28 +0000 (20:00 +0100)
Thanks to gregory38 for spotting this.

wrappers/egltrace.py
wrappers/glxtrace.py
wrappers/wgltrace.py

index 18058468049154acf0eb2d78d77a9d13368424ed..433058158686ad79e80eaf700b421b63db610069 100644 (file)
@@ -81,6 +81,7 @@ class EglTracer(GlTracer):
             print '        gltrace::releaseContext((uintptr_t)ctx);'
             print '    }'
 
+
 if __name__ == '__main__':
     print '#include <stdlib.h>'
     print '#include <string.h>'
index ff3eb4cd62652ec216b0e83e516aefd011c41241..21bf98c9bfc7f16cd6cdde99a07cc9418690eba8 100644 (file)
@@ -45,17 +45,34 @@ class GlxTracer(GlTracer):
         "glXGetProcAddressARB",
     ]
 
+    createContextFunctionNames = [
+        'glXCreateContext',
+        'glXCreateContextAttribsARB',
+        'glXCreateContextWithConfigSGIX'
+        'glXCreateNewContext',
+    ]
+
+    destroyContextFunctionNames = [
+        'glXDestroyContext',
+    ]
+
+    makeCurrentFunctionNames = [
+        'glXMakeCurrent',
+        'glXMakeContextCurrent',
+        'glXMakeCurrentReadSGI',
+    ]
+
     def traceFunctionImplBody(self, function):
-        if function.name == 'glXDestroyContext':
+        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);'
index 1b0035799fdd648f32bda397b2e4ddb5f86c67e4..317c5422a7d5400e17c9d791c084c630b1ee9d7f 100644 (file)
@@ -39,8 +39,24 @@ class WglTracer(GlTracer):
         "wglGetProcAddress",
     ]
 
+    createContextFunctionNames = [
+        'wglCreateContext',
+        'wglCreateContextAttribsARB',
+        'wglCreateLayerContext',
+    ]
+
+    destroyContextFunctionNames = [
+        'wglDeleteContext',
+    ]
+
+    makeCurrentFunctionNames = [
+        'wglMakeCurrent',
+        'wglMakeContextCurrentARB',
+        'wglMakeContextCurrentEXT',
+    ]
+
     def traceFunctionImplBody(self, function):
-        if function.name == 'wglDeleteContext':
+        if function.name in self.destroyContextFunctionNames:
             # 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) {'
@@ -50,11 +66,11 @@ class WglTracer(GlTracer):
 
         GlTracer.traceFunctionImplBody(self, function)
 
-        if function.name == 'wglCreateContext':
+        if function.name in self.createContextFunctionNames:
             print '    if (_result)'
             print '        gltrace::createContext((uintptr_t)_result);'
 
-        if function.name == 'wglMakeCurrent':
+        if function.name in self.makeCurrentFunctionNames:
             print '    if (_result) {'
             print '        if (hglrc != NULL)'
             print '            gltrace::setContext((uintptr_t)hglrc);'