diff --git a/pcsx2/MTVU.cpp b/pcsx2/MTVU.cpp index b77b37224f..e049ba3df7 100644 --- a/pcsx2/MTVU.cpp +++ b/pcsx2/MTVU.cpp @@ -47,7 +47,7 @@ static void MTVU_Unpack(void* data, VIFregisters& vifRegs) } // Called on Saving/Loading states... -void SaveStateBase::mtvuFreeze() +void SaveStateBase::mtvuFreeze() { FreezeTag("MTVU"); pxAssert(vu1Thread.IsDone()); @@ -142,7 +142,7 @@ void VU_Thread::ExecuteRingBuffer() break; } case MTVU_NULL_PACKET: - AtomicExchange(read_pos, 0); + read_pos = 0; break; jNO_DEFAULT; } @@ -187,7 +187,7 @@ void VU_Thread::ReserveSpace(s32 size) // Use this when reading read_pos from ee thread __fi s32 VU_Thread::GetReadPos() { - return AtomicRead(read_pos); + return read_pos.load(); } // Use this when reading write_pos from vu thread __fi s32 VU_Thread::GetWritePos() @@ -202,8 +202,7 @@ __fi u32* VU_Thread::GetWritePtr() __fi void VU_Thread::incReadPos(s32 offset) { // Offset in u32 sizes - s32 temp = (read_pos + offset) & buffer_mask; - AtomicExchange(read_pos, temp); + read_pos = (read_pos + offset) & buffer_mask; } __fi void VU_Thread::incWritePos() { // Adds write_offset diff --git a/pcsx2/MTVU.h b/pcsx2/MTVU.h index d404d75967..1a9bab8254 100644 --- a/pcsx2/MTVU.h +++ b/pcsx2/MTVU.h @@ -30,7 +30,7 @@ class VU_Thread : public pxThread { static const s32 buffer_size = (_1mb * 16) / sizeof(s32); static const u32 buffer_mask = buffer_size - 1; __aligned(4) u32 buffer[buffer_size]; - __aligned(4) volatile s32 read_pos; // Only modified by VU thread + __aligned(4) std::atomic read_pos; // Only modified by VU thread __aligned(4) volatile bool isBusy; // Is thread processing data? __aligned(4) s32 write_pos; // Only modified by EE thread __aligned(4) s32 write_offset; // Only modified by EE thread