mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +00:00
glrenderer: Emit more useful error messages
Catch the error when it happens, so that we can emit a specific and more helpful error message. Also verify that all branches in the code now do indeed set a proper GError when they fail, so that the final catch-all is no longer needed. Instead, assert that the error is set so that we catch future code additions early that do not set the GError.
This commit is contained in:
parent
f8ee4cfea5
commit
c907ad83b0
@ -54,6 +54,8 @@
|
||||
glGetUniformLocation(programs->program_name ## _program.id, "u_" #uniform_basename);\
|
||||
if (programs->program_name ## _program.program_name.uniform_basename ## _location == -1) \
|
||||
{ \
|
||||
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_LINK_FAILED, \
|
||||
"Failed to find variable \"u_%s\" in shader program \"%s\"", #uniform_basename, #program_name); \
|
||||
g_clear_pointer (&programs, gsk_gl_renderer_programs_unref); \
|
||||
goto out; \
|
||||
} \
|
||||
@ -3361,9 +3363,8 @@ gsk_gl_renderer_create_programs (GskGLRenderer *self,
|
||||
out:
|
||||
gsk_gl_shader_builder_finish (&shader_builder);
|
||||
|
||||
if (error && !(*error) && !programs)
|
||||
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_COMPILATION_FAILED,
|
||||
"Failed to compile all shader programs"); /* Probably, eh. */
|
||||
/* Check we indeed emitted an error if there was one */
|
||||
g_assert (programs || !error || *error);
|
||||
|
||||
return programs;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user