diff --git a/include/PICA/shader.hpp b/include/PICA/shader.hpp index fd777d99..d6761546 100644 --- a/include/PICA/shader.hpp +++ b/include/PICA/shader.hpp @@ -30,6 +30,7 @@ namespace ShaderOpcodes { IFU = 0x27, IFC = 0x28, LOOP = 0x29, + JMPC = 0x2C, JMPU = 0x2D, CMP1 = 0x2E, // Both of these instructions are CMP CMP2 = 0x2F, @@ -96,6 +97,7 @@ class PICAShader { void dp4(u32 instruction); void ifc(u32 instruction); void ifu(u32 instruction); + void jmpc(u32 instruction); void jmpu(u32 instruction); void loop(u32 instruction); void mad(u32 instruction); diff --git a/src/core/PICA/shader_interpreter.cpp b/src/core/PICA/shader_interpreter.cpp index 37db0979..dac64549 100644 --- a/src/core/PICA/shader_interpreter.cpp +++ b/src/core/PICA/shader_interpreter.cpp @@ -24,6 +24,7 @@ void PICAShader::run() { case ShaderOpcodes::END: return; // Stop running shader case ShaderOpcodes::IFC: ifc(instruction); break; case ShaderOpcodes::IFU: ifu(instruction); break; + case ShaderOpcodes::JMPC: jmpc(instruction); break; case ShaderOpcodes::JMPU: jmpu(instruction); break; case ShaderOpcodes::LOOP: loop(instruction); break; case ShaderOpcodes::MAX: max(instruction); break; @@ -492,6 +493,11 @@ void PICAShader::loop(u32 instruction) { loop.increment = uniform.z(); } +void PICAShader::jmpc(u32 instruction) { + if (isCondTrue(instruction)) + pc = (instruction >> 10) & 0xfff; +} + void PICAShader::jmpu(u32 instruction) { const u32 test = (instruction & 1) ^ 1; // If the LSB is 0 we want to compare to true, otherwise compare to false const u32 dest = (instruction >> 10) & 0xfff;