mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-12 13:08:50 +01:00
[util] Move platform specific sleep to own function in fps limiter
This commit is contained in:
parent
05a5b82f59
commit
5fcc9a1bd1
@ -111,14 +111,7 @@ namespace dxvk {
|
|||||||
while (remaining > sleepThreshold) {
|
while (remaining > sleepThreshold) {
|
||||||
TimerDuration sleepDuration = remaining - sleepThreshold;
|
TimerDuration sleepDuration = remaining - sleepThreshold;
|
||||||
|
|
||||||
if (NtDelayExecution) {
|
performSleep(sleepDuration);
|
||||||
LARGE_INTEGER ticks;
|
|
||||||
ticks.QuadPart = -sleepDuration.count();
|
|
||||||
|
|
||||||
NtDelayExecution(FALSE, &ticks);
|
|
||||||
} else {
|
|
||||||
std::this_thread::sleep_for(sleepDuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
t1 = dxvk::high_resolution_clock::now();
|
t1 = dxvk::high_resolution_clock::now();
|
||||||
remaining -= std::chrono::duration_cast<TimerDuration>(t1 - t0);
|
remaining -= std::chrono::duration_cast<TimerDuration>(t1 - t0);
|
||||||
@ -173,4 +166,16 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void FpsLimiter::performSleep(TimerDuration sleepDuration) {
|
||||||
|
if (NtDelayExecution) {
|
||||||
|
LARGE_INTEGER ticks;
|
||||||
|
ticks.QuadPart = -sleepDuration.count();
|
||||||
|
|
||||||
|
NtDelayExecution(FALSE, &ticks);
|
||||||
|
} else {
|
||||||
|
std::this_thread::sleep_for(sleepDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,8 @@ namespace dxvk {
|
|||||||
|
|
||||||
void updateSleepGranularity();
|
void updateSleepGranularity();
|
||||||
|
|
||||||
|
void performSleep(TimerDuration sleepDuration);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user