diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-09-24 04:55:25 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-10-25 15:01:30 +0200 |
commit | 8909f52166bf9c27d52b5a722efbd46d1a11e876 (patch) | |
tree | 2e21bbc3c3f5422325d8003d72cdb4bb120a26e5 /src/video_core/shader/decode.cpp | |
parent | Shader_Cache: setup connection of ConstBufferLocker (diff) | |
download | yuzu-8909f52166bf9c27d52b5a722efbd46d1a11e876.tar yuzu-8909f52166bf9c27d52b5a722efbd46d1a11e876.tar.gz yuzu-8909f52166bf9c27d52b5a722efbd46d1a11e876.tar.bz2 yuzu-8909f52166bf9c27d52b5a722efbd46d1a11e876.tar.lz yuzu-8909f52166bf9c27d52b5a722efbd46d1a11e876.tar.xz yuzu-8909f52166bf9c27d52b5a722efbd46d1a11e876.tar.zst yuzu-8909f52166bf9c27d52b5a722efbd46d1a11e876.zip |
Diffstat (limited to '')
-rw-r--r-- | src/video_core/shader/decode.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp index 3f87b87ca..053241128 100644 --- a/src/video_core/shader/decode.cpp +++ b/src/video_core/shader/decode.cpp @@ -198,24 +198,38 @@ void ShaderIR::InsertControlFlow(NodeBlock& bb, const ShaderBlock& block) { } return result; }; - if (block.branch.address < 0) { - if (block.branch.kills) { - Node n = Operation(OperationCode::Discard); - n = apply_conditions(block.branch.cond, n); + if (std::holds_alternative<SingleBranch>(*block.branch)) { + auto branch = std::get_if<SingleBranch>(block.branch.get()); + if (branch->address < 0) { + if (branch->kill) { + Node n = Operation(OperationCode::Discard); + n = apply_conditions(branch->condition, n); + bb.push_back(n); + global_code.push_back(n); + return; + } + Node n = Operation(OperationCode::Exit); + n = apply_conditions(branch->condition, n); bb.push_back(n); global_code.push_back(n); return; } - Node n = Operation(OperationCode::Exit); - n = apply_conditions(block.branch.cond, n); + Node n = Operation(OperationCode::Branch, Immediate(branch->address)); + n = apply_conditions(branch->condition, n); bb.push_back(n); global_code.push_back(n); return; } - Node n = Operation(OperationCode::Branch, Immediate(block.branch.address)); - n = apply_conditions(block.branch.cond, n); - bb.push_back(n); - global_code.push_back(n); + auto multi_branch = std::get_if<MultiBranch>(block.branch.get()); + Node op_a = GetRegister(multi_branch->gpr); + for (auto& branch_case : multi_branch->branches) { + Node n = Operation(OperationCode::Branch, Immediate(branch_case.address)); + Node op_b = Immediate(branch_case.cmp_value); + Node condition = GetPredicateComparisonInteger(Tegra::Shader::PredCondition::Equal, false, op_a, op_b); + auto result = Conditional(condition, {n}); + bb.push_back(result); + global_code.push_back(result); + } } u32 ShaderIR::DecodeInstr(NodeBlock& bb, u32 pc) { |