I can not past code snapshot here, because of too many codes. I will describe my problem by Vulkan validation error and renderdoc.
I create a render pass, initial/final layouts of the render target attachment(swapchain image) both are
VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL . So I need to make some image layout transitions.
While creating swapchain: transite the layouts of swapchain images from
At begining of a frame: transit the current layout of current render target to
Before submiting rendering command buffer prior to the call of
vkQueuePresentKHR: transite the current layout of current render target to
Also, I create two seperate command buffer, one for recording rendering command which will be submitted before
vkQueuePresentKHR, another for recording
vkCmdPipelineBarrier to transite the image layout which will be submitted before submitting render command buffer.
First validation error pops up after submitting rendering command buffer, second validation error pops up after the call
see image 1
It is weird that the first validation error is in submitting rendering command buffer instead of the command buffer for transiting image layout.
The first frame is presenting swapchain image 157 as showed in renderdoc recording.
- The image layout transition while creating swapchain
see image 2
- The image layout transition before submiting rendering command buffer
My two command buffers are allocated from same command pool. Does anyone know what’s happening here?
if I use rendering command buffer to record
vkCmdPipelineBarrier, no validation error appears. But I don know why a seperate trainsition command buffer can not work normally.