VERY experimental Nintendo Switch 2 emulator
C++
Shader: implement EX2 and LG2 in JIT
aroulin28f5cdc0dd13
diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cppindex 836942c6bb..93f608584f 100644--- a/src/video_core/shader/shader_jit_x64.cpp+++ b/src/video_core/shader/shader_jit_x64.cpp@@ -25,8 +25,8 @@ const JitFunction instr_table[64] = {&JitCompiler::Compile_DP4, // dp4nullptr, // dphnullptr, // unknown- nullptr, // ex2- nullptr, // lg2+ &JitCompiler::Compile_EX2, // ex2+ &JitCompiler::Compile_LG2, // lg2nullptr, // unknown&JitCompiler::Compile_MUL, // mulnullptr, // lge@@ -331,6 +331,24 @@ void JitCompiler::Compile_DP4(Instruction instr) {Compile_DestEnable(instr, SRC1);}+void JitCompiler::Compile_EX2(Instruction instr) {+ Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1);+ MOVSS(XMM0, R(SRC1));+ ABI_CallFunction(reinterpret_cast<const void*>(exp2f));+ SHUFPS(XMM0, R(XMM0), _MM_SHUFFLE(0, 0, 0, 0));+ MOVAPS(SRC1, R(XMM0));+ Compile_DestEnable(instr, SRC1);+}++void JitCompiler::Compile_LG2(Instruction instr) {+ Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1);+ MOVSS(XMM0, R(SRC1));+ ABI_CallFunction(reinterpret_cast<const void*>(log2f));+ SHUFPS(XMM0, R(XMM0), _MM_SHUFFLE(0, 0, 0, 0));+ MOVAPS(SRC1, R(XMM0));+ Compile_DestEnable(instr, SRC1);+}+void JitCompiler::Compile_MUL(Instruction instr) {Compile_SwizzleSrc(instr, 1, instr.common.src1, SRC1);Compile_SwizzleSrc(instr, 2, instr.common.src2, SRC2);diff --git a/src/video_core/shader/shader_jit_x64.h b/src/video_core/shader/shader_jit_x64.hindex b88f2a0d24..104f9f4668 100644--- a/src/video_core/shader/shader_jit_x64.h+++ b/src/video_core/shader/shader_jit_x64.h@@ -37,6 +37,8 @@ public:void Compile_ADD(Instruction instr);void Compile_DP3(Instruction instr);void Compile_DP4(Instruction instr);+ void Compile_EX2(Instruction instr);+ void Compile_LG2(Instruction instr);void Compile_MUL(Instruction instr);void Compile_FLR(Instruction instr);void Compile_MAX(Instruction instr);