vulkano-rs/vulkano

Expects VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, instead current layout is VK_IMAGE_LAYOUT_UNDEFINED

realmayus opened this issue · 0 comments

  • Version of vulkano: 0.34.1
  • OS: Ubuntu 23.10, Linux 6.5.0-14-generic x86_64
  • GPU (the selected PhysicalDevice): AMD Radeon RX 5700 XT (RADV NAVI10)
  • GPU Driver: amdgpu 2.4.115-1 amd64
  • Upload of a reasonably minimal complete main.rs file that demonstrates the issue: Sadly haven't had any luck reproducing this in a more minimal example, but here's my texture creation code, which should upload the images to the GPU. According to the logs, the formats of the images are R8G8B8A8_UNORM and R8G8B8A8_SRGB.

Issue

Hello, I'm getting the following errors when starting my program and I'm really not sure why it happens. I updated from an older vulkano version to 0.34.1, but I'm not sure if the issues are directly related to the update:

UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout(ERROR / SPEC): msgNum: 1303270965 - Validation Error: [ UNASSIGNED-CoreValidation-DrawState-InvalidImageLayout ] Object 0: handle = 0x55d3dc8947c0, type = VK_OBJECT_TYPE_COMMAND_BUFFER; Object 1: handle = 0xd175b40000000013, type = VK_OBJECT_TYPE_IMAGE; | MessageID = 0x4dae5635 | vkQueueSubmit(): pSubmits[0].pCommandBuffers[0] command buffer VkCommandBuffer 0x55d3dc8947c0[] expects VkImage 0xd175b40000000013[] (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.
    Objects: 2
        [0] 0x55d3dc8947c0, type: 6, name: NULL
        [1] 0xd175b40000000013, type: 10, name: NULL

This occurs several times, once per texture I try to load, as far as I can tell.
Later, I get this error too:

VUID-VkPresentInfoKHR-pImageIndices-01430(ERROR / SPEC): msgNum: 1219306694 - Validation Error: [ VUID-VkPresentInfoKHR-pImageIndices-01430 ] Object 0: handle = 0xfab64d0000000002, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0x48ad24c6 | vkQueuePresentKHR(): pPresentInfo->pSwapchains[0] image at index 0 was not acquired from the swapchain. 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 or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR layout at the time the operation is executed on a VkDevice (https://vulkan.lunarg.com/doc/view/1.3.268.0/linux/1.3-extensions/vkspec.html#VUID-VkPresentInfoKHR-pImageIndices-01430)
    Objects: 1
        [0] 0xfab64d0000000002, type: 1000001000, name: NULL

Then, my driver crashes.

For context, here's my render loop: https://github.com/realmayus/engine-vk/blob/d1a6b48dd58557009437ab9df566f79adb13e83e/src/renderer/src/render_loop.rs#L213-L362
and here's where I create the command buffers for the framebuffers: https://github.com/realmayus/engine-vk/blob/124f36f82d0fddba47cbc53093b9ab0450b3a9dc/src/renderer/src/lib.rs#L159-L197