I don’t understand when it is recommended to use VK_IMAGE_LAYOUT_GENERAL, and not go to the optimal layout for any action that I intend to perform. My current policy is to always go for the optimal layout.
But there is VK_IMAGE_LAYOUT_GENERAL. Perhaps I should use it when I use this layout for a short period of time.
For example, right now I am writing code to create mipmaps using vkCmdBlitImage. When I iterate over the sub-resources that execute the vkCmdBlitImage commands, should I go to VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL when I zoom out to mip and then go to VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL when I get all the last ADAM_ERAYTIM_ERAY_IME_ERIT_ERIT_ERIT_ERIT_ERIM_ERIT__IMER_ERIT_ALT__IMER_ERIT_ALT. It seems that a lot of transitions and maybe generating mips in VK_IMAGE_LAYOUT_GENERAL is better.
I understand that the answer can be measured, but it is difficult to measure on all of my target GPUs (especially because I still have nothing working on Android), so if someone has a decent rule of thumb, it will be much appreciated.
FWIW, I am writing Vulkan code that will run on desktop GPUs and Android, but I mostly care about the performance on the latter.
source share