]> git.tdb.fi Git - libs/gl.git/commitdiff
Move default uniform block sizing to OpenGL backend
authorMikko Rasa <tdb@tdb.fi>
Sun, 7 Nov 2021 17:11:59 +0000 (19:11 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 7 Nov 2021 17:11:59 +0000 (19:11 +0200)
source/backends/opengl/program_backend.cpp
source/core/program.cpp

index 911ce34e69fbf591ccd1950adea30ed91d6fda83..a3603adc78ef6ed5f89cbfde56543004f417a00b 100644 (file)
@@ -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);
+               }
        }
 }
 
index 9193cd7be155b54a4f8b1fc8a87de974cc3d72b4..2934d240c7ef0c3bda346636d51725c8729b7bd1 100644 (file)
@@ -42,13 +42,6 @@ void Program::add_stages(const Module &mod, const map<string, int> &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)