material: Improve the dot file debugging code

This improve the dot file output available when calling
_cogl_debug_dump_materials_dot_file. The material graph now directly
points into the layer graph and the layers now show the texture unit
index.
This commit is contained in:
Robert Bragg 2010-08-08 14:09:26 +01:00
parent abea3d7ead
commit 8caaf5a8b2

View File

@ -5147,30 +5147,38 @@ dump_layer_cb (CoglMaterialNode *node, void *user_data)
gboolean changes = FALSE; gboolean changes = FALSE;
if (state->parent_id >= 0) if (state->parent_id >= 0)
g_string_append_printf (state->graph, "%*slayer%d -> layer%d;\n", g_string_append_printf (state->graph, "%*slayer%p -> layer%p;\n",
state->indent, "", state->indent, "",
state->parent_id, layer->_parent.parent,
layer_id); layer);
g_string_append_printf (state->graph, g_string_append_printf (state->graph,
"%*slayer%d [label=\"layer=0x%p\\n" "%*slayer%p [label=\"layer=0x%p\\n"
"ref count=%d\" " "ref count=%d\" "
"color=\"blue\"];\n", "color=\"blue\"];\n",
state->indent, "", state->indent, "",
layer_id, layer,
layer, layer,
COGL_OBJECT (layer)->ref_count); COGL_OBJECT (layer)->ref_count);
changes_label = g_string_new (""); changes_label = g_string_new ("");
g_string_append_printf (changes_label, g_string_append_printf (changes_label,
"%*slayer%d -> layer_state%d [weight=100];\n" "%*slayer%p -> layer_state%d [weight=100];\n"
"%*slayer_state%d [shape=box label=\"", "%*slayer_state%d [shape=box label=\"",
state->indent, "", state->indent, "",
layer_id, layer,
layer_id, layer_id,
state->indent, "", state->indent, "",
layer_id); layer_id);
if (layer->differences & COGL_MATERIAL_LAYER_STATE_UNIT)
{
changes = TRUE;
g_string_append_printf (changes_label,
"\\lunit=%u\\n",
layer->unit_index);
}
if (layer->differences & COGL_MATERIAL_LAYER_STATE_TEXTURE) if (layer->differences & COGL_MATERIAL_LAYER_STATE_TEXTURE)
{ {
changes = TRUE; changes = TRUE;
@ -5208,13 +5216,7 @@ dump_layer_ref_cb (CoglMaterialLayer *layer, void *data)
int material_id = *state->node_id_ptr; int material_id = *state->node_id_ptr;
g_string_append_printf (state->graph, g_string_append_printf (state->graph,
"%*smaterial_state%d -> layer_ref%d [weight=200];\n", "%*smaterial_state%d -> layer%p;\n",
state->indent, "",
material_id,
material_id);
g_string_append_printf (state->graph,
"%*slayer_ref%d [label=\"addr=0x%p\" "
"shape=box color=blue];\n",
state->indent, "", state->indent, "",
material_id, material_id,
layer); layer);