Handle active attributes that don't have a location;

There are some attributes that don't have a location (gl_InstanceID
is being reported for some reason).  Their location is -1 and this
causes a left shift of a negative value which is undefined.
This commit is contained in:
bjorn 2020-07-30 02:46:17 -06:00
parent 4160743b77
commit b45baacb66
1 changed files with 4 additions and 1 deletions

View File

@ -2655,7 +2655,10 @@ Shader* lovrShaderCreateGraphics(const char* vertexSource, int vertexSourceLengt
GLenum type;
GLsizei length;
glGetActiveAttrib(program, i, LOVR_MAX_ATTRIBUTE_LENGTH, &length, &size, &type, name);
map_set(&shader->attributes, hash64(name, length), (glGetAttribLocation(program, name) << 1) | isAttributeTypeInteger(type));
int location = glGetAttribLocation(program, name);
if (location >= 0) {
map_set(&shader->attributes, hash64(name, length), (location << 1) | isAttributeTypeInteger(type));
}
}
shader->multiview = multiview;