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 | |
| 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')
| -rw-r--r-- | src/core/core_timing.cpp | 7 | ||||
| -rw-r--r-- | src/core/core_timing.h | 3 |
2 files changed, 10 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(); |
diff --git a/src/core/core_timing.h b/src/core/core_timing.h index fdacdd94a..1873852c4 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h | |||
| @@ -119,6 +119,9 @@ public: | |||
| 119 | /// Returns the current CNTPCT tick value. | 119 | /// Returns the current CNTPCT tick value. |
| 120 | u64 GetClockTicks() const; | 120 | u64 GetClockTicks() const; |
| 121 | 121 | ||
| 122 | /// Returns the current GPU tick value. | ||
| 123 | u64 GetGPUTicks() const; | ||
| 124 | |||
| 122 | /// Returns current time in microseconds. | 125 | /// Returns current time in microseconds. |
| 123 | std::chrono::microseconds GetGlobalTimeUs() const; | 126 | std::chrono::microseconds GetGlobalTimeUs() const; |
| 124 | 127 | ||