namespace GL {
namespace SL {
-const std::string &DumpTree::apply(Stage &stage)
+std::string DumpTree::apply(Stage &stage)
{
formatted = format("Stage: %s\n", Stage::get_stage_name(stage.type));
- tree.push_back(BRANCH);
+ begin_sub();
append(format("Version: %d.%02d", stage.required_features.glsl_version.major, stage.required_features.glsl_version.minor));
for(std::map<string, TypeDeclaration *>::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->block_name);
- if(!i->second->instance_name.empty())
- text += format(" %s", i->second->instance_name);
- append(text);
- }
+ append(format("Interface block: %%%d %s", get_label(*i->second), i->first));
for(std::map<string, FunctionDeclaration *>::const_iterator i=stage.functions.begin(); i!=stage.functions.end(); ++i)
append(format("Function: %%%d %s", get_label(*i->second), i->first));
void DumpTree::begin_sub()
{
- tree.back() = (tree.back()==BRANCH_LAST ? EMPTY : STRAIGHT);
+ if(!tree.empty())
+ tree.back() = (tree.back()==BRANCH_LAST ? EMPTY : STRAIGHT);
tree.push_back(BRANCH);
}
void DumpTree::end_sub()
{
tree.pop_back();
- if(tree.back()==STRAIGHT)
+ if(!tree.empty() && tree.back()==STRAIGHT)
tree.back() = BRANCH;
}
vector<Branch> branches;
if(iface.type_declaration)
- append(format("Type: %%%d %s", get_label(*iface.type_declaration), iface.type_declaration->name));
+ branches.push_back(format("Type: %%%d %s", get_label(*iface.type_declaration), iface.type_declaration->name));
if(iface.layout)
branches.push_back(iface.layout.get());
if(iface.members)