[mutter] cogl: Add new option COGL_DEBUG=stencilling to disable optimizations
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] cogl: Add new option COGL_DEBUG=stencilling to disable optimizations
- Date: Tue, 1 Jun 2021 13:39:35 +0000 (UTC)
commit c3d64cc05be11856433f12c84ad9cb8658d6d220
Author: Daniel van Vugt <daniel van vugt canonical com>
Date: Thu May 20 18:21:04 2021 +0800
cogl: Add new option COGL_DEBUG=stencilling to disable optimizations
This means stencilling every clip stack entry even when stencilling could
be skipped. This visibly reveals some bugs in the stencilling logic.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1873>
cogl/cogl/cogl-debug-options.h | 6 ++++++
cogl/cogl/cogl-debug.c | 1 +
cogl/cogl/cogl-debug.h | 1 +
cogl/cogl/driver/gl/cogl-clip-stack-gl.c | 6 ++++--
4 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl/cogl-debug-options.h b/cogl/cogl/cogl-debug-options.h
index f6cda51a2d..e6b1ca46d7 100644
--- a/cogl/cogl/cogl-debug-options.h
+++ b/cogl/cogl/cogl-debug-options.h
@@ -189,3 +189,9 @@ OPT (TEXTURES,
"textures",
N_("Debug texture management"),
N_("Logs information about texture management"))
+OPT (STENCILLING,
+ N_("Root Cause"),
+ "stencilling",
+ N_("Stencil every clip entry"),
+ N_("Disables optimizations that usually avoid stencilling when it's not "
+ "needed. This exercises more of the stencilling logic than usual."))
diff --git a/cogl/cogl/cogl-debug.c b/cogl/cogl/cogl-debug.c
index c4d648652d..056d92ec3e 100644
--- a/cogl/cogl/cogl-debug.c
+++ b/cogl/cogl/cogl-debug.c
@@ -85,6 +85,7 @@ static const GDebugKey cogl_behavioural_debug_keys[] = {
{ "disable-fast-read-pixel", COGL_DEBUG_DISABLE_FAST_READ_PIXEL},
{ "sync-primitive", COGL_DEBUG_SYNC_PRIMITIVE },
{ "sync-frame", COGL_DEBUG_SYNC_FRAME},
+ { "stencilling", COGL_DEBUG_STENCILLING },
};
static const int n_cogl_behavioural_debug_keys =
G_N_ELEMENTS (cogl_behavioural_debug_keys);
diff --git a/cogl/cogl/cogl-debug.h b/cogl/cogl/cogl-debug.h
index e202cc4a4a..d818437f6f 100644
--- a/cogl/cogl/cogl-debug.h
+++ b/cogl/cogl/cogl-debug.h
@@ -75,6 +75,7 @@ typedef enum
COGL_DEBUG_SYNC_PRIMITIVE,
COGL_DEBUG_SYNC_FRAME,
COGL_DEBUG_TEXTURES,
+ COGL_DEBUG_STENCILLING,
COGL_DEBUG_N_FLAGS
} CoglDebugFlags;
diff --git a/cogl/cogl/driver/gl/cogl-clip-stack-gl.c b/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
index 4975f34cf6..bec4d9b453 100644
--- a/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
+++ b/cogl/cogl/driver/gl/cogl-clip-stack-gl.c
@@ -500,7 +500,8 @@ _cogl_clip_stack_gl_flush (CoglClipStack *stack,
/* We don't need to do anything extra if the clip for this
rectangle was entirely described by its scissor bounds */
- if (!rect->can_be_scissor)
+ if (!rect->can_be_scissor ||
+ G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_STENCILLING)))
{
COGL_NOTE (CLIPPING, "Adding stencil clip for rectangle");
@@ -522,7 +523,8 @@ _cogl_clip_stack_gl_flush (CoglClipStack *stack,
/* If nrectangles <= 1, it can be fully represented with the
* scissor clip.
*/
- if (cairo_region_num_rectangles (region->region) > 1)
+ if (cairo_region_num_rectangles (region->region) > 1 ||
+ G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_STENCILLING)))
{
COGL_NOTE (CLIPPING, "Adding stencil clip for region");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]