mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-10 22:38:39 -05:00
Core: Re-write frame limiter
Now based on std::chrono, and also works in terms of emulated time instead of frames, so we can in the future frame-limit even when the display is disabled, etc. The frame limiter can also be enabled along with v-sync now, which should be useful for those with displays running at more than 60 Hz.
This commit is contained in:
@ -55,4 +55,20 @@ private:
|
||||
u32 game_frames = 0;
|
||||
};
|
||||
|
||||
class FrameLimiter {
|
||||
public:
|
||||
using Clock = std::chrono::high_resolution_clock;
|
||||
|
||||
void DoFrameLimiting(u64 current_system_time_us);
|
||||
|
||||
private:
|
||||
/// Emulated system time (in microseconds) at the last limiter invocation
|
||||
u64 previous_system_time_us = 0;
|
||||
/// Walltime at the last limiter invocation
|
||||
Clock::time_point previous_walltime = Clock::now();
|
||||
|
||||
/// Accumulated difference between walltime and emulated time
|
||||
std::chrono::microseconds frame_limiting_delta_err{0};
|
||||
};
|
||||
|
||||
} // namespace Core
|
||||
|
Reference in New Issue
Block a user