X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fdebug.cpp;h=2be5bce4ee2a97d5a31408af182c19c3571c0701;hb=eb7ffda6876bd2eeeb64dcb7c82236f36fe5cf43;hp=2f243dc73dc0d25518ce341597749f4255f45d8a;hpb=2280a09a286bbff2eb41783f8023863f320a3736;p=libs%2Fgl.git diff --git a/source/glsl/debug.cpp b/source/glsl/debug.cpp index 2f243dc7..2be5bce4 100644 --- a/source/glsl/debug.cpp +++ b/source/glsl/debug.cpp @@ -11,7 +11,7 @@ namespace SL { 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::const_iterator i=stage.types.begin(); i!=stage.types.end(); ++i) @@ -78,7 +78,8 @@ void DumpTree::append_subtree(Node &node) 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); } @@ -90,7 +91,7 @@ void DumpTree::last_branch() void DumpTree::end_sub() { tree.pop_back(); - if(tree.back()==STRAIGHT) + if(!tree.empty() && tree.back()==STRAIGHT) tree.back() = BRANCH; } @@ -372,10 +373,7 @@ void DumpTree::visit(VariableDeclaration &var) void DumpTree::visit(InterfaceBlock &iface) { - string head; - if(!iface.instance_name.empty()) - head += format("%%%d ", get_label(iface)); - head += format("%s %s", iface.interface, iface.block_name); + string head = format("%%%d %s %s", get_label(iface), iface.interface, iface.block_name); if(!iface.instance_name.empty()) head += format(" %s", iface.instance_name); if(iface.array)