VertexLoader: Change some pointer arithmetic to array syntax. should have no effect on performance.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@2255 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
e5e55534ac
commit
6deb87c176
|
@ -18,6 +18,9 @@
|
|||
#ifndef _VERTEXLOADER_H
|
||||
#define _VERTEXLOADER_H
|
||||
|
||||
// Top vertex loaders
|
||||
// Metroid Prime: P I16-flt N I16-s16 T0 I16-u16 T1 i16-flt
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "CPMemory.h"
|
||||
|
|
|
@ -160,7 +160,7 @@ void LOADERDECL Color_ReadIndex8_24b_6666()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u8* pData = cached_arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u32 val = *(pData+2) | ((*(pData+1))<<8) | ((*pData)<<16);
|
||||
u32 val = pData[2] | (pData[1] << 8) | (pData[0] << 16);
|
||||
_SetCol6666(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex8_32b_8888()
|
||||
|
@ -200,7 +200,7 @@ void LOADERDECL Color_ReadIndex16_24b_6666()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u8 *pData = cached_arraybases[ARRAY_COLOR+colIndex] + (Index * arraystrides[ARRAY_COLOR+colIndex]);
|
||||
u32 val = *(pData+2) | ((*(pData+1))<<8) | ((*pData)<<16);
|
||||
u32 val = pData[2] | (pData[1] << 8) | (pData[0] << 16);
|
||||
_SetCol6666(val);
|
||||
}
|
||||
void LOADERDECL Color_ReadIndex16_32b_8888()
|
||||
|
|
|
@ -29,6 +29,7 @@ VertexLoader_Normal::Set VertexLoader_Normal::m_Table[NUM_NRM_TYPE][NUM_NRM_INDI
|
|||
|
||||
void VertexLoader_Normal::Init(void)
|
||||
{
|
||||
// HACK is for signed instead of unsigned to prevent crashes.
|
||||
m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_UBYTE] = Set(3, Normal_DirectByte); //HACK
|
||||
m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_BYTE] = Set(3, Normal_DirectByte);
|
||||
m_Table[NRM_DIRECT] [NRM_INDICES1][NRM_NBT] [FORMAT_USHORT] = Set(6, Normal_DirectShort); //HACK
|
||||
|
@ -184,9 +185,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u8* pData = cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData); //Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData+1); //Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData+2); //Memory_Read_U8(iAddress+2);
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[0];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[1];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[2];
|
||||
VertexManager::s_pCurBufferPointer++;
|
||||
// ((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(signed char)Memory_Read_U8(iAddress)+0.5f) / 127.5f;
|
||||
// ((float*)VertexManager::s_pCurBufferPointer)[1] = ((float)(signed char)Memory_Read_U8(iAddress+1)+0.5f) / 127.5f;
|
||||
|
@ -199,9 +200,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u16* pData = (const u16 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]));
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(*pData); //Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(*(pData+1)); //Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(*(pData+2)); //Memory_Read_U16(iAddress+4);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(pData[0]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(pData[1]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(pData[2]);
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
}
|
||||
|
@ -210,9 +211,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u32* pData = (const u32 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(*pData); //Memory_Read_U32(iAddress);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(*(pData+1)); //Memory_Read_U32(iAddress+4);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(*(pData+2)); //Memory_Read_U32(iAddress+8);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[0]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(pData[1]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(pData[2]);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
|
@ -223,9 +224,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3_Indices1()
|
|||
const u8* pData = cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData + 3*i); //Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData + 3*i + 1); //Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData + 3*i + 2); //Memory_Read_U8(iAddress+2);
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[3 * i];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[3 * i + 1];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[3 * i + 2];
|
||||
VertexManager::s_pCurBufferPointer++;
|
||||
LOG_NORM8();
|
||||
}
|
||||
|
@ -237,9 +238,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short3_Indices1()
|
|||
const u16* pData = (const u16 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]));
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(*(pData + 3*i)); //Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(*(pData + 3*i + 1)); //Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(*(pData + 3*i + 2)); //Memory_Read_U16(iAddress+4);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(pData[3 * i]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(pData[3 * i + 1]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(pData[3 * i + 2]);
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
}
|
||||
|
@ -251,9 +252,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3_Indices1()
|
|||
const u32* pData = (const u32 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]));
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(*(pData + 3*i)); //Memory_Read_U32(iAddress);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(*(pData + 3*i + 1)); //Memory_Read_U32(iAddress+4);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(*(pData + 3*i + 2)); //Memory_Read_U32(iAddress+8);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[3 * i]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(pData[3 * i + 1]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(pData[3 * i + 2]);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
|
@ -265,9 +266,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3_Indices3()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u8* pData = cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData); //Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData+1); //Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData+2); //Memory_Read_U8(iAddress+2);
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[0];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[1];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[2];
|
||||
*VertexManager::s_pCurBufferPointer++;
|
||||
LOG_NORM8();
|
||||
}
|
||||
|
@ -279,9 +280,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short3_Indices3()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u16* pData = (const u16 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(*(pData)); //Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(*(pData+1)); //Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(*(pData+2)); //Memory_Read_U16(iAddress+4);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(pData[0]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(pData[1]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(pData[2]);
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
}
|
||||
|
@ -293,9 +294,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3_Indices3()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u32* pData = (const u32 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(*(pData)); //Memory_Read_U32(iAddress);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(*(pData+1)); //Memory_Read_U32(iAddress+4);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(*(pData+2)); //Memory_Read_U32(iAddress+8);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[0]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(pData[1]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(pData[2]);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
|
@ -309,9 +310,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u8* pData = cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData); //Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData+1); //Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData+2); //Memory_Read_U8(iAddress+2);
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[0];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[1];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[2];
|
||||
VertexManager::s_pCurBufferPointer++;
|
||||
LOG_NORM8();
|
||||
}
|
||||
|
@ -320,10 +321,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u16* pData = (const u16 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]));
|
||||
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(*(pData));//Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(*(pData+1));//Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(*(pData+2));//Memory_Read_U16(iAddress+4);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(pData[0]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(pData[1]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(pData[2]);
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
}
|
||||
|
@ -332,9 +332,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Float()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u32* pData = (const u32 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(*(pData));//Memory_Read_U32(iAddress);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(*(pData+1));//Memory_Read_U32(iAddress+4);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(*(pData+2));//Memory_Read_U32(iAddress+8);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[0]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(pData[1]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(pData[2]);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
|
@ -345,9 +345,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3_Indices1()
|
|||
const u8* pData = cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]);
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData + 3*i); //Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData + 3*i + 1); //Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData + 3*i + 2); //Memory_Read_U8(iAddress+2);
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[3 * i];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[3 * i + 1];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[3 * i + 2];
|
||||
VertexManager::s_pCurBufferPointer++;
|
||||
LOG_NORM8();
|
||||
}
|
||||
|
@ -360,9 +360,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short3_Indices1()
|
|||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(*(pData + 3*i)); //Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(*(pData + 3*i + 1)); //Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(*(pData + 3*i + 2)); //Memory_Read_U16(iAddress+4);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(pData[3 * i]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(pData[3 * i + 1]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(pData[3 * i + 2]);
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
}
|
||||
|
@ -375,9 +375,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Float3_Indices1()
|
|||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(*(pData + 3*i)); //Memory_Read_U32(iAddress);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(*(pData + 3*i + 1)); //Memory_Read_U32(iAddress+4);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(*(pData + 3*i + 2)); //Memory_Read_U32(iAddress+8);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[3 * i]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(pData[3 * i + 1]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(pData[3 * i + 2]);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
|
@ -389,9 +389,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3_Indices3()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u8* pData = cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i;
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData); //Memory_Read_U8(iAddress);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData+1); //Memory_Read_U8(iAddress+1);
|
||||
*VertexManager::s_pCurBufferPointer++ = *(pData+2); //Memory_Read_U8(iAddress+2);
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[0];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[1];
|
||||
*VertexManager::s_pCurBufferPointer++ = pData[2];
|
||||
VertexManager::s_pCurBufferPointer++;
|
||||
LOG_NORM8();
|
||||
}
|
||||
|
@ -403,13 +403,12 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short3_Indices3()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u16* pData = (const u16 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(*(pData)); //Memory_Read_U16(iAddress);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(*(pData+1)); //Memory_Read_U16(iAddress+2);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(*(pData+2)); //Memory_Read_U16(iAddress+4);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[0] = Common::swap16(pData[0]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[1] = Common::swap16(pData[1]);
|
||||
((u16*)VertexManager::s_pCurBufferPointer)[2] = Common::swap16(pData[2]);
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
LOG_NORM16();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void LOADERDECL VertexLoader_Normal::Normal_Index16_Float3_Indices3()
|
||||
|
@ -418,9 +417,9 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Float3_Indices3()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u32* pData = (const u32 *)(cached_arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(*(pData)); //Memory_Read_U32(iAddress);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(*(pData+1)); //Memory_Read_U32(iAddress+4);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(*(pData+2)); //Memory_Read_U32(iAddress+8);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[0]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(pData[1]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(pData[2]);
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
LOG_NORMF();
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ MOVUPS(MOffset(EDI, 0), XMM0);
|
|||
// Direct
|
||||
// ==============================================================================
|
||||
void LOADERDECL Pos_ReadDirect_UByte()
|
||||
{
|
||||
{
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)DataReadU8() * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)DataReadU8() * posScale;
|
||||
if (pVtxAttr->PosElements)
|
||||
|
@ -138,12 +138,13 @@ void LOADERDECL Pos_ReadDirect_Float()
|
|||
}
|
||||
|
||||
template<class T>
|
||||
inline void Pos_ReadIndex_Byte(int Index) {
|
||||
inline void Pos_ReadIndex_Byte(int Index)
|
||||
{
|
||||
const u8* pData = cached_arraybases[ARRAY_POSITION] + ((u32)Index * arraystrides[ARRAY_POSITION]);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(T)(*(pData))) * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = ((float)(T)(*(pData+1))) * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(T)(pData[0])) * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = ((float)(T)(pData[1])) * posScale;
|
||||
if (pVtxAttr->PosElements)
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = ((float)(T)(*(pData+2))) * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = ((float)(T)(pData[2])) * posScale;
|
||||
else
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f;
|
||||
LOG_VTX();
|
||||
|
@ -151,24 +152,26 @@ inline void Pos_ReadIndex_Byte(int Index) {
|
|||
}
|
||||
|
||||
template<class T>
|
||||
inline void Pos_ReadIndex_Short(int Index) {
|
||||
inline void Pos_ReadIndex_Short(int Index)
|
||||
{
|
||||
const u16* pData = (const u16 *)(cached_arraybases[ARRAY_POSITION] + ((u32)Index * arraystrides[ARRAY_POSITION]));
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(T)Common::swap16(*(pData))) * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = ((float)(T)Common::swap16(*(pData+1))) * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = ((float)(T)Common::swap16(pData[0])) * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = ((float)(T)Common::swap16(pData[1])) * posScale;
|
||||
if (pVtxAttr->PosElements)
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = ((float)(T)Common::swap16(*(pData+2))) * posScale;
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = ((float)(T)Common::swap16(pData[2])) * posScale;
|
||||
else
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f;
|
||||
LOG_VTX();
|
||||
VertexManager::s_pCurBufferPointer += 12;
|
||||
}
|
||||
|
||||
inline void Pos_ReadIndex_Float(int Index) {
|
||||
inline void Pos_ReadIndex_Float(int Index)
|
||||
{
|
||||
const u32* pData = (const u32 *)(cached_arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(*(pData));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(*(pData+1));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[0]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(pData[1]);
|
||||
if (pVtxAttr->PosElements)
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(*(pData+2));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(pData[2]);
|
||||
else
|
||||
((float*)VertexManager::s_pCurBufferPointer)[2] = 1.0f;
|
||||
LOG_VTX();
|
||||
|
|
|
@ -129,8 +129,8 @@ void LOADERDECL TexCoord_ReadIndex8_UByte2()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u8 *pData = cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u8)(*(pData+1)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)(pData[0]) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u8)(pData[1]) * tcScale[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
|
@ -150,8 +150,8 @@ void LOADERDECL TexCoord_ReadIndex8_Byte2()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u8 *pData = cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)(*(pData+1)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)(pData[0]) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)(pData[1]) * tcScale[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
|
@ -170,8 +170,8 @@ void LOADERDECL TexCoord_ReadIndex8_UShort2()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u16 *pData = (const u16 *)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Common::swap16(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u16)Common::swap16(*(pData+1)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Common::swap16(pData[0]) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u16)Common::swap16(pData[1]) * tcScale[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
|
@ -181,7 +181,7 @@ void LOADERDECL TexCoord_ReadIndex8_Short1()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u16 *pData = (const u16 *)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Common::swap16(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Common::swap16(pData[0]) * tcScale[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
|
@ -190,8 +190,8 @@ void LOADERDECL TexCoord_ReadIndex8_Short2()
|
|||
{
|
||||
u8 Index = DataReadU8();
|
||||
const u16 *pData = (const u16 *)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Common::swap16(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)Common::swap16(*(pData+1)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Common::swap16(pData[0]) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)Common::swap16(pData[1]) * tcScale[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
|
@ -201,7 +201,7 @@ void LOADERDECL TexCoord_ReadIndex8_Float1()
|
|||
{
|
||||
u16 Index = DataReadU8();
|
||||
const u32 *pData = (const u32 *)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(*(pData));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[0]);
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
|
@ -210,8 +210,8 @@ void LOADERDECL TexCoord_ReadIndex8_Float2()
|
|||
{
|
||||
u16 Index = DataReadU8();
|
||||
const u32 *pData = (const u32 *)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(*(pData));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(*(pData+1));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[0]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(pData[1]);
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
|
@ -222,7 +222,7 @@ void LOADERDECL TexCoord_ReadIndex16_UByte1()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u8 *pData = cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)(pData[0]) * tcScale[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
|
@ -231,8 +231,8 @@ void LOADERDECL TexCoord_ReadIndex16_UByte2()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u8 *pData = cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u8)(*(pData+1)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u8)(pData[0]) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u8)(pData[1]) * tcScale[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
|
@ -242,7 +242,7 @@ void LOADERDECL TexCoord_ReadIndex16_Byte1()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u8 *pData = cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)(pData[0]) * tcScale[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
|
@ -251,8 +251,8 @@ void LOADERDECL TexCoord_ReadIndex16_Byte2()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u8 *pData = cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]);
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)(*(pData+1)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s8)(pData[0]) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s8)(pData[1]) * tcScale[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
|
@ -262,7 +262,7 @@ void LOADERDECL TexCoord_ReadIndex16_UShort1()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u16* pData = (const u16 *)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Common::swap16(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Common::swap16(pData[0]) * tcScale[tcIndex];
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
|
@ -271,8 +271,8 @@ void LOADERDECL TexCoord_ReadIndex16_UShort2()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u16* pData = (const u16 *)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Common::swap16(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u16)Common::swap16(*(pData+1)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(u16)Common::swap16(pData[0]) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(u16)Common::swap16(pData[1]) * tcScale[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
|
@ -291,8 +291,8 @@ void LOADERDECL TexCoord_ReadIndex16_Short2()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u16 *pData = (const u16 *)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Common::swap16(*(pData)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)Common::swap16(*(pData+1)) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[0] = (float)(s16)Common::swap16(pData[0]) * tcScale[tcIndex];
|
||||
((float*)VertexManager::s_pCurBufferPointer)[1] = (float)(s16)Common::swap16(pData[1]) * tcScale[tcIndex];
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
|
@ -302,7 +302,7 @@ void LOADERDECL TexCoord_ReadIndex16_Float1()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u32 *pData = (const u32 *)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(*(pData));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[0]);
|
||||
LOG_TEX1();
|
||||
VertexManager::s_pCurBufferPointer += 4;
|
||||
tcIndex++;
|
||||
|
@ -311,8 +311,8 @@ void LOADERDECL TexCoord_ReadIndex16_Float2()
|
|||
{
|
||||
u16 Index = DataReadU16();
|
||||
const u32 *pData = (const u32 *)(cached_arraybases[ARRAY_TEXCOORD0+tcIndex] + (Index * arraystrides[ARRAY_TEXCOORD0+tcIndex]));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(*(pData));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(*(pData+1));
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[0]);
|
||||
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(pData[1]);
|
||||
LOG_TEX2();
|
||||
VertexManager::s_pCurBufferPointer += 8;
|
||||
tcIndex++;
|
||||
|
|
Loading…
Reference in New Issue