diff --git a/cogl-debug.h b/cogl-debug.h index 1785114b1..c8c1f566e 100644 --- a/cogl-debug.h +++ b/cogl-debug.h @@ -41,8 +41,9 @@ typedef enum { COGL_DEBUG_BLEND_STRINGS = 1 << 9, 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_DISABLE_VBOS = 1 << 12, + COGL_DEBUG_JOURNAL = 1 << 13, + COGL_DEBUG_BATCHING = 1 << 14 } CoglDebugFlags; #ifdef COGL_ENABLE_DEBUG diff --git a/common/cogl-debug.c b/common/cogl-debug.c index 82d5864a8..e093a344c 100644 --- a/common/cogl-debug.c +++ b/common/cogl-debug.c @@ -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); diff --git a/common/cogl-primitives.c b/common/cogl-primitives.c index ed3561672..3b9f7f5d4 100644 --- a/common/cogl-primitives.c +++ b/common/cogl-primitives.c @@ -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)