diff options
| author | bunnei <bunneidev@gmail.com> | 2021-07-26 18:51:00 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-07-26 18:51:00 -0700 |
| commit | d6c799494c6235bc0796386bb31cae9fbe26f737 (patch) | |
| tree | ba4d1992e822cb8c0b2744e838ea503df97dde1f /src/core/perf_stats.cpp | |
| parent | 7511f65e312ab9916967a1234e471ef11b818787 (diff) | |
| parent | c80ae87b4ec29903f8c65641bd7e3c6460484801 (diff) | |
Merge pull request #6696 from ameerj/speed-limit-rename
general: Rename "Frame Limit" references to "Speed Limit"
Diffstat (limited to 'src/core/perf_stats.cpp')
| -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; } |
