summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/Src/VertexLoader_Position.cpp
diff options
context:
space:
mode:
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;
}