cogl debug: Adds glViewport call tracing

To aid in the debugging of Clutter stage resize issues this adds a
COGL_DEBUG=opengl option that will trace "some select OpenGL calls"
(currently just glViewport calls)
This commit is contained in:
Robert Bragg 2010-02-17 18:45:08 +00:00
parent 5751e48756
commit f9fe4526eb
3 changed files with 10 additions and 1 deletions

View File

@ -48,6 +48,7 @@ static const GDebugKey cogl_log_debug_keys[] = {
{ "batching", COGL_DEBUG_BATCHING }, { "batching", COGL_DEBUG_BATCHING },
{ "matrices", COGL_DEBUG_MATRICES }, { "matrices", COGL_DEBUG_MATRICES },
{ "draw", COGL_DEBUG_DRAW }, { "draw", COGL_DEBUG_DRAW },
{ "opengl", COGL_DEBUG_OPENGL },
{ "pango", COGL_DEBUG_PANGO }, { "pango", COGL_DEBUG_PANGO },
}; };
static const int n_cogl_log_debug_keys = static const int n_cogl_log_debug_keys =
@ -114,6 +115,7 @@ _cogl_parse_debug_string (const char *value,
OPT ("force-scanline-paths:", "use a scanline based path rasterizer"); OPT ("force-scanline-paths:", "use a scanline based path rasterizer");
OPT ("dump-atlas-image:", "dump atlas changes to an image file"); OPT ("dump-atlas-image:", "dump atlas changes to an image file");
OPT ("disable-atlas:", "disable texture atlasing"); OPT ("disable-atlas:", "disable texture atlasing");
OPT ("opengl:", "traces some select OpenGL calls");
g_printerr ("\n%28s\n", "Special debug values:"); g_printerr ("\n%28s\n", "Special debug values:");
OPT ("all:", "Enables all non-behavioural debug options"); OPT ("all:", "Enables all non-behavioural debug options");
OPT ("verbose:", "Enables all non-behavioural debug options"); OPT ("verbose:", "Enables all non-behavioural debug options");

View File

@ -45,7 +45,8 @@ typedef enum {
COGL_DEBUG_FORCE_SCANLINE_PATHS = 1 << 14, COGL_DEBUG_FORCE_SCANLINE_PATHS = 1 << 14,
COGL_DEBUG_ATLAS = 1 << 15, COGL_DEBUG_ATLAS = 1 << 15,
COGL_DEBUG_DUMP_ATLAS_IMAGE = 1 << 16, COGL_DEBUG_DUMP_ATLAS_IMAGE = 1 << 16,
COGL_DEBUG_DISABLE_ATLAS = 1 << 17 COGL_DEBUG_DISABLE_ATLAS = 1 << 17,
COGL_DEBUG_OPENGL = 1 << 18
} CoglDebugFlags; } CoglDebugFlags;
#ifdef COGL_ENABLE_DEBUG #ifdef COGL_ENABLE_DEBUG

View File

@ -681,6 +681,12 @@ _cogl_framebuffer_flush_state (CoglHandle handle,
gl_viewport_y = framebuffer->height - gl_viewport_y = framebuffer->height -
(framebuffer->viewport_y + framebuffer->viewport_height); (framebuffer->viewport_y + framebuffer->viewport_height);
COGL_NOTE (OPENGL, "Calling glViewport(%d, %d, %d, %d)",
framebuffer->viewport_x,
gl_viewport_y,
framebuffer->viewport_width,
framebuffer->viewport_height);
GE (glViewport (framebuffer->viewport_x, GE (glViewport (framebuffer->viewport_x,
gl_viewport_y, gl_viewport_y,
framebuffer->viewport_width, framebuffer->viewport_width,