Skip to content
Browse files

Recognize for context creation/destruction/binding functions (issue #90

…).

Thanks to gregory38 for spotting this.
  • Loading branch information...
1 parent 112e747 commit a67ed0a94ba8f02c0e64a6e0a530b33152747240 @jrfonseca jrfonseca committed
Showing with 40 additions and 6 deletions.
  1. +1 −0 wrappers/egltrace.py
  2. +20 −3 wrappers/glxtrace.py
  3. +19 −3 wrappers/wgltrace.py
View
1 wrappers/egltrace.py
@@ -81,6 +81,7 @@ def traceFunctionImplBody(self, function):
print ' gltrace::releaseContext((uintptr_t)ctx);'
print ' }'
+
if __name__ == '__main__':
print '#include <stdlib.h>'
print '#include <string.h>'
View
23 wrappers/glxtrace.py
@@ -45,17 +45,34 @@ def isFunctionPublic(self, function):
"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);'
View
22 wrappers/wgltrace.py
@@ -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 @@ def traceFunctionImplBody(self, function):
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);'

0 comments on commit a67ed0a

Please sign in to comment.
Something went wrong with that request. Please try again.