summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2018-12-21 04:12:48 +0100
committerReinUsesLisp <reinuseslisp@airmail.cc>2019-01-15 21:54:50 +0100
commitc703f0aee41ba08219f10217169813ac97da06c2 (patch)
treebaf010a6068b0ab2f1dc571f2cb069b6fd9bd0e5
parentshader_decode: Partially implement BRA (diff)
downloadyuzu-c703f0aee41ba08219f10217169813ac97da06c2.tar
yuzu-c703f0aee41ba08219f10217169813ac97da06c2.tar.gz
yuzu-c703f0aee41ba08219f10217169813ac97da06c2.tar.bz2
yuzu-c703f0aee41ba08219f10217169813ac97da06c2.tar.lz
yuzu-c703f0aee41ba08219f10217169813ac97da06c2.tar.xz
yuzu-c703f0aee41ba08219f10217169813ac97da06c2.tar.zst
yuzu-c703f0aee41ba08219f10217169813ac97da06c2.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/shader/decode/float_set_predicate.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/src/video_core/shader/decode/float_set_predicate.cpp b/src/video_core/shader/decode/float_set_predicate.cpp
index 1dbe34353..5dd085fea 100644
--- a/src/video_core/shader/decode/float_set_predicate.cpp
+++ b/src/video_core/shader/decode/float_set_predicate.cpp
@@ -11,12 +11,44 @@ namespace VideoCommon::Shader {
using Tegra::Shader::Instruction;
using Tegra::Shader::OpCode;
+using Tegra::Shader::Pred;
u32 ShaderIR::DecodeFloatSetPredicate(BasicBlock& bb, u32 pc) {
const Instruction instr = {program_code[pc]};
const auto opcode = OpCode::Decode(instr);
- UNIMPLEMENTED();
+ const Node op_a = GetOperandAbsNegFloat(GetRegister(instr.gpr8), instr.fsetp.abs_a != 0,
+ instr.fsetp.neg_a != 0);
+ Node op_b = [&]() {
+ if (instr.is_b_imm) {
+ return GetImmediate19(instr);
+ } else if (instr.is_b_gpr) {
+ return GetRegister(instr.gpr20);
+ } else {
+ return GetConstBuffer(instr.cbuf34.index, instr.cbuf34.offset);
+ }
+ }();
+ op_b = GetOperandAbsNegFloat(op_b, instr.fsetp.abs_b, false);
+
+ // We can't use the constant predicate as destination.
+ ASSERT(instr.fsetp.pred3 != static_cast<u64>(Pred::UnusedIndex));
+
+ const Node predicate = GetPredicateComparisonFloat(instr.fsetp.cond, op_a, op_b);
+ const Node second_pred = GetPredicate(instr.fsetp.pred39, instr.fsetp.neg_pred != 0);
+
+ const OperationCode combiner = GetPredicateCombiner(instr.fsetp.op);
+ const Node value = Operation(combiner, predicate, second_pred);
+
+ // Set the primary predicate to the result of Predicate OP SecondPredicate
+ SetPredicate(bb, instr.fsetp.pred3, value);
+
+ if (instr.fsetp.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, predicate);
+ const Node second_value = Operation(combiner, negated_pred, second_pred);
+ SetPredicate(bb, instr.fsetp.pred0, second_value);
+ }
return pc;
}