mirror of
https://github.com/skyline-emu/skyline.git
synced 2024-12-23 18:51:56 +01:00
Avoid potential buffer copy race
This commit is contained in:
parent
720cfaafb6
commit
e65ca52d91
@ -291,8 +291,7 @@ namespace skyline::gpu {
|
|||||||
AdvanceSequence(); // We are modifying GPU backing contents so advance to the next sequence
|
AdvanceSequence(); // We are modifying GPU backing contents so advance to the next sequence
|
||||||
everHadInlineUpdate = true;
|
everHadInlineUpdate = true;
|
||||||
|
|
||||||
std::scoped_lock dstLock{stateMutex};
|
std::scoped_lock lock{stateMutex, src->stateMutex}; // Fine even if src and dst are same since recursive mutex
|
||||||
std::scoped_lock srcLock{src->stateMutex}; // Fine even if src and dst are same since recursive mutex
|
|
||||||
|
|
||||||
if (dirtyState == DirtyState::CpuDirty && SequencedCpuBackingWritesBlocked())
|
if (dirtyState == DirtyState::CpuDirty && SequencedCpuBackingWritesBlocked())
|
||||||
// If the buffer is used in sequence directly on the GPU, SynchronizeHost before modifying the mirror contents to ensure proper sequencing. This write will then be sequenced on the GPU instead (the buffer will be kept clean for the rest of the execution due to gpuCopyCallback blocking all writes)
|
// If the buffer is used in sequence directly on the GPU, SynchronizeHost before modifying the mirror contents to ensure proper sequencing. This write will then be sequenced on the GPU instead (the buffer will be kept clean for the rest of the execution due to gpuCopyCallback blocking all writes)
|
||||||
|
Loading…
Reference in New Issue
Block a user