X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=wrappers%2Fglxtrace.py;h=9c0f87dbcb443fba7fd520317368877062550c33;hb=940cdb8b143455fe2fc002ffd50f5e2ffcaf1260;hp=73e41b3641222e09fdaead8048685431b7062da5;hpb=4f76773c5d6e9a1e73435555b16229fe9e0d7f00;p=apitrace diff --git a/wrappers/glxtrace.py b/wrappers/glxtrace.py index 73e41b3..9c0f87d 100644 --- a/wrappers/glxtrace.py +++ b/wrappers/glxtrace.py @@ -29,7 +29,7 @@ from gltrace import GlTracer -from specs.stdapi import API +from specs.stdapi import Module, API from specs.glapi import glapi from specs.glxapi import glxapi @@ -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 @@ -84,9 +101,11 @@ if __name__ == '__main__': print '#include "glsize.hpp"' print + module = Module() + module.mergeModule(glxapi) + module.mergeModule(glapi) api = API() - api.addApi(glxapi) - api.addApi(glapi) + api.addModule(module) tracer = GlxTracer() tracer.traceApi(api)