From 6b89fb751617dd51eddf2adcc55e9a8da66f8e84 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 6 Jan 2017 15:17:08 +0200 Subject: [PATCH] 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. --- source/programcompiler.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) 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; -- 2.45.2