From: Mikko Rasa Date: Fri, 6 Jan 2017 13:17:08 +0000 (+0200) Subject: Don't replace in/out with attribute/varying until formatting X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=commitdiff_plain;h=6b89fb751617dd51eddf2adcc55e9a8da66f8e84;hp=a873639a9346082f9e71145a2b318bea32bfdeb6 Don't replace in/out with attribute/varying until formatting Some parts of the code depend on having the correct interfaces present in the AST. --- diff --git a/source/programcompiler.cpp b/source/programcompiler.cpp index 0d61c685..f9a14f2f 100644 --- a/source/programcompiler.cpp +++ b/source/programcompiler.cpp @@ -368,7 +368,17 @@ void ProgramCompiler::Formatter::visit(VariableDeclaration &var) if(!var.sampling.empty()) formatted += format("%s ", var.sampling); if(!var.interface.empty() && var.interface!=block_interface) - formatted += format("%s ", var.interface); + { + string interface = var.interface; + if(stage->required_versiontype==VERTEX && var.interface=="in") + interface = "attribute"; + else if((stage->type==VERTEX && var.interface=="out") || (stage->type==FRAGMENT && var.interface=="in")) + interface = "varying"; + } + formatted += format("%s ", interface); + } formatted += format("%s %s", var.type, var.name); if(var.array) { @@ -1569,11 +1579,7 @@ void ProgramCompiler::LegacyConverter::visit(VariableDeclaration &var) if((var.interface=="in" || var.interface=="out") && !check_version(Version(1, 30))) { - if(stage->type==VERTEX && var.interface=="in") - var.interface = "attribute"; - else if((stage->type==VERTEX && var.interface=="out") || (stage->type==FRAGMENT && var.interface=="in")) - var.interface = "varying"; - else if(stage->type==FRAGMENT && var.interface=="out") + if(stage->type==FRAGMENT && var.interface=="out") { frag_out_name = var.name; remove_node = true;