From cec11d624a4219d87d1b2cf983699eed1aa0e970 Mon Sep 17 00:00:00 2001 From: jp9000 Date: Sat, 7 Jun 2014 19:33:41 -0700 Subject: [PATCH] OpenGL: Don't call glGetAttribLocation on outputs Previously we were using glGetAttribLocation on all inputs/outputs and then just discarding if it was returned -1. However, we have a boolean value of 'input' in gl_parser_attrib, so there's no need to be doing this and discarding potentially useful error handling information. --- libobs-opengl/gl-shader.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/libobs-opengl/gl-shader.c b/libobs-opengl/gl-shader.c index 3bfe23daa..1fccf4fea 100644 --- a/libobs-opengl/gl-shader.c +++ b/libobs-opengl/gl-shader.c @@ -168,15 +168,22 @@ static inline bool gl_process_attrib(struct gs_shader *shader, struct gl_parser_attrib *pa) { struct shader_attrib attrib = {0}; + + /* don't parse output attributes */ + if (!pa->input) + return true; + get_attrib_type(pa->mapping, &attrib.type, &attrib.index); attrib.attrib = glGetAttribLocation(shader->program, pa->name.array); if (!gl_success("glGetAttribLocation")) return false; - /* If the attribute is not found, it's usually just an output */ - if (attrib.attrib == -1) - return true; + if (attrib.attrib == -1) { + blog(LOG_ERROR, "glGetAttribLocation: Could not find " + "attribute '%s'", pa->name.array); + return false; + } da_push_back(shader->attribs, &attrib); return true; @@ -208,7 +215,7 @@ static bool gl_shader_init(struct gs_shader *shader, if (!gl_success("glCreateShaderProgramv") || !shader->program) return false; -#if 0 +#if 1 blog(LOG_DEBUG, "+++++++++++++++++++++++++++++++++++"); blog(LOG_DEBUG, " GL shader string for: %s", file); blog(LOG_DEBUG, "-----------------------------------");