summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/VertexLoader_TextCoord.cpp
diff options
context:
space:
mode:
authornodchip <nodchip@gmail.com>2010-02-24 09:56:41 +0000
committernodchip <nodchip@gmail.com>2010-02-24 09:56:41 +0000
commit47fb73b71a27d1a1aaa9a7dc160de573c92a9ee3 (patch)
treed773daf9d479ece37ce0f44ba00d810ea5ed4015 /Source/Core/VideoCommon/Src/VertexLoader_TextCoord.cpp
parentdc9d533d4f4d228052b74f828c9b78b5f73d6c1b (diff)
Added SSSE3/SSE4.1 code for speed up. The code does not work in this revision because cpu_info is not initialized properly. I will fix the issue in another commit.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5119 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon/Src/VertexLoader_TextCoord.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/VertexLoader_TextCoord.cpp29
1 files changed, 23 insertions, 6 deletions
diff --git a/Source/Core/VideoCommon/Src/VertexLoader_TextCoord.cpp b/Source/Core/VideoCommon/Src/VertexLoader_TextCoord.cpp
index 00f4a31667..036d0e13cf 100644
--- a/Source/Core/VideoCommon/Src/VertexLoader_TextCoord.cpp
+++ b/Source/Core/VideoCommon/Src/VertexLoader_TextCoord.cpp
@@ -18,7 +18,9 @@
#ifndef VERTEXLOADER_TEXCOORD_H
#define VERTEXLOADER_TEXCOORD_H
+#include <nmmintrin.h>
#include "Common.h"
+#include "CPUDetect.h"
#include "VideoCommon.h"
#include "VertexLoader.h"
#include "VertexLoader_Position.h"
@@ -308,15 +310,30 @@ void LOADERDECL TexCoord_ReadIndex16_Float1()
VertexManager::s_pCurBufferPointer += 4;
tcIndex++;
}
-void LOADERDECL TexCoord_ReadIndex16_Float2()
+
+static const __m128i kMaskSwap32 = _mm_set_epi32(0xFFFFFFFFL, 0xFFFFFFFFL, 0x04050607L, 0x00010203L);
+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[0]);
- ((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(pData[1]);
- LOG_TEX2();
- VertexManager::s_pCurBufferPointer += 8;
- tcIndex++;
+
+ if (cpu_info.bSSSE3) {
+ const __m128i a = _mm_loadl_epi64((__m128i*)pData);
+ const __m128i b = _mm_shuffle_epi8(a, kMaskSwap32);
+ u8* p = VertexManager::s_pCurBufferPointer;
+ _mm_storel_epi64((__m128i*)p, b);
+ LOG_TEX2();
+ p += 8;
+ VertexManager::s_pCurBufferPointer = p;
+ tcIndex++;
+
+ } else {
+ ((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++;
+ }
}
#endif