diff options
Diffstat (limited to 'Source/Core/VideoCommon/Src/VertexLoader_Normal.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexLoader_Normal.cpp | 149 |
1 files changed, 89 insertions, 60 deletions
diff --git a/Source/Core/VideoCommon/Src/VertexLoader_Normal.cpp b/Source/Core/VideoCommon/Src/VertexLoader_Normal.cpp index da2f990594..df5975c31e 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader_Normal.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader_Normal.cpp @@ -184,9 +184,10 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte() { u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2); + u8* pData = Memory_Read_U8_Ptr(iAddress); + *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++; // ((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,10 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short() { u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); - ((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress); - ((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2); - ((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4); + u16* pData = Memory_Read_U16_Unswapped_Ptr(iAddress); + ((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); VertexManager::s_pCurBufferPointer += 8; LOG_NORM16(); } @@ -210,9 +212,10 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float() { u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); - ((u32*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U32(iAddress); - ((u32*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U32(iAddress+4); - ((u32*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U32(iAddress+8); + u32* pData = Memory_Read_U32_Unswapped_Ptr(iAddress); + ((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); VertexManager::s_pCurBufferPointer += 12; LOG_NORMF(); } @@ -220,12 +223,15 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float() void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3_Indices1() { u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); + u8* pData = Memory_Read_U8_Ptr(iAddress); + for (int i = 0; i < 3; i++) { - u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i; - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2); + //u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*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++; LOG_NORM8(); } @@ -234,12 +240,15 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3_Indices1() void LOADERDECL VertexLoader_Normal::Normal_Index8_Short3_Indices1() { u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); + u16* pData = Memory_Read_U16_Unswapped_Ptr(iAddress); + for (int i = 0; i < 3; i++) { - u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i; - ((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress); - ((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2); - ((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4); + //u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*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); VertexManager::s_pCurBufferPointer += 8; LOG_NORM16(); } @@ -248,12 +257,14 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short3_Indices1() void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3_Indices1() { u8 Index = DataReadU8(); + u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); + u32* pData = Memory_Read_U32_Unswapped_Ptr(iAddress); for (int i = 0; i < 3; i++) { - u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i; - ((u32*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U32(iAddress); - ((u32*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U32(iAddress+4); - ((u32*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U32(iAddress+8); + //u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*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); VertexManager::s_pCurBufferPointer += 12; LOG_NORMF(); } @@ -265,9 +276,10 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Byte3_Indices3() { u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i; - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2); + u8* pData = Memory_Read_U8_Ptr(iAddress); + *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++; LOG_NORM8(); } @@ -279,9 +291,10 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Short3_Indices3() { u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i; - ((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress); - ((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2); - ((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4); + u16* pData = Memory_Read_U16_Unswapped_Ptr(iAddress); + ((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); VertexManager::s_pCurBufferPointer += 8; LOG_NORM16(); } @@ -293,9 +306,10 @@ void LOADERDECL VertexLoader_Normal::Normal_Index8_Float3_Indices3() { u8 Index = DataReadU8(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i; - ((u32*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U32(iAddress); - ((u32*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U32(iAddress+4); - ((u32*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U32(iAddress+8); + u32* pData = Memory_Read_U32_Unswapped_Ptr(iAddress); + ((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); VertexManager::s_pCurBufferPointer += 12; LOG_NORMF(); } @@ -309,9 +323,10 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte() { u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2); + u8* pData = Memory_Read_U8_Ptr(iAddress); + *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++; LOG_NORM8(); } @@ -320,9 +335,11 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short() { u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); - ((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress); - ((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2); - ((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4); + u16* pData = Memory_Read_U16_Unswapped_Ptr(iAddress); + + ((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); VertexManager::s_pCurBufferPointer += 8; LOG_NORM16(); } @@ -331,9 +348,10 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Float() { u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); - ((u32*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U32(iAddress); - ((u32*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U32(iAddress+4); - ((u32*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U32(iAddress+8); + u32* pData = Memory_Read_U32_Unswapped_Ptr(iAddress); + ((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); VertexManager::s_pCurBufferPointer += 12; LOG_NORMF(); } @@ -341,12 +359,14 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Float() void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3_Indices1() { u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); + u8* pData = Memory_Read_U8_Ptr(iAddress); for (int i = 0; i < 3; i++) { - u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i; - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2); + //u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*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++; LOG_NORM8(); } @@ -355,12 +375,15 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3_Indices1() void LOADERDECL VertexLoader_Normal::Normal_Index16_Short3_Indices1() { u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); + u16* pData = Memory_Read_U16_Unswapped_Ptr(iAddress); + for (int i = 0; i < 3; i++) { - u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i; - ((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress); - ((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2); - ((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4); + //u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*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); VertexManager::s_pCurBufferPointer += 8; LOG_NORM16(); } @@ -369,12 +392,15 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short3_Indices1() void LOADERDECL VertexLoader_Normal::Normal_Index16_Float3_Indices1() { u16 Index = DataReadU16(); + u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]); + u32* pData = Memory_Read_U32_Unswapped_Ptr(iAddress); + for (int i = 0; i < 3; i++) { - u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i; - ((u32*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U32(iAddress); - ((u32*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U32(iAddress+4); - ((u32*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U32(iAddress+8); + //u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*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); VertexManager::s_pCurBufferPointer += 12; LOG_NORMF(); } @@ -386,9 +412,10 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Byte3_Indices3() { u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 1*3*i; - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+1); - *VertexManager::s_pCurBufferPointer++ = Memory_Read_U8(iAddress+2); + u8* pData = Memory_Read_U8_Ptr(iAddress); + *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++; LOG_NORM8(); } @@ -400,9 +427,10 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Short3_Indices3() { u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 2*3*i; - ((u16*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U16(iAddress); - ((u16*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U16(iAddress+2); - ((u16*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U16(iAddress+4); + u16* pData = Memory_Read_U16_Unswapped_Ptr(iAddress); + ((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); VertexManager::s_pCurBufferPointer += 8; LOG_NORM16(); } @@ -415,9 +443,10 @@ void LOADERDECL VertexLoader_Normal::Normal_Index16_Float3_Indices3() { u16 Index = DataReadU16(); u32 iAddress = arraybases[ARRAY_NORMAL] + (Index * arraystrides[ARRAY_NORMAL]) + 4*3*i; - ((u32*)VertexManager::s_pCurBufferPointer)[0] = Memory_Read_U32(iAddress); - ((u32*)VertexManager::s_pCurBufferPointer)[1] = Memory_Read_U32(iAddress+4); - ((u32*)VertexManager::s_pCurBufferPointer)[2] = Memory_Read_U32(iAddress+8); + u32* pData = Memory_Read_U32_Unswapped_Ptr(iAddress); + ((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); VertexManager::s_pCurBufferPointer += 12; LOG_NORMF(); } |
