X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprogramcompiler.cpp;h=cafedc8f03180d9be4285d7e189d7a9a1e4de975;hp=e03e64cd288708c8e476a56a9e921a3f5cbd3b59;hb=4b4d2a48048268d2ad48bafbce8647af8088573f;hpb=6fe1876a3040cc78ba4713194abf6d121f419458 diff --git a/source/programcompiler.cpp b/source/programcompiler.cpp index e03e64cd..cafedc8f 100644 --- a/source/programcompiler.cpp +++ b/source/programcompiler.cpp @@ -35,6 +35,8 @@ namespace GL { using namespace ProgramSyntax; +// XXX For some reason global declarations are emitted for otherwise undeclared local variables + ProgramCompiler::ProgramCompiler(): resources(0), module(0) @@ -860,6 +862,7 @@ void ProgramCompiler::InterfaceGenerator::insert_assignment(const string &left, ExpressionStatement *stmt = new ExpressionStatement; stmt->expression = assign; + stmt->visit(*this); insert_nodes.push_back(stmt); } @@ -891,7 +894,10 @@ void ProgramCompiler::InterfaceGenerator::visit(VariableDeclaration &var) { remove_node = true; if(var.init_expression) + { insert_assignment(var.name, var.init_expression->clone()); + return; + } } } else if(var.interface=="in")