summaryrefslogtreecommitdiff
path: root/src/video_core/gpu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/gpu.cpp')
-rw-r--r--src/video_core/gpu.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 456f733cf..70762c51a 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -194,17 +194,17 @@ struct GPU::Impl {
194 194
195 [[nodiscard]] u64 GetTicks() const { 195 [[nodiscard]] u64 GetTicks() const {
196 // This values were reversed engineered by fincs from NVN 196 // This values were reversed engineered by fincs from NVN
197 // The gpu clock is reported in units of 385/625 nanoseconds 197 // The GPU clock is 614.4 MHz
198 constexpr u64 gpu_ticks_num = 384; 198 using NsToGPUTickRatio = std::ratio<614'400'000, std::nano::den>;
199 constexpr u64 gpu_ticks_den = 625; 199 static_assert(NsToGPUTickRatio::num == 384 && NsToGPUTickRatio::den == 625);
200
201 u64 nanoseconds = system.CoreTiming().GetGlobalTimeNs().count();
200 202
201 u64 nanoseconds = system.CoreTiming().GetCPUTimeNs().count();
202 if (Settings::values.use_fast_gpu_time.GetValue()) { 203 if (Settings::values.use_fast_gpu_time.GetValue()) {
203 nanoseconds /= 256; 204 nanoseconds /= 256;
204 } 205 }
205 const u64 nanoseconds_num = nanoseconds / gpu_ticks_den; 206
206 const u64 nanoseconds_rem = nanoseconds % gpu_ticks_den; 207 return nanoseconds * NsToGPUTickRatio::num / NsToGPUTickRatio::den;
207 return nanoseconds_num * gpu_ticks_num + (nanoseconds_rem * gpu_ticks_num) / gpu_ticks_den;
208 } 208 }
209 209
210 [[nodiscard]] bool IsAsync() const { 210 [[nodiscard]] bool IsAsync() const {