From: Mikko Rasa Date: Sun, 10 Oct 2021 08:48:24 +0000 (+0300) Subject: Determine the default uniform block size regardless of module format X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=a833b47ecd5bf91a979a30d0898f768a14cf5067;p=libs%2Fgl.git Determine the default uniform block size regardless of module format --- diff --git a/source/backends/opengl/program_backend.cpp b/source/backends/opengl/program_backend.cpp index 4dbf38a7..86235ebe 100644 --- a/source/backends/opengl/program_backend.cpp +++ b/source/backends/opengl/program_backend.cpp @@ -334,11 +334,6 @@ void OpenGLProgram::query_uniforms() } default_block.sort_uniforms(); - if(!default_block.uniforms.empty()) - { - const ReflectData::UniformInfo &uni = *default_block.uniforms.back(); - default_block.data_size = uni.location*16+uni.array_size*get_type_size(uni.type); - } default_block.update_layout_hash(); rd.update_layout_hash(); } diff --git a/source/core/program.cpp b/source/core/program.cpp index 6458b477..5c8257b2 100644 --- a/source/core/program.cpp +++ b/source/core/program.cpp @@ -46,6 +46,13 @@ void Program::add_stages(const Module &mod, const map &spec_values) collect_attributes(static_cast(mod)); } + for(ReflectData::UniformBlockInfo &b: reflect_data.uniform_blocks) + if(!b.data_size && !b.uniforms.empty()) + { + const ReflectData::UniformInfo &uni = *b.uniforms.back(); + b.data_size = uni.location*16+uni.array_size*get_type_size(uni.type); + } + for(const ReflectData::UniformInfo &u: reflect_data.uniforms) require_type(u.type); for(const ReflectData::AttributeInfo &a: reflect_data.attributes)