From: Mikko Rasa Date: Sun, 24 Jan 2021 14:13:20 +0000 (+0200) Subject: Clear the dirty flag of Bufferable in upload_data X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=bb8b03770053cbddda88577e261ec4ee482e6c5c;p=libs%2Fgl.git Clear the dirty flag of Bufferable in upload_data --- diff --git a/source/bufferable.cpp b/source/bufferable.cpp index 3178e0ad..6b770a8f 100644 --- a/source/bufferable.cpp +++ b/source/bufferable.cpp @@ -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 diff --git a/source/uniformblock.cpp b/source/uniformblock.cpp index ff8033a0..ed862682 100644 --- a/source/uniformblock.cpp +++ b/source/uniformblock.cpp @@ -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)