]> git.tdb.fi Git - libs/gl.git/commitdiff
Use default member initializers in some more classes
authorMikko Rasa <tdb@tdb.fi>
Fri, 29 Oct 2021 09:48:39 +0000 (12:48 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 29 Oct 2021 09:54:20 +0000 (12:54 +0300)
source/render/instancearray.cpp
source/render/instancearray.h
source/render/programdata.cpp
source/render/programdata.h
source/render/renderer.cpp
source/render/renderer.h

index f6a7bb634bd450c0f6f4d4011655331ca72e93ea..4a24ac456b6439935d28c063cf94fb4143b109aa 100644 (file)
@@ -15,10 +15,7 @@ namespace Msp {
 namespace GL {
 
 InstanceArray::InstanceArray(const Object &o):
-       object(o),
-       instance_buffer(0),
-       matrix_location(-1),
-       matrix_offset(0)
+       object(o)
 {
        const Technique *tech = object.get_technique();
        for(const auto &kvp: tech->get_methods())
index 8f5c73225519a374623c818b6298cdc55a308471..0965499fe66f98de6268619a189f80d253d91800 100644 (file)
@@ -40,10 +40,10 @@ private:
        const Object &object;
        std::vector<ObjectInstance *> instances;
        VertexArray instance_data;
-       Buffer *instance_buffer;
+       Buffer *instance_buffer = 0;
        VertexSetup vtx_setup;
-       int matrix_location;
-       unsigned matrix_offset;
+       int matrix_location = -1;
+       unsigned matrix_offset = 0;
 
 public:
        InstanceArray(const Object &);
index 43bcbf3febea57702fb6be343818b01d9d472325..8defce5aab2ae43a802c8e348e0d32ec9d0e2289 100644 (file)
@@ -17,11 +17,7 @@ namespace Msp {
 namespace GL {
 
 ProgramData::ProgramData(const Program *p):
-       tied_program(p),
-       generation(0),
-       last_buffer_block(0),
-       buffer(0),
-       dirty(0)
+       tied_program(p)
 { }
 
 // Blocks are intentionally left uncopied
@@ -29,17 +25,11 @@ ProgramData::ProgramData(const ProgramData &other):
        tied_program(other.tied_program),
        uniforms(other.uniforms),
        uniform_data(other.uniform_data),
-       generation(other.generation),
-       last_buffer_block(0),
-       buffer(0),
-       dirty(0)
+       generation(other.generation)
 { }
 
 ProgramData::ProgramData(const ProgramData &other, const Program *p):
-       tied_program(p),
-       last_buffer_block(0),
-       buffer(0),
-       dirty(0)
+       tied_program(p)
 {
        if(tied_program)
        {
index 2eef750cf78f7d4ff821ee9c1354cb395d6b6933..4e8ee37302a90b23a7d64f05cd4ce7cb024586f2 100644 (file)
@@ -151,12 +151,12 @@ private:
        const Program *tied_program;
        std::vector<TaggedUniform> uniforms;
        std::vector<char> uniform_data;
-       unsigned generation;
+       unsigned generation = 0;
        mutable std::vector<SharedBlock> blocks;
        mutable std::vector<ProgramBlock> programs;
-       mutable UniformBlock *last_buffer_block;
-       mutable Buffer *buffer;
-       mutable Mask dirty;
+       mutable UniformBlock *last_buffer_block = 0;
+       mutable Buffer *buffer = 0;
+       mutable Mask dirty = 0;
        std::string debug_name;
 
 public:
index 5e155f2e970ac75f4ba85b59d857e66aa3c30f0b..447ab4e35de83faaad278b5df44e8861c7ea5d18 100644 (file)
@@ -20,8 +20,7 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
-Renderer::Renderer():
-       changed(0)
+Renderer::Renderer()
 {
        state_stack.reserve(16);
        state_stack.push_back(State());
index 42515e822993b622a163d5eb454359bf0a86f145..0496aaf3f68584496b5f13bf754338e6c5d91ec3 100644 (file)
@@ -107,7 +107,7 @@ private:
                SHADER_DATA = 16
        };
 
-       unsigned char changed;
+       unsigned char changed = 0;
        std::vector<State> state_stack;
        State *state;
        std::vector<BoundTexture> texture_stack;