X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Foutput.cpp;h=6e88fd1f870e6ba554a0fbfa0ddaba93d6347720;hb=1fa69bb8eec3070f5da296d6dd0bd67aea62d3bf;hp=aaba1dc4a0a638f15145dc48726344256056727a;hpb=696a97bd7411d69953c1a9e4b5f3dfb4c1d848f1;p=libs%2Fgl.git diff --git a/source/glsl/output.cpp b/source/glsl/output.cpp index aaba1dc4..6e88fd1f 100644 --- a/source/glsl/output.cpp +++ b/source/glsl/output.cpp @@ -9,14 +9,17 @@ namespace GL { namespace SL { Formatter::Formatter(): + stage(0), source_index(0), source_line(1), indent(0), parameter_list(false) { } -void Formatter::apply(Stage &s) +const string &Formatter::apply(Stage &s) { + SetForScope set_stage(stage, &s); + GLApi api = get_gl_api(); const Version &ver = s.required_version; @@ -33,7 +36,9 @@ void Formatter::apply(Stage &s) if(!s.required_extensions.empty()) formatted += '\n'; - StageVisitor::apply(s); + visit(s.content); + + return formatted; } void Formatter::append(const string &text) @@ -211,9 +216,9 @@ void Formatter::visit(VariableDeclaration &var) string interface = var.interface; if(stage->required_versiontype==VERTEX && var.interface=="in") + if(stage->type==Stage::VERTEX && var.interface=="in") interface = "attribute"; - else if((stage->type==VERTEX && var.interface=="out") || (stage->type==FRAGMENT && var.interface=="in")) + else if((stage->type==Stage::VERTEX && var.interface=="out") || (stage->type==Stage::FRAGMENT && var.interface=="in")) interface = "varying"; } append(format("%s ", interface));