summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/renderer_vulkan/vk_master_semaphore.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/video_core/renderer_vulkan/vk_master_semaphore.h b/src/video_core/renderer_vulkan/vk_master_semaphore.h
index 4f8688118..3d298d0b6 100644
--- a/src/video_core/renderer_vulkan/vk_master_semaphore.h
+++ b/src/video_core/renderer_vulkan/vk_master_semaphore.h
@@ -21,12 +21,12 @@ public:
21 21
22 /// Returns the current logical tick. 22 /// Returns the current logical tick.
23 [[nodiscard]] u64 CurrentTick() const noexcept { 23 [[nodiscard]] u64 CurrentTick() const noexcept {
24 return current_tick.load(std::memory_order_relaxed); 24 return current_tick.load(std::memory_order_acquire);
25 } 25 }
26 26
27 /// Returns the last known GPU tick. 27 /// Returns the last known GPU tick.
28 [[nodiscard]] u64 KnownGpuTick() const noexcept { 28 [[nodiscard]] u64 KnownGpuTick() const noexcept {
29 return gpu_tick.load(std::memory_order_relaxed); 29 return gpu_tick.load(std::memory_order_acquire);
30 } 30 }
31 31
32 /// Returns the timeline semaphore handle. 32 /// Returns the timeline semaphore handle.
@@ -41,12 +41,20 @@ public:
41 41
42 /// Advance to the logical tick and return the old one 42 /// Advance to the logical tick and return the old one
43 [[nodiscard]] u64 NextTick() noexcept { 43 [[nodiscard]] u64 NextTick() noexcept {
44 return current_tick.fetch_add(1, std::memory_order::relaxed); 44 return current_tick.fetch_add(1, std::memory_order_release);
45 } 45 }
46 46
47 /// Refresh the known GPU tick 47 /// Refresh the known GPU tick
48 void Refresh() { 48 void Refresh() {
49 gpu_tick.store(semaphore.GetCounter(), std::memory_order_relaxed); 49 auto this_tick = gpu_tick.load(std::memory_order_acquire);
50 u64 counter{};
51 do {
52 counter = semaphore.GetCounter();
53 if (counter < this_tick) {
54 return;
55 }
56 } while (!gpu_tick.compare_exchange_weak(this_tick, counter, std::memory_order_release,
57 std::memory_order_relaxed));
50 } 58 }
51 59
52 /// Waits for a tick to be hit on the GPU 60 /// Waits for a tick to be hit on the GPU