]> git.tdb.fi Git - libs/gl.git/blobdiff - source/backends/vulkan/texturecube_backend.cpp
Use another callback for pre-transfer synchronization
[libs/gl.git] / source / backends / vulkan / texturecube_backend.cpp
index fe528921f8c99b135537e4ae397f2978cabb62cf..f421e20d68be259dc110eb20820a3867f4fa5e31 100644 (file)
@@ -30,10 +30,14 @@ void VulkanTextureCube::sub_image(unsigned face, unsigned level, int x, int y, u
        const TextureCube &self = *static_cast<const TextureCube *>(this);
 
        unsigned level_size = self.get_level_size(level);
-       synchronize(face, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, (x==0 && y==0 && wd==level_size && ht==level_size));
+       bool discard = (x==0 && y==0 && wd==level_size && ht==level_size);
 
        size_t data_size = wd*ht*get_pixel_size(storage_fmt);
        void *staging = device.get_transfer_queue().prepare_transfer(data_size,
+               [this, level, discard](){
+                       unsigned n_levels = static_cast<const TextureCube *>(this)->levels;
+                       change_layout(n_levels, level, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, discard);
+               },
                [this, face, level, x, y, wd, ht](VkCommandBuffer cmd_buf, VkBuffer staging_buf, size_t src_off){
                        const VulkanFunctions &vk = device.get_functions();