diff options
| author | hrydgard <hrydgard@gmail.com> | 2009-02-15 13:45:03 +0000 |
|---|---|---|
| committer | hrydgard <hrydgard@gmail.com> | 2009-02-15 13:45:03 +0000 |
| commit | 6deb87c17602a26638203a1b06fe37cb7a58810b (patch) | |
| tree | d5b46defb7cb7f80d2783b802eb60e711351a042 /Source/Core/VideoCommon/Src/VertexLoader_Position.cpp | |
| parent | e5e55534ace34c81a1acdebf23b7ab45bb3fd6a6 (diff) | |
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
Diffstat (limited to 'Source/Core/VideoCommon/Src/VertexLoader_Position.cpp')
| -rw-r--r-- | Source/Core/VideoCommon/Src/VertexLoader_Position.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/Source/Core/VideoCommon/Src/VertexLoader_Position.cpp b/Source/Core/VideoCommon/Src/VertexLoader_Position.cpp index dc920559a4..d0032669cc 100644 --- a/Source/Core/VideoCommon/Src/VertexLoader_Position.cpp +++ b/Source/Core/VideoCommon/Src/VertexLoader_Position.cpp @@ -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(); |
