]> git.cworth.org Git - apitrace/blobdiff - wrappers/trace.py
gltrace: Expose marker functions when tracing is disabled.
[apitrace] / wrappers / trace.py
index 61a2cb95fcf8249c13719464a36bee5891f8f76a..31087e92b722c9ef4b6991078172a67551d1500f 100644 (file)
@@ -138,7 +138,7 @@ class ComplexValueSerializer(stdapi.OnceVisitor):
     def visitPolymorphic(self, polymorphic):
         if not polymorphic.contextLess:
             return
-        print 'static void _write__%s(int selector, const %s & value) {' % (polymorphic.tag, polymorphic.expr)
+        print 'static void _write__%s(int selector, %s const & value) {' % (polymorphic.tag, polymorphic.expr)
         print '    switch (selector) {'
         for cases, type in polymorphic.iterSwitch():
             for case in cases:
@@ -474,7 +474,7 @@ class Tracer:
 
         # No-op if tracing is disabled
         print '    if (!trace::isTracingEnabled()) {'
-        Tracer.invokeFunction(self, function)
+        self.doInvokeFunction(function)
         if function.type is not stdapi.Void:
             print '        return _result;'
         else:
@@ -512,7 +512,11 @@ class Tracer:
                 self.wrapRet(function, "_result")
             print '    trace::localWriter.endLeave();'
 
-    def invokeFunction(self, function, prefix='_', suffix=''):
+    def invokeFunction(self, function):
+        self.doInvokeFunction(function)
+
+    def doInvokeFunction(self, function, prefix='_', suffix=''):
+        # Same as invokeFunction() but called both when trace is enabled or disabled.
         if function.type is stdapi.Void:
             result = ''
         else:
@@ -627,7 +631,8 @@ class Tracer:
         # Private constructor
         print '%s::%s(%s * pInstance) {' % (getWrapperInterfaceName(interface), getWrapperInterfaceName(interface), interface.name)
         for type, name, value in self.enumWrapperInterfaceVariables(interface):
-            print '    %s = %s;' % (name, value)
+            if value is not None:
+                print '    %s = %s;' % (name, value)
         print '}'
         print
 
@@ -782,7 +787,7 @@ class Tracer:
         print '    %s_this->%s(%s);' % (result, method.name, ', '.join([str(arg.name) for arg in method.args]))
     
     def emit_memcpy(self, dest, src, length):
-        print '        unsigned _call = trace::localWriter.beginEnter(&trace::memcpy_sig);'
+        print '        unsigned _call = trace::localWriter.beginEnter(&trace::memcpy_sig, true);'
         print '        trace::localWriter.beginArg(0);'
         print '        trace::localWriter.writePointer((uintptr_t)%s);' % dest
         print '        trace::localWriter.endArg();'