diff options
author | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-23 01:56:21 +0200 |
---|---|---|
committer | ameerj <52414509+ameerj@users.noreply.github.com> | 2021-07-24 04:10:01 +0200 |
commit | 9dfbc9bdce15c299faf06aa7bf68a8660366daee (patch) | |
tree | 83ae648f51b4d0d2bb484741f86f5fb9bce8d00b /src/core/perf_stats.cpp | |
parent | Merge pull request #6686 from ReinUsesLisp/vk-optimal-copy (diff) | |
download | yuzu-9dfbc9bdce15c299faf06aa7bf68a8660366daee.tar yuzu-9dfbc9bdce15c299faf06aa7bf68a8660366daee.tar.gz yuzu-9dfbc9bdce15c299faf06aa7bf68a8660366daee.tar.bz2 yuzu-9dfbc9bdce15c299faf06aa7bf68a8660366daee.tar.lz yuzu-9dfbc9bdce15c299faf06aa7bf68a8660366daee.tar.xz yuzu-9dfbc9bdce15c299faf06aa7bf68a8660366daee.tar.zst yuzu-9dfbc9bdce15c299faf06aa7bf68a8660366daee.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/perf_stats.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/core/perf_stats.cpp b/src/core/perf_stats.cpp index 6635a1339..c9ded49d0 100644 --- a/src/core/perf_stats.cpp +++ b/src/core/perf_stats.cpp @@ -127,15 +127,15 @@ double PerfStats::GetLastFrameTimeScale() const { return duration_cast<DoubleSecs>(previous_frame_length).count() / FRAME_LENGTH; } -void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { - if (!Settings::values.use_frame_limit.GetValue() || +void SpeedLimiter::DoSpeedLimiting(microseconds current_system_time_us) { + if (!Settings::values.use_speed_limit.GetValue() || Settings::values.use_multi_core.GetValue()) { return; } auto now = Clock::now(); - const double sleep_scale = Settings::values.frame_limit.GetValue() / 100.0; + const double sleep_scale = Settings::values.speed_limit.GetValue() / 100.0; // Max lag caused by slow frames. Shouldn't be more than the length of a frame at the current // speed percent or it will clamp too much and prevent this from properly limiting to that @@ -143,17 +143,17 @@ void FrameLimiter::DoFrameLimiting(microseconds current_system_time_us) { // limiting const microseconds max_lag_time_us = duration_cast<microseconds>( std::chrono::duration<double, std::chrono::microseconds::period>(25ms / sleep_scale)); - frame_limiting_delta_err += duration_cast<microseconds>( + speed_limiting_delta_err += duration_cast<microseconds>( std::chrono::duration<double, std::chrono::microseconds::period>( (current_system_time_us - previous_system_time_us) / sleep_scale)); - frame_limiting_delta_err -= duration_cast<microseconds>(now - previous_walltime); - frame_limiting_delta_err = - std::clamp(frame_limiting_delta_err, -max_lag_time_us, max_lag_time_us); + speed_limiting_delta_err -= duration_cast<microseconds>(now - previous_walltime); + speed_limiting_delta_err = + std::clamp(speed_limiting_delta_err, -max_lag_time_us, max_lag_time_us); - if (frame_limiting_delta_err > microseconds::zero()) { - std::this_thread::sleep_for(frame_limiting_delta_err); + if (speed_limiting_delta_err > microseconds::zero()) { + std::this_thread::sleep_for(speed_limiting_delta_err); auto now_after_sleep = Clock::now(); - frame_limiting_delta_err -= duration_cast<microseconds>(now_after_sleep - now); + speed_limiting_delta_err -= duration_cast<microseconds>(now_after_sleep - now); now = now_after_sleep; } |