Fast seek forward in trace viewer.

This commit is contained in:
Ben Vanik 2015-03-14 20:08:05 -07:00
parent 55556e774f
commit a70533f1c5
1 changed files with 13 additions and 3 deletions

View File

@ -716,6 +716,7 @@ class TracePlayer : public TraceReader {
if (current_command_index_ == target_command) { if (current_command_index_ == target_command) {
return; return;
} }
int previous_command_index = current_command_index_;
current_command_index_ = target_command; current_command_index_ = target_command;
if (current_command_index_ == -1) { if (current_command_index_ == -1) {
return; return;
@ -723,9 +724,18 @@ class TracePlayer : public TraceReader {
auto frame = current_frame(); auto frame = current_frame();
const auto& command = frame->commands[target_command]; const auto& command = frame->commands[target_command];
assert_true(frame->start_ptr <= command.end_ptr); assert_true(frame->start_ptr <= command.end_ptr);
graphics_system_->PlayTrace( if (target_command && previous_command_index == target_command - 1) {
frame->start_ptr, command.end_ptr - frame->start_ptr, // Seek forward.
GraphicsSystem::TracePlaybackMode::kBreakOnSwap); const auto& previous_command = frame->commands[target_command - 1];
graphics_system_->PlayTrace(
previous_command.end_ptr, command.end_ptr - previous_command.end_ptr,
GraphicsSystem::TracePlaybackMode::kBreakOnSwap);
} else {
// Full playback from frame start.
graphics_system_->PlayTrace(
frame->start_ptr, command.end_ptr - frame->start_ptr,
GraphicsSystem::TracePlaybackMode::kBreakOnSwap);
}
} }
private: private: