1
0
Fork 0

cogl: Include the pipeline name and program number in debug logs

When running with COGL_DEBUG=show-source, log what pipeline and shader
program is used when painting, and what shader source code corresponds
to each shader program.

This helps identify what shader is used when painting to what
framebuffer.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3433>
This commit is contained in:
Jonas Ådahl 2024-06-07 22:55:23 +02:00 committed by Sebastian Wick
parent aaba08e5aa
commit fe63242d60
2 changed files with 12 additions and 1 deletions

View file

@ -1020,6 +1020,15 @@ _cogl_pipeline_flush_gl_state (CoglContext *ctx,
progend = _cogl_pipeline_progend;
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
{
g_message ("Drawing to the %d x %d sized %s using pipeline %s",
cogl_framebuffer_get_width (framebuffer),
cogl_framebuffer_get_height (framebuffer),
G_OBJECT_TYPE_NAME (G_OBJECT (framebuffer)),
pipeline->name ? pipeline->name : "N\\A");
}
if (G_UNLIKELY (!progend->start (pipeline)))
continue;

View file

@ -298,9 +298,11 @@ _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx,
for (i = 0; lines[i]; i++)
g_string_append_printf (buf, "%4d: %s\n", i + 1, lines[i]);
g_message ("%s shader:\n%s",
g_message ("%s shader (%s; %u):\n%s",
shader_gl_type == GL_VERTEX_SHADER ?
"vertex" : "fragment",
pipeline->name ? pipeline->name : "unknown",
shader_gl_handle,
buf->str);
g_string_free (buf, TRUE);
}