]> git.cworth.org Git - apitrace/blobdiff - retrace/retrace.py
attrib_list support for glXChooseVisual, the last GLX function.
[apitrace] / retrace / retrace.py
index d09d72aa2ca46aff0c10380463b51cfcb455c1c7..25fa62a51f4644c7141b9a664c359d9d81ddbed1 100644 (file)
@@ -40,12 +40,15 @@ class UnsupportedType(Exception):
     pass
 
 
-def lookupHandle(handle, value):
+def lookupHandle(handle, value, lval=False):
     if handle.key is None:
         return "_%s_map[%s]" % (handle.name, value)
     else:
         key_name, key_type = handle.key
-        return "_%s_map[%s][%s]" % (handle.name, key_name, value)
+        if handle.name == "location" and lval == False:
+            return "_location_map[%s].lookupUniformLocation(%s)" % (key_name, value)
+        else:
+            return "_%s_map[%s][%s]" % (handle.name, key_name, value)
 
 
 class ValueAllocator(stdapi.Visitor):
@@ -286,7 +289,7 @@ class SwizzledValueRegistrator(stdapi.Visitor, stdapi.ExpanderMixin):
         OpaqueValueDeserializer().visit(handle.type, '_origResult', rvalue);
         if handle.range is None:
             rvalue = "_origResult"
-            entry = lookupHandle(handle, rvalue)
+            entry = lookupHandle(handle, rvalue, True)
             if (entry.startswith('_program_map') or entry.startswith('_shader_map')):
                 print 'if (glretrace::supportsARBShaderObjects) {'
                 print '    _handleARB_map[%s] = %s;' % (rvalue, lvalue)
@@ -478,10 +481,9 @@ class Retracer:
         # On release our reference when we reach Release() == 0 call in the
         # trace.
         if method.name == 'Release':
-            print '    if (call.ret->toUInt()) {'
-            print '        return;'
+            print '    if (call.ret->toUInt() == 0) {'
+            print '        retrace::delObj(call.arg(0));'
             print '    }'
-            print '    retrace::delObj(call.arg(0));'
 
         arg_names = ", ".join(method.argNames())
         if method.type is not stdapi.Void:
@@ -494,7 +496,8 @@ class Retracer:
     def checkResult(self, resultType):
         if str(resultType) == 'HRESULT':
             print r'    if (FAILED(_result)) {'
-            print r'        retrace::warning(call) << "failed\n";'
+            print '         static char szMessageBuffer[128];'
+            print r'        retrace::warning(call) << "call returned 0x" << std::hex << _result << std::dec << ": " << (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, _result, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), szMessageBuffer, sizeof szMessageBuffer, NULL) ? szMessageBuffer : "???") << "\n";'
             print r'    }'
 
     def filterFunction(self, function):