X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fvulkan%2Ftexture1d_backend.cpp;h=e28ec4236cd9ae1b9758c9b77478830c43dbf214;hb=682d3ceda19df700ce6590028717e4f0042783ec;hp=91c6252a85d1544597f7a273e3e7e40a0fa8a381;hpb=8ab7589d65c4f8ca799f2a6886d128f4c36ff046;p=libs%2Fgl.git diff --git a/source/backends/vulkan/texture1d_backend.cpp b/source/backends/vulkan/texture1d_backend.cpp index 91c6252a..e28ec423 100644 --- a/source/backends/vulkan/texture1d_backend.cpp +++ b/source/backends/vulkan/texture1d_backend.cpp @@ -27,10 +27,14 @@ void VulkanTexture1D::sub_image(unsigned level, int x, unsigned wd, const void * const Texture1D &self = *static_cast(this); unsigned level_size = self.get_level_size(level); - change_layout(self.levels, level, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, (x==0 && wd==level_size)); + bool discard = (x==0 && wd==level_size); size_t data_size = wd*get_pixel_size(storage_fmt); - void *staging = device.get_transfer_queue().prepare_transfer(data_size, + void *staging = device.get_transfer_queue().prepare_transfer(this, false, data_size, + [this, level, discard](){ + unsigned n_levels = static_cast(this)->levels; + change_layout(n_levels, level, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, discard); + }, [this, level, x, wd](VkCommandBuffer cmd_buf, VkBuffer staging_buf, size_t src_off){ const VulkanFunctions &vk = device.get_functions();