Counters: Move input poll to after throttle

This commit is contained in:
Stenzek 2024-01-26 21:27:36 +10:00 committed by Connor McLaughlin
parent 5eacab387d
commit 77a6525556
6 changed files with 12 additions and 6 deletions

View File

@ -707,7 +707,7 @@ int main(int argc, char* argv[])
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
void Host::VSyncOnCPUThread() void Host::PumpMessagesOnCPUThread()
{ {
// update GS thread copy of frame number // update GS thread copy of frame number
MTGS::RunOnGSThread([frame_number = GSDumpReplayer::GetFrameNumber()]() { s_dump_frame_number = frame_number; }); MTGS::RunOnGSThread([frame_number = GSDumpReplayer::GetFrameNumber()]() { s_dump_frame_number = frame_number; });

View File

@ -1122,7 +1122,7 @@ void Host::OnCreateMemoryCardOpenRequested()
emit g_emu_thread->onCreateMemoryCardOpenRequested(); emit g_emu_thread->onCreateMemoryCardOpenRequested();
} }
void Host::VSyncOnCPUThread() void Host::PumpMessagesOnCPUThread()
{ {
g_emu_thread->getEventLoop()->processEvents(QEventLoop::AllEvents); g_emu_thread->getEventLoop()->processEvents(QEventLoop::AllEvents);
} }

View File

@ -498,6 +498,9 @@ static __fi void VSyncStart(u32 sCycle)
gsPostVsyncStart(); // MUST be after framelimit; doing so before causes funk with frame times! gsPostVsyncStart(); // MUST be after framelimit; doing so before causes funk with frame times!
// Poll input after MTGS frame push, just in case it has to stall to catch up.
VMManager::Internal::PollInputOnCPUThread();
if (EmuConfig.Trace.Enabled && EmuConfig.Trace.EE.m_EnableAll) if (EmuConfig.Trace.Enabled && EmuConfig.Trace.EE.m_EnableAll)
SysTrace.EE.Counters.Write(" ================ EE COUNTER VSYNC START (frame: %d) ================", g_FrameCount); SysTrace.EE.Counters.Write(" ================ EE COUNTER VSYNC START (frame: %d) ================", g_FrameCount);

View File

@ -2484,11 +2484,13 @@ void VMManager::Internal::VSyncOnCPUThread()
Achievements::FrameUpdate(); Achievements::FrameUpdate();
PollDiscordPresence(); PollDiscordPresence();
}
void VMManager::Internal::PollInputOnCPUThread()
{
Host::PumpMessagesOnCPUThread();
InputManager::PollSources(); InputManager::PollSources();
Host::VSyncOnCPUThread();
if (EmuConfig.EnableRecordingTools) if (EmuConfig.EnableRecordingTools)
{ {
// This code is called _before_ Counter's vsync end, and _after_ vsync start // This code is called _before_ Counter's vsync end, and _after_ vsync start

View File

@ -272,6 +272,7 @@ namespace VMManager
void ELFLoadingOnCPUThread(std::string elf_path); void ELFLoadingOnCPUThread(std::string elf_path);
void EntryPointCompilingOnCPUThread(); void EntryPointCompilingOnCPUThread();
void VSyncOnCPUThread(); void VSyncOnCPUThread();
void PollInputOnCPUThread();
} // namespace Internal } // namespace Internal
} // namespace VMManager } // namespace VMManager
@ -317,5 +318,5 @@ namespace Host
const std::string& disc_serial, u32 disc_crc, u32 current_crc); const std::string& disc_serial, u32 disc_crc, u32 current_crc);
/// Provided by the host; called once per frame at guest vsync. /// Provided by the host; called once per frame at guest vsync.
void VSyncOnCPUThread(); void PumpMessagesOnCPUThread();
} // namespace Host } // namespace Host

View File

@ -169,7 +169,7 @@ void Host::RequestVMShutdown(bool allow_confirm, bool allow_save_state, bool def
{ {
} }
void Host::VSyncOnCPUThread() void Host::PumpMessagesOnCPUThread()
{ {
} }