From 6c8e599159ea8d954cb78bccb3580160a07a76a8 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 2 Apr 2021 10:29:50 +0300 Subject: [PATCH] Add default constructors for the info structs in Program --- source/core/program.cpp | 33 ++++++++++++++++++++++++--------- source/core/program.h | 6 ++++++ 2 files changed, 30 insertions(+), 9 deletions(-) diff --git a/source/core/program.cpp b/source/core/program.cpp index 23069392..ed4eb661 100644 --- a/source/core/program.cpp +++ b/source/core/program.cpp @@ -331,11 +331,8 @@ void Program::query_uniforms() name[len-3] = 0; UniformInfo &info = uniforms[name]; - info.block = 0; info.name = name; info.array_size = size; - info.array_stride = 0; - info.matrix_stride = 0; info.type = from_gl_type(type); uniforms_by_index[i] = &info; } @@ -345,8 +342,6 @@ void Program::query_uniforms() query_uniform_blocks(uniforms_by_index); UniformBlockInfo &default_block = uniform_blocks[string()]; - default_block.data_size = 0; - default_block.bind_point = -1; for(UniformMap::iterator i=uniforms.begin(); i!=uniforms.end(); ++i) if(!i->second.block) @@ -461,8 +456,6 @@ void Program::collect_uniforms() const SpirVModule &mod = static_cast(*module); UniformBlockInfo &default_block = uniform_blocks[string()]; - default_block.data_size = 0; - default_block.bind_point = -1; const vector &variables = mod.get_variables(); for(vector::const_iterator i=variables.begin(); i!=variables.end(); ++i) @@ -488,8 +481,6 @@ void Program::collect_uniforms() info.block = &default_block; info.location = i->location; info.array_size = i->array_size; - info.array_stride = 0; - info.matrix_stride = 0; info.type = i->type; default_block.uniforms.push_back(&info); } @@ -635,6 +626,30 @@ void Program::unbind() } +Program::UniformInfo::UniformInfo(): + block(0), + location(0), + array_size(0), + array_stride(0), + matrix_stride(0), + type(VOID) +{ } + + +Program::UniformBlockInfo::UniformBlockInfo(): + data_size(0), + bind_point(-1), + layout_hash(0) +{ } + + +Program::AttributeInfo::AttributeInfo(): + location(-1), + array_size(0), + type(VOID) +{ } + + Program::Loader::Loader(Program &p, Collection &c): DataFile::CollectionObjectLoader(p, &c) { diff --git a/source/core/program.h b/source/core/program.h index 6f84cfd2..5ed61eaa 100644 --- a/source/core/program.h +++ b/source/core/program.h @@ -68,6 +68,8 @@ public: unsigned array_stride; unsigned matrix_stride; DataType type; + + UniformInfo(); }; struct UniformBlockInfo @@ -77,6 +79,8 @@ public: int bind_point; std::vector uniforms; LayoutHash layout_hash; + + UniformBlockInfo(); }; struct AttributeInfo @@ -85,6 +89,8 @@ public: unsigned location; unsigned array_size; DataType type; + + AttributeInfo(); }; typedef std::map UniformMap; -- 2.43.0