diff options
| author | 2023-05-28 17:45:47 -0400 | |
|---|---|---|
| committer | 2023-06-07 21:44:42 -0400 | |
| commit | 907507886d755fa56099713c4b8f05bb640a8b7d (patch) | |
| tree | a6ef3a8dfa9ba4aab797ab4985e078aba4b89fd2 /src/core/core_timing.cpp | |
| parent | time: Use compile time division for TimeSpanType conversion (diff) | |
| download | yuzu-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.cpp | 7 |
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 | ||
| 200 | u64 CoreTiming::GetGPUTicks() const { | ||
| 201 | if (is_multicore) [[likely]] { | ||
| 202 | return clock->GetGPUTick(); | ||
| 203 | } | ||
| 204 | return Common::WallClock::CNTPCTToGPUTick(ticks); | ||
| 205 | } | ||
| 206 | |||
| 200 | std::optional<s64> CoreTiming::Advance() { | 207 | std::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(); |