void ReflectData::update_layout_hash()
{
- string layout_descriptor;
+ layout_hash = hash<32>(uniform_blocks.size());
for(const UniformBlockInfo &b: uniform_blocks)
- layout_descriptor += format("%d:%x\n", b.bind_point, b.layout_hash);
- layout_hash = hash32(layout_descriptor);
+ {
+ layout_hash = hash_update<32>(layout_hash, b.bind_point);
+ layout_hash = hash_update<32>(layout_hash, b.layout_hash);
+ }
}
void ReflectData::UniformBlockInfo::update_layout_hash()
{
- string layout_descriptor;
+ layout_hash = hash<32>(uniforms.size());
for(const UniformInfo *u: uniforms)
- layout_descriptor += format("%d:%s:%x:%d\n", u->location, u->name, u->type, u->array_size);
- layout_hash = hash32(layout_descriptor);
+ {
+ layout_hash = hash_update<32>(layout_hash, u->location);
+ layout_hash = hash_update<32>(layout_hash, u->name);
+ layout_hash = hash_update<32>(layout_hash, u->type);
+ layout_hash = hash_update<32>(layout_hash, u->array_size);
+ }
}
} // namespace GL
namespace GL {
Tag::Tag(const char *s):
- id((s && *s) ? hash32(s, strlen(s)) : 0)
+ id((s && *s) ? hash<32>(s, strlen(s)) : 0)
{
#ifdef DEBUG
if(s)
}
Tag::Tag(const string &s):
- id(s.empty() ? 0 : hash32(s))
+ id(s.empty() ? 0 : hash<32>(s))
{
#ifdef DEBUG
if(!s.empty())
{
set<unsigned> &used = used_bindings[desc_set];
- unsigned bind_point = fold32(hash64(name))%range;
+ unsigned bind_point = hash_fold<32>(hash<64>(name))%range;
while(used.count(bind_point))
bind_point = (bind_point+1)%range;
id = j->second;
else
{
- id = hash32(v->name)%features.constant_id_range;
+ id = hash<32>(v->name)%features.constant_id_range;
while(used_ids.count(id))
id = (id+1)%features.constant_id_range;
}
for(const auto &kvp: extra_spec)
spec_values[kvp.first] = kvp.second;
- string info = module_name;
+ uint64_t info_hash = hash<64>(module_name);
for(const auto &kvp: spec_values)
- info += format(",%s:%d", kvp.first, kvp.second);
+ {
+ info_hash = hash_update<64>(info_hash, kvp.first);
+ info_hash = hash_update<64>(info_hash, kvp.second);
+ }
Resources &res = Resources::get_global();
- string name = format("_material_%016x.shader", hash64(info));
+ string name = format("_material_%016x.shader", info_hash);
Program *shprog = res.find<Program>(name);
if(shprog)
return shprog;