summaryrefslogtreecommitdiff
path: root/src/video_core/shader/decode.cpp
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2019-01-30 01:56:33 -0300
committerGravatar ReinUsesLisp2019-02-03 17:21:20 -0300
commit6a6fabea58bb12e70feded1354570f259c9f9a6d (patch)
tree33118d3d594805f5ccc26466009317afd928a557 /src/video_core/shader/decode.cpp
parentMerge pull request #2074 from ReinUsesLisp/shader-ir-unify-offset (diff)
downloadyuzu-6a6fabea58bb12e70feded1354570f259c9f9a6d.tar.gz
yuzu-6a6fabea58bb12e70feded1354570f259c9f9a6d.tar.xz
yuzu-6a6fabea58bb12e70feded1354570f259c9f9a6d.zip
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.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp
index 812983a99..4dfa8075a 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) {
151 UNIMPLEMENTED_IF_MSG(instr.pred.full_pred == Pred::NeverExecute, 151 UNIMPLEMENTED_IF_MSG(instr.pred.full_pred == Pred::NeverExecute,
152 "NeverExecute predicate not implemented"); 152 "NeverExecute predicate not implemented");
153 153
154 static const std::map<OpCode::Type, u32 (ShaderIR::*)(BasicBlock&, const BasicBlock&, u32)> 154 static const std::map<OpCode::Type, u32 (ShaderIR::*)(BasicBlock&, u32)>
155 decoders = { 155 decoders = {
156 {OpCode::Type::Arithmetic, &ShaderIR::DecodeArithmetic}, 156 {OpCode::Type::Arithmetic, &ShaderIR::DecodeArithmetic},
157 {OpCode::Type::ArithmeticImmediate, &ShaderIR::DecodeArithmeticImmediate}, 157 {OpCode::Type::ArithmeticImmediate, &ShaderIR::DecodeArithmeticImmediate},
@@ -181,9 +181,9 @@ u32 ShaderIR::DecodeInstr(BasicBlock& bb, u32 pc) {
181 181
182 std::vector<Node> tmp_block; 182 std::vector<Node> tmp_block;
183 if (const auto decoder = decoders.find(opcode->get().GetType()); decoder != decoders.end()) { 183 if (const auto decoder = decoders.find(opcode->get().GetType()); decoder != decoders.end()) {
184 pc = (this->*decoder->second)(tmp_block, bb, pc); 184 pc = (this->*decoder->second)(tmp_block, pc);
185 } else { 185 } else {
186 pc = DecodeOther(tmp_block, bb, pc); 186 pc = DecodeOther(tmp_block, pc);
187 } 187 }
188 188
189 // Some instructions (like SSY) don't have a predicate field, they are always unconditionally 189 // 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) {
192 const auto pred_index = static_cast<u32>(instr.pred.pred_index); 192 const auto pred_index = static_cast<u32>(instr.pred.pred_index);
193 193
194 if (can_be_predicated && pred_index != static_cast<u32>(Pred::UnusedIndex)) { 194 if (can_be_predicated && pred_index != static_cast<u32>(Pred::UnusedIndex)) {
195 bb.push_back( 195 const Node conditional =
196 Conditional(GetPredicate(pred_index, instr.negate_pred != 0), std::move(tmp_block))); 196 Conditional(GetPredicate(pred_index, instr.negate_pred != 0), std::move(tmp_block));
197 global_code.push_back(conditional);
198 bb.push_back(conditional);
197 } else { 199 } else {
198 for (auto& node : tmp_block) { 200 for (auto& node : tmp_block) {
199 bb.push_back(std::move(node)); 201 global_code.push_back(node);
202 bb.push_back(node);
200 } 203 }
201 } 204 }
202 205