1

I was working on this Vulkan tutorial and decided to implement a camera, which worked fine, then I decided to use Vulkan Memory Allocator. After I it, the project stopped working, giving me

validation layer: Validation Error: [ VUID-VkPresentInfoKHR-pImageIndices-01296 ] Object 0: handle = 0x289430725d8, 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 (https://github.com/KhronosGroup/Vulkan-Docs/search?q=)VUID-VkPresentInfoKHR-pImageIndices-01296)

and

validation layer: Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout ] Object 0: handle = 0x2894bf54f40, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x4dae5635 | vkQueueSubmit(): pSubmits[0].pCommandBuffers[0] command buffer VkCommandBuffer 0x2894bf54f40[] expects VkImage 0x84c0580000000017[] (subresource: aspectMask 0x1 array layer 0, mip level 0) to be in layout VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL--instead, current layout is VK_IMAGE_LAYOUT_UNDEFINED.

every time I try to draw the frame. GitHub of my code. I have researched the problem, and I understand that the VkImage should transition to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, but it for some reason does not. Note that it worked fine without VMA.

I tried to look through the program with breakpoints and found that my code for transitioning image layouts gives the expected results, and the images are not VK_NULL_HANDLE, and that the initial and final formats are sent as what they should be. I know what line causes the error: 1351 for the first, then 1367 for the second. I have tried transitioning the image formats right after creation, but that just gives a different error:

validation layer: Validation Error: [ VUID-VkCommandBufferAllocateInfo-commandPool-parameter ] Object 0: handle = 0x1dbfff775b0, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0xa70ffe70 | Invalid VkCommandPool Object 0xcccccccccccccccc. The Vulkan spec states: commandPool must be a valid VkCommandPool handle (https://vulkan.lunarg.com/doc/view/1.3.239.0/windows/1.3-extensions/vkspec.html#VUID-VkCommandBufferAllocateInfo-commandPool-parameter)"

which I assume means that the command buffer has not been created. I tried creating the command buffer first but it gives the same error.

Mac O'Brien
  • 2,407
  • 18
  • 22

0 Answers0