System: Fix pre-frame sleep getting stuck
This commit is contained in:
parent
0b4e302c22
commit
515a4d07fb
|
@ -2120,16 +2120,20 @@ void System::FrameDone()
|
||||||
AccumulatePreFrameSleepTime(current_time);
|
AccumulatePreFrameSleepTime(current_time);
|
||||||
|
|
||||||
// pre-frame sleep (input lag reduction)
|
// pre-frame sleep (input lag reduction)
|
||||||
current_time = Timer::GetCurrentValue();
|
// if we're running over, then fall through to the normal Throttle() case which will fix up next_frame_time.
|
||||||
if (s_state.pre_frame_sleep)
|
if (s_state.pre_frame_sleep && pre_frame_sleep_until > current_time)
|
||||||
{
|
{
|
||||||
// don't sleep if it's under 1ms, because we're just going to overshoot (or spin).
|
// don't sleep if it's under 1ms, because we're just going to overshoot (or spin).
|
||||||
if (pre_frame_sleep_until > current_time &&
|
if (Timer::ConvertValueToMilliseconds(pre_frame_sleep_until - current_time) >= 1)
|
||||||
Timer::ConvertValueToMilliseconds(pre_frame_sleep_until - current_time) >= 1)
|
|
||||||
{
|
{
|
||||||
Throttle(current_time, pre_frame_sleep_until);
|
Throttle(current_time, pre_frame_sleep_until);
|
||||||
current_time = Timer::GetCurrentValue();
|
current_time = Timer::GetCurrentValue();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// still need to update next_frame_time
|
||||||
|
s_state.next_frame_time += s_state.frame_period;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue