TracePlayer - Expose internal playback pointers

This commit is contained in:
Dr. Chat 2015-11-21 21:41:41 -06:00
parent b750875e9d
commit 2a88225500
2 changed files with 18 additions and 0 deletions

View File

@ -92,11 +92,17 @@ void TracePlayer::PlayTraceOnThread(const uint8_t* trace_data,
auto command_processor = graphics_system_->command_processor();
command_processor->set_swap_mode(SwapMode::kIgnored);
player_start_ptr_ = trace_data;
player_target_ptr_ = trace_data + trace_size;
player_current_ptr_ = trace_data;
playing_trace_ = true;
auto trace_ptr = trace_data;
bool pending_break = false;
const PacketStartCommand* pending_packet = nullptr;
while (trace_ptr < trace_data + trace_size) {
player_current_ptr_ = trace_ptr;
auto type = static_cast<TraceCommandType>(xe::load<uint32_t>(trace_ptr));
switch (type) {
case TraceCommandType::kPrimaryBufferStart: {
@ -184,6 +190,7 @@ void TracePlayer::PlayTraceOnThread(const uint8_t* trace_data,
}
}
playing_trace_ = false;
command_processor->set_swap_mode(SwapMode::kNormal);
command_processor->IssueSwap(0, 1280, 720);
}

View File

@ -10,6 +10,7 @@
#ifndef XENIA_GPU_TRACE_PLAYER_H_
#define XENIA_GPU_TRACE_PLAYER_H_
#include <atomic>
#include <string>
#include "xenia/gpu/trace_protocol.h"
@ -34,8 +35,14 @@ class TracePlayer : public TraceReader {
GraphicsSystem* graphics_system() const { return graphics_system_; }
int current_frame_index() const { return current_frame_index_; }
int current_command_index() const { return current_command_index_; }
bool playing_trace() const { return playing_trace_; }
const Frame* current_frame() const;
// Only valid if playing_trace is true.
const uint8_t* player_current_ptr() const { return player_current_ptr_; }
const uint8_t* player_start_ptr() const { return player_start_ptr_; }
const uint8_t* player_target_ptr() const { return player_target_ptr_; }
void SeekFrame(int target_frame);
void SeekCommand(int target_command);
@ -49,6 +56,10 @@ class TracePlayer : public TraceReader {
GraphicsSystem* graphics_system_;
int current_frame_index_;
int current_command_index_;
std::atomic<bool> playing_trace_ = false;
std::atomic<const uint8_t*> player_current_ptr_ = 0;
std::atomic<const uint8_t*> player_start_ptr_ = 0;
std::atomic<const uint8_t*> player_target_ptr_ = 0;
};
} // namespace gpu