1
0
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:
Joshua Ashton 2022-08-16 08:55:39 +00:00 committed by Philip Rebohle
parent 05a5b82f59
commit 5fcc9a1bd1
2 changed files with 15 additions and 8 deletions

View File

@ -111,14 +111,7 @@ namespace dxvk {
while (remaining > sleepThreshold) {
TimerDuration sleepDuration = remaining - sleepThreshold;
if (NtDelayExecution) {
LARGE_INTEGER ticks;
ticks.QuadPart = -sleepDuration.count();
NtDelayExecution(FALSE, &ticks);
} else {
std::this_thread::sleep_for(sleepDuration);
}
performSleep(sleepDuration);
t1 = dxvk::high_resolution_clock::now();
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);
}
}
}

View File

@ -86,6 +86,8 @@ namespace dxvk {
void updateSleepGranularity();
void performSleep(TimerDuration sleepDuration);
};
}