From af88423285f44f9546526d234aac0360952418f5 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Wed, 23 Apr 2014 19:43:54 -0300 Subject: [PATCH] Fixed an attempted creation of an array with a constant size of 0 --- src/modules/graphics/opengl/Shader.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/modules/graphics/opengl/Shader.cpp b/src/modules/graphics/opengl/Shader.cpp index f9de5707b..2240b55f5 100644 --- a/src/modules/graphics/opengl/Shader.cpp +++ b/src/modules/graphics/opengl/Shader.cpp @@ -186,8 +186,16 @@ void Shader::createProgram(const std::vector &shaderids) // Bind generic vertex attribute indices to names in the shader. for (int i = 0; i < int(OpenGL::ATTRIB_MAX_ENUM); i++) { + OpenGL::VertexAttrib attrib = (OpenGL::VertexAttrib) i; + + // FIXME: We skip this both because pseudo-instancing is temporarily + // disabled (see graphics.lua), and because binding a non-existant + // attribute name to a location causes a shader linker warning. + if (attrib == OpenGL::ATTRIB_PSEUDO_INSTANCE_ID) + continue; + const char *name = nullptr; - if (attribNames.find((OpenGL::VertexAttrib) i, name)) + if (attribNames.find(attrib, name)) glBindAttribLocation(program, i, (const GLchar *) name); } @@ -768,7 +776,7 @@ StringMap Shader::typeNames(Shader::t StringMap::Entry Shader::attribNameEntries[] = { -// {"love_PseudoInstanceID", OpenGL::ATTRIB_PSEUDO_INSTANCE_ID}, + {"love_PseudoInstanceID", OpenGL::ATTRIB_PSEUDO_INSTANCE_ID}, }; StringMap Shader::attribNames(Shader::attribNameEntries, sizeof(Shader::attribNameEntries));