From c02f56fca33b3ac3d6c889e0659803344fe1d49f Mon Sep 17 00:00:00 2001 From: xsacha Date: Fri, 7 Jan 2011 09:42:44 +0000 Subject: [PATCH] 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 --- .../Plugin_VideoDX9/Src/D3DTexture.cpp | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.cpp b/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.cpp index 3134efedc1..c379506f84 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/D3DTexture.cpp @@ -18,6 +18,8 @@ #include "D3DBase.h" #include "D3DTexture.h" +#include "CPUDetect.h" + #if _M_SSE >= 0x401 #include #include @@ -237,13 +239,15 @@ LPDIRECT3DTEXTURE9 CreateTexture2D(const u8* buffer, const int width, const int } } else { #if _M_SSE >= 0x301 - // Note: Should we use CPUDetect.h and bSSSE3? // Uses SSSE3 intrinsics to optimize RGBA -> BGRA swizzle: - ConvertRGBA_BGRA_SSSE3((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch); -#else - // Uses SSE2 intrinsics to optimize RGBA -> BGRA swizzle: - ConvertRGBA_BGRA_SSE2((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch); + if (cpu_info.bSSSE3) { + ConvertRGBA_BGRA_SSSE3((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch); + } else #endif + // Uses SSE2 intrinsics to optimize RGBA -> BGRA swizzle: + { + ConvertRGBA_BGRA_SSE2((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch); + } #if 0 for (int y = 0; y < height; y++) { @@ -323,13 +327,15 @@ void ReplaceTexture2D(LPDIRECT3DTEXTURE9 pTexture, const u8* buffer, const int w else { #if _M_SSE >= 0x301 - // Note: Should we use CPUDetect.h and bSSSE3? // Uses SSSE3 intrinsics to optimize RGBA -> BGRA swizzle: - ConvertRGBA_BGRA_SSSE3((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch); -#else - // Uses SSE2 intrinsics to optimize RGBA -> BGRA swizzle: - ConvertRGBA_BGRA_SSE2((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch); + if (cpu_info.bSSSE3) { + ConvertRGBA_BGRA_SSSE3((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch); + } else #endif + // Uses SSE2 intrinsics to optimize RGBA -> BGRA swizzle: + { + ConvertRGBA_BGRA_SSE2((u32 *)Lock.pBits, Lock.Pitch, pIn, width, height, pitch); + } #if 0 for (int y = 0; y < height; y++) {