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.
This commit is contained in:
parent
3ce70778f9
commit
cec11d624a
@ -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, "-----------------------------------");
|
||||
|
Loading…
x
Reference in New Issue
Block a user