summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar bunnei2022-07-17 13:59:52 -0700
committerGravatar GitHub2022-07-17 13:59:52 -0700
commitba8ea956242537d862b4f9b5d27b95a5a6928ea7 (patch)
treef776066179ea4c1e2671ff3dc3811ed7301261a9 /src/core
parentMerge pull request #8544 from german77/14dot0 (diff)
parenthle: service: nvflinger: Fix implicit conversion. (diff)
downloadyuzu-ba8ea956242537d862b4f9b5d27b95a5a6928ea7.tar.gz
yuzu-ba8ea956242537d862b4f9b5d27b95a5a6928ea7.tar.xz
yuzu-ba8ea956242537d862b4f9b5d27b95a5a6928ea7.zip
Merge pull request #8508 from yuzu-emu/mc-speed-limit
hle: service: nvflinger: Factor speed limit into frame time calculation.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 5f69c8c2c..5574269eb 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -287,9 +287,21 @@ s64 NVFlinger::GetNextTicks() const {
287 static constexpr s64 max_hertz = 120LL; 287 static constexpr s64 max_hertz = 120LL;
288 288
289 const auto& settings = Settings::values; 289 const auto& settings = Settings::values;
290 const bool unlocked_fps = settings.disable_fps_limit.GetValue(); 290 auto speed_scale = 1.f;
291 const s64 fps_cap = unlocked_fps ? static_cast<s64>(settings.fps_cap.GetValue()) : 1; 291 if (settings.use_multi_core.GetValue()) {
292 return (1000000000 * (1LL << swap_interval)) / (max_hertz * fps_cap); 292 if (settings.use_speed_limit.GetValue()) {
293 // Scales the speed based on speed_limit setting on MC. SC is handled by
294 // SpeedLimiter::DoSpeedLimiting.
295 speed_scale = 100.f / settings.speed_limit.GetValue();
296 } else {
297 // Run at unlocked framerate.
298 speed_scale = 0.01f;
299 }
300 }
301
302 const auto next_ticks = ((1000000000 * (1LL << swap_interval)) / max_hertz);
303
304 return static_cast<s64>(speed_scale * static_cast<float>(next_ticks));
293} 305}
294 306
295} // namespace Service::NVFlinger 307} // namespace Service::NVFlinger