From 06c9d0f054b17637f5285e72755d2759313681d9 Mon Sep 17 00:00:00 2001 From: Pekka Paalanen Date: Wed, 27 Jan 2021 16:11:25 +0200 Subject: [PATCH] gl-renderer: send protocol error on shader failure If we are trying to use a NULL shader, it is likely that the shader compilation failed for some reason. Since we are trying this for a view, the failure was probably triggered by a client. If there is a client, get rid of it by sending it a protocol error. Hopefully the compositor can then continue operation after a glitch on screen. Signed-off-by: Pekka Paalanen --- libweston/renderer-gl/gl-renderer.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index dba3a5b3..9944032d 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -788,6 +788,19 @@ use_output(struct weston_output *output) return 0; } +static void +gl_renderer_send_shader_error(struct weston_view *view) +{ + struct wl_resource *resource = view->surface->resource; + + if (!resource) + return; + + wl_client_post_implementation_error(wl_resource_get_client(resource), + "Weston GL-renderer shader failed for wl_surface@%u", + wl_resource_get_id(resource)); +} + static void gl_renderer_use_program_with_view_uniforms(struct gl_renderer *gr, struct gl_shader *shader, @@ -798,8 +811,10 @@ gl_renderer_use_program_with_view_uniforms(struct gl_renderer *gr, struct gl_surface_state *gs = get_surface_state(view->surface); struct gl_output_state *go = get_output_state(output); - if (!gl_renderer_use_program(gr, shader)) + if (!gl_renderer_use_program(gr, shader)) { + gl_renderer_send_shader_error(view); return; + } glUniformMatrix4fv(shader->proj_uniform, 1, GL_FALSE, go->output_matrix.d);