mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-11 15:28:13 -05:00
Merge pull request #8508 from yuzu-emu/mc-speed-limit
hle: service: nvflinger: Factor speed limit into frame time calculation.
This commit is contained in:
@ -287,9 +287,21 @@ 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<s64>(settings.fps_cap.GetValue()) : 1;
|
||||
return (1000000000 * (1LL << swap_interval)) / (max_hertz * fps_cap);
|
||||
auto speed_scale = 1.f;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
const auto next_ticks = ((1000000000 * (1LL << swap_interval)) / max_hertz);
|
||||
|
||||
return static_cast<s64>(speed_scale * static_cast<float>(next_ticks));
|
||||
}
|
||||
|
||||
} // namespace Service::NVFlinger
|
||||
|
Reference in New Issue
Block a user