]> git.tdb.fi Git - libs/gl.git/commitdiff
Clear the dirty flag of Bufferable in upload_data
authorMikko Rasa <tdb@tdb.fi>
Sun, 24 Jan 2021 14:13:20 +0000 (16:13 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 24 Jan 2021 14:51:33 +0000 (16:51 +0200)
source/bufferable.cpp
source/uniformblock.cpp

index 3178e0adefa38f72e2d8aa22ecbae6769c50cdc7..6b770a8f68f2c447bb18fe608930cba4bf9e6ab7 100644 (file)
@@ -124,7 +124,6 @@ void Bufferable::update_buffer() const
        }
 
        upload_data(0);
-       dirty = false;
 }
 
 void Bufferable::upload_data(char *target) const
@@ -136,6 +135,7 @@ void Bufferable::upload_data(char *target) const
        }
        else
                buffer->sub_data(offset, get_data_size(), get_data_pointer());
+       dirty = false;
 }
 
 
@@ -157,16 +157,10 @@ void Bufferable::AsyncUpdater::upload_data()
        // Update all bufferables in the same buffer at once
        for(const Bufferable *b=bufferable.prev_in_buffer; b; b=b->prev_in_buffer)
                if(b->dirty || buffer_resized)
-               {
                        b->upload_data(mapped_address+b->offset);
-                       b->dirty = false;
-               }
        for(const Bufferable *b=bufferable.next_in_buffer; b; b=b->next_in_buffer)
                if(b->dirty || buffer_resized)
-               {
                        b->upload_data(mapped_address+b->offset);
-                       b->dirty = false;
-               }
 }
 
 } // namespace GL
index ff8033a0ffdd9d7ddaa270f1699307754b59b9da..ed86268225b1649b34f64287d6777410fb1b208d 100644 (file)
@@ -57,6 +57,7 @@ void UniformBlock::upload_data(char *target) const
                copy(data.begin(), data.end(), target);
        else
                buf_range->data(&data[0]);
+       dirty = false;
 }
 
 void UniformBlock::attach(int index, const Uniform &uni)