X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fdebug.cpp;h=50d2b985604ccfa4f5a4c1c2afe0d667d02be01c;hb=3f899b1fc2e04f4fe74c99ad3e8ebb900c257214;hp=c29a60ceab724c6b19069538d38aa3ad144b7d29;hpb=7daccf2582084283a9e5064995f674eef835996e;p=libs%2Fgl.git diff --git a/source/glsl/debug.cpp b/source/glsl/debug.cpp index c29a60ce..50d2b985 100644 --- a/source/glsl/debug.cpp +++ b/source/glsl/debug.cpp @@ -27,6 +27,9 @@ const std::string &DumpTree::apply(Stage &stage) append(text); } + for(std::map::const_iterator i=stage.functions.begin(); i!=stage.functions.end(); ++i) + append(format("Function: %%%d %s", get_label(*i->second), i->first)); + last_branch(); stage.content.visit(*this); return formatted; @@ -171,9 +174,7 @@ void DumpTree::visit(Assignment &assign) append(format("Assignment: %s%s", assign.oper, (assign.self_referencing ? " (self-referencing)" : ""))); begin_sub(); if(assign.target_declaration) - { append(format("Target: %%%d %s %s", get_label(*assign.target_declaration), assign.target_declaration->type, assign.target_declaration->name)); - } assign.left->visit(*this); last_branch(); assign.right->visit(*this); @@ -296,14 +297,18 @@ void DumpTree::visit(InterfaceBlock &block) void DumpTree::visit(FunctionDeclaration &func) { - append(format("%%%d %s %s()", get_label(func), func.return_type, func.name)); + string text = format("%%%d %s %s", get_label(func), func.return_type, func.name); + if(!func.definition) + text += " (undefined)"; + append(text); begin_sub(); for(NodeArray::const_iterator i=func.parameters.begin(); i!=func.parameters.end(); ++i) (*i)->visit(*this); - if(func.definition) - append(format("Definition: %%%d", get_label(*func.definition))); last_branch(); - func.body.visit(*this); + if(func.definition!=&func) + append(format("Definition: %%%d", get_label(*func.definition))); + else + func.body.visit(*this); end_sub(); }