cogl-debug: Add a debug option for tracing clipping

This adds a COGL_DEBUG=clipping option that reports how the clip is
being flushed. This is needed to determine whether the scissor,
stencil clip planes or software clipping is being used.
This commit is contained in:
Neil Roberts 2011-01-24 16:36:56 +00:00
parent 35a2d79e46
commit 5137d0a23f
5 changed files with 22 additions and 1 deletions

View File

@ -597,6 +597,8 @@ _cogl_clip_stack_flush (CoglClipStack *stack)
/* If the stack is empty then there's nothing else to do */
if (stack == NULL)
{
COGL_NOTE (CLIPPING, "Flushed empty clip stack");
ctx->current_clip_stack_uses_stencil = FALSE;
GE (glDisable (GL_SCISSOR_TEST));
return;
@ -636,6 +638,10 @@ _cogl_clip_stack_flush (CoglClipStack *stack)
}
}
COGL_NOTE (CLIPPING, "Flushing scissor to (%i, %i, %i, %i)",
scissor_x0, scissor_y0,
scissor_x1, scissor_y1);
GE (glEnable (GL_SCISSOR_TEST));
GE (glScissor (scissor_x0, scissor_y_start,
scissor_x1 - scissor_x0,
@ -651,6 +657,8 @@ _cogl_clip_stack_flush (CoglClipStack *stack)
{
CoglClipStackPath *path_entry = (CoglClipStackPath *) entry;
COGL_NOTE (CLIPPING, "Adding stencil clip for path");
_cogl_matrix_stack_push (modelview_stack);
_cogl_matrix_stack_set (modelview_stack, &path_entry->matrix);
@ -677,6 +685,8 @@ _cogl_clip_stack_flush (CoglClipStack *stack)
them then use that instead */
if (has_clip_planes)
{
COGL_NOTE (CLIPPING, "Adding clip planes clip for rectangle");
set_clip_planes (rect->x0,
rect->y0,
rect->x1,
@ -687,6 +697,8 @@ _cogl_clip_stack_flush (CoglClipStack *stack)
}
else
{
COGL_NOTE (CLIPPING, "Adding stencil clip for rectangle");
add_stencil_clip_rectangle (rect->x0,
rect->y0,
rect->x1,

View File

@ -174,3 +174,8 @@ OPT (DISABLE_FAST_READ_PIXEL,
"Disable read pixel optimization",
"Disable optimization for reading 1px for simple "
"scenes of opaque rectangles")
OPT (CLIPPING,
"Cogl Tracing",
"clipping",
"Trace clipping",
"Logs information about how Cogl is implementing clipping")

View File

@ -54,7 +54,8 @@ static const GDebugKey cogl_log_debug_keys[] = {
{ "show-source", COGL_DEBUG_SHOW_SOURCE},
{ "offscreen", COGL_DEBUG_OFFSCREEN },
{ "texture-pixmap", COGL_DEBUG_TEXTURE_PIXMAP },
{ "bitmap", COGL_DEBUG_BITMAP }
{ "bitmap", COGL_DEBUG_BITMAP },
{ "clipping", COGL_DEBUG_CLIPPING }
};
static const int n_cogl_log_debug_keys =
G_N_ELEMENTS (cogl_log_debug_keys);

View File

@ -62,6 +62,7 @@ typedef enum {
COGL_DEBUG_DISABLE_SOFTWARE_CLIP,
COGL_DEBUG_DISABLE_PROGRAM_CACHES,
COGL_DEBUG_DISABLE_FAST_READ_PIXEL,
COGL_DEBUG_CLIPPING,
COGL_DEBUG_N_FLAGS
} CoglDebugFlags;

View File

@ -1046,6 +1046,8 @@ maybe_software_clip_entries (CoglJournalEntry *batch_start,
/* If we make it here then we know we can software clip the entire batch */
COGL_NOTE (CLIPPING, "Software clipping a batch of length %i", batch_len);
for (entry_num = 0; entry_num < batch_len; entry_num++)
{
CoglJournalEntry *journal_entry = batch_start + entry_num;