diff options
author | Morph <39850852+Morph1984@users.noreply.github.com> | 2023-05-28 17:45:47 -0400 |
---|---|---|
committer | Morph <39850852+Morph1984@users.noreply.github.com> | 2023-06-07 21:44:42 -0400 |
commit | 907507886d755fa56099713c4b8f05bb640a8b7d (patch) | |
tree | a6ef3a8dfa9ba4aab797ab4985e078aba4b89fd2 /src/video_core/gpu.cpp | |
parent | 9dcc7bde8bb05dbc62fa196bcbe1484762e66917 (diff) |
(wall, native)_clock: Add GetGPUTick
Allows us to directly calculate the GPU tick without double conversion to and from the host clock tick.
Diffstat (limited to 'src/video_core/gpu.cpp')
-rw-r--r-- | src/video_core/gpu.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 70762c51a..db385076d 100644 --- a/src/video_core/gpu.cpp +++ b/src/video_core/gpu.cpp @@ -193,18 +193,13 @@ struct GPU::Impl { } [[nodiscard]] u64 GetTicks() const { - // This values were reversed engineered by fincs from NVN - // The GPU clock is 614.4 MHz - using NsToGPUTickRatio = std::ratio<614'400'000, std::nano::den>; - static_assert(NsToGPUTickRatio::num == 384 && NsToGPUTickRatio::den == 625); - - u64 nanoseconds = system.CoreTiming().GetGlobalTimeNs().count(); + u64 gpu_tick = system.CoreTiming().GetGPUTicks(); if (Settings::values.use_fast_gpu_time.GetValue()) { - nanoseconds /= 256; + gpu_tick /= 256; } - return nanoseconds * NsToGPUTickRatio::num / NsToGPUTickRatio::den; + return gpu_tick; } [[nodiscard]] bool IsAsync() const { |