Problem:
I try to create a texture with initial value by clear color parameter of vkCmdBeginRenderPass. However, renderdoc display the texture as layout_undefined, and no validation error occurs.
Detail:
Here is my usage of this texture. The texture is created with multiple mip map. I initial the texture by clear value parameter of vkCmdBeginRenderPass. The level 0 of the texture is used as shader input, the leve 1 is used as render target. The following pseudocode is how I did.
SetImageLayout(texture.level1, renderpass.initialLayout)
BeginRenderpass(clearValue)
SetImageLayout(texture.level0, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL)
vkCmdDraw()
EndRenderpass()
There is no validation error, which should mean the image layout transition is correct. However, the renderdoc capture display the texture as layout_undefined. Is the way of clearing color wrong? Do I need to use the vkCmdClearColorImage?