From: Mikko Rasa Date: Thu, 9 Dec 2021 10:23:04 +0000 (+0200) Subject: Populate used bindings in ReflectData X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=7696b0c0c5620398aa3a031521a1510026452f4d;p=libs%2Fgl.git Populate used bindings in ReflectData --- diff --git a/source/core/program.cpp b/source/core/program.cpp index 533dca61..e146c7ac 100644 --- a/source/core/program.cpp +++ b/source/core/program.cpp @@ -63,12 +63,7 @@ void Program::add_stages(const Module &mod, const map &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); diff --git a/source/core/reflectdata.cpp b/source/core/reflectdata.cpp index 8ecb9abe..93ecee5f 100644 --- a/source/core/reflectdata.cpp +++ b/source/core/reflectdata.cpp @@ -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() { diff --git a/source/core/reflectdata.h b/source/core/reflectdata.h index cc360d04..ba86dd33 100644 --- a/source/core/reflectdata.h +++ b/source/core/reflectdata.h @@ -69,6 +69,7 @@ struct ReflectData std::vector used_bindings; void update_layout_hash(); + void update_used_bindings(); }; } // namespace GL