X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fglsl%2Fdebug.h;fp=source%2Fglsl%2Fdebug.h;h=5b2a3d96594460459d34783a93545e22dc23cb01;hp=c3e9c701075b87974a7e5101ad635bf0bf8e5d8b;hb=b23a9af95c65c01d949153fc49e5091aaa7c3d30;hpb=f1e31ee641f0cafdfe2015bff206b9ee2ad85abf diff --git a/source/glsl/debug.h b/source/glsl/debug.h index c3e9c701..5b2a3d96 100644 --- a/source/glsl/debug.h +++ b/source/glsl/debug.h @@ -32,11 +32,28 @@ private: Branch(Node *n): node(n) { } }; + struct Colors + { + const char *default_color; + const char *tree_color; + const char *location_color; + const char *label_color; + const char *type_color; + const char *name_color; + const char *error_color; + }; + std::map node_labels; std::string formatted; std::vector tree; + const Colors &colors; + + static const Colors no_colors; + static const Colors default_colors; public: + DumpTree(bool = false); + std::string apply(Stage &); std::string apply(Node &n) { n.visit(*this); return formatted; } @@ -48,8 +65,10 @@ private: void begin_sub(); void last_branch(); void end_sub(); - unsigned get_label(const Node &); + std::string get_label(const Node &); std::string format_type(TypeDeclaration *); + std::string format_type(const std::string &); + std::string format_name(const std::string &); template typename T::const_iterator increment(typename T::const_iterator &, const T &);