Ver Fonte

Shader_IR: mark labels as unused for partial decompile.

Fernando Sahmkow há 7 anos atrás
pai
commit
0366c18d87
2 ficheiros alterados com 9 adições e 3 exclusões
  1. 1 3
      src/video_core/shader/ast.cpp
  2. 8 0
      src/video_core/shader/ast.h

+ 1 - 3
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();
             }
         }
     }

+ 8 - 0
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) {