diff options
| author | MaranBr <maranbr@outlook.com> | 2026-07-10 05:25:12 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-07-10 05:25:12 +0200 |
| commit | a27d35463ef9d78553313b568e96f98097be7c11 (patch) | |
| tree | 420f4e1c9ab639da5d803c1df0340cc8f933677b /src/video_core/renderer_vulkan/vk_scheduler.cpp | |
| parent | 5606edd1a654a792a0a1b87d197207f72b7130c0 (diff) | |
[video_core] Improve synchronization and refactor buffer cache timing logic (#4182)
This simplifies the GPU accuracy setting by removing the intermediate Balanced mode and setting High as the default on desktop platforms.
It introduces a dedicated setting for GPU fence behavior, allowing the synchronization policy to be configured independently of GPU accuracy.
The Vulkan buffer cache now tracks GPU recording timeline ticks and waits only when necessary, reducing unnecessary synchronization while maintaining correctness for hard-to-trace graphical bugs.
GPU buffer readback has also been refined to synchronize only the affected upload regions when needed, and default DMA behavior has been updated to align with the new GPU accuracy model.
### TL;DR
The fix for particles freezing and unfreezing in mid-air in `Super Mario Odyssey` has been improved, resulting in less of a performance hit.
This game requires the new `Enable GPU Buffer Readback` option to be enabled to fix this issue.
The vertex explosions that occurred in `Super Mario Bros. Wonder`, especially in World 4, have been completely eliminated. You can now enjoy a smooth experience without graphical glitches exploding across the screen.
This game requires the new `GPU Fence Behavior` option to be set to `Strict` to fully fix this issue.
The flickering issue inside certain Shrines in `The Legend of Zelda: Tears of the Kingdom` has also been fixed.
For now, this game requires the new `GPU Fence Behavior` option to be set to `Accurate` to fully fix this issue.
These options are intended to fix graphical bugs in games that require better synchronization behavior between CPU and GPU, so other games may be affected as well.
Co-authored-by: xbzk <xbzk@eden-emu.dev>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4182
Reviewed-by: Lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_scheduler.cpp')
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_scheduler.cpp | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/src/video_core/renderer_vulkan/vk_scheduler.cpp b/src/video_core/renderer_vulkan/vk_scheduler.cpp index 3bf7a9ac78..334d82efff 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.cpp +++ b/src/video_core/renderer_vulkan/vk_scheduler.cpp @@ -27,8 +27,6 @@ namespace Vulkan { -constexpr u64 MAX_PENDING_FLUSHES = 5; - void Scheduler::CommandChunk::ExecuteAll(vk::CommandBuffer cmdbuf, vk::CommandBuffer upload_cmdbuf) { auto command = first; @@ -49,15 +47,6 @@ Scheduler::Scheduler(const Device& device_, StateTracker& state_tracker_) master_semaphore{std::make_unique<MasterSemaphore>(device)}, command_pool{std::make_unique<CommandPool>(*master_semaphore, device)} { - /*// PRE-OPTIMIZATION: Warm up the pool to prevent mid-frame spikes - { - std::scoped_lock rl{reserve_mutex}; - chunk_reserve.reserve(2048); // Prevent vector resizing - for (int i = 0; i < 1024; ++i) { - chunk_reserve.push_back(std::make_unique<CommandChunk>()); - } - }*/ - AcquireNewChunk(); AllocateWorkerCommandBuffer(); worker_thread = std::jthread([this](std::stop_token token) { WorkerThread(token); }); @@ -66,18 +55,7 @@ Scheduler::Scheduler(const Device& device_, StateTracker& state_tracker_) Scheduler::~Scheduler() = default; u64 Scheduler::Flush(VkSemaphore signal_semaphore, VkSemaphore wait_semaphore) { - // Prevent the CPU from getting too far ahead of the GPU by limiting pending flushes. - const bool should_throttle = Settings::IsGPULevelHigh(); - if (should_throttle) { - const u64 current_tick = master_semaphore->CurrentTick(); - const u64 gap = current_tick > last_submitted_tick ? current_tick - last_submitted_tick : 0; - const u64 step = (std::min)(MAX_PENDING_FLUSHES, gap); - const u64 new_tick = last_submitted_tick + step; - if (new_tick < current_tick) { - last_submitted_tick = new_tick; - master_semaphore->Wait(last_submitted_tick); - } - } + // When flushing, we only send data to the worker thread; no waiting is necessary. const u64 signal_value = SubmitExecution(signal_semaphore, wait_semaphore); AllocateNewContext(); return signal_value; |
