KhronosGroup / KhronosGroup/Vulkan-ValidationLayers

Clarification about (or possible validation bug) with VkImageSwapchainCreateInfoKHR

Open
#4,343 4 comments 0 reactions 0 assignees View on GitHub
WSI
Dominant language
C++
Stars
1k
Forks
504
Avg merge
11h 35m
Merged PRs (30d)
224

Description

**Describe the Issue**
When switching from using `vkGetSwapchainImagesKHR` into a `vkCreateImage` with `VkImageSwapchainCreateInfoKHR` and `vkBindImageMemory2` with `VkBindImageMemorySwapchainInfoKHR`, with no other changes (the referred to images should be the same), the observable behaviour matches, however, a new validation error is reported:
```
[21.07.2022 08:45:19:830035][ERROR]: Validation Error: [ VUID-VkPresentInfoKHR-pImageIndices-01296 ] Object 0: handle = 0xf0eb3400000000a5, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0xc7aabc16 | vkQueuePresentKHR: 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 layout at the time the operation is executed on a VkDevice (https://github.com/KhronosGroup/Vulkan-Docs/search?q=)VUID-VkPresentInfoKHR-pImageIndices-01296)
[21.07.2022 08:45:19:846718][ERROR]: Validation Error: [ VUID-VkPresentInfoKHR-pImageIndices-01296 ] Object 0: handle = 0xf0eb3400000000a5, type = VK_OBJECT_TYPE_SWAPCHAIN_KHR; | MessageID = 0xc7aabc16 | vkQueuePresentKHR: pSwapchains[0] image at index 1 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 layout at the time the operation is executed on a VkDevice (https://github.com/KhronosGroup/Vulkan-Docs/search?q=)VUID-VkPresentInfoKHR-pImageIndices-01296)
```

- The image acquision is working the exact same way, and indexing into the same image indices.
- The image layouts are being transitioned from undefined to general and then present_src, just as before.
- Another concern is that `VUID-VkPresentInfoKHR-pImageIndices-01296` is not the VUID reported on the documentation, but does show up here: https://github.com/KhronosGroup/Vulkan-Docs/blob/f8ab0080c198effe3bd9300a5574c28719fc0726/chapters/VK_KHR_swapchain/wsi.txt#L1308 .

**Valid Usage ID**
VUID-VkPresentInfoKHR-pImageIndices-01296

**Environment:**
- OS: Windows 11
- GPU: GTX 1050 Ti
- SDK or header version if building from repo: 1.3.201
- Options enabled (synchronization, best practices, etc.): Info, Warning, Performance, Error

**Additional context**
Issue directed from https://github.com/KhronosGroup/Vulkan-Docs/issues/1896

Contributor guide

Open the contributing guide

Research direction

Start by reviewing validation handling for VUID-VkPresentInfoKHR-pImageIndices-01296 and the Vulkan swapchain image creation, binding, acquisition, and presentation paths. Reproduce the reported switch to VkImageSwapchainCreateInfoKHR and vkBindImageMemory2 on the stated environment, then compare the validation result with the Vulkan documentation. Done means the VUID behavior is clarified or the validation issue is corrected with appropriate coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.