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

VkImageSwapchainCreateInfoKHR validation reports erroneous failure regarding pQueueFamilyIndices #8076

Open
litherum opened this issue May 31, 2024 · 0 comments
Labels
WSI Window System Integration related issues

Comments

@litherum
Copy link

Environment:

  • OS: FreeBSD 14.0
  • GPU and driver version: NVIDIA GeForce RTX 4090 550.54.14.0
  • SDK or header version if building from repo: 1.3.283
  • Options enabled (synchronization, best practices, etc.): defaults

Describe the Issue

Steps to reproduce:

  1. Create a std::vector<uint32_t> queueFamilyIndices holding some indices of queue families
  2. Create a VkSwapchain swapchain with VkSwapchainCreateInfoKHR::pQueueFamilyIndices set to queueFamilyIndices.data()
  3. Call vkCreateImage() with:
    A. VkImageCreateInfo::pQueueFamilyIndices also set to queueFamilyIndices.data()
    B. VkImageCreateInfo::pNext pointing to a VkImageSwapchainCreateInfoKHR whose swapchain field is set to swapchain

Expected behavior

This alone should not cause a validation error.

Actual behavior

(VUID-VkImageSwapchainCreateInfoKHR-swapchain-00995) Validation Error: [ VUID-VkImageSwapchainCreateInfoKHR-swapchain-00995 ] | MessageID = 0x53c85abf | vkCreateImage(): pCreateInfo->pNext.swapchain was created with pQueueFamilyIndices containing index 0 which is not included in pCreateInfo->pQueueFamilyIndices. The Vulkan spec states: If swapchain is not VK_NULL_HANDLE, the fields of VkImageCreateInfo must match the implied image creation parameters of the swapchain (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkImageSwapchainCreateInfoKHR-swapchain-00995)

Additional context

This is caused by an erroneous check in cc_image.cpp. That code says:

for (uint32_t i = 0; i < pCreateInfo->queueFamilyIndexCount; ++i) {
    bool found = false;
    for (uint32_t j = 0; j < pCreateInfo->queueFamilyIndexCount; ++j) {
        if (i != j && pCreateInfo->pQueueFamilyIndices[j] == swapchain_state->create_info.pQueueFamilyIndices[i]) {
            found = true;
            break;
        }
    }
    if (!found) {
        skip |=
            LogError(vuid, device, create_info_loc.pNext(Struct::VkImageSwapchainCreateInfoKHR, Field::swapchain),
     "was created with pQueueFamilyIndices containing index %" PRIu32
     " which is not included in pCreateInfo->pQueueFamilyIndices.",
     i);
    }
}

This code is trying to check that every item in pCreateInfo->queueFamilyIndexCount is present in swapchain_state->create_info.pQueueFamilyIndices. However, the error is the i != j check: because this check exists, if a queue family index is listed at the same position in both arrays, it will be erroneously determined to be missing.

I also think the error message is incorrect, because the missing value isn't i itself, but instead swapchain_state->create_info.pQueueFamilyIndices[i].

@spencer-lunarg spencer-lunarg added the WSI Window System Integration related issues label Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WSI Window System Integration related issues
Projects
None yet
Development

No branches or pull requests

2 participants