diff --git a/src/util/util_fps_limiter.cpp b/src/util/util_fps_limiter.cpp index 7bc9ed17..66737eaf 100644 --- a/src/util/util_fps_limiter.cpp +++ b/src/util/util_fps_limiter.cpp @@ -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(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); + } + } + } diff --git a/src/util/util_fps_limiter.h b/src/util/util_fps_limiter.h index b5ad21be..94890c2c 100644 --- a/src/util/util_fps_limiter.h +++ b/src/util/util_fps_limiter.h @@ -86,6 +86,8 @@ namespace dxvk { void updateSleepGranularity(); + void performSleep(TimerDuration sleepDuration); + }; }