summaryrefslogtreecommitdiffstats
path: root/src/common/x64
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2023-05-28 23:45:47 +0200
committerMorph <39850852+Morph1984@users.noreply.github.com>2023-06-08 03:44:42 +0200
commit907507886d755fa56099713c4b8f05bb640a8b7d (patch)
treea6ef3a8dfa9ba4aab797ab4985e078aba4b89fd2 /src/common/x64
parenttime: Use compile time division for TimeSpanType conversion (diff)
downloadyuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar
yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.gz
yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.bz2
yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.lz
yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.xz
yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.tar.zst
yuzu-907507886d755fa56099713c4b8f05bb640a8b7d.zip
Diffstat (limited to '')
-rw-r--r--src/common/x64/native_clock.cpp7
-rw-r--r--src/common/x64/native_clock.h3
2 files changed, 9 insertions, 1 deletions
diff --git a/src/common/x64/native_clock.cpp b/src/common/x64/native_clock.cpp
index 5d1eb0590..7d2a26bd9 100644
--- a/src/common/x64/native_clock.cpp
+++ b/src/common/x64/native_clock.cpp
@@ -12,7 +12,8 @@ NativeClock::NativeClock(u64 rdtsc_frequency_)
ns_rdtsc_factor{GetFixedPoint64Factor(NsRatio::den, rdtsc_frequency)},
us_rdtsc_factor{GetFixedPoint64Factor(UsRatio::den, rdtsc_frequency)},
ms_rdtsc_factor{GetFixedPoint64Factor(MsRatio::den, rdtsc_frequency)},
- cntpct_rdtsc_factor{GetFixedPoint64Factor(CNTFRQ, rdtsc_frequency)} {}
+ cntpct_rdtsc_factor{GetFixedPoint64Factor(CNTFRQ, rdtsc_frequency)},
+ gputick_rdtsc_factor{GetFixedPoint64Factor(GPUTickFreq, rdtsc_frequency)} {}
std::chrono::nanoseconds NativeClock::GetTimeNS() const {
return std::chrono::nanoseconds{MultiplyHigh(GetHostTicksElapsed(), ns_rdtsc_factor)};
@@ -30,6 +31,10 @@ u64 NativeClock::GetCNTPCT() const {
return MultiplyHigh(GetHostTicksElapsed(), cntpct_rdtsc_factor);
}
+u64 NativeClock::GetGPUTick() const {
+ return MultiplyHigh(GetHostTicksElapsed(), gputick_rdtsc_factor);
+}
+
u64 NativeClock::GetHostTicksNow() const {
return FencedRDTSC();
}
diff --git a/src/common/x64/native_clock.h b/src/common/x64/native_clock.h
index d6f8626c1..334415eff 100644
--- a/src/common/x64/native_clock.h
+++ b/src/common/x64/native_clock.h
@@ -19,6 +19,8 @@ public:
u64 GetCNTPCT() const override;
+ u64 GetGPUTick() const override;
+
u64 GetHostTicksNow() const override;
u64 GetHostTicksElapsed() const override;
@@ -33,6 +35,7 @@ private:
u64 us_rdtsc_factor;
u64 ms_rdtsc_factor;
u64 cntpct_rdtsc_factor;
+ u64 gputick_rdtsc_factor;
};
} // namespace Common::X64