Add a COGL_DEBUG option to disable software clipping

This adds a debug option called disable-software-clipping which causes
the journal to always log the clip stack state rather than trying to
manually clip rectangles.
This commit is contained in:
Neil Roberts 2010-11-10 14:02:31 +00:00 committed by Robert Bragg
parent 1d88e6c8ac
commit e292d28c56
4 changed files with 22 additions and 12 deletions

View File

@ -143,6 +143,11 @@ OPT (DISABLE_NPOT_TEXTURES,
"Disable non-power-of-two textures",
"Makes Cogl think that the GL driver doesn't support NPOT textures "
"so that it will create sliced textures or textures with waste instead.")
OPT (DISABLE_SOFTWARE_CLIP,
"Root Cause",
"disable-software-clip",
"Disable software clipping",
"Disables Cogl's attempts to clip some rectangles in software.")
OPT (SHOW_SOURCE,
"Cogl Tracing",
"show-source",

View File

@ -72,7 +72,8 @@ static const GDebugKey cogl_behavioural_debug_keys[] = {
{ "disable-glsl", COGL_DEBUG_DISABLE_GLSL},
{ "disable-blending", COGL_DEBUG_DISABLE_BLENDING},
{ "disable-npot-textures", COGL_DEBUG_DISABLE_NPOT_TEXTURES},
{ "wireframe", COGL_DEBUG_WIREFRAME}
{ "wireframe", COGL_DEBUG_WIREFRAME},
{ "disable-software-clip", COGL_DEBUG_DISABLE_SOFTWARE_CLIP}
};
static const int n_cogl_behavioural_debug_keys =
G_N_ELEMENTS (cogl_behavioural_debug_keys);

View File

@ -58,7 +58,8 @@ typedef enum {
COGL_DEBUG_TEXTURE_PIXMAP = 1 << 25,
COGL_DEBUG_BITMAP = 1 << 26,
COGL_DEBUG_DISABLE_NPOT_TEXTURES = 1 << 27,
COGL_DEBUG_WIREFRAME = 1 << 28
COGL_DEBUG_WIREFRAME = 1 << 28,
COGL_DEBUG_DISABLE_SOFTWARE_CLIP = 1 << 29
} CoglDebugFlags;
#ifdef COGL_ENABLE_DEBUG

View File

@ -1155,16 +1155,19 @@ _cogl_journal_flush (void)
state.modelview_stack = modelview_stack;
state.projection_stack = _cogl_framebuffer_get_projection_stack (framebuffer);
/* We do an initial walk of the journal to analyse the clip stack
batches to see if we can do software clipping. We do this as a
separate walk of the journal because we can modify entries and
this may end up joining together clip stack batches in the next
iteration. */
batch_and_call ((CoglJournalEntry *)ctx->journal->data, /* first entry */
ctx->journal->len, /* max number of entries to consider */
compare_entry_clip_stacks,
_cogl_journal_check_software_clip, /* callback */
&state); /* data */
if (G_UNLIKELY ((cogl_debug_flags & COGL_DEBUG_DISABLE_SOFTWARE_CLIP) == 0))
{
/* We do an initial walk of the journal to analyse the clip stack
batches to see if we can do software clipping. We do this as a
separate walk of the journal because we can modify entries and
this may end up joining together clip stack batches in the next
iteration. */
batch_and_call ((CoglJournalEntry *)ctx->journal->data, /* first entry */
ctx->journal->len, /* max number of entries to consider */
compare_entry_clip_stacks,
_cogl_journal_check_software_clip, /* callback */
&state); /* data */
}
/* We upload the vertices after the clip stack pass in case it
modifies the entries */