diff options
author | Benjamin Otte <otte@redhat.com> | 2020-12-03 05:33:30 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2020-12-03 13:07:17 +0100 |
commit | c907ad83b0f5d7b32a04e9cbd0949e8da0143bf6 (patch) | |
tree | 2972d723a5f0d0efbf9a70625ac91de3f96d55c4 | |
parent | f8ee4cfea5d5ed1b586caac7f30157d8977cf3a3 (diff) | |
download | gtk+-c907ad83b0f5d7b32a04e9cbd0949e8da0143bf6.tar.gz |
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.
-rw-r--r-- | gsk/gl/gskglrenderer.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index bb09be8bdd..57b0767772 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -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; } |