+
+Texture2D::AsyncTransfer::AsyncTransfer(Texture2D &t, unsigned l, unsigned x_, unsigned y_, unsigned wd, unsigned ht):
+ texture(&t),
+ level(l),
+ x(x_),
+ y(y_),
+ width(wd),
+ height(ht),
+ data_size(width*height*get_pixel_size(texture->storage_fmt)),
+ dest_addr(0)
+{
+ dest_addr = allocate();
+}
+
+Texture2D::AsyncTransfer::AsyncTransfer(AsyncTransfer &&other):
+ Texture2DBackend::AsyncTransfer(move(other)),
+ texture(other.texture),
+ level(other.level),
+ x(other.x),
+ y(other.y),
+ width(other.width),
+ height(other.height),
+ data_size(other.data_size),
+ dest_addr(other.dest_addr)
+{
+ other.dest_addr = 0;
+}
+
+Texture2D::AsyncTransfer &Texture2D::AsyncTransfer::operator=(AsyncTransfer &&other)
+{
+ if(dest_addr)
+ finalize();
+
+ Texture2DBackend::AsyncTransfer::operator=(move(other));
+
+ texture = other.texture;
+ level = other.level;
+ x = other.x;
+ y = other.y;
+ width = other.width;
+ height = other.height;
+ data_size = other.data_size;
+ dest_addr = other.dest_addr;
+
+ other.dest_addr = 0;
+
+ return *this;
+}
+
+Texture2D::AsyncTransfer::~AsyncTransfer()
+{
+ if(dest_addr)
+ finalize();
+}
+