]> git.tdb.fi Git - libs/gl.git/blob - source/core/reflectdata.cpp
Use default member initializers for simple types
[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         string layout_descriptor;
14         for(const UniformBlockInfo &b: uniform_blocks)
15                 layout_descriptor += format("%d:%x\n", b.bind_point, b.layout_hash);
16         layout_hash = hash32(layout_descriptor);
17 }
18
19
20 void ReflectData::UniformBlockInfo::sort_uniforms()
21 {
22         sort(uniforms, [](const UniformInfo *u1, const UniformInfo *u2){ return u1->location<u2->location; });
23 }
24
25 void ReflectData::UniformBlockInfo::update_layout_hash()
26 {
27         string layout_descriptor;
28         for(const UniformInfo *u: uniforms)
29                 layout_descriptor += format("%d:%s:%x:%d\n", u->location, u->name, u->type, u->array_size);
30         layout_hash = hash32(layout_descriptor);
31 }
32
33 } // namespace GL
34 } // namespace Msp