]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/optimize.cpp
Refactor creation of the shader builtin module
[libs/gl.git] / source / glsl / optimize.cpp
index 25115a5975674485afb4f0b8e1368250419be451..c76cae1b50f34a69ade9d31ead0c563250d24ae6 100644 (file)
@@ -217,14 +217,14 @@ UnusedVariableLocator::UnusedVariableLocator():
        global_scope(true)
 { }
 
-void UnusedVariableLocator::apply(Stage &s)
+const set<Node *> &UnusedVariableLocator::apply(Stage &s)
 {
        variables.push_back(BlockVariableMap());
-       StageVisitor::apply(s);
+       visit(s.content);
        BlockVariableMap &global_variables = variables.back();
        for(BlockVariableMap::iterator i=global_variables.begin(); i!=global_variables.end(); ++i)
        {
-               if(i->first->interface=="out" && (s.type==FRAGMENT || i->first->linked_declaration || !i->first->name.compare(0, 3, "gl_")))
+               if(i->first->interface=="out" && (s.type==Stage::FRAGMENT || i->first->linked_declaration || !i->first->name.compare(0, 3, "gl_")))
                        continue;
                if(!i->second.referenced)
                {
@@ -233,6 +233,8 @@ void UnusedVariableLocator::apply(Stage &s)
                }
        }
        variables.pop_back();
+
+       return unused_nodes;
 }
 
 void UnusedVariableLocator::visit(VariableReference &var)