mirror of https://github.com/PCSX2/pcsx2.git
GSRunner: Kick screenshots on the GS thread
Instead of from the "CPU" thread.
This commit is contained in:
parent
06081ca18b
commit
fa2db10e44
|
@ -77,6 +77,9 @@ static std::string s_output_prefix;
|
||||||
static s32 s_loop_count = 1;
|
static s32 s_loop_count = 1;
|
||||||
static std::optional<bool> s_use_window;
|
static std::optional<bool> s_use_window;
|
||||||
|
|
||||||
|
// Owned by the GS thread.
|
||||||
|
static u32 s_dump_frame_number = 0;
|
||||||
|
|
||||||
bool GSRunner::SetCriticalFolders()
|
bool GSRunner::SetCriticalFolders()
|
||||||
{
|
{
|
||||||
EmuFolders::AppRoot = Path::Canonicalize(Path::GetDirectory(FileSystem::GetProgramPath()));
|
EmuFolders::AppRoot = Path::Canonicalize(Path::GetDirectory(FileSystem::GetProgramPath()));
|
||||||
|
@ -286,6 +289,13 @@ void Host::ReleaseHostDisplay(bool clear_state)
|
||||||
|
|
||||||
bool Host::BeginPresentFrame(bool frame_skip)
|
bool Host::BeginPresentFrame(bool frame_skip)
|
||||||
{
|
{
|
||||||
|
// when we wrap around, don't race other files
|
||||||
|
GSJoinSnapshotThreads();
|
||||||
|
|
||||||
|
// queue dumping of this frame
|
||||||
|
std::string dump_path(fmt::format("{}_frame{}.png", s_output_prefix, s_dump_frame_number));
|
||||||
|
GSQueueSnapshot(dump_path);
|
||||||
|
|
||||||
if (g_host_display->BeginPresent(frame_skip))
|
if (g_host_display->BeginPresent(frame_skip))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -657,15 +667,8 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
void Host::CPUThreadVSync()
|
void Host::CPUThreadVSync()
|
||||||
{
|
{
|
||||||
if (!s_output_prefix.empty())
|
// update GS thread copy of frame number
|
||||||
{
|
GetMTGS().RunOnGSThread([frame_number = GSDumpReplayer::GetFrameNumber()]() { s_dump_frame_number = frame_number; });
|
||||||
// wait for the previous frame to complete (and thus dump)
|
|
||||||
GetMTGS().WaitGS(false, false, false);
|
|
||||||
|
|
||||||
// queue dumping of this frame
|
|
||||||
std::string dump_path(fmt::format("{}_frame{}.png", s_output_prefix, GSDumpReplayer::GetFrameNumber()));
|
|
||||||
GetMTGS().RunOnGSThread([dump_path = std::move(dump_path)]() { GSQueueSnapshot(dump_path); });
|
|
||||||
}
|
|
||||||
|
|
||||||
// process any window messages (but we shouldn't really have any)
|
// process any window messages (but we shouldn't really have any)
|
||||||
GSRunner::PumpPlatformMessages();
|
GSRunner::PumpPlatformMessages();
|
||||||
|
|
Loading…
Reference in New Issue