Extend stateMutex scope inside Buffer::SynchronizeHost

The code is much simpler to reason about when reading the code as it doesn't require evaluating all the potential edge cases of trap handlers in different states. It should be noted that this should not change behavior in any meaningful way, at most it can prevent a minor race where the protection could be upgraded after being downgraded by the signal handler leading to a redundant trap.
This commit is contained in:
Billy Laws 2022-08-04 23:22:56 +01:00 committed by PixelyIon
parent c3cf79cb39
commit c1bf5a804a
No known key found for this signature in database
GPG Key ID: 11BC6C3201BC2C05

View File

@ -161,12 +161,13 @@ namespace skyline::gpu {
dirtyState = DirtyState::Clean;
WaitOnFence();
AdvanceSequence(); // We are modifying GPU backing contents so advance to the next sequence
if (!skipTrap)
gpu.state.nce->TrapRegions(*trapHandle, true); // Trap any future CPU writes to this buffer, must be done before the memcpy so that any modifications during the copy are tracked
}
AdvanceSequence(); // We are modifying GPU backing contents so advance to the next sequence
if (!skipTrap)
gpu.state.nce->TrapRegions(*trapHandle, true); // Trap any future CPU writes to this buffer, must be done before the memcpy so that any modifications during the copy are tracked
std::memcpy(backing.data(), mirror.data(), mirror.size());
}