summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-07-02 23:38:28 +0200
committerGitHub <noreply@github.com>2023-07-02 23:38:28 +0200
commit95ceae40e6f4806a1bf00913315ed22bd2842854 (patch)
treee1054aaadcfd0db9904835a3bf6ab80bf37d673c /src/core
parentMerge pull request #10479 from GPUCode/format-list (diff)
parentcore_timing: Remove GetCurrentTimerResolution in CoreTiming loop (diff)
downloadyuzu-95ceae40e6f4806a1bf00913315ed22bd2842854.tar
yuzu-95ceae40e6f4806a1bf00913315ed22bd2842854.tar.gz
yuzu-95ceae40e6f4806a1bf00913315ed22bd2842854.tar.bz2
yuzu-95ceae40e6f4806a1bf00913315ed22bd2842854.tar.lz
yuzu-95ceae40e6f4806a1bf00913315ed22bd2842854.tar.xz
yuzu-95ceae40e6f4806a1bf00913315ed22bd2842854.tar.zst
yuzu-95ceae40e6f4806a1bf00913315ed22bd2842854.zip
Diffstat (limited to '')
-rw-r--r--src/core/core_timing.cpp9
-rw-r--r--src/core/core_timing.h8
2 files changed, 14 insertions, 3 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 4f0a3f8ea..e6112a3c9 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -253,9 +253,6 @@ void CoreTiming::ThreadLoop() {
auto wait_time = *next_time - GetGlobalTimeNs().count();
if (wait_time > 0) {
#ifdef _WIN32
- const auto timer_resolution_ns =
- Common::Windows::GetCurrentTimerResolution().count();
-
while (!paused && !event.IsSet() && wait_time > 0) {
wait_time = *next_time - GetGlobalTimeNs().count();
@@ -316,4 +313,10 @@ std::chrono::microseconds CoreTiming::GetGlobalTimeUs() const {
return std::chrono::microseconds{Common::WallClock::CPUTickToUS(cpu_ticks)};
}
+#ifdef _WIN32
+void CoreTiming::SetTimerResolutionNs(std::chrono::nanoseconds ns) {
+ timer_resolution_ns = ns.count();
+}
+#endif
+
} // namespace Core::Timing
diff --git a/src/core/core_timing.h b/src/core/core_timing.h
index 10db1de55..5bca1c78d 100644
--- a/src/core/core_timing.h
+++ b/src/core/core_timing.h
@@ -131,6 +131,10 @@ public:
/// Checks for events manually and returns time in nanoseconds for next event, threadsafe.
std::optional<s64> Advance();
+#ifdef _WIN32
+ void SetTimerResolutionNs(std::chrono::nanoseconds ns);
+#endif
+
private:
struct Event;
@@ -143,6 +147,10 @@ private:
s64 global_timer = 0;
+#ifdef _WIN32
+ s64 timer_resolution_ns;
+#endif
+
// The queue is a min-heap using std::make_heap/push_heap/pop_heap.
// We don't use std::priority_queue because we need to be able to serialize, unserialize and
// erase arbitrary events (RemoveEvent()) regardless of the queue order. These aren't