From 4b85ac8cc541ff67c00c6a15253f3ef6fdfbc56a Mon Sep 17 00:00:00 2001 From: wheremyfoodat Date: Fri, 10 Mar 2023 00:00:54 +0200 Subject: [PATCH] [PICA] Implement CALLC --- include/PICA/shader.hpp | 2 ++ src/core/PICA/shader_interpreter.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/PICA/shader.hpp b/include/PICA/shader.hpp index 03b2970e..9f0c34cc 100644 --- a/include/PICA/shader.hpp +++ b/include/PICA/shader.hpp @@ -25,6 +25,7 @@ namespace ShaderOpcodes { NOP = 0x21, END = 0x22, CALL = 0x24, + CALLC = 0x25, CALLU = 0x26, IFU = 0x27, IFC = 0x28, @@ -87,6 +88,7 @@ class PICAShader { // Shader opcodes void add(u32 instruction); void call(u32 instruction); + void callc(u32 instruction); void callu(u32 instruction); void cmp(u32 instruction); void dp3(u32 instruction); diff --git a/src/core/PICA/shader_interpreter.cpp b/src/core/PICA/shader_interpreter.cpp index c08f714d..f1caa7a9 100644 --- a/src/core/PICA/shader_interpreter.cpp +++ b/src/core/PICA/shader_interpreter.cpp @@ -14,6 +14,7 @@ void PICAShader::run() { switch (opcode) { case ShaderOpcodes::ADD: add(instruction); break; case ShaderOpcodes::CALL: call(instruction); break; + case ShaderOpcodes::CALLC: callc(instruction); break; case ShaderOpcodes::CALLU: callu(instruction); break; case ShaderOpcodes::CMP1: case ShaderOpcodes::CMP2: cmp(instruction); @@ -451,6 +452,12 @@ void PICAShader::call(u32 instruction) { pc = dest; } +void PICAShader::callc(u32 instruction) { + if (isCondTrue(instruction)) { + call(instruction); // Pls inline + } +} + void PICAShader::callu(u32 instruction) { const u32 bit = (instruction >> 22) & 0xf; // Bit of the bool uniform to check