glGetActiveUniform(id, i, 128, &len, &size, &type, name);
if(len && strncmp(name, "gl_", 3))
{
+ /* Some implementations report the first element of a uniform array,
+ others report just the name of an array. */
+ if(len>3 && !strcmp(name+len-3, "[0]"))
+ name[len-3] = 0;
+
UniformInfo &info = uniforms[name];
info.block = 0;
info.name = name;
vector<const UniformInfo *> blockless_uniforms;
for(UniformMap::iterator i=uniforms.begin(); i!=uniforms.end(); ++i)
- {
if(!i->second.block)
{
i->second.location = glGetUniformLocation(id, i->second.name.c_str());
blockless_uniforms.push_back(&i->second);
}
- /* Some implementations report the first element of a uniform array,
- others report just the name of an array. */
- if(i->second.name.size()>3 && !i->second.name.compare(i->second.name.size()-3, 3, "[0]"))
- i->second.name.erase(i->second.name.size()-3, 3);
- }
-
uniform_layout_hash = compute_layout_hash(blockless_uniforms);
}