X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fglsl%2Foutput.cpp;h=b277ba8ee09fef2b2c38c4152dc136982c16d68f;hb=4181ceb89a2d538712c81826da610e7e8583e9a5;hp=72af837958e77a712196b97cc9279258e8c08555;hpb=2989fc60f0fd98282962a0105bcba055193e2f8c;p=libs%2Fgl.git diff --git a/source/glsl/output.cpp b/source/glsl/output.cpp index 72af8379..b277ba8e 100644 --- a/source/glsl/output.cpp +++ b/source/glsl/output.cpp @@ -94,7 +94,7 @@ void Formatter::visit(Block &block) bool first = true; for(NodeList::iterator i=block.body.begin(); i!=block.body.end(); ++i) { - if((*i)->source==BUILTIN_SOURCE) + if((*i)->source<=BUILTIN_SOURCE) continue; if(!first) append('\n'); @@ -136,6 +136,12 @@ void Formatter::visit(MemberAccess &memacc) append(format(".%s", memacc.member)); } +void Formatter::visit(Swizzle &swizzle) +{ + swizzle.left->visit(*this); + append(format(".%s", swizzle.component_group)); +} + void Formatter::visit(UnaryExpression &unary) { if(unary.oper->type==Operator::PREFIX) @@ -229,7 +235,7 @@ void Formatter::visit(VariableDeclaration &var) append(format("%s ", var.interpolation)); if(!var.sampling.empty()) append(format("%s ", var.sampling)); - if(!var.interface.empty() && var.interface!=block_interface) + if(!var.interface.empty()) { string interface = var.interface; if(mode==Compiler::PROGRAM && stage && stage->required_features.glsl_versionname; + if(var.array) + type_name = type_name.substr(0, type_name.find('[')); + append(format("%s %s", type_name, var.name)); if(var.array) { append('['); @@ -262,9 +271,9 @@ void Formatter::visit(VariableDeclaration &var) 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.struct_declaration) + iface.struct_declaration->members.visit(*this); if(!iface.instance_name.empty()) { append(' '); @@ -277,7 +286,7 @@ void Formatter::visit(InterfaceBlock &iface) void Formatter::visit(FunctionDeclaration &func) { - append(format("%s %s(", func.return_type, func.name)); + append(format("%s %s(", func.return_type_declaration->name, func.name)); for(NodeArray::iterator i=func.parameters.begin(); i!=func.parameters.end(); ++i) { if(i!=func.parameters.begin())