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);
}
gives us the first element of the array, so try to look that up and
add an offset. */
unsigned offset = lexical_cast<unsigned>(n.substr(open_bracket+1, n.size()-2-open_bracket));
- i = uniforms.find(n.substr(0, open_bracket)+"[0]");
+ i = uniforms.find(n.substr(0, open_bracket));
if(i!=uniforms.end() && !i->second.block && offset<i->second.size)
return i->second.location+offset;
}