mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-17 19:21:30 +12:00
[Shader interpreter] Implement CALL
This commit is contained in:
parent
c4be91588d
commit
f9079f9dce
2 changed files with 17 additions and 0 deletions
|
@ -22,6 +22,7 @@ namespace ShaderOpcodes {
|
||||||
MOV = 0x13,
|
MOV = 0x13,
|
||||||
NOP = 0x21,
|
NOP = 0x21,
|
||||||
END = 0x22,
|
END = 0x22,
|
||||||
|
CALL = 0x24,
|
||||||
CALLU = 0x26,
|
CALLU = 0x26,
|
||||||
IFU = 0x27,
|
IFU = 0x27,
|
||||||
IFC = 0x28,
|
IFC = 0x28,
|
||||||
|
@ -83,6 +84,7 @@ class PICAShader {
|
||||||
|
|
||||||
// Shader opcodes
|
// Shader opcodes
|
||||||
void add(u32 instruction);
|
void add(u32 instruction);
|
||||||
|
void call(u32 instruction);
|
||||||
void callu(u32 instruction);
|
void callu(u32 instruction);
|
||||||
void cmp(u32 instruction);
|
void cmp(u32 instruction);
|
||||||
void dp3(u32 instruction);
|
void dp3(u32 instruction);
|
||||||
|
|
|
@ -13,6 +13,7 @@ void PICAShader::run() {
|
||||||
|
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case ShaderOpcodes::ADD: add(instruction); break;
|
case ShaderOpcodes::ADD: add(instruction); break;
|
||||||
|
case ShaderOpcodes::CALL: call(instruction); break;
|
||||||
case ShaderOpcodes::CALLU: callu(instruction); break;
|
case ShaderOpcodes::CALLU: callu(instruction); break;
|
||||||
case ShaderOpcodes::CMP1: case ShaderOpcodes::CMP2:
|
case ShaderOpcodes::CMP1: case ShaderOpcodes::CMP2:
|
||||||
cmp(instruction);
|
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) {
|
void PICAShader::callu(u32 instruction) {
|
||||||
const u32 bit = (instruction >> 22) & 0xf; // Bit of the bool uniform to check
|
const u32 bit = (instruction >> 22) & 0xf; // Bit of the bool uniform to check
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue