Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan swapchain and RT layout transition validation error #83

Open
Pikachuxxxx opened this issue Jan 15, 2022 · 1 comment
Open

Vulkan swapchain and RT layout transition validation error #83

Pikachuxxxx opened this issue Jan 15, 2022 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers graphics:Vulkan Issue related to Vulkan API implementation icebox This will not be worked on for a while

Comments

@Pikachuxxxx
Copy link
Owner

Pikachuxxxx commented Jan 15, 2022

The swapchain image is in VK_IMAGE_LAYOUT_UNDEFINED layout, but to present the image, it should be in either VK_IMAGE_LAYOUT_PRESENT_SRC_KHR or VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR.

[VULKAN]  - Validation ERROR :
message ID : -945112042
ID Name : VUID-VkPresentInfoKHR-pImageIndices-01296
Message : Validation Error: [ VUID-VkPresentInfoKHR-pImageIndices-01296 ] Object 0: handle = 0x22b53b62620, 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)

We can manually transition the layout of swapchain image to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR before presenting to resolve this issue using memory and pipeline barriers, however now VK_IMAGE_LAYOUT_PRESENT_SRC_KHR is not a layout fit for rendering in the next frame. So before rendering, we need to transition the image back into VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL. Hence it must be done once before presenting and again after presenting to make sure the format of the swapchain images is properly transitioned.

============================================================
Razix Engine Stats
Version : 0.20.1
Configuration : [Debug | Release | Distribution]
Release Stage : Development
Release Date : 9-1-2022
OS : Windows 10 Home
Processor : Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz 2.60 GHz
Vulkan API Version : 1.2.186
GPU Name : NVIDIA GeForce RTX 2060
Vendor ID : 4318
Device Type : DISCRETE GPU
Driver Version : 497.116.0

@Pikachuxxxx Pikachuxxxx added bug Something isn't working good first issue Good for newcomers labels Jan 15, 2022
@Pikachuxxxx Pikachuxxxx added icebox This will not be worked on for a while graphics:Vulkan Issue related to Vulkan API implementation labels Mar 7, 2022
@Pikachuxxxx
Copy link
Owner Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers graphics:Vulkan Issue related to Vulkan API implementation icebox This will not be worked on for a while
Projects
None yet
Development

No branches or pull requests

1 participant