summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/nvflinger/nvflinger.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-07-26 01:23:44 +0200
committerGitHub <noreply@github.com>2021-07-26 01:23:44 +0200
commitc09557acd8a1880b0f19cc13d5fde46186363c3d (patch)
tree2e1ddda5bd411f69d90c8efd214910aec3ec9b06 /src/core/hle/service/nvflinger/nvflinger.cpp
parentMerge pull request #6575 from FernandoS27/new_settings (diff)
parentconfig, nvflinger: Add FPS cap setting (diff)
downloadyuzu-c09557acd8a1880b0f19cc13d5fde46186363c3d.tar
yuzu-c09557acd8a1880b0f19cc13d5fde46186363c3d.tar.gz
yuzu-c09557acd8a1880b0f19cc13d5fde46186363c3d.tar.bz2
yuzu-c09557acd8a1880b0f19cc13d5fde46186363c3d.tar.lz
yuzu-c09557acd8a1880b0f19cc13d5fde46186363c3d.tar.xz
yuzu-c09557acd8a1880b0f19cc13d5fde46186363c3d.tar.zst
yuzu-c09557acd8a1880b0f19cc13d5fde46186363c3d.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 1d810562f..941748970 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -307,11 +307,12 @@ void NVFlinger::Compose() {
}
s64 NVFlinger::GetNextTicks() const {
- if (Settings::values.disable_fps_limit.GetValue()) {
- return 0;
- }
- constexpr s64 max_hertz = 120LL;
- return (1000000000 * (1LL << swap_interval)) / max_hertz;
+ static constexpr s64 max_hertz = 120LL;
+
+ const auto& settings = Settings::values;
+ const bool unlocked_fps = settings.disable_fps_limit.GetValue();
+ const s64 fps_cap = unlocked_fps ? static_cast<s64>(settings.fps_cap.GetValue()) : 1;
+ return (1000000000 * (1LL << swap_interval)) / (max_hertz * fps_cap);
}
} // namespace Service::NVFlinger