From 7dfe8b58dc3211c581d2839104010b37ab3c49ca Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 5 Mar 2016 13:12:24 -0800 Subject: [PATCH] Clear attrMask on bad shader compile. This prevents various crashes when incorrect attributes are enabled. --- GPU/GLES/ShaderManager.cpp | 3 +++ GPU/GLES/TransformPipeline.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/GPU/GLES/ShaderManager.cpp b/GPU/GLES/ShaderManager.cpp index fab370a0d..82fdcdd65 100644 --- a/GPU/GLES/ShaderManager.cpp +++ b/GPU/GLES/ShaderManager.cpp @@ -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; } diff --git a/GPU/GLES/TransformPipeline.cpp b/GPU/GLES/TransformPipeline.cpp index 7d2fcfc71..7ef3f0d08 100644 --- a/GPU/GLES/TransformPipeline.cpp +++ b/GPU/GLES/TransformPipeline.cpp @@ -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); }