mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-04 16:24:29 +01:00
[util] Be more robust against timing weirdness when computing vblank count
This commit is contained in:
parent
d1e39be7e7
commit
d7fa39c4eb
@ -36,6 +36,9 @@ namespace dxvk {
|
||||
*/
|
||||
template<typename TimePoint, typename Duration>
|
||||
uint64_t computeRefreshCount(TimePoint t0, TimePoint t1, Duration refreshPeriod) {
|
||||
if (t1 < t0)
|
||||
return 0;
|
||||
|
||||
auto duration = std::chrono::duration_cast<Duration>(t1 - t0);
|
||||
return duration.count() / refreshPeriod.count();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user