[PICA] Implement CALLC

This commit is contained in:
wheremyfoodat 2023-03-10 00:00:54 +02:00
parent 53d25ba075
commit 4b85ac8cc5
2 changed files with 9 additions and 0 deletions

View file

@ -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);

View file

@ -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