Clear attrMask on bad shader compile.

This prevents various crashes when incorrect attributes are enabled.
This commit is contained in:
Unknown W. Brackets 2016-03-05 13:12:24 -08:00
parent 9bde45d6f9
commit 7dfe8b58dc
2 changed files with 4 additions and 1 deletions

View File

@ -156,6 +156,9 @@ LinkedShader::LinkedShader(ShaderID VSID, Shader *vs, ShaderID FSID, Shader *fs,
}
// Prevent a buffer overflow.
numBones = 0;
// Avoid weird attribute enables.
attrMask = 0;
availableUniforms = 0;
return;
}

View File

@ -247,7 +247,7 @@ static const GlTypeInfo GLComp[] = {
};
static inline void VertexAttribSetup(int attrib, int fmt, int stride, u8 *ptr) {
if (attrib != -1 && fmt) {
if (fmt) {
const GlTypeInfo &type = GLComp[fmt];
glVertexAttribPointer(attrib, type.count, type.type, type.normalized, stride, ptr);
}