MTVU: partially port code to MTVU

Remains volatize as MTGS and the ScopedLockBool stuff
This commit is contained in:
Gregory Hainaut 2016-02-22 22:32:41 +01:00
parent 40b1a3996a
commit 3a4787dd98
2 changed files with 5 additions and 6 deletions

View File

@ -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

View File

@ -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<int> 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