Merge pull request #3167 from Tilka/wrapper

VertexLoaderUtils: remove simple wrapper functions
This commit is contained in:
flacs 2015-10-12 00:41:25 +02:00
commit c8382cca83
4 changed files with 17 additions and 54 deletions

View File

@ -85,7 +85,7 @@ static void ReadXFData(u32 iBufferSize)
u32 pData[16];
for (int i = 0; i < streamSize; i++)
pData[i] = DataReadU32();
pData[i] = DataRead<u32>();
SWLoadXFReg(streamSize, streamAddress, pData);
// return to normal command processing
@ -120,7 +120,7 @@ static void DecodeStandard(u32 bufferSize)
{
_assert_msg_(VIDEO, CommandRunnable(bufferSize), "Underflow during standard opcode decoding");
int Cmd = DataReadU8();
int Cmd = DataRead<u8>();
if (Cmd == GX_NOP)
return;
@ -148,15 +148,15 @@ static void DecodeStandard(u32 bufferSize)
case GX_LOAD_CP_REG: //0x08
{
u32 SubCmd = DataReadU8();
u32 Value = DataReadU32();
u32 SubCmd = DataRead<u8>();
u32 Value = DataRead<u32>();
SWLoadCPReg(SubCmd, Value);
}
break;
case GX_LOAD_XF_REG:
{
u32 Cmd2 = DataReadU32();
u32 Cmd2 = DataRead<u32>();
streamSize = ((Cmd2 >> 16) & 15) + 1;
streamAddress = Cmd2 & 0xFFFF;
currentFunction = ReadXFData;
@ -166,22 +166,22 @@ static void DecodeStandard(u32 bufferSize)
break;
case GX_LOAD_INDX_A: //used for position matrices
SWLoadIndexedXF(DataReadU32(), 0xC);
SWLoadIndexedXF(DataRead<u32>(), 0xC);
break;
case GX_LOAD_INDX_B: //used for normal matrices
SWLoadIndexedXF(DataReadU32(), 0xD);
SWLoadIndexedXF(DataRead<u32>(), 0xD);
break;
case GX_LOAD_INDX_C: //used for postmatrices
SWLoadIndexedXF(DataReadU32(), 0xE);
SWLoadIndexedXF(DataRead<u32>(), 0xE);
break;
case GX_LOAD_INDX_D: //used for lights
SWLoadIndexedXF(DataReadU32(), 0xF);
SWLoadIndexedXF(DataRead<u32>(), 0xF);
break;
case GX_CMD_CALL_DL:
{
u32 dwAddr = DataReadU32();
u32 dwCount = DataReadU32();
u32 dwAddr = DataRead<u32>();
u32 dwCount = DataRead<u32>();
ExecuteDisplayList(dwAddr, dwCount);
}
break;
@ -196,7 +196,7 @@ static void DecodeStandard(u32 bufferSize)
case GX_LOAD_BP_REG: //0x61
{
u32 cmd = DataReadU32();
u32 cmd = DataRead<u32>();
SWLoadBPReg(cmd);
}
break;
@ -210,7 +210,7 @@ static void DecodeStandard(u32 bufferSize)
vertexLoader.SetFormat(vatIndex, primitiveType);
// switch to primitive processing
streamSize = DataReadU16();
streamSize = DataRead<u16>();
currentFunction = DecodePrimitiveStream;
minCommandSize = vertexLoader.GetVertexSize();
readOpcode = false;
@ -249,7 +249,7 @@ bool CommandRunnable(u32 iBufferSize)
if (readOpcode)
{
u8 Cmd = DataPeek8(0);
u8 Cmd = DataPeek<u8>(0);
u32 minSize = 1;
switch (Cmd)

View File

@ -25,7 +25,7 @@ u8* g_vertex_manager_write_ptr;
static void PosMtx_ReadDirect_UByte(VertexLoader* loader)
{
u32 posmtx = DataReadU8() & 0x3f;
u32 posmtx = DataRead<u8>() & 0x3f;
if (loader->m_counter < 3)
VertexLoaderManager::position_matrix_index[loader->m_counter] = posmtx;
DataWrite<u32>(posmtx);
@ -34,7 +34,7 @@ static void PosMtx_ReadDirect_UByte(VertexLoader* loader)
static void TexMtx_ReadDirect_UByte(VertexLoader* loader)
{
loader->m_curtexmtx[loader->m_texmtxread] = DataReadU8() & 0x3f;
loader->m_curtexmtx[loader->m_texmtxread] = DataRead<u8>() & 0x3f;
PRIM_LOG("texmtx%d: %d, ", loader->m_texmtxread, loader->m_curtexmtx[loader->m_texmtxread]);
loader->m_texmtxread++;

View File

@ -32,22 +32,6 @@ __forceinline T DataPeek(int _uOffset, u8* bufp = g_video_buffer_read_ptr)
return Common::FromBigEndian(result);
}
// TODO: kill these
__forceinline u8 DataPeek8(int _uOffset)
{
return DataPeek<u8>(_uOffset);
}
__forceinline u16 DataPeek16(int _uOffset)
{
return DataPeek<u16>(_uOffset);
}
__forceinline u32 DataPeek32(int _uOffset)
{
return DataPeek<u32>(_uOffset);
}
template <typename T>
__forceinline T DataRead(u8** bufp = &g_video_buffer_read_ptr)
{
@ -56,27 +40,6 @@ __forceinline T DataRead(u8** bufp = &g_video_buffer_read_ptr)
return result;
}
// TODO: kill these
__forceinline u8 DataReadU8()
{
return DataRead<u8>();
}
__forceinline s8 DataReadS8()
{
return DataRead<s8>();
}
__forceinline u16 DataReadU16()
{
return DataRead<u16>();
}
__forceinline u32 DataReadU32()
{
return DataRead<u32>();
}
__forceinline u32 DataReadU32Unswapped()
{
u32 result;

View File

@ -85,7 +85,7 @@ void Color_ReadDirect_32b_888x(VertexLoader* loader)
}
void Color_ReadDirect_16b_565(VertexLoader* loader)
{
SetCol565(loader, DataReadU16());
SetCol565(loader, DataRead<u16>());
}
void Color_ReadDirect_16b_4444(VertexLoader* loader)
{