mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-07 14:45:41 +12:00
[PICA] Add JMPU
This commit is contained in:
parent
9f7a86fc01
commit
3be6553207
2 changed files with 12 additions and 0 deletions
|
@ -30,6 +30,7 @@ namespace ShaderOpcodes {
|
|||
IFU = 0x27,
|
||||
IFC = 0x28,
|
||||
LOOP = 0x29,
|
||||
JMPU = 0x2D,
|
||||
CMP1 = 0x2E, // Both of these instructions are CMP
|
||||
CMP2 = 0x2F,
|
||||
MAD = 0x38 // Everything between 0x38-0x3F is a MAD but fuck it
|
||||
|
@ -95,6 +96,7 @@ class PICAShader {
|
|||
void dp4(u32 instruction);
|
||||
void ifc(u32 instruction);
|
||||
void ifu(u32 instruction);
|
||||
void jmpu(u32 instruction);
|
||||
void loop(u32 instruction);
|
||||
void mad(u32 instruction);
|
||||
void max(u32 instruction);
|
||||
|
|
|
@ -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::JMPU: jmpu(instruction); break;
|
||||
case ShaderOpcodes::LOOP: loop(instruction); break;
|
||||
case ShaderOpcodes::MAX: max(instruction); break;
|
||||
case ShaderOpcodes::MIN: min(instruction); break;
|
||||
|
@ -489,4 +490,13 @@ void PICAShader::loop(u32 instruction) {
|
|||
loop.endingPC = dest + 1; // Loop is inclusive so we need + 1 here
|
||||
loop.iterations = uniform.x() + 1;
|
||||
loop.increment = uniform.z();
|
||||
}
|
||||
|
||||
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;
|
||||
const u32 bit = (instruction >> 22) & 0xf; // Bit of the bool uniform to check
|
||||
|
||||
if (((boolUniform >> bit) & 1) == test) // Jump if the bool uniform is the value we want
|
||||
pc = dest;
|
||||
}
|
Loading…
Add table
Reference in a new issue