Texture memory management

I"m in the middle of finishing our texture support on vulkan, and am looking for clarification on some points I haven’t been able to find explicitly addressed:

If i’m uploading textures with mips, there is no way to simply upload the mips? Mips>1 negates the use of VK_IMAGE_TILING_LINEAR - image must be VK_IMAGE_TILING_OPTIMAL.

As far as I can tell, I need to vkCreateImage my multi-mip image as _OPTIMAL, load the corresponding data into a VkBuffer, and then vkCmdCopyBufferToImage() each mip into place (with appropriate waiting/locking). This contrasts to the single mip, _LINEAR path, where I can vkMapMemory -> memcpy -> vkUnMapMemory.

I’m also assuming this is the preferred path to allow the driver to optimize texture layout. If I have a single mip, what are the constraints/benefits of _LINEAR vs _OPTIMAL? Is _LINEAR just a simple convenience but otherwise to be avoided?

Just want to make sure I’m not missing some details before I do the work.

Cheers - j

Yeah, VK_IMAGE_TILING_LINEAR has only very limited support overall (and also on other vendors), so you are correct, for uploading mip-mapped images the recommendation is to upload to a staging vkBuffer and then do a vkCmdCopyBufferToImage into your destination image that uses VK_IMAGE_TILING_OPTIMAL.

Note that you are likely get much better performance for VK_IMAGE_TILING_OPTIMAL images even in cases where we support VK_IMAGE_TILING_LINEAR

Regards,

Mathias