summaryrefslogtreecommitdiffstats
path: root/src/video_core/gpu.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-02-13 23:16:07 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-02-13 23:16:07 +0100
commitd6ed31b9faeb2b1ee7c04098e614a73ca11869af (patch)
tree9771a482e3e0bb5004bae4728820b969013918a5 /src/video_core/gpu.cpp
parentGPU: Implement GPU Clock correctly. (diff)
downloadyuzu-d6ed31b9faeb2b1ee7c04098e614a73ca11869af.tar
yuzu-d6ed31b9faeb2b1ee7c04098e614a73ca11869af.tar.gz
yuzu-d6ed31b9faeb2b1ee7c04098e614a73ca11869af.tar.bz2
yuzu-d6ed31b9faeb2b1ee7c04098e614a73ca11869af.tar.lz
yuzu-d6ed31b9faeb2b1ee7c04098e614a73ca11869af.tar.xz
yuzu-d6ed31b9faeb2b1ee7c04098e614a73ca11869af.tar.zst
yuzu-d6ed31b9faeb2b1ee7c04098e614a73ca11869af.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/gpu.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/video_core/gpu.cpp b/src/video_core/gpu.cpp
index 4aca39faf..4419ab735 100644
--- a/src/video_core/gpu.cpp
+++ b/src/video_core/gpu.cpp
@@ -123,15 +123,17 @@ bool GPU::CancelSyncptInterrupt(const u32 syncpoint_id, const u32 value) {
return true;
}
-// 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::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;
+
const u64 cpu_ticks = system.CoreTiming().GetTicks();
const u64 nanoseconds = Core::Timing::CyclesToNs(cpu_ticks).count();
- return (nanoseconds * gpu_ticks_num) / gpu_ticks_den;
+ 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;
}
void GPU::FlushCommands() {