diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2023-05-28 23:45:47 +0200 |
---|---|---|
committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2023-06-08 03:44:42 +0200 |
commit | 907507886d755fa56099713c4b8f05bb640a8b7d (patch) | |
tree | a6ef3a8dfa9ba4aab797ab4985e078aba4b89fd2 /src/common/wall_clock.cpp | |
parent | time: Use compile time division for TimeSpanType conversion (diff) | |
download | yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.gz yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.bz2 yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.lz yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.xz yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.zst yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/common/wall_clock.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/common/wall_clock.cpp b/src/common/wall_clock.cpp index ad8db06b0..dc0dcbd68 100644 --- a/src/common/wall_clock.cpp +++ b/src/common/wall_clock.cpp @@ -32,6 +32,10 @@ public: return GetHostTicksElapsed() * NsToCNTPCTRatio::num / NsToCNTPCTRatio::den; } + u64 GetGPUTick() const override { + return GetHostTicksElapsed() * NsToGPUTickRatio::num / NsToGPUTickRatio::den; + } + u64 GetHostTicksNow() const override { return static_cast<u64>(SteadyClock::Now().time_since_epoch().count()); } @@ -52,12 +56,12 @@ std::unique_ptr<WallClock> CreateOptimalClock() { #ifdef ARCHITECTURE_x86_64 const auto& caps = GetCPUCaps(); - if (caps.invariant_tsc && caps.tsc_frequency >= WallClock::CNTFRQ) { + if (caps.invariant_tsc && caps.tsc_frequency >= WallClock::GPUTickFreq) { return std::make_unique<X64::NativeClock>(caps.tsc_frequency); } else { // Fallback to StandardWallClock if the hardware TSC // - Is not invariant - // - Is not more precise than CNTFRQ + // - Is not more precise than GPUTickFreq return std::make_unique<StandardWallClock>(); } #else |