summaryrefslogtreecommitdiff
path: root/src/core/core_timing.cpp
diff options
context:
space:
mode:
authorGravatar Morph2023-05-28 17:45:47 -0400
committerGravatar Morph2023-06-07 21:44:42 -0400
commit907507886d755fa56099713c4b8f05bb640a8b7d (patch)
treea6ef3a8dfa9ba4aab797ab4985e078aba4b89fd2 /src/core/core_timing.cpp
parenttime: Use compile time division for TimeSpanType conversion (diff)
downloadyuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.gz
yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.xz
yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.zip
(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/core/core_timing.cpp')
-rw-r--r--src/core/core_timing.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 9a1d5a69a..e57bca70a 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -197,6 +197,13 @@ u64 CoreTiming::GetClockTicks() const {
197 return ticks; 197 return ticks;
198} 198}
199 199
200u64 CoreTiming::GetGPUTicks() const {
201 if (is_multicore) [[likely]] {
202 return clock->GetGPUTick();
203 }
204 return Common::WallClock::CNTPCTToGPUTick(ticks);
205}
206
200std::optional<s64> CoreTiming::Advance() { 207std::optional<s64> CoreTiming::Advance() {
201 std::scoped_lock lock{advance_lock, basic_lock}; 208 std::scoped_lock lock{advance_lock, basic_lock};
202 global_timer = GetGlobalTimeNs().count(); 209 global_timer = GetGlobalTimeNs().count();