]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/reflectdata.cpp
Fix reflection of image types from Spir-V modules
[libs/gl.git] / source / core / reflectdata.cpp
index 7a141db261f0b032aa3a9800a61079fa5a9162c2..8ecb9abe08fe11eac8e7fd845ebc9dc0fabaf9df 100644 (file)
@@ -10,30 +10,15 @@ namespace GL {
 
 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);
+       }
 }
 
 
-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; });
@@ -41,18 +26,15 @@ void ReflectData::UniformBlockInfo::sort_uniforms()
 
 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);
+       }
 }
 
-
-ReflectData::AttributeInfo::AttributeInfo():
-       location(-1),
-       array_size(0),
-       type(VOID)
-{ }
-
 } // namespace GL
 } // namespace Msp