summaryrefslogtreecommitdiff
path: root/src/video_core/shader/decode
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-05-14 17:16:23 -0300
committerGravatar ReinUsesLisp2019-07-19 22:20:47 -0300
commit6c4985edc9e05dbd9a93ba670625daee98c14bcf (patch)
tree04fa84dcbc2401f09c6daf2db839bbd5df9f9ef2 /src/video_core/shader/decode
parentMerge pull request #2687 from lioncash/tls-process (diff)
downloadyuzu-6c4985edc9e05dbd9a93ba670625daee98c14bcf.tar.gz
yuzu-6c4985edc9e05dbd9a93ba670625daee98c14bcf.tar.xz
yuzu-6c4985edc9e05dbd9a93ba670625daee98c14bcf.zip
shader/half_set_predicate: Implement missing HSETP2 variants
Diffstat (limited to 'src/video_core/shader/decode')
-rw-r--r--src/video_core/shader/decode/half_set_predicate.cpp42
1 files changed, 29 insertions, 13 deletions
diff --git a/src/video_core/shader/decode/half_set_predicate.cpp b/src/video_core/shader/decode/half_set_predicate.cpp
index d59d15bd8..ff41fb2b5 100644
--- a/src/video_core/shader/decode/half_set_predicate.cpp
+++ b/src/video_core/shader/decode/half_set_predicate.cpp
@@ -23,17 +23,33 @@ u32 ShaderIR::DecodeHalfSetPredicate(NodeBlock& bb, u32 pc) {
23 Node op_a = UnpackHalfFloat(GetRegister(instr.gpr8), instr.hsetp2.type_a); 23 Node op_a = UnpackHalfFloat(GetRegister(instr.gpr8), instr.hsetp2.type_a);
24 op_a = GetOperandAbsNegHalf(op_a, instr.hsetp2.abs_a, instr.hsetp2.negate_a); 24 op_a = GetOperandAbsNegHalf(op_a, instr.hsetp2.abs_a, instr.hsetp2.negate_a);
25 25
26 Node op_b = [&]() { 26 Tegra::Shader::PredCondition cond{};
27 switch (opcode->get().GetId()) { 27 bool h_and{};
28 case OpCode::Id::HSETP2_R: 28 Node op_b{};
29 return GetOperandAbsNegHalf(GetRegister(instr.gpr20), instr.hsetp2.abs_a, 29 switch (opcode->get().GetId()) {
30 instr.hsetp2.negate_b); 30 case OpCode::Id::HSETP2_C:
31 default: 31 cond = instr.hsetp2.cbuf_and_imm.cond;
32 UNREACHABLE(); 32 h_and = instr.hsetp2.cbuf_and_imm.h_and;
33 return Immediate(0); 33 op_b = GetOperandAbsNegHalf(GetConstBuffer(instr.cbuf34.index, instr.cbuf34.offset),
34 } 34 instr.hsetp2.cbuf.abs_b, instr.hsetp2.cbuf.negate_b);
35 }(); 35 break;
36 op_b = UnpackHalfFloat(op_b, instr.hsetp2.type_b); 36 case OpCode::Id::HSETP2_IMM:
37 cond = instr.hsetp2.cbuf_and_imm.cond;
38 h_and = instr.hsetp2.cbuf_and_imm.h_and;
39 op_b = UnpackHalfImmediate(instr, true);
40 break;
41 case OpCode::Id::HSETP2_R:
42 cond = instr.hsetp2.reg.cond;
43 h_and = instr.hsetp2.reg.h_and;
44 op_b =
45 UnpackHalfFloat(GetOperandAbsNegHalf(GetRegister(instr.gpr20), instr.hsetp2.reg.abs_b,
46 instr.hsetp2.reg.negate_b),
47 instr.hsetp2.reg.type_b);
48 break;
49 default:
50 UNREACHABLE();
51 op_b = Immediate(0);
52 }
37 53
38 // We can't use the constant predicate as destination. 54 // We can't use the constant predicate as destination.
39 ASSERT(instr.hsetp2.pred3 != static_cast<u64>(Pred::UnusedIndex)); 55 ASSERT(instr.hsetp2.pred3 != static_cast<u64>(Pred::UnusedIndex));
@@ -42,9 +58,9 @@ u32 ShaderIR::DecodeHalfSetPredicate(NodeBlock& bb, u32 pc) {
42 58
43 const OperationCode combiner = GetPredicateCombiner(instr.hsetp2.op); 59 const OperationCode combiner = GetPredicateCombiner(instr.hsetp2.op);
44 const OperationCode pair_combiner = 60 const OperationCode pair_combiner =
45 instr.hsetp2.h_and ? OperationCode::LogicalAll2 : OperationCode::LogicalAny2; 61 h_and ? OperationCode::LogicalAll2 : OperationCode::LogicalAny2;
46 62
47 const Node comparison = GetPredicateComparisonHalf(instr.hsetp2.cond, op_a, op_b); 63 const Node comparison = GetPredicateComparisonHalf(cond, op_a, op_b);
48 const Node first_pred = Operation(pair_combiner, comparison); 64 const Node first_pred = Operation(pair_combiner, comparison);
49 65
50 // Set the primary predicate to the result of Predicate OP SecondPredicate 66 // Set the primary predicate to the result of Predicate OP SecondPredicate