As my question title says, I want update texture for every frame.
I got an idea :
create a VkImage
as a texture buffer with bellow configurations :
initialLayout = VK_IMAGE_LAYOUT_PREINITIALIZED
usage= VK_IMAGE_USAGE_SAMPLED_BIT
and it's memory type is VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT
In draw loop :
first frame :
- map texure data to
VkImage
(usevkMapMemory
). - change
VkImage
layout fromVK_IMAGE_LAYOUT_PREINITIALIZED
toVK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
. - use this
VkImage
as texture buffer.
second frame:
The layout will be VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL
after the first frame , can I map next texure data to this VkImage
directly without change it's layout ? if I can not do that, which layout can I change this VkImage
to ?
In vkspec 11.4 it says :
The new layout used in a transition must not be VK_IMAGE_LAYOUT_UNDEFINED or VK_IMAGE_LAYOUT_PREINITIALIZED
So , I can not change layout back to _PREINITIALIZED
.
Any help will be appreciated.