From f8aaa599907cff765efdaa6f9875cb4c42746870 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sun, 26 Jun 2022 13:58:06 -0700 Subject: hle: service: nvflinger: Factor speed limit into frame time calculation. - This allows the %-based "Limit Speed Percent" setting to work with MC emulation. - This is already supported for SC emulation. --- src/core/hle/service/nvflinger/nvflinger.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 5f69c8c2c..f92d6beb5 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -289,7 +289,14 @@ s64 NVFlinger::GetNextTicks() const { const auto& settings = Settings::values; const bool unlocked_fps = settings.disable_fps_limit.GetValue(); const s64 fps_cap = unlocked_fps ? static_cast(settings.fps_cap.GetValue()) : 1; - return (1000000000 * (1LL << swap_interval)) / (max_hertz * fps_cap); + auto speed_scale = 1.f; + if (settings.use_speed_limit.GetValue() && settings.use_multi_core.GetValue()) { + // Scales the speed based on speed_limit setting on MC. SC is handled by + // SpeedLimiter::DoSpeedLimiting. + speed_scale = 100.f / settings.speed_limit.GetValue(); + } + return static_cast(((1000000000 * (1LL << swap_interval)) / (max_hertz * fps_cap)) * + speed_scale); } } // namespace Service::NVFlinger -- cgit v1.2.3 From 02282477e739c8db64a13ecb0d1128098b0b0035 Mon Sep 17 00:00:00 2001 From: bunnei Date: Fri, 15 Jul 2022 22:14:00 -0700 Subject: yuzu: settings: Remove framerate cap and merge unlocked framerate setting. - These were all somewhat redundant. --- src/core/hle/service/nvflinger/nvflinger.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index f92d6beb5..798c4d3a7 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -287,16 +287,18 @@ s64 NVFlinger::GetNextTicks() const { 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(settings.fps_cap.GetValue()) : 1; auto speed_scale = 1.f; - if (settings.use_speed_limit.GetValue() && settings.use_multi_core.GetValue()) { - // Scales the speed based on speed_limit setting on MC. SC is handled by - // SpeedLimiter::DoSpeedLimiting. - speed_scale = 100.f / settings.speed_limit.GetValue(); + if (settings.use_multi_core.GetValue()) { + if (settings.use_speed_limit.GetValue()) { + // Scales the speed based on speed_limit setting on MC. SC is handled by + // SpeedLimiter::DoSpeedLimiting. + speed_scale = 100.f / settings.speed_limit.GetValue(); + } else { + // Run at unlocked framerate. + speed_scale = 0.01f; + } } - return static_cast(((1000000000 * (1LL << swap_interval)) / (max_hertz * fps_cap)) * - speed_scale); + return static_cast(((1000000000 * (1LL << swap_interval)) / max_hertz) * speed_scale); } } // namespace Service::NVFlinger -- cgit v1.2.3 From 6d160873c4c6a963057da5c3dca5c5f26e810052 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 16 Jul 2022 13:26:47 -0700 Subject: hle: service: nvflinger: Fix implicit conversion. --- src/core/hle/service/nvflinger/nvflinger.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/core/hle') diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp index 798c4d3a7..5574269eb 100644 --- a/src/core/hle/service/nvflinger/nvflinger.cpp +++ b/src/core/hle/service/nvflinger/nvflinger.cpp @@ -298,7 +298,10 @@ s64 NVFlinger::GetNextTicks() const { speed_scale = 0.01f; } } - return static_cast(((1000000000 * (1LL << swap_interval)) / max_hertz) * speed_scale); + + const auto next_ticks = ((1000000000 * (1LL << swap_interval)) / max_hertz); + + return static_cast(speed_scale * static_cast(next_ticks)); } } // namespace Service::NVFlinger -- cgit v1.2.3