mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-11 08:39:48 +12:00
Shader Interpreter: implement SGE
This commit is contained in:
parent
85c586b3d0
commit
ccdf8f7722
2 changed files with 22 additions and 0 deletions
|
@ -159,6 +159,7 @@ class PICAShader {
|
|||
void mul(u32 instruction);
|
||||
void rcp(u32 instruction);
|
||||
void rsq(u32 instruction);
|
||||
void sge(u32 instruction);
|
||||
void sgei(u32 instruction);
|
||||
void slt(u32 instruction);
|
||||
void slti(u32 instruction);
|
||||
|
|
|
@ -45,6 +45,7 @@ void PICAShader::run() {
|
|||
case ShaderOpcodes::NOP: break; // Do nothing
|
||||
case ShaderOpcodes::RCP: rcp(instruction); break;
|
||||
case ShaderOpcodes::RSQ: rsq(instruction); break;
|
||||
case ShaderOpcodes::SGE: sge(instruction); break;
|
||||
case ShaderOpcodes::SGEI: sgei(instruction); break;
|
||||
case ShaderOpcodes::SLT: slt(instruction); break;
|
||||
case ShaderOpcodes::SLTI: slti(instruction); break;
|
||||
|
@ -517,6 +518,26 @@ void PICAShader::slt(u32 instruction) {
|
|||
}
|
||||
}
|
||||
|
||||
void PICAShader::sge(u32 instruction) {
|
||||
const u32 operandDescriptor = operandDescriptors[instruction & 0x7f];
|
||||
u32 src1 = getBits<12, 7>(instruction);
|
||||
const u32 src2 = getBits<7, 5>(instruction); // src2 coming first because PICA moment
|
||||
const u32 idx = getBits<19, 2>(instruction);
|
||||
const u32 dest = getBits<21, 5>(instruction);
|
||||
|
||||
src1 = getIndexedSource(src1, idx);
|
||||
vec4f srcVec1 = getSourceSwizzled<1>(src1, operandDescriptor);
|
||||
vec4f srcVec2 = getSourceSwizzled<2>(src2, operandDescriptor);
|
||||
auto& 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 - i] ? f24::fromFloat32(1.0) : f24::zero();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PICAShader::sgei(u32 instruction) {
|
||||
const u32 operandDescriptor = operandDescriptors[instruction & 0x7f];
|
||||
const u32 src1 = getBits<14, 5>(instruction);
|
||||
|
|
Loading…
Add table
Reference in a new issue