X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fprogramcompiler.cpp;h=00d217a06aebb4dcb83b731427e466a584fffe6b;hp=bb77e0ea911e205c192c68cd88462f6affdf1ff6;hb=ae1fe9121b341c7852e54aa586f23edaf21b664c;hpb=b699b811b22450828268be7ed67e35900be7bdad diff --git a/source/programcompiler.cpp b/source/programcompiler.cpp index bb77e0ea..00d217a0 100644 --- a/source/programcompiler.cpp +++ b/source/programcompiler.cpp @@ -989,7 +989,7 @@ bool ProgramCompiler::InterfaceGenerator::generate_interface(VariableDeclaration return true; } -void ProgramCompiler::InterfaceGenerator::insert_assignment(const string &left, ProgramSyntax::Expression *right) +ExpressionStatement &ProgramCompiler::InterfaceGenerator::insert_assignment(const string &left, ProgramSyntax::Expression *right) { Assignment *assign = new Assignment; VariableReference *ref = new VariableReference; @@ -1002,6 +1002,8 @@ void ProgramCompiler::InterfaceGenerator::insert_assignment(const string &left, stmt->expression = assign; stmt->visit(*this); insert_nodes.push_back(stmt); + + return *stmt; } void ProgramCompiler::InterfaceGenerator::visit(VariableReference &var) @@ -1033,7 +1035,9 @@ void ProgramCompiler::InterfaceGenerator::visit(VariableDeclaration &var) remove_node = true; if(var.init_expression) { - insert_assignment(var.name, var.init_expression->clone()); + ExpressionStatement &stmt = insert_assignment(var.name, var.init_expression->clone()); + stmt.source = var.source; + stmt.line = var.line; return; } } @@ -1944,6 +1948,8 @@ void ProgramCompiler::LegacyConverter::visit(FunctionCall &call) call.name = "texture2D"; else if(type=="sampler3D") call.name = "texture3D"; + else if(type=="samplerCube") + call.name = "textureCube"; else if(type=="sampler1DShadow") call.name = "shadow1D"; else if(type=="sampler2DShadow")