]> git.tdb.fi Git - libs/gl.git/commitdiff
Remove some unused code from UnusedVariableRemover
authorMikko Rasa <tdb@tdb.fi>
Sun, 10 Oct 2021 11:14:54 +0000 (14:14 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 10 Oct 2021 11:14:54 +0000 (14:14 +0300)
The interface_block variable has always been null since dfcf8eb.

source/glsl/optimize.cpp
source/glsl/optimize.h

index 0d6f753768ad2bd5fdbf7ff4d3a8f44ff75f1cb9..a8ff44a50e44fa94b8eb3d799f3ec1d64eb22988 100644 (file)
@@ -1267,16 +1267,8 @@ bool UnusedVariableRemover::apply(Stage &s)
                        for(AssignmentInfo *a: kvp.second.assignments)
                                unused_nodes.erase(a->node);
                }
-
-               if(!kvp.second.output && !kvp.second.referenced)
-               {
-                       // Don't remove variables from inside interface blocks.
-                       if(!kvp.second.interface_block)
-                               unused_nodes.insert(kvp.first);
-               }
-               else if(kvp.second.interface_block)
-                       // Interface blocks are kept if even one member is used.
-                       unused_nodes.erase(kvp.second.interface_block);
+               else if(!kvp.second.referenced)
+                       unused_nodes.insert(kvp.first);
        }
 
        NodeRemover().apply(s, unused_nodes);
@@ -1493,14 +1485,10 @@ void UnusedVariableRemover::visit(VariableDeclaration &var)
                return;
 
        VariableInfo &var_info = variables[&var];
-       var_info.interface_block = interface_block;
 
        /* Mark variables as output if they're used by the next stage or the
        graphics API. */
-       if(interface_block)
-               var_info.output = (interface_block->interface=="out" && (interface_block->linked_block || !interface_block->block_name.compare(0, 3, "gl_")));
-       else
-               var_info.output = (var.interface=="out" && (stage->type==Stage::FRAGMENT || var.linked_declaration || !var.name.compare(0, 3, "gl_")));
+       var_info.output = (var.interface=="out" && (stage->type==Stage::FRAGMENT || var.linked_declaration || !var.name.compare(0, 3, "gl_")));
 
        if(var.init_expression)
        {
index b8ab3201ccc54aa74fc603fce30caf8b5bd6b683..d9fc2d6a7a074367262dc890967ac632b9d22682 100644 (file)
@@ -328,7 +328,6 @@ private:
 
        struct VariableInfo
        {
-               InterfaceBlock *interface_block = 0;
                std::vector<AssignmentInfo *> assignments;
                bool initialized = false;
                bool output = false;
@@ -340,7 +339,6 @@ private:
        Stage *stage = 0;
        BlockVariableMap variables;
        std::list<AssignmentInfo> assignments;
-       InterfaceBlock *interface_block = 0;
        Assignment *r_assignment = 0;
        bool assignment_target = false;
        bool r_side_effects = false;