+ if(uni.location>=0 && i->second->location>=0 && i->second->location!=uni.location)
+ {
+ error(*uni.node, format("Mismatched location %d for uniform '%s'", uni.location, uni.name));
+ add_info(*i->second->node, format("Previously declared here with location %d", i->second->location));
+ }
+ if(uni.bind_point>=0 && i->second->bind_point>=0 && i->second->bind_point!=uni.bind_point)
+ {
+ error(*uni.node, format("Mismatched binding %d for uniform '%s'", uni.bind_point, uni.name));
+ add_info(*i->second->node, format("Previously declared here with binding %d", i->second->bind_point));
+ }
+ if(uni.type && i->second->type && !TypeComparer().apply(*uni.type, *i->second->type))
+ {
+ string type_name = (dynamic_cast<const StructDeclaration *>(uni.type) ?
+ "structure" : format("type '%s'", uni.type->name));
+ error(*uni.node, format("Mismatched %s for uniform '%s'", type_name, uni.name));
+
+ string message = "Previously declared here";
+ if(!dynamic_cast<const StructDeclaration *>(i->second->type))
+ message += format(" with type '%s'", i->second->type->name);
+ add_info(*i->second->node, message);
+ }