diff --git a/plugins/GSdx/GSSetupPrimCodeGenerator.cpp b/plugins/GSdx/GSSetupPrimCodeGenerator.cpp index 37427898f8..3735ec9a41 100644 --- a/plugins/GSdx/GSSetupPrimCodeGenerator.cpp +++ b/plugins/GSdx/GSSetupPrimCodeGenerator.cpp @@ -22,6 +22,8 @@ #include "stdafx.h" #include "GSSetupPrimCodeGenerator.h" +using namespace Xbyak; + #if _M_SSE >= 0x501 GSVector8 GSSetupPrimCodeGenerator::m_shift[9]; #else @@ -75,3 +77,14 @@ GSSetupPrimCodeGenerator::GSSetupPrimCodeGenerator(void* param, uint64 key, void Generate(); } + +#if _M_SSE >= 0x501 +#else +void GSSetupPrimCodeGenerator::Generate() +{ + if(g_cpu.has(util::Cpu::tAVX)) + Generate_AVX(); + else + Generate_SSE(); +} +#endif diff --git a/plugins/GSdx/GSSetupPrimCodeGenerator.h b/plugins/GSdx/GSSetupPrimCodeGenerator.h index d4b2c1106f..e07eb00334 100644 --- a/plugins/GSdx/GSSetupPrimCodeGenerator.h +++ b/plugins/GSdx/GSSetupPrimCodeGenerator.h @@ -23,6 +23,7 @@ #include "GSScanlineEnvironment.h" #include "GSFunctionMap.h" +#include "GSUtil.h" class GSSetupPrimCodeGenerator : public GSCodeGenerator { @@ -35,9 +36,21 @@ class GSSetupPrimCodeGenerator : public GSCodeGenerator void Generate(); +#if _M_SSE < 0x501 + void Generate_SSE(); + void Depth_SSE(); + void Texture_SSE(); + void Color_SSE(); + + void Generate_AVX(); + void Depth_AVX(); + void Texture_AVX(); + void Color_AVX(); +#else void Depth(); void Texture(); void Color(); +#endif public: GSSetupPrimCodeGenerator(void* param, uint64 key, void* code, size_t maxsize); diff --git a/plugins/GSdx/GSSetupPrimCodeGenerator.x64.avx.cpp b/plugins/GSdx/GSSetupPrimCodeGenerator.x64.avx.cpp index f42d4feb1b..f8f88022af 100644 --- a/plugins/GSdx/GSSetupPrimCodeGenerator.x64.avx.cpp +++ b/plugins/GSdx/GSSetupPrimCodeGenerator.x64.avx.cpp @@ -23,11 +23,11 @@ #include "GSSetupPrimCodeGenerator.h" #include "GSVertexSW.h" -#if _M_SSE == 0x500 && (defined(_M_AMD64) || defined(_WIN64)) +#if _M_SSE < 0x501 && (defined(_M_AMD64) || defined(_WIN64)) using namespace Xbyak; -void GSSetupPrimCodeGenerator::Generate() +void GSSetupPrimCodeGenerator::Generate_AVX() { #ifdef _WIN64 sub(rsp, 8 + 2 * 16); @@ -48,11 +48,11 @@ void GSSetupPrimCodeGenerator::Generate() } } - Depth(); + Depth_AVX(); - Texture(); + Texture_AVX(); - Color(); + Color_AVX(); #ifdef _WIN64 vmovdqa(xmm6, ptr[rsp + 0]); @@ -64,7 +64,7 @@ void GSSetupPrimCodeGenerator::Generate() ret(); } -void GSSetupPrimCodeGenerator::Depth() +void GSSetupPrimCodeGenerator::Depth_AVX() { if(!m_en.z && !m_en.f) { @@ -158,7 +158,7 @@ void GSSetupPrimCodeGenerator::Depth() } } -void GSSetupPrimCodeGenerator::Texture() +void GSSetupPrimCodeGenerator::Texture_AVX() { if(!m_en.t) { @@ -234,7 +234,7 @@ void GSSetupPrimCodeGenerator::Texture() } } -void GSSetupPrimCodeGenerator::Color() +void GSSetupPrimCodeGenerator::Color_AVX() { if(!m_en.c) { diff --git a/plugins/GSdx/GSSetupPrimCodeGenerator.x64.cpp b/plugins/GSdx/GSSetupPrimCodeGenerator.x64.cpp index 238dd86bdc..b4169e766f 100644 --- a/plugins/GSdx/GSSetupPrimCodeGenerator.x64.cpp +++ b/plugins/GSdx/GSSetupPrimCodeGenerator.x64.cpp @@ -23,11 +23,11 @@ #include "GSSetupPrimCodeGenerator.h" #include "GSVertexSW.h" -#if _M_SSE < 0x500 && (defined(_M_AMD64) || defined(_WIN64)) +#if _M_SSE < 0x501 && (defined(_M_AMD64) || defined(_WIN64)) using namespace Xbyak; -void GSSetupPrimCodeGenerator::Generate() +void GSSetupPrimCodeGenerator::Generate_SSE() { #ifdef _WIN64 sub(rsp, 8 + 2 * 16); @@ -48,11 +48,11 @@ void GSSetupPrimCodeGenerator::Generate() } } - Depth(); + Depth_SSE(); - Texture(); + Texture_SSE(); - Color(); + Color_SSE(); #ifdef _WIN64 vmovdqa(xmm6, ptr[rsp + 0]); @@ -64,7 +64,7 @@ void GSSetupPrimCodeGenerator::Generate() ret(); } -void GSSetupPrimCodeGenerator::Depth() +void GSSetupPrimCodeGenerator::Depth_SSE() { if(!m_en.z && !m_en.f) { @@ -163,7 +163,7 @@ void GSSetupPrimCodeGenerator::Depth() } } -void GSSetupPrimCodeGenerator::Texture() +void GSSetupPrimCodeGenerator::Texture_SSE() { if(!m_en.t) { @@ -242,7 +242,7 @@ void GSSetupPrimCodeGenerator::Texture() } } -void GSSetupPrimCodeGenerator::Color() +void GSSetupPrimCodeGenerator::Color_SSE() { if(!m_en.c) { diff --git a/plugins/GSdx/GSSetupPrimCodeGenerator.x86.avx.cpp b/plugins/GSdx/GSSetupPrimCodeGenerator.x86.avx.cpp index 21a7d47c97..f75ea3b6d2 100644 --- a/plugins/GSdx/GSSetupPrimCodeGenerator.x86.avx.cpp +++ b/plugins/GSdx/GSSetupPrimCodeGenerator.x86.avx.cpp @@ -23,7 +23,7 @@ #include "GSSetupPrimCodeGenerator.h" #include "GSVertexSW.h" -#if _M_SSE == 0x500 && !(defined(_M_AMD64) || defined(_WIN64)) +#if _M_SSE < 0x501 && !(defined(_M_AMD64) || defined(_WIN64)) using namespace Xbyak; @@ -32,7 +32,7 @@ static const int _vertex = _args + 4; static const int _index = _args + 8; static const int _dscan = _args + 12; -void GSSetupPrimCodeGenerator::Generate() +void GSSetupPrimCodeGenerator::Generate_AVX() { if((m_en.z || m_en.f) && m_sel.prim != GS_SPRITE_CLASS || m_en.t || m_en.c && m_sel.iip) { @@ -44,16 +44,16 @@ void GSSetupPrimCodeGenerator::Generate() } } - Depth(); + Depth_AVX(); - Texture(); + Texture_AVX(); - Color(); + Color_AVX(); ret(); } -void GSSetupPrimCodeGenerator::Depth() +void GSSetupPrimCodeGenerator::Depth_AVX() { if(!m_en.z && !m_en.f) { @@ -144,7 +144,7 @@ void GSSetupPrimCodeGenerator::Depth() } } -void GSSetupPrimCodeGenerator::Texture() +void GSSetupPrimCodeGenerator::Texture_AVX() { if(!m_en.t) { @@ -213,7 +213,7 @@ void GSSetupPrimCodeGenerator::Texture() } } -void GSSetupPrimCodeGenerator::Color() +void GSSetupPrimCodeGenerator::Color_AVX() { if(!m_en.c) { @@ -339,4 +339,4 @@ void GSSetupPrimCodeGenerator::Color() } } -#endif \ No newline at end of file +#endif diff --git a/plugins/GSdx/GSSetupPrimCodeGenerator.x86.cpp b/plugins/GSdx/GSSetupPrimCodeGenerator.x86.cpp index 008a12a8f5..951788fa09 100644 --- a/plugins/GSdx/GSSetupPrimCodeGenerator.x86.cpp +++ b/plugins/GSdx/GSSetupPrimCodeGenerator.x86.cpp @@ -23,7 +23,7 @@ #include "GSSetupPrimCodeGenerator.h" #include "GSVertexSW.h" -#if _M_SSE < 0x500 && !(defined(_M_AMD64) || defined(_WIN64)) +#if _M_SSE < 0x501 && !(defined(_M_AMD64) || defined(_WIN64)) using namespace Xbyak; @@ -32,7 +32,7 @@ static const int _vertex = _args + 4; static const int _index = _args + 8; static const int _dscan = _args + 12; -void GSSetupPrimCodeGenerator::Generate() +void GSSetupPrimCodeGenerator::Generate_SSE() { if((m_en.z || m_en.f) && m_sel.prim != GS_SPRITE_CLASS || m_en.t || m_en.c && m_sel.iip) { @@ -44,16 +44,16 @@ void GSSetupPrimCodeGenerator::Generate() } } - Depth(); + Depth_SSE(); - Texture(); + Texture_SSE(); - Color(); + Color_SSE(); ret(); } -void GSSetupPrimCodeGenerator::Depth() +void GSSetupPrimCodeGenerator::Depth_SSE() { if(!m_en.z && !m_en.f) { @@ -149,7 +149,7 @@ void GSSetupPrimCodeGenerator::Depth() } } -void GSSetupPrimCodeGenerator::Texture() +void GSSetupPrimCodeGenerator::Texture_SSE() { if(!m_en.t) { @@ -221,7 +221,7 @@ void GSSetupPrimCodeGenerator::Texture() } } -void GSSetupPrimCodeGenerator::Color() +void GSSetupPrimCodeGenerator::Color_SSE() { if(!m_en.c) { @@ -354,4 +354,4 @@ void GSSetupPrimCodeGenerator::Color() } } -#endif \ No newline at end of file +#endif