예제 #1
0
void
_cg_debug_dump_pipelines_dot_file(const char *filename)
{
    c_string_t *graph;
    print_debug_state_t layer_state;
    print_debug_state_t pipeline_state;
    int layer_id = 0;
    int pipeline_id = 0;

    _CG_GET_DEVICE(dev, NO_RETVAL);

    if (!dev->default_pipeline)
        return;

    graph = c_string_new("");
    c_string_append_printf(graph, "digraph {\n");

    layer_state.graph = graph;
    layer_state.parent_id = -1;
    layer_state.node_id_ptr = &layer_id;
    layer_state.indent = 0;
    dump_layer_cb((cg_node_t *)dev->default_layer_0, &layer_state);

    pipeline_state.graph = graph;
    pipeline_state.parent_id = -1;
    pipeline_state.node_id_ptr = &pipeline_id;
    pipeline_state.indent = 0;
    dump_pipeline_cb((cg_node_t *)dev->default_pipeline, &pipeline_state);

    c_string_append_printf(graph, "}\n");

    if (filename)
        c_file_set_contents(filename, graph->str, -1, NULL);
    else
        c_print("%s", graph->str);

    c_string_free(graph, true);
}
예제 #2
0
void
_cogl_debug_dump_pipelines_dot_file (const char *filename)
{
  GString *graph;
  PrintDebugState layer_state;
  PrintDebugState pipeline_state;
  int layer_id = 0;
  int pipeline_id = 0;

  _COGL_GET_CONTEXT (ctx, NO_RETVAL);

  if (!ctx->default_pipeline)
    return;

  graph = g_string_new ("");
  g_string_append_printf (graph, "digraph {\n");

  layer_state.graph = graph;
  layer_state.parent_id = -1;
  layer_state.node_id_ptr = &layer_id;
  layer_state.indent = 0;
  dump_layer_cb ((CoglNode *)ctx->default_layer_0, &layer_state);

  pipeline_state.graph = graph;
  pipeline_state.parent_id = -1;
  pipeline_state.node_id_ptr = &pipeline_id;
  pipeline_state.indent = 0;
  dump_pipeline_cb ((CoglNode *)ctx->default_pipeline, &pipeline_state);

  g_string_append_printf (graph, "}\n");

  if (filename)
    g_file_set_contents (filename, graph->str, -1, NULL);
  else
    g_print ("%s", graph->str);

  g_string_free (graph, TRUE);
}