diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/rasterizer_accelerated.h | 2 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_master_semaphore.h | 17 |
2 files changed, 14 insertions, 5 deletions
diff --git a/src/video_core/rasterizer_accelerated.h b/src/video_core/rasterizer_accelerated.h index ea879bfdd..249644e50 100644 --- a/src/video_core/rasterizer_accelerated.h +++ b/src/video_core/rasterizer_accelerated.h | |||
| @@ -42,7 +42,7 @@ private: | |||
| 42 | }; | 42 | }; |
| 43 | static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!"); | 43 | static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!"); |
| 44 | 44 | ||
| 45 | std::array<CacheEntry, 0x1000000> cached_pages; | 45 | std::array<CacheEntry, 0x2000000> cached_pages; |
| 46 | Core::Memory::Memory& cpu_memory; | 46 | Core::Memory::Memory& cpu_memory; |
| 47 | }; | 47 | }; |
| 48 | 48 | ||
diff --git a/src/video_core/renderer_vulkan/vk_master_semaphore.h b/src/video_core/renderer_vulkan/vk_master_semaphore.h index 4f8688118..0886b7da8 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,21 @@ 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 | u64 this_tick{}; |
| 50 | u64 counter{}; | ||
| 51 | do { | ||
| 52 | this_tick = gpu_tick.load(std::memory_order_acquire); | ||
| 53 | counter = semaphore.GetCounter(); | ||
| 54 | if (counter < this_tick) { | ||
| 55 | return; | ||
| 56 | } | ||
| 57 | } while (!gpu_tick.compare_exchange_weak(this_tick, counter, std::memory_order_release, | ||
| 58 | std::memory_order_relaxed)); | ||
| 50 | } | 59 | } |
| 51 | 60 | ||
| 52 | /// Waits for a tick to be hit on the GPU | 61 | /// Waits for a tick to be hit on the GPU |