]> git.tdb.fi Git - libs/gl.git/blob - source/core/reflectdata.cpp
Fix reflection of image types from Spir-V modules
[libs/gl.git] / source / core / reflectdata.cpp
1 #include <msp/core/algorithm.h>
2 #include <msp/core/hash.h>
3 #include <msp/strings/format.h>
4 #include "reflectdata.h"
5
6 using namespace std;
7
8 namespace Msp {
9 namespace GL {
10
11 void ReflectData::update_layout_hash()
12 {
13         layout_hash = hash<32>(uniform_blocks.size());
14         for(const UniformBlockInfo &b: uniform_blocks)
15         {
16                 layout_hash = hash_update<32>(layout_hash, b.bind_point);
17                 layout_hash = hash_update<32>(layout_hash, b.layout_hash);
18         }
19 }
20
21
22 void ReflectData::UniformBlockInfo::sort_uniforms()
23 {
24         sort(uniforms, [](const UniformInfo *u1, const UniformInfo *u2){ return u1->location<u2->location; });
25 }
26
27 void ReflectData::UniformBlockInfo::update_layout_hash()
28 {
29         layout_hash = hash<32>(uniforms.size());
30         for(const UniformInfo *u: uniforms)
31         {
32                 layout_hash = hash_update<32>(layout_hash, u->location);
33                 layout_hash = hash_update<32>(layout_hash, u->name);
34                 layout_hash = hash_update<32>(layout_hash, u->type);
35                 layout_hash = hash_update<32>(layout_hash, u->array_size);
36         }
37 }
38
39 } // namespace GL
40 } // namespace Msp