mirror of
https://github.com/brl/mutter.git
synced 2025-02-20 15:04:09 +00:00
cogl/pipeline/glsl: Add line numbers to displayed source
When running with COGL_DEBUG=show-source include line numbers so that it becomes easier to understand compilation errors. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3443>
This commit is contained in:
parent
ae3a20a0a0
commit
05efc92084
@ -280,21 +280,28 @@ _cogl_glsl_shader_set_source_with_boilerplate (CoglContext *ctx,
|
|||||||
|
|
||||||
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
|
if (G_UNLIKELY (COGL_DEBUG_ENABLED (COGL_DEBUG_SHOW_SOURCE)))
|
||||||
{
|
{
|
||||||
GString *buf = g_string_new (NULL);
|
GString *buf;
|
||||||
|
g_auto (GStrv) lines = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
g_string_append_printf (buf,
|
buf = g_string_new (NULL);
|
||||||
"%s shader:\n",
|
|
||||||
shader_gl_type == GL_VERTEX_SHADER ?
|
|
||||||
"vertex" : "fragment");
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
if (lengths[i] != -1)
|
if (lengths[i] != -1)
|
||||||
g_string_append_len (buf, strings[i], lengths[i]);
|
g_string_append_len (buf, strings[i], lengths[i]);
|
||||||
else
|
else
|
||||||
g_string_append (buf, strings[i]);
|
g_string_append (buf, strings[i]);
|
||||||
|
|
||||||
g_message ("%s", buf->str);
|
lines = g_strsplit (buf->str, "\n", 0);
|
||||||
|
g_string_free (buf, TRUE);
|
||||||
|
|
||||||
|
buf = g_string_new (NULL);
|
||||||
|
for (i = 0; lines[i]; i++)
|
||||||
|
g_string_append_printf (buf, "%4d: %s\n", i + 1, lines[i]);
|
||||||
|
|
||||||
|
g_message ("%s shader:\n%s",
|
||||||
|
shader_gl_type == GL_VERTEX_SHADER ?
|
||||||
|
"vertex" : "fragment",
|
||||||
|
buf->str);
|
||||||
g_string_free (buf, TRUE);
|
g_string_free (buf, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user