X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=retrace%2Fretrace.py;h=70926c0b39d755fe293286b88e6b86fbe3df7441;hb=a936afc3ebb349c3aec8b5a595706f3c9749ad37;hp=1e39d42a19346d9f3b6be8f226a6c44bc88a8158;hpb=bb23f3a0bad625e3c427b9de991d4a42fa22e5f0;p=apitrace diff --git a/retrace/retrace.py b/retrace/retrace.py index 1e39d42..70926c0 100644 --- a/retrace/retrace.py +++ b/retrace/retrace.py @@ -66,10 +66,10 @@ class ValueAllocator(stdapi.Visitor): pass def visitArray(self, array, lvalue, rvalue): - print ' %s = _allocator.alloc<%s>(&%s);' % (lvalue, array.type, rvalue) + print ' %s = static_cast<%s *>(_allocator.alloc(&%s, sizeof *%s));' % (lvalue, array.type, rvalue, lvalue) def visitPointer(self, pointer, lvalue, rvalue): - print ' %s = _allocator.alloc<%s>(&%s);' % (lvalue, pointer.type, rvalue) + print ' %s = static_cast<%s *>(_allocator.alloc(&%s, sizeof *%s));' % (lvalue, pointer.type, rvalue, lvalue) def visitIntPointer(self, pointer, lvalue, rvalue): pass @@ -166,7 +166,14 @@ class ValueDeserializer(stdapi.Visitor, stdapi.ExpanderMixin): print ' if (retrace::verbosity >= 2) {' print ' std::cout << "%s " << size_t(%s) << " <- " << size_t(%s) << "\\n";' % (handle.name, lvalue, new_lvalue) print ' }' - print ' %s = %s;' % (lvalue, new_lvalue) + if (new_lvalue.startswith('_program_map') or new_lvalue.startswith('_shader_map')): + print 'if (glretrace::supportsARBShaderObjects) {' + print ' %s = _handleARB_map[%s];' % (lvalue, lvalue) + print '} else {' + print ' %s = %s;' % (lvalue, new_lvalue) + print '}' + else: + print ' %s = %s;' % (lvalue, new_lvalue) def visitBlob(self, blob, lvalue, rvalue): print ' %s = static_cast<%s>((%s).toPointer());' % (lvalue, blob, rvalue) @@ -279,8 +286,15 @@ class SwizzledValueRegistrator(stdapi.Visitor, stdapi.ExpanderMixin): OpaqueValueDeserializer().visit(handle.type, '_origResult', rvalue); if handle.range is None: rvalue = "_origResult" - entry = lookupHandle(handle, rvalue) - print " %s = %s;" % (entry, lvalue) + entry = lookupHandle(handle, rvalue) + if (entry.startswith('_program_map') or entry.startswith('_shader_map')): + print 'if (glretrace::supportsARBShaderObjects) {' + print ' _handleARB_map[%s] = %s;' % (rvalue, lvalue) + print '} else {' + print ' %s = %s;' % (entry, lvalue) + print '}' + else: + print " %s = %s;" % (entry, lvalue) print ' if (retrace::verbosity >= 2) {' print ' std::cout << "{handle.name} " << {rvalue} << " -> " << {lvalue} << "\\n";'.format(**locals()) print ' }' @@ -464,10 +478,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: