X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fbackends%2Fvulkan%2Ftexture1d_backend.cpp;h=59ef60d010c1bb8a310fee19dcb1fc85312a37b1;hb=1a5dafe20e47c764f2914c341fb7b8f1fba59fb8;hp=e27f371bdc33c75608303d5926198acc49840cd1;hpb=7b0a38db12c3d1aacb59520a3f4baa16d9ec0048;p=libs%2Fgl.git diff --git a/source/backends/vulkan/texture1d_backend.cpp b/source/backends/vulkan/texture1d_backend.cpp index e27f371b..59ef60d0 100644 --- a/source/backends/vulkan/texture1d_backend.cpp +++ b/source/backends/vulkan/texture1d_backend.cpp @@ -19,7 +19,6 @@ void VulkanTexture1D::fill_image_info(void *ii) const VkImageCreateInfo *image_info = static_cast(ii); image_info->imageType = VK_IMAGE_TYPE_1D; image_info->extent.width = self.width; - image_info->mipLevels = self.levels; } void VulkanTexture1D::sub_image(unsigned level, int x, unsigned wd, const void *data) @@ -29,15 +28,13 @@ void VulkanTexture1D::sub_image(unsigned level, int x, unsigned wd, const void * unsigned level_size = self.get_level_size(level); bool discard = (x==0 && wd==level_size); + TransferQueue &tq = device.get_transfer_queue(); size_t data_size = wd*get_pixel_size(storage_fmt); - void *staging = device.get_transfer_queue().prepare_transfer(this, false, data_size, + void *staging = tq.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); + change_layout(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(); - + [this, level, x, wd](const VulkanCommandRecorder &vkCmd, VkBuffer staging_buf, size_t src_off){ VkBufferImageCopy region = { }; region.bufferOffset = src_off; region.imageSubresource.aspectMask = get_vulkan_aspect(get_components(storage_fmt)); @@ -46,15 +43,11 @@ void VulkanTexture1D::sub_image(unsigned level, int x, unsigned wd, const void * region.imageSubresource.layerCount = 1; region.imageOffset = { x, 0, 0 }; region.imageExtent = { wd, 1, 1 }; - vk.CmdCopyBufferToImage(cmd_buf, staging_buf, handle, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion); + vkCmd.CopyBufferToImage(staging_buf, handle, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, ®ion); }); stage_pixels(staging, data, wd); -} - -void VulkanTexture1D::generate_mipmap() -{ - generate_mipmap_levels(static_cast(this)->levels); + tq.finalize_transfer(staging); } void VulkanTexture1D::fill_mipmap_blit(unsigned level, void *b)