]> git.tdb.fi Git - libs/gl.git/blobdiff - source/glsl/debug.cpp
Store types and interface blocks in Stage
[libs/gl.git] / source / glsl / debug.cpp
index 62cf7a94701ec04169c39748fbad6c84b46d58d2..c29a60ceab724c6b19069538d38aa3ad144b7d29 100644 (file)
@@ -13,6 +13,20 @@ const std::string &DumpTree::apply(Stage &stage)
        formatted = format("Stage: %s\n", Stage::get_stage_name(stage.type));
        tree.push_back(BRANCH);
        append(format("Version: %d.%02d", stage.required_features.glsl_version.major, stage.required_features.glsl_version.minor));
+
+       for(std::map<string, StructDeclaration *>::const_iterator i=stage.types.begin(); i!=stage.types.end(); ++i)
+               append(format("Type: %%%d %s", get_label(*i->second), i->first));
+
+       set<InterfaceBlock *> seen_interfaces;
+       for(std::map<string, InterfaceBlock *>::const_iterator i=stage.interface_blocks.begin(); i!=stage.interface_blocks.end(); ++i)
+               if(seen_interfaces.insert(i->second).second)
+               {
+                       string text = format("Interface block: %%%d %s %s", get_label(*i->second), i->second->interface, i->second->name);
+                       if(!i->second->instance_name.empty())
+                               text += format(" %s", i->second->instance_name);
+                       append(text);
+               }
+
        last_branch();
        stage.content.visit(*this);
        return formatted;
@@ -79,23 +93,10 @@ void DumpTree::visit(Block &block)
        append(format("Block %s", (block.use_braces ? "{}" : "(inline)")));
        begin_sub();
 
-       for(std::map<string, StructDeclaration *>::const_iterator i=block.types.begin(); i!=block.types.end(); ++i)
-               append(format("Type: %%%d %s", get_label(*i->second), i->first));
-
        for(std::map<string, VariableDeclaration *>::const_iterator i=block.variables.begin(); i!=block.variables.end(); ++i)
                append(format("Variable: %%%d %s %s", get_label(*i->second), i->second->type, i->first));
 
-       set<InterfaceBlock *> seen_interfaces;
-       for(std::map<string, InterfaceBlock *>::const_iterator i=block.interfaces.begin(); i!=block.interfaces.end(); ++i)
-               if(seen_interfaces.insert(i->second).second)
-               {
-                       string text = format("Interface: %%%d %s %s", get_label(*i->second), i->second->interface, i->second->name);
-                       if(!i->second->instance_name.empty())
-                               text += format(" %s", i->second->instance_name);
-                       append(text);
-               }
-
-       bool labeled_body = (!block.types.empty() || !block.variables.empty());
+       bool labeled_body = !block.variables.empty();
        if(labeled_body)
        {
                last_branch();