]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/visitor.cpp
Transform interface block contents into structs
[libs/gl.git] / source / glsl / visitor.cpp
index fa6e614c6394a1705e4d45b6214fc55efbc760a1..ebcedb71242cc883bd2ef7b7c58ac6783867a19a 100644 (file)
@@ -39,7 +39,8 @@ void TraversingVisitor::visit(BinaryExpression &binary)
 
 void TraversingVisitor::visit(Assignment &assign)
 {
-       visit(static_cast<BinaryExpression &>(assign));
+       assign.left->visit(*this);
+       assign.right->visit(*this);
 }
 
 void TraversingVisitor::visit(FunctionCall &call)
@@ -75,7 +76,8 @@ void TraversingVisitor::visit(VariableDeclaration &var)
 
 void TraversingVisitor::visit(InterfaceBlock &iface)
 {
-       iface.members.visit(*this);
+       if(iface.members)
+               iface.members->visit(*this);
 }
 
 void TraversingVisitor::visit(FunctionDeclaration &func)
@@ -154,10 +156,10 @@ void NodeRemover::visit(Block &block)
        }
 }
 
-void NodeRemover::visit(StructDeclaration &strct)
+void NodeRemover::visit(TypeDeclaration &type)
 {
-       if(to_remove->count(&strct))
-               remove_from_map(stage->types, strct.name, strct);
+       if(to_remove->count(&type))
+               remove_from_map(stage->types, type.name, type);
 }
 
 void NodeRemover::visit(VariableDeclaration &var)
@@ -177,9 +179,9 @@ void NodeRemover::visit(InterfaceBlock &iface)
 {
        if(to_remove->count(&iface))
        {
-               remove_from_map(stage->interface_blocks, iface.name, iface);
+               remove_from_map(stage->interface_blocks, iface.interface+iface.name, iface);
                if(!iface.instance_name.empty())
-                       remove_from_map(stage->interface_blocks, iface.instance_name, iface);
+                       remove_from_map(stage->interface_blocks, "_"+iface.instance_name, iface);
        }
        SetFlag set_recursive(recursive_remove, recursive_remove || to_remove->count(&iface));
        TraversingVisitor::visit(iface);