From a947933bf0dc777928ba58e0d3a646f7d18240ce Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Wed, 27 Apr 2022 13:07:36 +0530 Subject: [PATCH] Fix `Buffer` cycle check being inverted The check for the fence cycle being the same as the current cycle was incorrectly inverted to be the opposite of what it should have been, leading to bugs. --- app/src/main/cpp/skyline/gpu/buffer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/skyline/gpu/buffer.cpp b/app/src/main/cpp/skyline/gpu/buffer.cpp index 82a20e05..641726b1 100644 --- a/app/src/main/cpp/skyline/gpu/buffer.cpp +++ b/app/src/main/cpp/skyline/gpu/buffer.cpp @@ -69,7 +69,7 @@ namespace skyline::gpu { if (srcBuffer->dirtyState == Buffer::DirtyState::GpuDirty) { // If the source buffer is GPU dirty we cannot directly copy over its GPU backing contents - // Only sync back the buffer if it's not attched to the current fence cycle, otherwise propagate the GPU dirtiness + // Only sync back the buffer if it's not attached to the current fence cycle, otherwise propagate the GPU dirtiness if (!srcBuffer->cycle.owner_before(pCycle)) { // Perform a GPU -> CPU sync on the source then do a CPU -> GPU sync for the region occupied by the source // This is required since if we were created from a two buffers: one GPU dirty in the current cycle, and one GPU dirty in the previous cycle, if we marked ourselves as CPU dirty here then the GPU dirtiness from the current cycle buffer would be ignored and cause writes to be missed @@ -225,7 +225,7 @@ namespace skyline::gpu { std::memcpy(data.data(), mirror.data() + offset, data.size()); } else if (dirtyState == DirtyState::GpuDirty) { // If this buffer was attached to the current cycle, flush all pending host GPU work and wait to ensure that we read valid data - if (!cycle.owner_before(pCycle)) + if (cycle.owner_before(pCycle)) flushHostCallback(); SynchronizeGuest(); @@ -241,7 +241,7 @@ namespace skyline::gpu { SynchronizeHostWithCycle(pCycle); // Perform a CPU -> GPU sync to ensure correct ordering of writes } else if (dirtyState == DirtyState::GpuDirty) { // If this buffer was attached to the current cycle, flush all pending host GPU work and wait to ensure that writes are correctly ordered - if (!cycle.owner_before(pCycle)) + if (cycle.owner_before(pCycle)) flushHostCallback(); SynchronizeGuest();