diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2018-12-18 23:54:12 +0100 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-01-15 21:54:52 +0100 |
commit | 21f9e9da092ddd96fe9f149660a5bf4f676c8413 (patch) | |
tree | 12228a6205e317165b48074eb12e8d0efc41f38f /src/video_core | |
parent | shader_decode: Implement HADD2 and HMUL2 (diff) | |
download | yuzu-21f9e9da092ddd96fe9f149660a5bf4f676c8413.tar yuzu-21f9e9da092ddd96fe9f149660a5bf4f676c8413.tar.gz yuzu-21f9e9da092ddd96fe9f149660a5bf4f676c8413.tar.bz2 yuzu-21f9e9da092ddd96fe9f149660a5bf4f676c8413.tar.lz yuzu-21f9e9da092ddd96fe9f149660a5bf4f676c8413.tar.xz yuzu-21f9e9da092ddd96fe9f149660a5bf4f676c8413.tar.zst yuzu-21f9e9da092ddd96fe9f149660a5bf4f676c8413.zip |
Diffstat (limited to 'src/video_core')
-rw-r--r-- | src/video_core/shader/decode/half_set_predicate.cpp | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/src/video_core/shader/decode/half_set_predicate.cpp b/src/video_core/shader/decode/half_set_predicate.cpp index 5fe123ea5..d7d63d50a 100644 --- a/src/video_core/shader/decode/half_set_predicate.cpp +++ b/src/video_core/shader/decode/half_set_predicate.cpp @@ -11,12 +11,48 @@ namespace VideoCommon::Shader { using Tegra::Shader::Instruction; using Tegra::Shader::OpCode; +using Tegra::Shader::Pred; u32 ShaderIR::DecodeHalfSetPredicate(BasicBlock& bb, u32 pc) { const Instruction instr = {program_code[pc]}; const auto opcode = OpCode::Decode(instr); - UNIMPLEMENTED(); + UNIMPLEMENTED_IF(instr.hsetp2.ftz != 0); + + Node op_a = GetRegister(instr.gpr8); + op_a = GetOperandAbsNegHalf(op_a, instr.hsetp2.abs_a, instr.hsetp2.negate_a); + + const Node op_b = [&]() { + switch (opcode->get().GetId()) { + case OpCode::Id::HSETP2_R: + return GetOperandAbsNegHalf(GetRegister(instr.gpr20), instr.hsetp2.abs_a, + instr.hsetp2.negate_b); + default: + UNREACHABLE(); + return Immediate(0); + } + }(); + + // We can't use the constant predicate as destination. + ASSERT(instr.hsetp2.pred3 != static_cast<u64>(Pred::UnusedIndex)); + + const Node second_pred = GetPredicate(instr.hsetp2.pred39, instr.hsetp2.neg_pred != 0); + + const OperationCode combiner = GetPredicateCombiner(instr.hsetp2.op); + + MetaHalfArithmetic meta = { + false, {instr.hsetp2.type_a, instr.hsetp2.type_b}, instr.hsetp2.h_and != 0}; + const Node first_pred = GetPredicateComparisonHalf(instr.hsetp2.cond, meta, op_a, op_b); + + // Set the primary predicate to the result of Predicate OP SecondPredicate + const Node value = Operation(combiner, first_pred, second_pred); + SetPredicate(bb, instr.hsetp2.pred3, value); + + if (instr.hsetp2.pred0 != static_cast<u64>(Pred::UnusedIndex)) { + // Set the secondary predicate to the result of !Predicate OP SecondPredicate, if enabled + const Node negated_pred = Operation(OperationCode::LogicalNegate, first_pred); + SetPredicate(bb, instr.hsetp2.pred0, Operation(combiner, negated_pred, second_pred)); + } return pc; } |