summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-12-23 21:14:43 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-01-15 21:54:52 +0100
commit3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c (patch)
tree3ff28d39f035c263aaad7293e141c2c8dd83b4b0
parentshader_decode: Implement PSET (diff)
downloadyuzu-3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c.tar
yuzu-3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c.tar.gz
yuzu-3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c.tar.bz2
yuzu-3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c.tar.lz
yuzu-3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c.tar.xz
yuzu-3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c.tar.zst
yuzu-3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c.zip
-rw-r--r--src/video_core/shader/decode/predicate_set_predicate.cpp51
1 files changed, 37 insertions, 14 deletions
diff --git a/src/video_core/shader/decode/predicate_set_predicate.cpp b/src/video_core/shader/decode/predicate_set_predicate.cpp
index 24352170d..6ea6daceb 100644
--- a/src/video_core/shader/decode/predicate_set_predicate.cpp
+++ b/src/video_core/shader/decode/predicate_set_predicate.cpp
@@ -17,25 +17,48 @@ u32 ShaderIR::DecodePredicateSetPredicate(BasicBlock& bb, u32 pc) {
const Instruction instr = {program_code[pc]};
const auto opcode = OpCode::Decode(instr);
- const Node op_a = GetPredicate(instr.psetp.pred12, instr.psetp.neg_pred12 != 0);
- const Node op_b = GetPredicate(instr.psetp.pred29, instr.psetp.neg_pred29 != 0);
+ switch (opcode->get().GetId()) {
+ case OpCode::Id::PSETP: {
+ const Node op_a = GetPredicate(instr.psetp.pred12, instr.psetp.neg_pred12 != 0);
+ const Node op_b = GetPredicate(instr.psetp.pred29, instr.psetp.neg_pred29 != 0);
- // We can't use the constant predicate as destination.
- ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex));
+ // We can't use the constant predicate as destination.
+ ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex));
- const Node second_pred = GetPredicate(instr.psetp.pred39, instr.psetp.neg_pred39 != 0);
+ const Node second_pred = GetPredicate(instr.psetp.pred39, instr.psetp.neg_pred39 != 0);
- const OperationCode combiner = GetPredicateCombiner(instr.psetp.op);
- const Node predicate = Operation(combiner, op_a, op_b);
+ const OperationCode combiner = GetPredicateCombiner(instr.psetp.op);
+ const Node predicate = Operation(combiner, op_a, op_b);
- // Set the primary predicate to the result of Predicate OP SecondPredicate
- SetPredicate(bb, instr.psetp.pred3, Operation(combiner, predicate, second_pred));
+ // Set the primary predicate to the result of Predicate OP SecondPredicate
+ SetPredicate(bb, instr.psetp.pred3, Operation(combiner, predicate, second_pred));
- if (instr.psetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) {
- // Set the secondary predicate to the result of !Predicate OP SecondPredicate, if enabled
- SetPredicate(
- bb, instr.psetp.pred0,
- Operation(combiner, Operation(OperationCode::LogicalNegate, predicate), second_pred));
+ if (instr.psetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) {
+ // Set the secondary predicate to the result of !Predicate OP SecondPredicate, if
+ // enabled
+ SetPredicate(bb, instr.psetp.pred0,
+ Operation(combiner, Operation(OperationCode::LogicalNegate, predicate),
+ second_pred));
+ }
+ break;
+ }
+ case OpCode::Id::CSETP: {
+ const Node pred = GetPredicate(instr.csetp.pred39, instr.csetp.neg_pred39 != 0);
+ const Node condition_code = GetConditionCode(instr.csetp.cc);
+
+ const OperationCode combiner = GetPredicateCombiner(instr.csetp.op);
+
+ if (instr.csetp.pred3 != static_cast<u64>(Pred::UnusedIndex)) {
+ SetPredicate(bb, instr.csetp.pred3, Operation(combiner, condition_code, pred));
+ }
+ if (instr.csetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) {
+ const Node neg_cc = Operation(OperationCode::LogicalNegate, condition_code);
+ SetPredicate(bb, instr.csetp.pred0, Operation(combiner, neg_cc, pred));
+ }
+ break;
+ }
+ default:
+ UNIMPLEMENTED_MSG("Unhandled predicate instruction: {}", opcode->get().GetName());
}
return pc;