Switch to sleep_precise for WaitUntil() which is used for frame timing.

This can improve frame pacing slightly, not just on Windows actually.
This commit is contained in:
Henrik Rydgård committed 2025-03-01 19:13:06 +01:00
1 parent 4f8896eb19
commit 1f96c3a2b3
2 files changed
+18 -7

No files matched your search

+10 -1
View File
@@ -19,6 +19,7 @@
// * Frame skipping. This gets complicated.
// * The game not actually asking for flips, like in static loading screens
#include "ppsspp_config.h"
#include "Common/Profiler/Profiler.h"
#include "Common/Log.h"
#include "Common/TimeUtil.h"
@@ -35,7 +36,13 @@
FrameTiming g_frameTiming;
void WaitUntil(double now, double timestamp, const char *reason) {
#ifdef _WIN32
#if 1
// Use precise timing.
sleep_precise(timestamp - now);
#else
#if PPSSPP_PLATFORM(WINDOWS)
// Old method. TODO: Should we make an option?
while (time_now_d() < timestamp) {
sleep_ms(1, reason); // Sleep for 1ms on this thread
}
@@ -45,6 +52,8 @@ void WaitUntil(double now, double timestamp, const char *reason) {
usleep((long)(left * 1000000));
}
#endif
#endif
}
inline Draw::PresentMode GetBestImmediateMode(Draw::PresentMode supportedModes) {