diff options
author | bunnei <bunneidev@gmail.com> | 2023-06-21 21:12:46 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-21 21:12:46 -0700 |
commit | e3122c5b468fd59b7eded5a3a7300643d05616bc (patch) | |
tree | 3fe4c2c0bea83f3bb8849ef8839b9520873d41c2 /src/video_core/gpu.cpp | |
parent | 7eb7d56b1bf96267969a913940ae9e35581ab27a (diff) | |
parent | 3e6d81a00899f7f488bfedd849edb64f927b124d (diff) |
Merge pull request #10086 from Morph1984/coretiming-ng-1mainline-0-1476
core_timing: Use CNTPCT as the guest CPU tick
Diffstat (limited to 'src/video_core/gpu.cpp')
-rw-r--r-- | src/video_core/gpu.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp index 456f733cf3..db385076da 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 reported in units of 385/625 nanoseconds - constexpr u64 gpu_ticks_num = 384; - constexpr u64 gpu_ticks_den = 625; + u64 gpu_tick = system.CoreTiming().GetGPUTicks(); - u64 nanoseconds = system.CoreTiming().GetCPUTimeNs().count(); if (Settings::values.use_fast_gpu_time.GetValue()) { - nanoseconds /= 256; + gpu_tick /= 256; } - const u64 nanoseconds_num = nanoseconds / gpu_ticks_den; - const u64 nanoseconds_rem = nanoseconds % gpu_ticks_den; - return nanoseconds_num * gpu_ticks_num + (nanoseconds_rem * gpu_ticks_num) / gpu_ticks_den; + + return gpu_tick; } [[nodiscard]] bool IsAsync() const { |