]> git.tdb.fi Git - libs/gl.git/commitdiff
Always treat GLSL function parameters as referenced
authorMikko Rasa <tdb@tdb.fi>
Sat, 10 Dec 2016 20:48:07 +0000 (22:48 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 10 Dec 2016 20:48:07 +0000 (22:48 +0200)
They can't be removed so adding them to the set of unused nodes would
lead to an infinite loop.

source/programcompiler.cpp

index cc4b5efe3df0bfca482feb8d9ae3f46e46391d42..13b203b4f4ace5e93fbf5c27a155d94ffe540c51 100644 (file)
@@ -1346,6 +1346,8 @@ void ProgramCompiler::UnusedVariableLocator::visit(FunctionDeclaration &func)
        BlockVariableMap &block_variables = variables.back();
        for(BlockVariableMap::iterator i=block_variables.begin(); i!=block_variables.end(); ++i)
                i->second.conditionally_assigned = true;
+       for(vector<RefPtr<VariableDeclaration> >::iterator i=func.parameters.begin(); i!=func.parameters.end(); ++i)
+               block_variables[i->get()].referenced = true;
        merge_down_variables();
 }