debug: Adds a COGL_DEBUG=disable-fast-read-pixel option

COGL_DEBUG=disable-fast-read-pixel can be used to disable the
optimization for reading a single pixel colour back by looking at the
geometry in the journal and not involving the GPU. With this disabled we
will always flush the journal, rendering to the framebuffer and then use
glReadPixels to get the result.
This commit is contained in:
Robert Bragg 2011-01-20 14:41:51 +00:00
parent 1bdb0e6e98
commit 9a663d8e41
5 changed files with 45 additions and 32 deletions

View File

@ -168,4 +168,9 @@ OPT (DISABLE_BLENDING,
"disable-program-caches", "disable-program-caches",
"Disable program caches", "Disable program caches",
"Disable fallback caches for arbfp and glsl programs") "Disable fallback caches for arbfp and glsl programs")
OPT (DISABLE_FAST_READ_PIXEL,
"Root Cause",
"disable-fast-read-pixel",
"Disable read pixel optimization",
"Disable optimization for reading 1px for simple "
"scenes of opaque rectangles")

View File

@ -75,7 +75,8 @@ static const GDebugKey cogl_behavioural_debug_keys[] = {
{ "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}, { "disable-software-clip", COGL_DEBUG_DISABLE_SOFTWARE_CLIP},
{ "disable-program-caches", COGL_DEBUG_DISABLE_PROGRAM_CACHES} { "disable-program-caches", COGL_DEBUG_DISABLE_PROGRAM_CACHES},
{ "disable-fast-read-pixel", COGL_DEBUG_DISABLE_FAST_READ_PIXEL}
}; };
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

@ -31,36 +31,37 @@
G_BEGIN_DECLS G_BEGIN_DECLS
typedef enum { typedef enum {
COGL_DEBUG_SLICING = 1 << 1, COGL_DEBUG_SLICING = 1 << 0,
COGL_DEBUG_OFFSCREEN = 1 << 2, COGL_DEBUG_OFFSCREEN = 1 << 1,
COGL_DEBUG_DRAW = 1 << 3, COGL_DEBUG_DRAW = 1 << 2,
COGL_DEBUG_PANGO = 1 << 4, COGL_DEBUG_PANGO = 1 << 3,
COGL_DEBUG_RECTANGLES = 1 << 5, COGL_DEBUG_RECTANGLES = 1 << 4,
COGL_DEBUG_HANDLE = 1 << 6, COGL_DEBUG_HANDLE = 1 << 5,
COGL_DEBUG_BLEND_STRINGS = 1 << 7, COGL_DEBUG_BLEND_STRINGS = 1 << 6,
COGL_DEBUG_DISABLE_BATCHING = 1 << 8, COGL_DEBUG_DISABLE_BATCHING = 1 << 7,
COGL_DEBUG_DISABLE_VBOS = 1 << 9, COGL_DEBUG_DISABLE_VBOS = 1 << 8,
COGL_DEBUG_DISABLE_PBOS = 1 << 10, COGL_DEBUG_DISABLE_PBOS = 1 << 9,
COGL_DEBUG_JOURNAL = 1 << 11, COGL_DEBUG_JOURNAL = 1 << 10,
COGL_DEBUG_BATCHING = 1 << 12, COGL_DEBUG_BATCHING = 1 << 11,
COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM = 1 << 13, COGL_DEBUG_DISABLE_SOFTWARE_TRANSFORM = 1 << 12,
COGL_DEBUG_MATRICES = 1 << 14, COGL_DEBUG_MATRICES = 1 << 13,
COGL_DEBUG_ATLAS = 1 << 15, COGL_DEBUG_ATLAS = 1 << 14,
COGL_DEBUG_DUMP_ATLAS_IMAGE = 1 << 16, COGL_DEBUG_DUMP_ATLAS_IMAGE = 1 << 15,
COGL_DEBUG_DISABLE_ATLAS = 1 << 17, COGL_DEBUG_DISABLE_ATLAS = 1 << 16,
COGL_DEBUG_OPENGL = 1 << 18, COGL_DEBUG_OPENGL = 1 << 17,
COGL_DEBUG_DISABLE_TEXTURING = 1 << 19, COGL_DEBUG_DISABLE_TEXTURING = 1 << 18,
COGL_DEBUG_DISABLE_ARBFP = 1 << 20, COGL_DEBUG_DISABLE_ARBFP = 1 << 19,
COGL_DEBUG_DISABLE_FIXED = 1 << 21, COGL_DEBUG_DISABLE_FIXED = 1 << 20,
COGL_DEBUG_DISABLE_GLSL = 1 << 22, COGL_DEBUG_DISABLE_GLSL = 1 << 21,
COGL_DEBUG_SHOW_SOURCE = 1 << 23, COGL_DEBUG_SHOW_SOURCE = 1 << 22,
COGL_DEBUG_DISABLE_BLENDING = 1 << 24, COGL_DEBUG_DISABLE_BLENDING = 1 << 23,
COGL_DEBUG_TEXTURE_PIXMAP = 1 << 25, COGL_DEBUG_TEXTURE_PIXMAP = 1 << 24,
COGL_DEBUG_BITMAP = 1 << 26, COGL_DEBUG_BITMAP = 1 << 25,
COGL_DEBUG_DISABLE_NPOT_TEXTURES = 1 << 27, COGL_DEBUG_DISABLE_NPOT_TEXTURES = 1 << 26,
COGL_DEBUG_WIREFRAME = 1 << 28, COGL_DEBUG_WIREFRAME = 1 << 27,
COGL_DEBUG_DISABLE_SOFTWARE_CLIP = 1 << 29, COGL_DEBUG_DISABLE_SOFTWARE_CLIP = 1 << 28,
COGL_DEBUG_DISABLE_PROGRAM_CACHES = 1 << 30 COGL_DEBUG_DISABLE_PROGRAM_CACHES = 1 << 29,
COGL_DEBUG_DISABLE_FAST_READ_PIXEL = 1 << 30
} CoglDebugFlags; } CoglDebugFlags;
#ifdef COGL_ENABLE_DEBUG #ifdef COGL_ENABLE_DEBUG

View File

@ -1237,6 +1237,9 @@ _cogl_framebuffer_try_fast_read_pixel (CoglFramebuffer *framebuffer,
{ {
gboolean found_intersection; gboolean found_intersection;
if (G_UNLIKELY (cogl_debug_flags & COGL_DEBUG_DISABLE_FAST_READ_PIXEL))
return FALSE;
if (source != COGL_READ_PIXELS_COLOR_BUFFER) if (source != COGL_READ_PIXELS_COLOR_BUFFER)
return FALSE; return FALSE;

View File

@ -1689,6 +1689,9 @@ try_checking_point_hits_entry_after_clipping (CoglJournalEntry *entry,
ClipBounds clip_bounds; ClipBounds clip_bounds;
float poly[16]; float poly[16];
if (!can_software_clip)
return FALSE;
if (!can_software_clip_entry (entry, NULL, if (!can_software_clip_entry (entry, NULL,
entry->clip_stack, &clip_bounds)) entry->clip_stack, &clip_bounds))
return FALSE; return FALSE;