[gtk/wip/otte/conic: 1/3] glrenderer: Emit more useful error messages
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/conic: 1/3] glrenderer: Emit more useful error messages
- Date: Thu, 3 Dec 2020 12:07:31 +0000 (UTC)
commit c907ad83b0f5d7b32a04e9cbd0949e8da0143bf6
Author: Benjamin Otte <otte redhat com>
Date: Thu Dec 3 05:33:30 2020 +0100
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.
gsk/gl/gskglrenderer.c | 7 ++++---
1 file 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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]