X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Foutput.cpp;h=81f335735e80eb433fd746ae85216dc59b309e83;hb=9ec831710f64a62ad5f2e896a55ae82a3519f29e;hp=3fc703c1966d9b4a9c745f7f3ee8e49aa55c5af8;hpb=c0be4e4ae1a8b6ac31ff6b7080e2242c13d947ff;p=libs%2Fgl.git diff --git a/source/glsl/output.cpp b/source/glsl/output.cpp index 3fc703c1..81f33573 100644 --- a/source/glsl/output.cpp +++ b/source/glsl/output.cpp @@ -44,7 +44,7 @@ const string &Formatter::apply(Stage &s, Compiler::Mode m) append("#extension ext_texture_array: require\n"); formatted += '\n'; - visit(s.content); + s.content.visit(*this); return formatted; } @@ -99,6 +99,11 @@ void Formatter::visit(VariableReference &var) append(var.name); } +void Formatter::visit(InterfaceBlockReference &iface) +{ + append(iface.name); +} + void Formatter::visit(MemberAccess &memacc) { memacc.left->visit(*this); @@ -156,10 +161,14 @@ void Formatter::visit(Block &block) SetForScope set(indent, indent+(indent>0 || use_braces)); string spaces(indent*2, ' '); + bool first = true; for(NodeList::iterator i=block.body.begin(); i!=block.body.end(); ++i) { - if(i!=block.body.begin()) + if((*i)->source==BUILTIN_SOURCE) + continue; + if(!first) append('\n'); + first = false; set_source((*i)->source, (*i)->line); append(spaces); (*i)->visit(*this); @@ -186,9 +195,9 @@ void Formatter::visit(Layout &layout) { if(i!=layout.qualifiers.begin()) append(", "); - append(i->identifier); - if(!i->value.empty()) - append(format("=%s", i->value)); + append(i->name); + if(i->has_value) + append(format("=%d", i->value)); } append(')'); } @@ -255,6 +264,13 @@ void Formatter::visit(InterfaceBlock &iface) SetForScope set(block_interface, iface.interface); append(format("%s %s\n", iface.interface, iface.name)); iface.members.visit(*this); + if(!iface.instance_name.empty()) + { + append(' '); + append(iface.instance_name); + if(iface.array) + append("[]"); + } append(';'); } @@ -341,6 +357,18 @@ void Formatter::visit(Iteration &iter) } } +void Formatter::visit(Passthrough &pass) +{ + append("passthrough"); + if(pass.subscript) + { + append('['); + pass.subscript->visit(*this); + append(']'); + } + append(';'); +} + void Formatter::visit(Return &ret) { append("return");