diff options
| author | 2019-06-25 20:15:40 -0400 | |
|---|---|---|
| committer | 2019-07-09 08:14:39 -0400 | |
| commit | 01b21ee1e8e7455dd84ee7f22d33426caaaafdb3 (patch) | |
| tree | ed443fde0bf5e5bd140d0f7787c44e87ad5f5505 /src/video_core/shader/decode.cpp | |
| parent | shader_ir: Unify blocks in decompiled shaders. (diff) | |
| download | yuzu-01b21ee1e8e7455dd84ee7f22d33426caaaafdb3.tar.gz yuzu-01b21ee1e8e7455dd84ee7f22d33426caaaafdb3.tar.xz yuzu-01b21ee1e8e7455dd84ee7f22d33426caaaafdb3.zip | |
shader_ir: Corrections, documenting and asserting control_flow
Diffstat (limited to 'src/video_core/shader/decode.cpp')
| -rw-r--r-- | src/video_core/shader/decode.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/video_core/shader/decode.cpp b/src/video_core/shader/decode.cpp index f9b1960da..b4a282cbd 100644 --- a/src/video_core/shader/decode.cpp +++ b/src/video_core/shader/decode.cpp | |||
| @@ -46,7 +46,7 @@ void ShaderIR::Decode() { | |||
| 46 | coverage_end = shader_info.end; | 46 | coverage_end = shader_info.end; |
| 47 | if (shader_info.decompilable) { | 47 | if (shader_info.decompilable) { |
| 48 | disable_flow_stack = true; | 48 | disable_flow_stack = true; |
| 49 | auto insert_block = ([this](NodeBlock& nodes, u32 label) { | 49 | const auto insert_block = ([this](NodeBlock& nodes, u32 label) { |
| 50 | if (label == exit_branch) { | 50 | if (label == exit_branch) { |
| 51 | return; | 51 | return; |
| 52 | } | 52 | } |
| @@ -88,7 +88,6 @@ void ShaderIR::Decode() { | |||
| 88 | for (u32 label = main_offset; label < shader_end; label++) { | 88 | for (u32 label = main_offset; label < shader_end; label++) { |
| 89 | basic_blocks.insert({label, DecodeRange(label, label + 1)}); | 89 | basic_blocks.insert({label, DecodeRange(label, label + 1)}); |
| 90 | } | 90 | } |
| 91 | return; | ||
| 92 | } | 91 | } |
| 93 | 92 | ||
| 94 | NodeBlock ShaderIR::DecodeRange(u32 begin, u32 end) { | 93 | NodeBlock ShaderIR::DecodeRange(u32 begin, u32 end) { |
| @@ -104,16 +103,17 @@ void ShaderIR::DecodeRangeInner(NodeBlock& bb, u32 begin, u32 end) { | |||
| 104 | } | 103 | } |
| 105 | 104 | ||
| 106 | void ShaderIR::InsertControlFlow(NodeBlock& bb, const ShaderBlock& block) { | 105 | void ShaderIR::InsertControlFlow(NodeBlock& bb, const ShaderBlock& block) { |
| 107 | auto apply_conditions = ([&](const Condition& cond, Node n) -> Node { | 106 | const auto apply_conditions = ([&](const Condition& cond, Node n) -> Node { |
| 108 | Node result = n; | 107 | Node result = n; |
| 109 | if (cond.cc != ConditionCode::T) { | 108 | if (cond.cc != ConditionCode::T) { |
| 110 | result = Conditional(GetConditionCode(cond.cc), {result}); | 109 | result = Conditional(GetConditionCode(cond.cc), {result}); |
| 111 | } | 110 | } |
| 112 | if (cond.predicate != Pred::UnusedIndex) { | 111 | if (cond.predicate != Pred::UnusedIndex) { |
| 113 | u32 pred = static_cast<u32>(cond.predicate); | 112 | u32 pred = static_cast<u32>(cond.predicate); |
| 114 | bool is_neg = pred > 7; | 113 | const bool is_neg = pred > 7; |
| 115 | if (is_neg) | 114 | if (is_neg) { |
| 116 | pred -= 8; | 115 | pred -= 8; |
| 116 | } | ||
| 117 | result = Conditional(GetPredicate(pred, is_neg), {result}); | 117 | result = Conditional(GetPredicate(pred, is_neg), {result}); |
| 118 | } | 118 | } |
| 119 | return result; | 119 | return result; |