Use CPUDetect.h and bSSSE3 to fix "unknown machine instructions" on DX9 plugin.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@6767 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
xsacha 2011-01-07 09:42:44 +00:00
parent c4477f68e1
commit c02f56fca3

View File

@ -18,6 +18,8 @@
#include "D3DBase.h" #include "D3DBase.h"
#include "D3DTexture.h" #include "D3DTexture.h"
#include "CPUDetect.h"
#if _M_SSE >= 0x401 #if _M_SSE >= 0x401
#include <smmintrin.h> #include <smmintrin.h>
#include <emmintrin.h> #include <emmintrin.h>
@ -237,13 +239,15 @@ LPDIRECT3DTEXTURE9 CreateTexture2D(const u8* buffer, const int width, const int
} }
} else { } else {
#if _M_SSE >= 0x301 #if _M_SSE >= 0x301
// Note: Should we use CPUDetect.h and bSSSE3?
// Uses SSSE3 intrinsics to optimize RGBA -> BGRA swizzle: // Uses SSSE3 intrinsics to optimize RGBA -> BGRA swizzle:
ConvertRGBA_BGRA_SSSE3((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch); if (cpu_info.bSSSE3) {
#else ConvertRGBA_BGRA_SSSE3((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch);
// Uses SSE2 intrinsics to optimize RGBA -> BGRA swizzle: } else
ConvertRGBA_BGRA_SSE2((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch);
#endif #endif
// Uses SSE2 intrinsics to optimize RGBA -> BGRA swizzle:
{
ConvertRGBA_BGRA_SSE2((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch);
}
#if 0 #if 0
for (int y = 0; y < height; y++) for (int y = 0; y < height; y++)
{ {
@ -323,13 +327,15 @@ void ReplaceTexture2D(LPDIRECT3DTEXTURE9 pTexture, const u8* buffer, const int w
else else
{ {
#if _M_SSE >= 0x301 #if _M_SSE >= 0x301
// Note: Should we use CPUDetect.h and bSSSE3?
// Uses SSSE3 intrinsics to optimize RGBA -> BGRA swizzle: // Uses SSSE3 intrinsics to optimize RGBA -> BGRA swizzle:
ConvertRGBA_BGRA_SSSE3((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch); if (cpu_info.bSSSE3) {
#else ConvertRGBA_BGRA_SSSE3((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch);
// Uses SSE2 intrinsics to optimize RGBA -> BGRA swizzle: } else
ConvertRGBA_BGRA_SSE2((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch);
#endif #endif
// Uses SSE2 intrinsics to optimize RGBA -> BGRA swizzle:
{
ConvertRGBA_BGRA_SSE2((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch);
}
#if 0 #if 0
for (int y = 0; y < height; y++) for (int y = 0; y < height; y++)
{ {