[util] Move sleep granularity getting to own function

This commit is contained in:
Joshua Ashton 2022-08-16 08:52:24 +00:00 committed by Philip Rebohle
parent b885883e06
commit 05a5b82f59
2 changed files with 10 additions and 4 deletions

View File

@ -137,6 +137,14 @@ namespace dxvk {
void FpsLimiter::initialize() {
updateSleepGranularity();
m_sleepThreshold = 4 * m_sleepGranularity;
m_lastFrame = dxvk::high_resolution_clock::now();
m_initialized = true;
}
void FpsLimiter::updateSleepGranularity() {
HMODULE ntdll = ::GetModuleHandleW(L"ntdll.dll");
if (ntdll) {
@ -163,10 +171,6 @@ namespace dxvk {
// Assume 1ms sleep granularity by default
m_sleepGranularity = TimerDuration(10000);
}
m_sleepThreshold = 4 * m_sleepGranularity;
m_lastFrame = dxvk::high_resolution_clock::now();
m_initialized = true;
}
}

View File

@ -84,6 +84,8 @@ namespace dxvk {
void initialize();
void updateSleepGranularity();
};
}