From d7d5d6b87dbf8cbe959b403e33c99ae075c90221 Mon Sep 17 00:00:00 2001 From: Colin Edwards Date: Sat, 23 Feb 2019 19:04:16 -0600 Subject: [PATCH] libobs-opengl: Log shader compiler errors --- libobs-opengl/gl-shader.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/libobs-opengl/gl-shader.c b/libobs-opengl/gl-shader.c index e51783860..cab4d7fd7 100644 --- a/libobs-opengl/gl-shader.c +++ b/libobs-opengl/gl-shader.c @@ -220,8 +220,20 @@ static bool gl_shader_init(struct gs_shader *shader, if (!gl_success("glGetShaderiv")) return false; - if (!compiled) + if (!compiled) { + GLint infoLength = 0; + glGetShaderiv(shader->obj, GL_INFO_LOG_LENGTH, &infoLength); + + char *infoLog = malloc(sizeof(char) * infoLength); + + GLsizei returnedLength = 0; + glGetShaderInfoLog(shader->obj, infoLength, &returnedLength, infoLog); + blog(LOG_ERROR, "Error compiling shader:\n%s\n", infoLog); + + free(infoLog); + success = false; + } gl_get_shader_info(shader->obj, file, error_string);