Merge pull request #421 from Subv/sh_pred3

Shaders: Implemented predicate condition 3 (LessEqual) in the fset and fsetp instructions.
This commit is contained in:
bunnei 2018-04-29 15:59:33 -04:00 committed by GitHub
commit 869075867b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -882,6 +882,9 @@ private:
case PredCondition::Equal: case PredCondition::Equal:
SetPredicate(instr.fsetp.pred3, '(' + op_a + ") == (" + op_b + ')'); SetPredicate(instr.fsetp.pred3, '(' + op_a + ") == (" + op_b + ')');
break; break;
case PredCondition::LessEqual:
SetPredicate(instr.fsetp.pred3, '(' + op_a + ") <= (" + op_b + ')');
break;
default: default:
NGLOG_CRITICAL(HW_GPU, "Unhandled predicate condition: {} (a: {}, b: {})", NGLOG_CRITICAL(HW_GPU, "Unhandled predicate condition: {} (a: {}, b: {})",
static_cast<unsigned>(instr.fsetp.cond.Value()), op_a, op_b); static_cast<unsigned>(instr.fsetp.cond.Value()), op_a, op_b);
@ -933,6 +936,10 @@ private:
regs.SetRegisterToFloat(instr.gpr0, 0, regs.SetRegisterToFloat(instr.gpr0, 0,
"((" + op_a + ") == (" + op_b + ")) ? 1.0 : 0", 1, 1); "((" + op_a + ") == (" + op_b + ")) ? 1.0 : 0", 1, 1);
break; break;
case PredCondition::LessEqual:
regs.SetRegisterToFloat(instr.gpr0, 0,
"((" + op_a + ") <= (" + op_b + ")) ? 1.0 : 0", 1, 1);
break;
case PredCondition::GreaterThan: case PredCondition::GreaterThan:
regs.SetRegisterToFloat(instr.gpr0, 0, regs.SetRegisterToFloat(instr.gpr0, 0,
"((" + op_a + ") > (" + op_b + ")) ? 1.0 : 0", 1, 1); "((" + op_a + ") > (" + op_b + ")) ? 1.0 : 0", 1, 1);