]> git.tdb.fi Git - libs/gl.git/commitdiff
Populate used bindings in ReflectData
authorMikko Rasa <tdb@tdb.fi>
Thu, 9 Dec 2021 10:23:04 +0000 (12:23 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 9 Dec 2021 10:23:04 +0000 (12:23 +0200)
source/core/program.cpp
source/core/reflectdata.cpp
source/core/reflectdata.h

index 533dca610c9585f649420edadd34bf4f5e858617..e146c7acd7eed8db385f2176492ed1a504fdb4e0 100644 (file)
@@ -63,12 +63,7 @@ void Program::add_stages(const Module &mod, const map<string, int> &spec_values)
 
        finalize_uniforms();
 
-       for(const ReflectData::UniformInfo &u: reflect_data.uniforms)
-               if(u.binding>=0)
-                       reflect_data.used_bindings.push_back(u.binding);
-       for(const ReflectData::UniformBlockInfo &b: reflect_data.uniform_blocks)
-               reflect_data.used_bindings.push_back(b.bind_point);
-       sort(reflect_data.used_bindings);
+       reflect_data.update_used_bindings();
 
        for(const ReflectData::UniformInfo &u: reflect_data.uniforms)
                require_type(u.type);
index 8ecb9abe08fe11eac8e7fd845ebc9dc0fabaf9df..93ecee5fd2ddafce8e436e6af37c9c9355dc4352 100644 (file)
@@ -18,6 +18,16 @@ void ReflectData::update_layout_hash()
        }
 }
 
+void ReflectData::update_used_bindings()
+{
+       for(const UniformInfo &u: uniforms)
+               if(u.binding>=0)
+                       used_bindings.push_back(u.binding);
+       for(const UniformBlockInfo &b: uniform_blocks)
+               used_bindings.push_back(b.bind_point);
+       sort(used_bindings);
+}
+
 
 void ReflectData::UniformBlockInfo::sort_uniforms()
 {
index cc360d04d28e7ec70925c77d45397e40bb16da0b..ba86dd333ea442cdad8d593cf6cfe2765b7741b1 100644 (file)
@@ -69,6 +69,7 @@ struct ReflectData
        std::vector<int> used_bindings;
 
        void update_layout_hash();
+       void update_used_bindings();
 };
 
 } // namespace GL