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 <pekka.paalanen@collabora.com>
dev
Pekka Paalanen 4 years ago
parent 7903c5e667
commit 06c9d0f054
  1. 17
      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);

Loading…
Cancel
Save