aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-08-21 11:54:47 -0400
committerFernandoS27 <fsahmkow27@gmail.com>2019-10-04 18:52:51 -0400
commit0366c18d87f8c60ff6a99db668a7f2d810aaeeb0 (patch)
treefa1731f7cb9285ffe40f789447b528262edd618f /src
parent47e4f6a52c5eb34916e2c1f4c876e6e8624e3840 (diff)
Shader_IR: mark labels as unused for partial decompile.
Diffstat (limited to 'src')
-rw-r--r--src/video_core/shader/ast.cpp4
-rw-r--r--src/video_core/shader/ast.h8
2 files changed, 9 insertions, 3 deletions
diff --git a/src/video_core/shader/ast.cpp b/src/video_core/shader/ast.cpp
index 14c50e1c68..74b9a8f9a9 100644
--- a/src/video_core/shader/ast.cpp
+++ b/src/video_core/shader/ast.cpp
@@ -497,9 +497,7 @@ void ASTManager::Decompile() {
}
}
if (can_remove) {
- auto& manager = label->GetManager();
- manager.Remove(label);
- labels.erase(it);
+ label->MarkLabelUnused();
}
}
}
diff --git a/src/video_core/shader/ast.h b/src/video_core/shader/ast.h
index 849d0612c7..07deb58e4d 100644
--- a/src/video_core/shader/ast.h
+++ b/src/video_core/shader/ast.h
@@ -112,6 +112,7 @@ class ASTLabel {
public:
ASTLabel(u32 index) : index{index} {}
u32 index;
+ bool unused{};
};
class ASTGoto {
@@ -204,6 +205,13 @@ public:
return nullptr;
}
+ void MarkLabelUnused() const {
+ auto inner = std::get_if<ASTLabel>(&data);
+ if (inner) {
+ inner->unused = true;
+ }
+ }
+
Expr GetIfCondition() const {
auto inner = std::get_if<ASTIfThen>(&data);
if (inner) {