- if function.name in ("glXGetProcAddress", "glXGetProcAddressARB"):
- print ' %s = __unwrap_proc_addr(procName, %s);' % (instance, instance)
+ 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 in self.createContextFunctionNames:
+ print ' if (_result != NULL)'
+ print ' gltrace::createContext((uintptr_t)_result);'
+
+ if function.name in self.makeCurrentFunctionNames:
+ print ' if (_result) {'
+ print ' if (ctx != NULL)'
+ print ' gltrace::setContext((uintptr_t)ctx);'
+ print ' else'
+ print ' gltrace::clearContext();'
+ print ' }'