summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/VertexLoader_Position.cpp
diff options
context:
space:
mode:
authornodchip <nodchip@gmail.com>2010-04-09 03:02:12 +0000
committernodchip <nodchip@gmail.com>2010-04-09 03:02:12 +0000
commit6136c94de594713375d2df4dc2b3d36c55699e76 (patch)
tree0d945214845fd66c70f3ebac484d698ed77a2c62 /Source/Core/VideoCommon/Src/VertexLoader_Position.cpp
parent73caf37bcab99de6b9c87d1a35738df31a6465cd (diff)
VideoCommon: merged SSSE3/SSE4.1 codes. Added some additional SSSE3/SSE4.1 codes which will be used in "The Legend of Zelda: Twilight Princess".
These codes don't work unless "_M_SSE=0x301", for SSSE3, or "_M_SSE=0x401", for SSE4.1, is defined as a preprocessor definition. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5300 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source/Core/VideoCommon/Src/VertexLoader_Position.cpp')
-rw-r--r--Source/Core/VideoCommon/Src/VertexLoader_Position.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/Src/VertexLoader_Position.cpp b/Source/Core/VideoCommon/Src/VertexLoader_Position.cpp
index aa193d4955..6ff0884cec 100644
--- a/Source/Core/VideoCommon/Src/VertexLoader_Position.cpp
+++ b/Source/Core/VideoCommon/Src/VertexLoader_Position.cpp
@@ -21,6 +21,10 @@
#include "VertexLoader_Position.h"
#include "NativeVertexWriter.h"
+#if _M_SSE >= 301
+#include <tmmintrin.h>
+#endif
+
extern float posScale;
extern TVtxAttr *pVtxAttr;
@@ -146,16 +150,33 @@ inline void Pos_ReadIndex_Short(int Index)
VertexManager::s_pCurBufferPointer += 12;
}
+#if _M_SSE >= 0x301
+static const __m128i kMaskSwap32_3 = _mm_set_epi32(0xFFFFFFFFL, 0x08090A0BL, 0x04050607L, 0x00010203L);
+static const __m128i kMaskSwap32_2 = _mm_set_epi32(0xFFFFFFFFL, 0xFFFFFFFFL, 0x04050607L, 0x00010203L);
+#endif
+
template<bool three>
inline void Pos_ReadIndex_Float(int Index)
{
const u32* pData = (const u32 *)(cached_arraybases[ARRAY_POSITION] + (Index * arraystrides[ARRAY_POSITION]));
+
+#if _M_SSE >= 0x301
+
+ const __m128i a = _mm_loadu_si128((__m128i*)pData);
+ __m128i b = _mm_shuffle_epi8(a, three ? kMaskSwap32_3 : kMaskSwap32_2);
+ _mm_storeu_si128((__m128i*)VertexManager::s_pCurBufferPointer, b);
+
+#else
+
((u32*)VertexManager::s_pCurBufferPointer)[0] = Common::swap32(pData[0]);
((u32*)VertexManager::s_pCurBufferPointer)[1] = Common::swap32(pData[1]);
if (three)
((u32*)VertexManager::s_pCurBufferPointer)[2] = Common::swap32(pData[2]);
else
((float*)VertexManager::s_pCurBufferPointer)[2] = 0.0f;
+
+#endif
+
LOG_VTX();
VertexManager::s_pCurBufferPointer += 12;
}