diff options
author | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-01-30 01:56:33 -0300 |
---|---|---|
committer | ReinUsesLisp <reinuseslisp@airmail.cc> | 2019-02-03 17:21:20 -0300 |
commit | 6a6fabea58bb12e70feded1354570f259c9f9a6d (patch) | |
tree | 33118d3d594805f5ccc26466009317afd928a557 /src/video_core/shader/decode.cpp | |
parent | eceab45dac2b67392a896fa322af15e6aa81c242 (diff) |
shader_ir: Pass decoded nodes as a whole instead of per basic blocks
Some games call LDG at the top of a basic block, making the tracking
heuristic to fail. This commit lets the heuristic the decoded nodes as a
whole instead of per basic blocks.
This may lead to some false positives but allows it the heuristic to
track cases it previously couldn't.
Diffstat (limited to 'src/video_core/shader/decode.cpp')
-rw-r--r-- | src/video_core/shader/decode.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp index 812983a995..4dfa8075a5 100644 --- a/src/video_core/shader/decode.cpp +++ b/src/video_core/shader/decode.cpp @@ -151,7 +151,7 @@ u32 ShaderIR::DecodeInstr(BasicBlock& bb, u32 pc) { UNIMPLEMENTED_IF_MSG(instr.pred.full_pred == Pred::NeverExecute, "NeverExecute predicate not implemented"); - static const std::map<OpCode::Type, u32 (ShaderIR::*)(BasicBlock&, const BasicBlock&, u32)> + static const std::map<OpCode::Type, u32 (ShaderIR::*)(BasicBlock&, u32)> decoders = { {OpCode::Type::Arithmetic, &ShaderIR::DecodeArithmetic}, {OpCode::Type::ArithmeticImmediate, &ShaderIR::DecodeArithmeticImmediate}, @@ -181,9 +181,9 @@ u32 ShaderIR::DecodeInstr(BasicBlock& bb, u32 pc) { std::vector<Node> tmp_block; if (const auto decoder = decoders.find(opcode->get().GetType()); decoder != decoders.end()) { - pc = (this->*decoder->second)(tmp_block, bb, pc); + pc = (this->*decoder->second)(tmp_block, pc); } else { - pc = DecodeOther(tmp_block, bb, pc); + pc = DecodeOther(tmp_block, pc); } // Some instructions (like SSY) don't have a predicate field, they are always unconditionally @@ -192,11 +192,14 @@ u32 ShaderIR::DecodeInstr(BasicBlock& bb, u32 pc) { const auto pred_index = static_cast<u32>(instr.pred.pred_index); if (can_be_predicated && pred_index != static_cast<u32>(Pred::UnusedIndex)) { - bb.push_back( - Conditional(GetPredicate(pred_index, instr.negate_pred != 0), std::move(tmp_block))); + const Node conditional = + Conditional(GetPredicate(pred_index, instr.negate_pred != 0), std::move(tmp_block)); + global_code.push_back(conditional); + bb.push_back(conditional); } else { for (auto& node : tmp_block) { - bb.push_back(std::move(node)); + global_code.push_back(node); + bb.push_back(node); } } |