--- /dev/null
+#include <msp/core/algorithm.h>
+#include <msp/core/hash.h>
+#include <msp/strings/format.h>
+#include "reflectdata.h"
+
+using namespace std;
+
+namespace Msp {
+namespace GL {
+
+void ReflectData::update_layout_hash()
+{
+ string layout_descriptor;
+ for(const UniformBlockInfo &b: uniform_blocks)
+ layout_descriptor += format("%d:%x\n", b.bind_point, b.layout_hash);
+ layout_hash = hash32(layout_descriptor);
+}
+
+
+ReflectData::UniformInfo::UniformInfo():
+ block(0),
+ location(-1),
+ array_size(0),
+ array_stride(0),
+ matrix_stride(0),
+ type(VOID),
+ binding(-1)
+{ }
+
+
+ReflectData::UniformBlockInfo::UniformBlockInfo():
+ data_size(0),
+ bind_point(-1),
+ layout_hash(0)
+{ }
+
+void ReflectData::UniformBlockInfo::sort_uniforms()
+{
+ sort(uniforms, [](const UniformInfo *u1, const UniformInfo *u2){ return u1->location<u2->location; });
+}
+
+void ReflectData::UniformBlockInfo::update_layout_hash()
+{
+ string layout_descriptor;
+ 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);
+}
+
+
+ReflectData::AttributeInfo::AttributeInfo():
+ location(-1),
+ array_size(0),
+ type(VOID)
+{ }
+
+} // namespace GL
+} // namespace Msp