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", "Disable non-power-of-two textures",
"Makes Cogl think that the GL driver doesn't support NPOT 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.") "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, OPT (SHOW_SOURCE,
"Cogl Tracing", "Cogl Tracing",
"show-source", "show-source",

View File

@ -72,7 +72,8 @@ static const GDebugKey cogl_behavioural_debug_keys[] = {
{ "disable-glsl", COGL_DEBUG_DISABLE_GLSL}, { "disable-glsl", COGL_DEBUG_DISABLE_GLSL},
{ "disable-blending", COGL_DEBUG_DISABLE_BLENDING}, { "disable-blending", COGL_DEBUG_DISABLE_BLENDING},
{ "disable-npot-textures", COGL_DEBUG_DISABLE_NPOT_TEXTURES}, { "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 = static const int n_cogl_behavioural_debug_keys =
G_N_ELEMENTS (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_TEXTURE_PIXMAP = 1 << 25,
COGL_DEBUG_BITMAP = 1 << 26, COGL_DEBUG_BITMAP = 1 << 26,
COGL_DEBUG_DISABLE_NPOT_TEXTURES = 1 << 27, 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; } CoglDebugFlags;
#ifdef COGL_ENABLE_DEBUG #ifdef COGL_ENABLE_DEBUG

View File

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