VERY experimental Nintendo Switch 2 emulator
C++
Shader: Implement "invert condition" feature of IFU instruction
Yuri Kunde Schlesnerb4c68589f6ca
diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cppindex 7b0c20b740..aeced71b0b 100644--- a/src/video_core/shader/shader_interpreter.cpp+++ b/src/video_core/shader/shader_interpreter.cpp@@ -515,7 +515,8 @@ void RunInterpreter(UnitState<Debug>& state) {case OpCode::Id::JMPU:Record<DebugDataRecord::COND_BOOL_IN>(state.debug, iteration, uniforms.b[instr.flow_control.bool_uniform_id]);- if (uniforms.b[instr.flow_control.bool_uniform_id]) {++ if (uniforms.b[instr.flow_control.bool_uniform_id] == !(instr.flow_control.num_instructions & 1)) {state.program_counter = instr.flow_control.dest_offset - 1;}break;diff --git a/src/video_core/shader/shader_jit_x64.cpp b/src/video_core/shader/shader_jit_x64.cppindex 00415e402d..6554830b22 100644--- a/src/video_core/shader/shader_jit_x64.cpp+++ b/src/video_core/shader/shader_jit_x64.cpp@@ -710,7 +710,9 @@ void JitCompiler::Compile_JMP(Instruction instr) {elseUNREACHABLE();- FixupBranch b = J_CC(CC_NZ, true);+ bool inverted_condition = (instr.opcode.Value() == OpCode::Id::JMPU) &&+ (instr.flow_control.num_instructions & 1);+ FixupBranch b = J_CC(inverted_condition ? CC_Z : CC_NZ, true);Compile_Block(instr.flow_control.dest_offset);