- size_t data_size = wd*ht*get_pixel_size(storage_fmt);
- void *staging = device.get_transfer_queue().prepare_transfer(data_size,
- [this, level, x, y, wd, ht](VkCommandBuffer cmd_buf, VkBuffer staging_buf, size_t src_off){
- const VulkanFunctions &vk = device.get_functions();
+ blit.srcOffsets[1] = { static_cast<int>(src_size.x), static_cast<int>(src_size.y), 1 };
+ blit.dstOffsets[1] = { static_cast<int>(dst_size.x), static_cast<int>(dst_size.y), 1 };
+}
+
+uint64_t VulkanTexture2D::get_data_size() const
+{
+ return 0;
+}
+
+void VulkanTexture2D::unload()
+{
+}
+
+
+void *VulkanTexture2D::AsyncTransfer::allocate()
+{
+ const Texture2D::AsyncTransfer &self = *static_cast<const Texture2D::AsyncTransfer *>(this);
+
+ Texture2D &tex = *self.texture;
+ unsigned level = self.level;
+ int x = self.x;
+ int y = self.y;
+ unsigned wd = self.width;
+ unsigned ht = self.height;
+
+ auto level_size = tex.get_level_size(level);
+ bool discard = (x==0 && y==0 && wd==level_size.x && ht==level_size.y);
+
+ TransferQueue &tq = tex.device.get_transfer_queue();
+ return tq.prepare_transfer(&tex, false, self.data_size,
+ [&tex, level, discard](){
+ tex.change_layout(level, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, discard);
+ },
+ [&tex, level, x, y, wd, ht](VkCommandBuffer cmd_buf, VkBuffer staging_buf, size_t src_off){
+ const VulkanFunctions &vk = tex.device.get_functions();