[cogl journal] Adds a --cogl-debug=batching option to trace batching
Enabling this option makes Cogl trace how the journal is managing to batch your rectangles. The journal staggers how it emmits state to the GL driver and the batches will normally get smaller for each stage, but ideally you don't want to be in a situation where Cogl is only able to draw one quad per modelview change and draw call. E.g. this is a fairly ideal example: BATCHING: journal len = 101 BATCHING: vbo offset batch len = 101 BATCHING: material batch len = 101 BATCHING: modelview batch len = 101 This isn't: BATCHING: journal len = 1 BATCHING: vbo offset batch len = 1 BATCHING: material batch len = 1 BATCHING: modelview batch len = 1 BATCHING: journal len = 1 BATCHING: vbo offset batch len = 1 BATCHING: material batch len = 1 BATCHING: modelview batch len = 1 <repeat>
This commit is contained in:
parent
121bcd6dfe
commit
839c466d62
@ -42,7 +42,8 @@ typedef enum {
|
||||
COGL_DEBUG_DISABLE_BATCHING = 1 << 10,
|
||||
COGL_DEBUG_FORCE_CLIENT_SIDE_MATRICES = 1 << 11,
|
||||
COGL_DEBUG_DISABLE_VBOS = 1 << 12,
|
||||
COGL_DEBUG_JOURNAL = 1 << 13
|
||||
COGL_DEBUG_JOURNAL = 1 << 13,
|
||||
COGL_DEBUG_BATCHING = 1 << 14
|
||||
} CoglDebugFlags;
|
||||
|
||||
#ifdef COGL_ENABLE_DEBUG
|
||||
|
@ -44,7 +44,8 @@ static const GDebugKey cogl_debug_keys[] = {
|
||||
{ "disable-batching", COGL_DEBUG_DISABLE_BATCHING },
|
||||
{ "client-side-matrices", COGL_DEBUG_FORCE_CLIENT_SIDE_MATRICES },
|
||||
{ "disable-vbos", COGL_DEBUG_DISABLE_VBOS },
|
||||
{ "journal", COGL_DEBUG_JOURNAL }
|
||||
{ "journal", COGL_DEBUG_JOURNAL },
|
||||
{ "batching", COGL_DEBUG_BATCHING }
|
||||
};
|
||||
|
||||
static const gint n_cogl_debug_keys = G_N_ELEMENTS (cogl_debug_keys);
|
||||
|
@ -178,6 +178,9 @@ _cogl_journal_flush_modelview_and_entries (CoglJournalEntry *batch_start,
|
||||
{
|
||||
CoglJournalFlushState *state = data;
|
||||
|
||||
if (cogl_debug_flags & COGL_DEBUG_BATCHING)
|
||||
g_print ("BATCHING: modelview batch len = %d\n", batch_len);
|
||||
|
||||
GE (glLoadMatrixf ((GLfloat *)&batch_start->model_view));
|
||||
|
||||
#ifdef HAVE_COGL_GL
|
||||
@ -263,10 +266,8 @@ _cogl_journal_flush_material_and_entries (CoglJournalEntry *batch_start,
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
#if 0
|
||||
if (batch_len != 1)
|
||||
g_debug ("batch len = %d", batch_len);
|
||||
#endif
|
||||
if (cogl_debug_flags & COGL_DEBUG_BATCHING)
|
||||
g_print ("BATCHING: material batch len = %d\n", batch_len);
|
||||
|
||||
_cogl_material_flush_gl_state (batch_start->material,
|
||||
&batch_start->flush_options);
|
||||
@ -382,6 +383,9 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
|
||||
|
||||
_COGL_GET_CONTEXT (ctx, NO_RETVAL);
|
||||
|
||||
if (cogl_debug_flags & COGL_DEBUG_BATCHING)
|
||||
g_print ("BATCHING: vbo offset batch len = %d\n", batch_len);
|
||||
|
||||
/* XXX NB:
|
||||
* Our journal's vertex data is arranged as follows:
|
||||
* 4 vertices per quad:
|
||||
@ -418,7 +422,7 @@ _cogl_journal_flush_vbo_offsets_and_entries (CoglJournalEntry *batch_start,
|
||||
/* We only call gl{Vertex,Color,Texture}Pointer when the stride within
|
||||
* the VBO changes. (due to a change in the number of material layers)
|
||||
* While the stride remains constant we walk forward through the above
|
||||
* VBO use a vertex offset passed to glDraw{Arrays,Elements} */
|
||||
* VBO using a vertex offset passed to glDraw{Arrays,Elements} */
|
||||
state->vertex_offset = 0;
|
||||
|
||||
if (cogl_debug_flags & COGL_DEBUG_JOURNAL)
|
||||
@ -522,6 +526,9 @@ _cogl_journal_flush (void)
|
||||
if (ctx->journal->len == 0)
|
||||
return;
|
||||
|
||||
if (cogl_debug_flags & COGL_DEBUG_BATCHING && ctx->journal->len != 1)
|
||||
g_print ("BATCHING: journal len = %d\n", ctx->journal->len);
|
||||
|
||||
/* Load all the vertex data we have accumulated so far into a single VBO
|
||||
* to minimize memory management costs within the GL driver. */
|
||||
if (!vbo_fallback)
|
||||
|
Loading…
Reference in New Issue
Block a user