]> git.tdb.fi Git - libs/gl.git/commitdiff
Add default constructors for the info structs in Program
authorMikko Rasa <tdb@tdb.fi>
Fri, 2 Apr 2021 07:29:50 +0000 (10:29 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 2 Apr 2021 08:46:55 +0000 (11:46 +0300)
source/core/program.cpp
source/core/program.h

index 23069392a78727b544e9a6dcb7f26a4f3ddf4066..ed4eb6619fa903b4911b955140d90648f6477feb 100644 (file)
@@ -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<const SpirVModule &>(*module);
 
        UniformBlockInfo &default_block = uniform_blocks[string()];
-       default_block.data_size = 0;
-       default_block.bind_point = -1;
 
        const vector<SpirVModule::Variable> &variables = mod.get_variables();
        for(vector<SpirVModule::Variable>::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<Program>(p, &c)
 {
index 6f84cfd26436e314b6d48d02dac8e7c0e2b51154..5ed61eaafb647654ba2f91ec8860340073f7645a 100644 (file)
@@ -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<const UniformInfo *> uniforms;
                LayoutHash layout_hash;
+
+               UniformBlockInfo();
        };
 
        struct AttributeInfo
@@ -85,6 +89,8 @@ public:
                unsigned location;
                unsigned array_size;
                DataType type;
+
+               AttributeInfo();
        };
 
        typedef std::map<std::string, UniformInfo> UniformMap;