summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2019-08-21 11:54:47 -0400
committerGravatar FernandoS272019-10-04 18:52:51 -0400
commit0366c18d87f8c60ff6a99db668a7f2d810aaeeb0 (patch)
treefa1731f7cb9285ffe40f789447b528262edd618f /src
parentShader_Ir: Refactor Decompilation process and allow multiple decompilation mo... (diff)
downloadyuzu-0366c18d87f8c60ff6a99db668a7f2d810aaeeb0.tar.gz
yuzu-0366c18d87f8c60ff6a99db668a7f2d810aaeeb0.tar.xz
yuzu-0366c18d87f8c60ff6a99db668a7f2d810aaeeb0.zip
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 14c50e1c6..74b9a8f9a 100644
--- a/src/video_core/shader/ast.cpp
+++ b/src/video_core/shader/ast.cpp
@@ -497,9 +497,7 @@ void ASTManager::Decompile() {
497 } 497 }
498 } 498 }
499 if (can_remove) { 499 if (can_remove) {
500 auto& manager = label->GetManager(); 500 label->MarkLabelUnused();
501 manager.Remove(label);
502 labels.erase(it);
503 } 501 }
504 } 502 }
505 } 503 }
diff --git a/src/video_core/shader/ast.h b/src/video_core/shader/ast.h
index 849d0612c..07deb58e4 100644
--- a/src/video_core/shader/ast.h
+++ b/src/video_core/shader/ast.h
@@ -112,6 +112,7 @@ class ASTLabel {
112public: 112public:
113 ASTLabel(u32 index) : index{index} {} 113 ASTLabel(u32 index) : index{index} {}
114 u32 index; 114 u32 index;
115 bool unused{};
115}; 116};
116 117
117class ASTGoto { 118class ASTGoto {
@@ -204,6 +205,13 @@ public:
204 return nullptr; 205 return nullptr;
205 } 206 }
206 207
208 void MarkLabelUnused() const {
209 auto inner = std::get_if<ASTLabel>(&data);
210 if (inner) {
211 inner->unused = true;
212 }
213 }
214
207 Expr GetIfCondition() const { 215 Expr GetIfCondition() const {
208 auto inner = std::get_if<ASTIfThen>(&data); 216 auto inner = std::get_if<ASTIfThen>(&data);
209 if (inner) { 217 if (inner) {