mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-22 05:15:51 +12:00
[PICA] Implement mul
This commit is contained in:
parent
f22d389591
commit
61212c9341
2 changed files with 24 additions and 0 deletions
|
@ -12,6 +12,7 @@ void PICAShader::run() {
|
|||
case ShaderOpcodes::DP4: dp4(instruction); break;
|
||||
case ShaderOpcodes::END: return; // Stop running shader
|
||||
case ShaderOpcodes::MOV: mov(instruction); break;
|
||||
case ShaderOpcodes::MUL: mul(instruction); break;
|
||||
default:Helpers::panic("Unimplemented PICA instruction %08X (Opcode = %02X)", instruction, opcode);
|
||||
}
|
||||
}
|
||||
|
@ -58,6 +59,27 @@ void PICAShader::add(u32 instruction) {
|
|||
}
|
||||
}
|
||||
|
||||
void PICAShader::mul(u32 instruction) {
|
||||
const u32 operandDescriptor = operandDescriptors[instruction & 0x7f];
|
||||
const u32 src1 = (instruction >> 12) & 0x7f;
|
||||
const u32 src2 = (instruction >> 7) & 0x1f; // src2 coming first because PICA moment
|
||||
const u32 idx = (instruction >> 19) & 3;
|
||||
const u32 dest = (instruction >> 21) & 0x1f;
|
||||
|
||||
if (idx) Helpers::panic("[PICA] MUL: idx != 0");
|
||||
vec4f srcVec1 = getSourceSwizzled<1>(src1, operandDescriptor);
|
||||
vec4f srcVec2 = getSourceSwizzled<2>(src2, operandDescriptor);
|
||||
|
||||
vec4f& destVector = getDest(dest);
|
||||
|
||||
u32 componentMask = operandDescriptor & 0xf;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (componentMask & (1 << i)) {
|
||||
destVector[3 - i] = srcVec1[3 - i] * srcVec2[3 - 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PICAShader::mov(u32 instruction) {
|
||||
const u32 operandDescriptor = operandDescriptors[instruction & 0x7f];
|
||||
const u32 src = (instruction >> 12) & 0x7f;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue