]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/bufferable.cpp
Fix reflection of image types from Spir-V modules
[libs/gl.git] / source / core / bufferable.cpp
index 24c0f2789f4bae1bf256237587509ff40c408e68..374c4eeb3b83ee5d1617b9249383696a9f7aa15f 100644 (file)
@@ -8,6 +8,23 @@ using namespace std;
 namespace Msp {
 namespace GL {
 
+Bufferable::Bufferable(Bufferable &&other):
+       buffer(other.buffer),
+       offset(other.offset),
+       next_in_buffer(other.next_in_buffer),
+       prev_in_buffer(other.prev_in_buffer),
+       location_dirty(other.location_dirty),
+       dirty(other.dirty)
+{
+       other.buffer = 0;
+       other.next_in_buffer = 0;
+       other.prev_in_buffer = 0;
+       if(next_in_buffer)
+               next_in_buffer->prev_in_buffer = this;
+       if(prev_in_buffer)
+               prev_in_buffer->next_in_buffer = this;
+}
+
 Bufferable::~Bufferable()
 {
        unlink_from_buffer();
@@ -53,18 +70,13 @@ void Bufferable::change_buffer(Buffer *buf)
        }
 }
 
-unsigned Bufferable::get_required_buffer_size() const
+size_t Bufferable::get_required_buffer_size() const
 {
        const Bufferable *last = this;
        for(; last->next_in_buffer; last=last->next_in_buffer) ;
        return last->offset+last->get_data_size();
 }
 
-Bufferable::AsyncUpdater *Bufferable::refresh_async() const
-{
-       return dirty ? new AsyncUpdater(*this) : 0;
-}
-
 void Bufferable::unlink_from_buffer()
 {
        if(prev_in_buffer)
@@ -82,11 +94,11 @@ void Bufferable::unlink_from_buffer()
 
 void Bufferable::update_offset()
 {
-       unsigned new_offset = 0;
+       size_t new_offset = 0;
        if(prev_in_buffer)
                new_offset = prev_in_buffer->offset+prev_in_buffer->get_data_size();
 
-       unsigned align = get_alignment();
+       size_t align = get_alignment();
        new_offset += align-1;
        new_offset -= new_offset%align;
        if(new_offset!=offset)
@@ -110,11 +122,10 @@ void Bufferable::upload_data(char *target) const
        if(!buffer)
                throw invalid_operation("Bufferable::upload_data");
 
-       unsigned data_size = get_data_size();
+       size_t data_size = get_data_size();
        if(location_dirty)
        {
                buffer->require_size(offset+data_size);
-               location_changed(buffer, offset, data_size);
                location_dirty = false;
        }