diff options
| author | 2018-12-23 17:14:43 -0300 | |
|---|---|---|
| committer | 2019-01-15 17:54:52 -0300 | |
| commit | 3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c (patch) | |
| tree | 3ff28d39f035c263aaad7293e141c2c8dd83b4b0 /src | |
| parent | shader_decode: Implement PSET (diff) | |
| download | yuzu-3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c.tar.gz yuzu-3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c.tar.xz yuzu-3f1136ac6f39e3d0e0f2c250905a79c9b47aa28c.zip | |
shader_decode: Implement CSETP
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/shader/decode/predicate_set_predicate.cpp | 51 |
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) { | |||
| 17 | const Instruction instr = {program_code[pc]}; | 17 | const Instruction instr = {program_code[pc]}; |
| 18 | const auto opcode = OpCode::Decode(instr); | 18 | const auto opcode = OpCode::Decode(instr); |
| 19 | 19 | ||
| 20 | const Node op_a = GetPredicate(instr.psetp.pred12, instr.psetp.neg_pred12 != 0); | 20 | switch (opcode->get().GetId()) { |
| 21 | const Node op_b = GetPredicate(instr.psetp.pred29, instr.psetp.neg_pred29 != 0); | 21 | case OpCode::Id::PSETP: { |
| 22 | const Node op_a = GetPredicate(instr.psetp.pred12, instr.psetp.neg_pred12 != 0); | ||
| 23 | const Node op_b = GetPredicate(instr.psetp.pred29, instr.psetp.neg_pred29 != 0); | ||
| 22 | 24 | ||
| 23 | // We can't use the constant predicate as destination. | 25 | // We can't use the constant predicate as destination. |
| 24 | ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); | 26 | ASSERT(instr.psetp.pred3 != static_cast<u64>(Pred::UnusedIndex)); |
| 25 | 27 | ||
| 26 | const Node second_pred = GetPredicate(instr.psetp.pred39, instr.psetp.neg_pred39 != 0); | 28 | const Node second_pred = GetPredicate(instr.psetp.pred39, instr.psetp.neg_pred39 != 0); |
| 27 | 29 | ||
| 28 | const OperationCode combiner = GetPredicateCombiner(instr.psetp.op); | 30 | const OperationCode combiner = GetPredicateCombiner(instr.psetp.op); |
| 29 | const Node predicate = Operation(combiner, op_a, op_b); | 31 | const Node predicate = Operation(combiner, op_a, op_b); |
| 30 | 32 | ||
| 31 | // Set the primary predicate to the result of Predicate OP SecondPredicate | 33 | // Set the primary predicate to the result of Predicate OP SecondPredicate |
| 32 | SetPredicate(bb, instr.psetp.pred3, Operation(combiner, predicate, second_pred)); | 34 | SetPredicate(bb, instr.psetp.pred3, Operation(combiner, predicate, second_pred)); |
| 33 | 35 | ||
| 34 | if (instr.psetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) { | 36 | if (instr.psetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) { |
| 35 | // Set the secondary predicate to the result of !Predicate OP SecondPredicate, if enabled | 37 | // Set the secondary predicate to the result of !Predicate OP SecondPredicate, if |
| 36 | SetPredicate( | 38 | // enabled |
| 37 | bb, instr.psetp.pred0, | 39 | SetPredicate(bb, instr.psetp.pred0, |
| 38 | Operation(combiner, Operation(OperationCode::LogicalNegate, predicate), second_pred)); | 40 | Operation(combiner, Operation(OperationCode::LogicalNegate, predicate), |
| 41 | second_pred)); | ||
| 42 | } | ||
| 43 | break; | ||
| 44 | } | ||
| 45 | case OpCode::Id::CSETP: { | ||
| 46 | const Node pred = GetPredicate(instr.csetp.pred39, instr.csetp.neg_pred39 != 0); | ||
| 47 | const Node condition_code = GetConditionCode(instr.csetp.cc); | ||
| 48 | |||
| 49 | const OperationCode combiner = GetPredicateCombiner(instr.csetp.op); | ||
| 50 | |||
| 51 | if (instr.csetp.pred3 != static_cast<u64>(Pred::UnusedIndex)) { | ||
| 52 | SetPredicate(bb, instr.csetp.pred3, Operation(combiner, condition_code, pred)); | ||
| 53 | } | ||
| 54 | if (instr.csetp.pred0 != static_cast<u64>(Pred::UnusedIndex)) { | ||
| 55 | const Node neg_cc = Operation(OperationCode::LogicalNegate, condition_code); | ||
| 56 | SetPredicate(bb, instr.csetp.pred0, Operation(combiner, neg_cc, pred)); | ||
| 57 | } | ||
| 58 | break; | ||
| 59 | } | ||
| 60 | default: | ||
| 61 | UNIMPLEMENTED_MSG("Unhandled predicate instruction: {}", opcode->get().GetName()); | ||
| 39 | } | 62 | } |
| 40 | 63 | ||
| 41 | return pc; | 64 | return pc; |