From 6d2e73b314db7e32982f9220ce32079477990f78 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 3 Feb 2020 20:00:54 +0000 Subject: [PATCH] gl-renderer: Fail earlier if shader compilation fails If we can't compile our shaders, there's no point trying to link them. Signed-off-by: Daniel Stone --- libweston/renderer-gl/gl-renderer.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libweston/renderer-gl/gl-renderer.c b/libweston/renderer-gl/gl-renderer.c index 6c435507..a40db360 100644 --- a/libweston/renderer-gl/gl-renderer.c +++ b/libweston/renderer-gl/gl-renderer.c @@ -2970,6 +2970,8 @@ shader_init(struct gl_shader *shader, struct gl_renderer *renderer, shader->vertex_shader = compile_shader(GL_VERTEX_SHADER, 1, &vertex_source); + if (shader->vertex_shader == GL_NONE) + return -1; if (renderer->fragment_shader_debug) { sources[0] = fragment_source; @@ -2984,6 +2986,8 @@ shader_init(struct gl_shader *shader, struct gl_renderer *renderer, shader->fragment_shader = compile_shader(GL_FRAGMENT_SHADER, count, sources); + if (shader->fragment_shader == GL_NONE) + return -1; shader->program = glCreateProgram(); glAttachShader(shader->program, shader->vertex_shader);