Fixing tracing of games that do everything in nested indirect buffers.

This commit is contained in:
Ben Vanik 2015-03-06 22:27:41 -08:00
parent 14c6fbfba4
commit 05239daecf
3 changed files with 9 additions and 6 deletions

View File

@ -775,7 +775,12 @@ bool CommandProcessor::ExecutePacketType3(RingbufferReader* reader,
uint32_t count = ((packet >> 16) & 0x3FFF) + 1; uint32_t count = ((packet >> 16) & 0x3FFF) + 1;
auto data_start_offset = reader->offset(); auto data_start_offset = reader->offset();
trace_writer_.WritePacketStart(reader->ptr() - 4, 1 + count); // To handle nesting behavior when tracing we special case indirect buffers.
if (opcode == PM4_INDIRECT_BUFFER) {
trace_writer_.WritePacketStart(reader->ptr() - 4, 2);
} else {
trace_writer_.WritePacketStart(reader->ptr() - 4, 1 + count);
}
// & 1 == predicate - when set, we do bin check to see if we should execute // & 1 == predicate - when set, we do bin check to see if we should execute
// the packet. Only type 3 packets are affected. // the packet. Only type 3 packets are affected.

View File

@ -665,7 +665,7 @@ class TraceReader {
break; break;
} }
} }
if (pending_break) { if (pending_break || current_frame.command_count) {
current_frame.end_ptr = trace_ptr; current_frame.end_ptr = trace_ptr;
frames_.push_back(std::move(current_frame)); frames_.push_back(std::move(current_frame));
} }

View File

@ -112,10 +112,9 @@ class TraceWriter {
return; return;
} }
auto cmd = PrimaryBufferStartCommand({ auto cmd = PrimaryBufferStartCommand({
TraceCommandType::kPrimaryBufferStart, base_ptr, count, TraceCommandType::kPrimaryBufferStart, base_ptr, 0,
}); });
fwrite(&cmd, 1, sizeof(cmd), file_); fwrite(&cmd, 1, sizeof(cmd), file_);
fwrite(membase_ + base_ptr, 4, count, file_);
} }
void WritePrimaryBufferEnd() { void WritePrimaryBufferEnd() {
@ -133,10 +132,9 @@ class TraceWriter {
return; return;
} }
auto cmd = IndirectBufferStartCommand({ auto cmd = IndirectBufferStartCommand({
TraceCommandType::kIndirectBufferStart, base_ptr, count, TraceCommandType::kIndirectBufferStart, base_ptr, 0,
}); });
fwrite(&cmd, 1, sizeof(cmd), file_); fwrite(&cmd, 1, sizeof(cmd), file_);
fwrite(membase_ + base_ptr, 4, count, file_);
} }
void WriteIndirectBufferEnd() { void WriteIndirectBufferEnd() {