Vulkan swapchain and image present problem

Hi, I was doing some encapsulations based on the vulkan tutorial code( [Introduction - Vulkan Tutorial]) and in the process I ran into the Validation Error: [ VUID-VkPresentInfoKHR-pImageIndices-01296 ]. I spent the whole day checking the swapchain, swapchain imageviews, framebuffer, syncronizations these kinds of stuff but I still can’t figure out the problem.

This is the full validation error message:

validation layer: Validation Error: [ VUID-VkPresentInfoKHR-pImageIndices-01296 ] Object 0: handle = 0x1564fbd1f10, type = VK_OBJECT_TYPE_QUEUE; | MessageID = 0xc7aabc16 | vkQueuePresentKHR(): pSwapchains[0] images passed to present must be in layout VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR but is in VK_IMAGE_LAYOUT_UNDEFINED. The Vulkan spec states: Each element of pImageIndices must be the index of a presentable image acquired from the swapchain specified by the corresponding element of the pSwapchains array, and the presented image subresource must be in the VK_IMAGE_LAYOUT_PRESENT_SRC_KHR layout at the time the operation is executed on a VkDevice (VUID-VkPresentInfoKHR-pImageIndices-01296)

This is the renderer code:

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.