summaryrefslogtreecommitdiffstats
path: root/src/video_core/shader/ast.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-09-28 21:16:19 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-10-05 00:52:57 +0200
commit3c09d9abe6d268ada063fd67c08d09fc0fcad613 (patch)
tree27f1442ec1ee8390850dd5099ed3642f1d3f59db /src/video_core/shader/ast.cpp
parentvk_shader_decompiler: Correct Branches inside conditionals. (diff)
downloadyuzu-3c09d9abe6d268ada063fd67c08d09fc0fcad613.tar
yuzu-3c09d9abe6d268ada063fd67c08d09fc0fcad613.tar.gz
yuzu-3c09d9abe6d268ada063fd67c08d09fc0fcad613.tar.bz2
yuzu-3c09d9abe6d268ada063fd67c08d09fc0fcad613.tar.lz
yuzu-3c09d9abe6d268ada063fd67c08d09fc0fcad613.tar.xz
yuzu-3c09d9abe6d268ada063fd67c08d09fc0fcad613.tar.zst
yuzu-3c09d9abe6d268ada063fd67c08d09fc0fcad613.zip
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() {
auto it = gotos.begin();
while (it != gotos.end()) {
const ASTNode goto_node = *it;
- const u32 label_index = goto_node->GetGotoLabel();
- const ASTNode label = labels[label_index];
+ const auto label_index = goto_node->GetGotoLabel();
+ if (!label_index) {
+ return;
+ }
+ const ASTNode label = labels[*label_index];
if (!full_decompile) {
// We only decompile backward jumps
if (!IsBackwardsJump(goto_node, label)) {
@@ -498,8 +501,11 @@ void ASTManager::Decompile() {
bool can_remove = true;
ASTNode label = *it;
for (const ASTNode goto_node : gotos) {
- const u32 label_index = goto_node->GetGotoLabel();
- ASTNode glabel = labels[label_index];
+ const auto label_index = goto_node->GetGotoLabel();
+ if (!label_index) {
+ return;
+ }
+ ASTNode glabel = labels[*label_index];
if (glabel == label) {
can_remove = false;
break;