}
}
+void LegacyConverter::visit(RefPtr<Expression> &expr)
+{
+ r_replaced_reference = 0;
+ expr->visit(*this);
+ if(r_replaced_reference)
+ expr = r_replaced_reference;
+ r_replaced_reference = 0;
+}
+
bool LegacyConverter::check_version(const Version &feature_version) const
{
if(features.glsl_version<feature_version)
}
}
+void LegacyConverter::visit(InterfaceBlockReference &iface)
+{
+ r_flattened_interface = nodes_to_remove.count(iface.declaration);
+}
+
+void LegacyConverter::visit(MemberAccess &memacc)
+{
+ r_flattened_interface = false;
+ visit(memacc.left);
+ if(r_flattened_interface)
+ {
+ VariableReference *var = new VariableReference;
+ var->name = memacc.member;
+ r_replaced_reference = var;
+ }
+}
+
void LegacyConverter::visit(Assignment &assign)
{
TraversingVisitor::visit(assign);
unsupported("ARB_uniform_buffer_object required for interface block instances");
else if(iface.struct_declaration)
{
+ for(const RefPtr<Statement> &s: iface.struct_declaration->members.body)
+ if(VariableDeclaration *var = dynamic_cast<VariableDeclaration *>(s.get()))
+ var->interface = iface.interface;
stage->content.body.splice(uniform_insert_point, iface.struct_declaration->members.body);
nodes_to_remove.insert(&iface);
nodes_to_remove.insert(iface.struct_declaration);
VariableDeclaration *frag_out = 0;
NodeList<Statement>::iterator uniform_insert_point;
std::set<Node *> nodes_to_remove;
+ RefPtr<Expression> r_replaced_reference;
+ bool r_flattened_interface = false;
public:
virtual void apply(Stage &, const Features &);
void unsupported(const std::string &);
virtual void visit(Block &);
+ virtual void visit(RefPtr<Expression> &);
bool check_version(const Version &) const;
bool check_extension(bool Features::*) const;
bool supports_stage(Stage::Type) const;
bool supports_unified_interface_syntax() const;
virtual void visit(VariableReference &);
+ virtual void visit(InterfaceBlockReference &);
+ virtual void visit(MemberAccess &);
virtual void visit(Assignment &);
bool supports_unified_sampling_functions() const;
virtual void visit(FunctionCall &);