]> git.tdb.fi Git - libs/gl.git/commitdiff
Remove empty default block before adding uniforms to blocks
authorMikko Rasa <tdb@tdb.fi>
Wed, 17 Nov 2021 12:52:06 +0000 (14:52 +0200)
committerMikko Rasa <tdb@tdb.fi>
Wed, 17 Nov 2021 13:07:00 +0000 (15:07 +0200)
Otherwise the block pointers of the uniforms will be incorrect

source/core/program.cpp

index 8e8455626dc1dc7ab6ced86ba86f0cd2a741f25c..0b07da8e501e2a959d826dd4441347353223f27c 100644 (file)
@@ -94,6 +94,12 @@ void Program::collect_uniforms(const SpirVModule &mod)
 
        sort_member(reflect_data.uniforms, &ReflectData::UniformInfo::tag);
 
+       if(block_uniform_names.front().empty())
+       {
+               reflect_data.uniform_blocks.erase(reflect_data.uniform_blocks.begin());
+               block_uniform_names.erase(block_uniform_names.begin());
+       }
+
        for(unsigned i=0; i<reflect_data.uniform_blocks.size(); ++i)
        {
                ReflectData::UniformBlockInfo &block = reflect_data.uniform_blocks[i];
@@ -108,9 +114,6 @@ void Program::collect_uniforms(const SpirVModule &mod)
                block.update_layout_hash();
        }
 
-       if(reflect_data.uniform_blocks.front().uniforms.empty())
-               reflect_data.uniform_blocks.erase(reflect_data.uniform_blocks.begin());
-
        reflect_data.update_layout_hash();
 }