mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 02:20:43 -05:00
[Cogl journal] Adds a --cogl-debug=journal option for tracing the journal
When this option is used Cogl will print a trace of all quads that get logged into the journal, and a trace of quads as they get flushed. If you are seeing a bug with the geometry being drawn by Cogl this may give some clues by letting you sanity check the numbers being logged vs the numbers being emitted.
This commit is contained in:
parent
3ea7816499
commit
d03e6cfb2c
@ -41,7 +41,8 @@ typedef enum {
|
|||||||
COGL_DEBUG_BLEND_STRINGS = 1 << 9,
|
COGL_DEBUG_BLEND_STRINGS = 1 << 9,
|
||||||
COGL_DEBUG_DISABLE_BATCHING = 1 << 10,
|
COGL_DEBUG_DISABLE_BATCHING = 1 << 10,
|
||||||
COGL_DEBUG_FORCE_CLIENT_SIDE_MATRICES = 1 << 11,
|
COGL_DEBUG_FORCE_CLIENT_SIDE_MATRICES = 1 << 11,
|
||||||
COGL_DEBUG_DISABLE_VBOS = 1 << 12
|
COGL_DEBUG_DISABLE_VBOS = 1 << 12,
|
||||||
|
COGL_DEBUG_JOURNAL = 1 << 13
|
||||||
} CoglDebugFlags;
|
} CoglDebugFlags;
|
||||||
|
|
||||||
#ifdef COGL_ENABLE_DEBUG
|
#ifdef COGL_ENABLE_DEBUG
|
||||||
|
@ -43,7 +43,8 @@ static const GDebugKey cogl_debug_keys[] = {
|
|||||||
{ "blend-strings", COGL_DEBUG_BLEND_STRINGS },
|
{ "blend-strings", COGL_DEBUG_BLEND_STRINGS },
|
||||||
{ "disable-batching", COGL_DEBUG_DISABLE_BATCHING },
|
{ "disable-batching", COGL_DEBUG_DISABLE_BATCHING },
|
||||||
{ "client-side-matrices", COGL_DEBUG_FORCE_CLIENT_SIDE_MATRICES },
|
{ "client-side-matrices", COGL_DEBUG_FORCE_CLIENT_SIDE_MATRICES },
|
||||||
{ "disable-vbos", COGL_DEBUG_DISABLE_VBOS }
|
{ "disable-vbos", COGL_DEBUG_DISABLE_VBOS },
|
||||||
|
{ "journal", COGL_DEBUG_JOURNAL }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const gint n_cogl_debug_keys = G_N_ELEMENTS (cogl_debug_keys);
|
static const gint n_cogl_debug_keys = G_N_ELEMENTS (cogl_debug_keys);
|
||||||
|
@ -421,14 +421,19 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
|
|||||||
* VBO use a vertex offset passed to glDraw{Arrays,Elements} */
|
* VBO use a vertex offset passed to glDraw{Arrays,Elements} */
|
||||||
state->vertex_offset = 0;
|
state->vertex_offset = 0;
|
||||||
|
|
||||||
/* XXX: Uncomment for debugging */
|
if (cogl_debug_flags & COGL_DEBUG_JOURNAL)
|
||||||
#if 0
|
{
|
||||||
g_assert (cogl_get_features () & COGL_FEATURE_VBOS);
|
guint8 *verts;
|
||||||
_cogl_journal_dump_quad_batch (((guint8 *)ctx->logged_vertices->data) +
|
|
||||||
(size_t)state->vbo_offset,
|
if (cogl_get_features () & COGL_FEATURE_VBOS)
|
||||||
|
verts = ((guint8 *)ctx->logged_vertices->data) +
|
||||||
|
(size_t)state->vbo_offset;
|
||||||
|
else
|
||||||
|
verts = (guint8 *)state->vbo_offset;
|
||||||
|
_cogl_journal_dump_quad_batch (verts,
|
||||||
batch_start->n_layers,
|
batch_start->n_layers,
|
||||||
batch_len);
|
batch_len);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
batch_and_call (batch_start,
|
batch_and_call (batch_start,
|
||||||
batch_len,
|
batch_len,
|
||||||
@ -442,6 +447,8 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
|
|||||||
|
|
||||||
/* progress forward through the VBO containing all our vertices */
|
/* progress forward through the VBO containing all our vertices */
|
||||||
state->vbo_offset += (stride * 4 * batch_len);
|
state->vbo_offset += (stride * 4 * batch_len);
|
||||||
|
if (cogl_debug_flags & COGL_DEBUG_JOURNAL)
|
||||||
|
g_print ("new vbo offset = %lu\n", (gulong)state->vbo_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -450,6 +457,8 @@ compare_entry_strides (CoglJournalEntry *entry0, CoglJournalEntry *entry1)
|
|||||||
/* Currently the only thing that affects the stride for our vertex arrays
|
/* Currently the only thing that affects the stride for our vertex arrays
|
||||||
* is the number of material layers. We need to update our VBO offsets
|
* is the number of material layers. We need to update our VBO offsets
|
||||||
* whenever the stride changes. */
|
* whenever the stride changes. */
|
||||||
|
/* TODO: We should be padding the n_layers == 1 case as if it were
|
||||||
|
* n_layers == 2 so we can reduce the need to split batches. */
|
||||||
if (entry0->n_layers == entry1->n_layers ||
|
if (entry0->n_layers == entry1->n_layers ||
|
||||||
(entry0->n_layers <= MIN_LAYER_PADING &&
|
(entry0->n_layers <= MIN_LAYER_PADING &&
|
||||||
entry1->n_layers <= MIN_LAYER_PADING))
|
entry1->n_layers <= MIN_LAYER_PADING))
|
||||||
@ -637,11 +646,12 @@ _cogl_journal_log_quad (float x_1,
|
|||||||
t[0] = tex_coords[2]; t[1] = tex_coords[1];
|
t[0] = tex_coords[2]; t[1] = tex_coords[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: Uncomment for debugging */
|
if (cogl_debug_flags & COGL_DEBUG_JOURNAL)
|
||||||
#if 0
|
{
|
||||||
|
g_print ("Logged new quad:\n");
|
||||||
v = &g_array_index (ctx->logged_vertices, GLfloat, next_vert);
|
v = &g_array_index (ctx->logged_vertices, GLfloat, next_vert);
|
||||||
_cogl_journal_dump_quad_vertices ((guint8 *)v, n_layers);
|
_cogl_journal_dump_quad_vertices ((guint8 *)v, n_layers);
|
||||||
#endif
|
}
|
||||||
|
|
||||||
next_entry = ctx->journal->len;
|
next_entry = ctx->journal->len;
|
||||||
g_array_set_size (ctx->journal, next_entry + 1);
|
g_array_set_size (ctx->journal, next_entry + 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user