Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsx capture: Fix regression after #7730 #7744

Merged
merged 4 commits into from Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 6 additions & 9 deletions rpcs3/Emu/RSX/RSXThread.cpp
Expand Up @@ -28,8 +28,7 @@ class GSRender;

#define CMD_DEBUG 0

bool user_asked_for_frame_capture = false;
bool capture_current_frame = false;
std::atomic<bool> user_asked_for_frame_capture = false;
rsx::frame_trace_data frame_debug;
rsx::frame_capture_data frame_capture;

Expand Down Expand Up @@ -305,11 +304,13 @@ namespace rsx
};

m_rtts_dirty = true;
memset(m_textures_dirty, -1, sizeof(m_textures_dirty));
memset(m_vertex_textures_dirty, -1, sizeof(m_vertex_textures_dirty));
m_textures_dirty.fill(true);
m_vertex_textures_dirty.fill(true);

m_graphics_state = pipeline_state::all_dirty;

user_asked_for_frame_capture = false;

if (g_cfg.misc.use_native_interface && (g_cfg.video.renderer == video_renderer::opengl || g_cfg.video.renderer == video_renderer::vulkan))
{
m_overlay_manager = g_fxo->init<rsx::overlays::display_manager>(0);
Expand Down Expand Up @@ -651,9 +652,6 @@ namespace rsx
std::this_thread::sleep_for(10ms);
do_local_task(rsx::FIFO_state::lock_wait);

user_asked_for_frame_capture = false;
capture_current_frame = false;

m_rsx_thread_exiting = true;
g_fxo->get<rsx::dma_manager>()->join();
}
Expand Down Expand Up @@ -2519,10 +2517,9 @@ namespace rsx
void thread::on_frame_end(u32 buffer, bool forced)
{
// Marks the end of a frame scope GPU-side
if (user_asked_for_frame_capture && !capture_current_frame)
if (user_asked_for_frame_capture.exchange(false) && !capture_current_frame)
{
capture_current_frame = true;
user_asked_for_frame_capture = false;
frame_debug.reset();
frame_capture.reset();

Expand Down
9 changes: 5 additions & 4 deletions rpcs3/Emu/RSX/RSXThread.h
Expand Up @@ -3,6 +3,7 @@
#include <deque>
#include <variant>
#include <stack>
#include <atomic>

#include "GCM.h"
#include "rsx_cache.h"
Expand All @@ -26,8 +27,7 @@
extern u64 get_guest_system_time();
extern u64 get_system_time();

extern bool user_asked_for_frame_capture;
extern bool capture_current_frame;
extern std::atomic<bool> user_asked_for_frame_capture;
extern rsx::frame_trace_data frame_debug;
extern rsx::frame_capture_data frame_capture;

Expand Down Expand Up @@ -674,8 +674,8 @@ namespace rsx
u32 local_mem_size{0};

bool m_rtts_dirty;
bool m_textures_dirty[16];
bool m_vertex_textures_dirty[4];
std::array<bool, 16> m_textures_dirty;
std::array<bool, 4> m_vertex_textures_dirty;
bool m_framebuffer_state_contested = false;
rsx::framebuffer_creation_context m_current_framebuffer_context = rsx::framebuffer_creation_context::context_draw;

Expand Down Expand Up @@ -717,6 +717,7 @@ namespace rsx
vm::ptr<void(u32)> user_handler = vm::null;
vm::ptr<void(u32)> vblank_handler = vm::null;
atomic_t<u64> vblank_count{0};
bool capture_current_frame = false;

public:
bool invalid_command_interrupt_raised = false;
Expand Down
4 changes: 2 additions & 2 deletions rpcs3/Emu/RSX/rsx_methods.cpp
Expand Up @@ -176,15 +176,15 @@ namespace rsx
{
rsx->clear_surface(arg);

if (capture_current_frame)
if (rsx->capture_current_frame)
{
rsx->capture_frame("clear");
}
}

void clear_zcull(thread* rsx, u32 _reg, u32 arg)
{
if (capture_current_frame)
if (rsx->capture_current_frame)
{
rsx->capture_frame("clear zcull memory");
}
Expand Down
5 changes: 4 additions & 1 deletion rpcs3/rpcs3qt/debugger_frame.cpp
Expand Up @@ -25,9 +25,10 @@
#include <QJSEngine>
#include <QVBoxLayout>
#include <QTimer>
#include <atomic>

constexpr auto qstr = QString::fromStdString;
extern bool user_asked_for_frame_capture;
extern std::atomic<bool> user_asked_for_frame_capture;

debugger_frame::debugger_frame(std::shared_ptr<gui_settings> settings, QWidget *parent)
: custom_dock_widget(tr("Debugger"), parent), xgui_settings(settings)
Expand Down Expand Up @@ -281,6 +282,8 @@ void debugger_frame::UpdateUI()
{
UpdateUnitList();

m_btn_capture->setEnabled(Emu.IsRunning() || Emu.IsPaused());

if (m_no_thread_selected) return;

const auto cpu = this->cpu.lock();
Expand Down