mirror of
https://github.com/starr-dusT/yuzu-mainline
synced 2024-03-05 21:12:25 -08:00
Merge pull request #7127 from FernandoS27/i-saw-a-wabbit
A few fixes on Vulkan and Rasterizer Caching
This commit is contained in:
commit
5b735a4c9d
@ -42,7 +42,7 @@ private:
|
|||||||
};
|
};
|
||||||
static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!");
|
static_assert(sizeof(CacheEntry) == 8, "CacheEntry should be 8 bytes!");
|
||||||
|
|
||||||
std::array<CacheEntry, 0x1000000> cached_pages;
|
std::array<CacheEntry, 0x2000000> cached_pages;
|
||||||
Core::Memory::Memory& cpu_memory;
|
Core::Memory::Memory& cpu_memory;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -21,12 +21,12 @@ public:
|
|||||||
|
|
||||||
/// Returns the current logical tick.
|
/// Returns the current logical tick.
|
||||||
[[nodiscard]] u64 CurrentTick() const noexcept {
|
[[nodiscard]] u64 CurrentTick() const noexcept {
|
||||||
return current_tick.load(std::memory_order_relaxed);
|
return current_tick.load(std::memory_order_acquire);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the last known GPU tick.
|
/// Returns the last known GPU tick.
|
||||||
[[nodiscard]] u64 KnownGpuTick() const noexcept {
|
[[nodiscard]] u64 KnownGpuTick() const noexcept {
|
||||||
return gpu_tick.load(std::memory_order_relaxed);
|
return gpu_tick.load(std::memory_order_acquire);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the timeline semaphore handle.
|
/// Returns the timeline semaphore handle.
|
||||||
@ -41,12 +41,21 @@ public:
|
|||||||
|
|
||||||
/// Advance to the logical tick and return the old one
|
/// Advance to the logical tick and return the old one
|
||||||
[[nodiscard]] u64 NextTick() noexcept {
|
[[nodiscard]] u64 NextTick() noexcept {
|
||||||
return current_tick.fetch_add(1, std::memory_order::relaxed);
|
return current_tick.fetch_add(1, std::memory_order_release);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Refresh the known GPU tick
|
/// Refresh the known GPU tick
|
||||||
void Refresh() {
|
void Refresh() {
|
||||||
gpu_tick.store(semaphore.GetCounter(), std::memory_order_relaxed);
|
u64 this_tick{};
|
||||||
|
u64 counter{};
|
||||||
|
do {
|
||||||
|
this_tick = gpu_tick.load(std::memory_order_acquire);
|
||||||
|
counter = semaphore.GetCounter();
|
||||||
|
if (counter < this_tick) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} while (!gpu_tick.compare_exchange_weak(this_tick, counter, std::memory_order_release,
|
||||||
|
std::memory_order_relaxed));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Waits for a tick to be hit on the GPU
|
/// Waits for a tick to be hit on the GPU
|
||||||
|
Loading…
Reference in New Issue
Block a user