mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-28 21:08:04 +03:00
CoreTiming: Move VISkip calculation into a separate function.
This commit is contained in:
parent
7236d1539a
commit
a517c9f862
2 changed files with 12 additions and 4 deletions
|
@ -436,10 +436,7 @@ void CoreTimingManager::Throttle(const s64 target_cycle)
|
||||||
target_time += adjustment;
|
target_time += adjustment;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip the VI interrupt if the CPU is lagging by a certain amount.
|
UpdateVISkip(time, target_time);
|
||||||
// It doesn't matter what amount of lag we skip VI at, as long as it's constant.
|
|
||||||
const TimePoint vi_target = time - std::min(m_max_fallback, m_max_variance) / 2;
|
|
||||||
m_throttle_disable_vi_int = target_time < vi_target;
|
|
||||||
|
|
||||||
SleepUntil(target_time);
|
SleepUntil(target_time);
|
||||||
}
|
}
|
||||||
|
@ -469,6 +466,16 @@ void CoreTimingManager::ResetThrottle(s64 cycle)
|
||||||
m_throttle_reference_time = Clock::now();
|
m_throttle_reference_time = Clock::now();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CoreTimingManager::UpdateVISkip(TimePoint current_time, TimePoint target_time)
|
||||||
|
{
|
||||||
|
const DT vi_fallback = std::min(m_max_variance, m_max_fallback);
|
||||||
|
|
||||||
|
// Skip the VI interrupt if the CPU is lagging by a certain amount.
|
||||||
|
// It doesn't matter what amount of lag we skip VI at, as long as it's constant.
|
||||||
|
const TimePoint vi_target = current_time - vi_fallback / 2;
|
||||||
|
m_throttle_disable_vi_int = target_time < vi_target;
|
||||||
|
}
|
||||||
|
|
||||||
bool CoreTimingManager::GetVISkip() const
|
bool CoreTimingManager::GetVISkip() const
|
||||||
{
|
{
|
||||||
return m_throttle_disable_vi_int && g_ActiveConfig.bVISkip && !Core::WantsDeterminism();
|
return m_throttle_disable_vi_int && g_ActiveConfig.bVISkip && !Core::WantsDeterminism();
|
||||||
|
|
|
@ -215,6 +215,7 @@ private:
|
||||||
void UpdateSpeedLimit(s64 cycle, double new_speed);
|
void UpdateSpeedLimit(s64 cycle, double new_speed);
|
||||||
void ResetThrottle(s64 cycle);
|
void ResetThrottle(s64 cycle);
|
||||||
TimePoint CalculateTargetHostTimeInternal(s64 target_cycle);
|
TimePoint CalculateTargetHostTimeInternal(s64 target_cycle);
|
||||||
|
void UpdateVISkip(TimePoint current_time, TimePoint target_time);
|
||||||
|
|
||||||
int DowncountToCycles(int downcount) const;
|
int DowncountToCycles(int downcount) const;
|
||||||
int CyclesToDowncount(int cycles) const;
|
int CyclesToDowncount(int cycles) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue