gsdx: properly check SSE support

1/ Check all "levels"
2/ requires AVX for 64 bits
This commit is contained in:
Gregory Hainaut 2016-11-18 17:59:58 +01:00
parent 8b4da69861
commit 82d12691e1
1 changed files with 30 additions and 26 deletions

View File

@ -203,38 +203,42 @@ bool GSUtil::HasCompatibleBits(uint32 spsm, uint32 dpsm)
bool GSUtil::CheckSSE()
{
bool status = true;
Xbyak::util::Cpu cpu;
struct ISA {
Xbyak::util::Cpu::Type type;
const char* instruction_set = "";
const char* name;
};
#if _M_SSE >= 0x501
type = Xbyak::util::Cpu::tAVX2;
instruction_set = "AVX2";
#elif _M_SSE >= 0x500
type = Xbyak::util::Cpu::tAVX;
instruction_set = "AVX";
#elif _M_SSE >= 0x402
type = Xbyak::util::Cpu::tSSE42;
instruction_set = "SSE4.2";
#elif _M_SSE >= 0x401
type = Xbyak::util::Cpu::tSSE41;
instruction_set = "SSE4.1";
#elif _M_SSE >= 0x301
type = Xbyak::util::Cpu::tSSSE3;
instruction_set = "SSSE3";
#elif _M_SSE >= 0x200
type = Xbyak::util::Cpu::tSSE2;
instruction_set = "SSE2";
ISA checks[] = {
{Xbyak::util::Cpu::tSSE2, "SSE2"},
#if _M_SSE >= 0x301 || defined(_M_AMD64)
{Xbyak::util::Cpu::tSSSE3, "SSSE3"},
#endif
#if _M_SSE >= 0x401 || defined(_M_AMD64)
{Xbyak::util::Cpu::tSSE41, "SSE41"},
#endif
#if _M_SSE >= 0x402 || defined(_M_AMD64)
{Xbyak::util::Cpu::tSSE42, "SSE42"},
#endif
#if _M_SSE >= 0x500 || defined(_M_AMD64)
{Xbyak::util::Cpu::tAVX, "AVX1"},
#endif
#if _M_SSE >= 0x501
{Xbyak::util::Cpu::tAVX2, "AVX2"},
#endif
};
if(!cpu.has(type))
{
fprintf(stderr, "This CPU does not support %s\n", instruction_set);
for (size_t i = 0; i < countof(checks); i++) {
if(!cpu.has(checks[i].type)) {
fprintf(stderr, "This CPU does not support %s\n", checks[i].name);
return false;
status = false;
}
}
return true;
return status;
}
#define OCL_PROGRAM_VERSION 3