X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Foptimize.cpp;h=5813e2d9a2a196a6fe759b730641dea562f6bdfa;hb=9a63244c1342337915c4610401a24c09fa72cc3d;hp=25115a5975674485afb4f0b8e1368250419be451;hpb=696a97bd7411d69953c1a9e4b5f3dfb4c1d848f1;p=libs%2Fgl.git diff --git a/source/glsl/optimize.cpp b/source/glsl/optimize.cpp index 25115a59..5813e2d9 100644 --- a/source/glsl/optimize.cpp +++ b/source/glsl/optimize.cpp @@ -39,10 +39,6 @@ void InlineableFunctionLocator::visit(FunctionDeclaration &func) } -FunctionInliner::FunctionInliner(): - extract_result(0) -{ } - FunctionInliner::FunctionInliner(const set &in): inlineable(in), extract_result(0) @@ -217,14 +213,14 @@ UnusedVariableLocator::UnusedVariableLocator(): global_scope(true) { } -void UnusedVariableLocator::apply(Stage &s) +const set &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 +229,8 @@ void UnusedVariableLocator::apply(Stage &s) } } variables.pop_back(); + + return unused_nodes; } void UnusedVariableLocator::visit(VariableReference &var)