1 #include <msp/core/algorithm.h>
2 #include <msp/core/hash.h>
3 #include <msp/strings/format.h>
4 #include "reflectdata.h"
11 void ReflectData::update_layout_hash()
13 layout_hash = hash<32>(uniform_blocks.size());
14 for(const UniformBlockInfo &b: uniform_blocks)
16 layout_hash = hash_update<32>(layout_hash, b.bind_point);
17 layout_hash = hash_update<32>(layout_hash, b.layout_hash);
21 void ReflectData::update_used_bindings()
23 for(const UniformInfo &u: uniforms)
24 if(u.binding>=0 && is_image(u.type))
25 used_bindings.push_back(u.binding|TEXTURE_BINDING);
26 for(const UniformBlockInfo &b: uniform_blocks)
27 used_bindings.push_back(b.bind_point|UNIFORM_BLOCK_BINDING);
32 void ReflectData::UniformBlockInfo::sort_uniforms()
34 sort(uniforms, [](const UniformInfo *u1, const UniformInfo *u2){ return u1->location<u2->location; });
37 void ReflectData::UniformBlockInfo::update_layout_hash()
39 layout_hash = hash<32>(uniforms.size());
40 for(const UniformInfo *u: uniforms)
42 layout_hash = hash_update<32>(layout_hash, u->location);
43 layout_hash = hash_update<32>(layout_hash, u->name);
44 layout_hash = hash_update<32>(layout_hash, u->type);
45 layout_hash = hash_update<32>(layout_hash, u->array_size);