From 72764bef4a33d18d4282887a188946261937ca8e Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 13 Oct 2012 19:09:33 +0200 Subject: [PATCH] In the graph debug output, color each node according to which phase they are in. --- effect_chain.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/effect_chain.cpp b/effect_chain.cpp index 617d1cb..64e3dec 100644 --- a/effect_chain.cpp +++ b/effect_chain.cpp @@ -394,7 +394,23 @@ void EffectChain::output_dot(const char *filename) fprintf(fp, "digraph G {\n"); for (unsigned i = 0; i < nodes.size(); ++i) { - fprintf(fp, " n%ld [label=\"%s\"];\n", (long)nodes[i], nodes[i]->effect->effect_type_id().c_str()); + // Find out which phase this event belongs to. + int in_phase = -1; + for (unsigned j = 0; j < phases.size(); ++j) { + const Phase* p = phases[j]; + if (std::find(p->effects.begin(), p->effects.end(), nodes[i]) != p->effects.end()) { + assert(in_phase == -1); + in_phase = j; + } + } + + if (in_phase == -1) { + fprintf(fp, " n%ld [label=\"%s\"];\n", (long)nodes[i], nodes[i]->effect->effect_type_id().c_str()); + } else { + fprintf(fp, " n%ld [label=\"%s\" style=\"filled\" fillcolor=\"/accent8/%d\"];\n", + (long)nodes[i], nodes[i]->effect->effect_type_id().c_str(), + (in_phase % 8) + 1); + } for (unsigned j = 0; j < nodes[i]->outgoing_links.size(); ++j) { std::vector labels; @@ -934,6 +950,8 @@ void EffectChain::finalize() // Construct all needed GLSL programs, starting at the output. construct_glsl_programs(find_output_node()); + output_dot("step11-split-to-phases.dot"); + // If we have more than one phase, we need intermediate render-to-texture. // Construct an FBO, and then as many textures as we need. // We choose the simplest option of having one texture per output, -- 2.39.2