[Shader interpreter] Implement CALL
This commit is contained in:
@@ -13,6 +13,7 @@ void PICAShader::run() {
|
||||
|
||||
switch (opcode) {
|
||||
case ShaderOpcodes::ADD: add(instruction); break;
|
||||
case ShaderOpcodes::CALL: call(instruction); break;
|
||||
case ShaderOpcodes::CALLU: callu(instruction); break;
|
||||
case ShaderOpcodes::CMP1: case ShaderOpcodes::CMP2:
|
||||
cmp(instruction);
|
||||
@@ -393,6 +394,20 @@ void PICAShader::ifu(u32 instruction) {
|
||||
}
|
||||
}
|
||||
|
||||
void PICAShader::call(u32 instruction) {
|
||||
if (callIndex >= 4) [[unlikely]]
|
||||
Helpers::panic("[PICA] Overflowed CALL stack");
|
||||
|
||||
const u32 num = instruction & 0xff;
|
||||
const u32 dest = (instruction >> 10) & 0xfff;
|
||||
|
||||
auto& block = callInfo[callIndex++];
|
||||
block.endingPC = dest + num;
|
||||
block.returnPC = pc;
|
||||
|
||||
pc = dest;
|
||||
}
|
||||
|
||||
void PICAShader::callu(u32 instruction) {
|
||||
const u32 bit = (instruction >> 22) & 0xf; // Bit of the bool uniform to check
|
||||
|
||||
|
||||
Reference in New Issue
Block a user