Fix Texture Trap Data Race

The trap callbacks did not wait on the `Texture` to complete synchronization to the guest, this resulted in races where the contents written to the texture would be overwritten by the synced content. This commit fixes that by waiting on the fences at the end of the trap callback.
This commit is contained in:
PixelyIon
2022-07-13 21:40:41 +05:30
parent cb7c3602e7
commit 4f6a67af36

View File

@ -150,6 +150,7 @@ namespace skyline::gpu {
if (!lock)
return false;
SynchronizeGuest(true); // We can skip trapping since the caller will do it
WaitOnFence();
return true;
}, [this] {
DirtyState expectedState{DirtyState::Clean};
@ -161,6 +162,7 @@ namespace skyline::gpu {
return false;
SynchronizeGuest(true);
dirtyState = DirtyState::CpuDirty; // We need to assume the texture is dirty since we don't know what the guest is writing
WaitOnFence();
return true;
});
}