rsx-capture: Save initial method registers state

This commit is contained in:
eladash 2018-09-26 12:39:17 +03:00 committed by kd-11
parent 5b0ed1e2eb
commit f056ef7a80
2 changed files with 16 additions and 6 deletions

View File

@ -230,10 +230,15 @@ namespace rsx
while (!Emu.IsStopped())
{
// Load registers while the RSX is still idle
method_registers = frame->reg_state;
_mm_mfence();
// start up fifo buffer by dumping the put ptr to first stop
sys_rsx_context_attribute(context_id, 0x001, 0x20000000, fifo_stops[0], 0, 0);
auto renderer = rsx::get_current_renderer();
auto render = get_current_renderer();
size_t stopIdx = 0;
for (const auto& replay_cmd : frame->replay_commands)
{
@ -248,7 +253,7 @@ namespace rsx
continue;
// wait until rsx idle and at our first 'stop' to apply state
while (!Emu.IsStopped() && (renderer->ctrl->get != renderer->ctrl->put) && (renderer->ctrl->get != fifo_stops[stopIdx]))
while (!Emu.IsStopped() && (render->ctrl->get != render->ctrl->put) && (render->ctrl->get != fifo_stops[stopIdx]))
{
while (Emu.IsPaused())
std::this_thread::sleep_for(10ms);
@ -263,14 +268,14 @@ namespace rsx
if (stopIdx >= fifo_stops.size())
fmt::throw_exception("Capture Replay: StopIdx greater than size of fifo_stops");
renderer->ctrl->put = fifo_stops[stopIdx];
render->ctrl->put = fifo_stops[stopIdx];
}
// dump put to end of stops, which should have actual end
u32 end = fifo_stops.back();
renderer->ctrl->put = end;
render->ctrl->put = end;
while (renderer->ctrl->get != end && !Emu.IsStopped())
while (render->ctrl->get != end && !Emu.IsStopped())
{
while (Emu.IsPaused())
std::this_thread::sleep_for(10ms);

View File

@ -5,6 +5,7 @@
#include "Emu/Cell/PPUModule.h"
#include "Emu/Cell/lv2/sys_sync.h"
#include "Emu/Cell/lv2/sys_ppu_thread.h"
#include "Emu/RSX/rsx_methods.h"
#include "Emu/RSX/gcm_enums.h"
#include <cereal/types/vector.hpp>
@ -16,7 +17,7 @@
namespace rsx
{
constexpr u32 FRAME_CAPTURE_MAGIC = 0x52524300; // ascii 'RRC/0'
constexpr u32 FRAME_CAPTURE_VERSION = 0x2;
constexpr u32 FRAME_CAPTURE_VERSION = 0x3;
struct frame_capture_data
{
@ -181,6 +182,8 @@ namespace rsx
std::unordered_map<u64, display_buffers_state> display_buffers_map;
// actual command queue to hold everything above
std::vector<replay_command> replay_commands;
// Initial registers state at the beginning of the capture
rsx::rsx_state reg_state;
template<typename Archive>
void serialize(Archive & ar)
@ -192,6 +195,7 @@ namespace rsx
ar(memory_data_map);
ar(display_buffers_map);
ar(replay_commands);
ar(reg_state);
}
void reset()
@ -201,6 +205,7 @@ namespace rsx
tile_map.clear();
memory_map.clear();
replay_commands.clear();
reg_state = method_registers;
}
};