From d1a682eace60ac08229d6f76d879f7e8156b866a Mon Sep 17 00:00:00 2001 From: Billy Laws Date: Sun, 17 Jul 2022 18:08:17 +0530 Subject: [PATCH] Fix `setDirty` behavior in `Buffer::SynchronizeGuest` The condition for `setDirty` in the dirty state CAS was inverted from what it should've been resulting in synchronizing incorrectly, this commit fixes the condition to correct synchronization. --- app/src/main/cpp/skyline/gpu/buffer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/cpp/skyline/gpu/buffer.cpp b/app/src/main/cpp/skyline/gpu/buffer.cpp index 02d04316..6ebc0d95 100644 --- a/app/src/main/cpp/skyline/gpu/buffer.cpp +++ b/app/src/main/cpp/skyline/gpu/buffer.cpp @@ -166,7 +166,7 @@ namespace skyline::gpu { auto currentState{dirtyState.load(std::memory_order_relaxed)}; do { - if (currentState == DirtyState::CpuDirty || (currentState == DirtyState::Clean && setDirty)) + if (currentState == DirtyState::CpuDirty || (currentState == DirtyState::Clean && !setDirty)) return true; // If the buffer is synchronized (Clean/CpuDirty), there is no need to synchronize it else if (currentState == DirtyState::GpuDirty && nonBlocking && !PollFence()) return false; // If the buffer is GPU dirty and the fence is not signalled then we can't block