From: Mikko Rasa Date: Sun, 7 Nov 2021 17:11:59 +0000 (+0200) Subject: Move default uniform block sizing to OpenGL backend X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=013c562e389936acf61970118eab23a420a8f611;p=libs%2Fgl.git Move default uniform block sizing to OpenGL backend --- diff --git a/source/backends/opengl/program_backend.cpp b/source/backends/opengl/program_backend.cpp index 911ce34e..a3603adc 100644 --- a/source/backends/opengl/program_backend.cpp +++ b/source/backends/opengl/program_backend.cpp @@ -493,6 +493,12 @@ void OpenGLProgram::finalize_uniforms() if(func) uniform_calls.push_back(UniformCall(u->location, u->array_size, func)); } + + if(i->data_size<=0) + { + const ReflectData::UniformInfo &last = *i->uniforms.back(); + i->data_size = last.location*16+last.array_size*get_type_size(last.type); + } } } diff --git a/source/core/program.cpp b/source/core/program.cpp index 9193cd7b..2934d240 100644 --- a/source/core/program.cpp +++ b/source/core/program.cpp @@ -42,13 +42,6 @@ void Program::add_stages(const Module &mod, const map &spec_values) finalize_uniforms(); - 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)