summaryrefslogtreecommitdiff
path: root/src/video_core/shader/ast.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-09-28 15:16:19 -0400
committerGravatar FernandoS272019-10-04 18:52:57 -0400
commit3c09d9abe6d268ada063fd67c08d09fc0fcad613 (patch)
tree27f1442ec1ee8390850dd5099ed3642f1d3f59db /src/video_core/shader/ast.cpp
parentvk_shader_decompiler: Correct Branches inside conditionals. (diff)
downloadyuzu-3c09d9abe6d268ada063fd67c08d09fc0fcad613.tar.gz
yuzu-3c09d9abe6d268ada063fd67c08d09fc0fcad613.tar.xz
yuzu-3c09d9abe6d268ada063fd67c08d09fc0fcad613.zip
Shader_Ir: Address Feedback and clang format.
Diffstat (limited to 'src/video_core/shader/ast.cpp')
-rw-r--r--src/video_core/shader/ast.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/video_core/shader/ast.cpp b/src/video_core/shader/ast.cpp
index fc440526f..c4548f0bc 100644
--- a/src/video_core/shader/ast.cpp
+++ b/src/video_core/shader/ast.cpp
@@ -442,8 +442,11 @@ void ASTManager::Decompile() {
442 auto it = gotos.begin(); 442 auto it = gotos.begin();
443 while (it != gotos.end()) { 443 while (it != gotos.end()) {
444 const ASTNode goto_node = *it; 444 const ASTNode goto_node = *it;
445 const u32 label_index = goto_node->GetGotoLabel(); 445 const auto label_index = goto_node->GetGotoLabel();
446 const ASTNode label = labels[label_index]; 446 if (!label_index) {
447 return;
448 }
449 const ASTNode label = labels[*label_index];
447 if (!full_decompile) { 450 if (!full_decompile) {
448 // We only decompile backward jumps 451 // We only decompile backward jumps
449 if (!IsBackwardsJump(goto_node, label)) { 452 if (!IsBackwardsJump(goto_node, label)) {
@@ -498,8 +501,11 @@ void ASTManager::Decompile() {
498 bool can_remove = true; 501 bool can_remove = true;
499 ASTNode label = *it; 502 ASTNode label = *it;
500 for (const ASTNode goto_node : gotos) { 503 for (const ASTNode goto_node : gotos) {
501 const u32 label_index = goto_node->GetGotoLabel(); 504 const auto label_index = goto_node->GetGotoLabel();
502 ASTNode glabel = labels[label_index]; 505 if (!label_index) {
506 return;
507 }
508 ASTNode glabel = labels[*label_index];
503 if (glabel == label) { 509 if (glabel == label) {
504 can_remove = false; 510 can_remove = false;
505 break; 511 break;