Rejigger some FIFO buffer variables to be more rational.

videoBuffer -> s_video_buffer
size -> s_video_buffer_write_ptr
g_pVideoData -> g_video_buffer_read_ptr (impl moved to Fifo.cpp)

This eradicates the wonderful use of 'size' as a global name, and makes
it clear that s_video_buffer_write_ptr and g_video_buffer_read_ptr are
the two ends of the FIFO buffer s_video_buffer.

Oh, and remove a useless namespace {}.
This commit is contained in:
comex
2014-08-26 13:37:32 -04:00
parent e86ddacb18
commit 0ae9e398c8
6 changed files with 70 additions and 69 deletions

View File

@ -57,7 +57,7 @@ static void DecodePrimitiveStream(u32 iBufferSize)
{
while (streamSize > 0 && iBufferSize >= vertexSize)
{
g_pVideoData += vertexSize;
g_video_buffer_read_ptr += vertexSize;
iBufferSize -= vertexSize;
streamSize--;
}
@ -94,26 +94,26 @@ static void ReadXFData(u32 iBufferSize)
static void ExecuteDisplayList(u32 addr, u32 count)
{
u8 *videoDataSave = g_pVideoData;
u8 *videoDataSave = g_video_buffer_read_ptr;
u8 *dlStart = Memory::GetPointer(addr);
g_pVideoData = dlStart;
g_video_buffer_read_ptr = dlStart;
while (OpcodeDecoder::CommandRunnable(count))
{
OpcodeDecoder::Run(count);
// if data was read by the opcode decoder then the video data pointer changed
u32 readCount = (u32)(g_pVideoData - dlStart);
dlStart = g_pVideoData;
u32 readCount = (u32)(g_video_buffer_read_ptr - dlStart);
dlStart = g_video_buffer_read_ptr;
_assert_msg_(VIDEO, count >= readCount, "Display list underrun");
count -= readCount;
}
g_pVideoData = videoDataSave;
g_video_buffer_read_ptr = videoDataSave;
}
static void DecodeStandard(u32 bufferSize)

View File

@ -57,7 +57,7 @@ void DoState(PointerWrap &p)
p.Do(interruptWaiting);
// Is this right?
p.DoArray(g_pVideoData,writePos);
p.DoArray(g_video_buffer_read_ptr,writePos);
}
static void UpdateInterrupts_Wrapper(u64 userdata, int cyclesLate)
@ -95,7 +95,7 @@ void Init()
interruptSet = false;
interruptWaiting = false;
g_pVideoData = nullptr;
g_video_buffer_read_ptr = nullptr;
g_bSkipCurrentFrame = false;
}
@ -311,7 +311,7 @@ bool RunBuffer()
_dbg_assert_(COMMANDPROCESSOR, writePos >= readPos);
g_pVideoData = &commandBuffer[readPos];
g_video_buffer_read_ptr = &commandBuffer[readPos];
u32 availableBytes = writePos - readPos;
@ -322,7 +322,7 @@ bool RunBuffer()
OpcodeDecoder::Run(availableBytes);
// if data was read by the opcode decoder then the video data pointer changed
readPos = (u32)(g_pVideoData - &commandBuffer[0]);
readPos = (u32)(g_video_buffer_read_ptr - &commandBuffer[0]);
_dbg_assert_(VIDEO, writePos >= readPos);
availableBytes = writePos - readPos;
}