Skip to content

check-vulkan: Don't try to create two queues in the same family

Simon McVittie requested to merge wip/task294 into main

It's possible (indeed quite likely) that we will choose the same queue family for the graphics queue (any family with the GRAPHICS_BIT) and the present queue (any family that supports presentation). Having more than one VkDeviceQueueCreateInfo for the same family is a Vulkan spec constraint violation, so we need to uniquify them and only do one per family. The Nvidia proprietary driver has some logic that relies on them being unique, leading to a null pointer dereference on some systems if not.

In the original C++ version of check-vulkan, unique_queue_families was a std::set (hence its name), but it was wrongly converted into a plain array that doesn't do anything to ensure they're unique.


Fixes: 22d7f70d "check-vulkan: Convert the file from C++ to C"

@cubanismo, please could you test this on your system that can reproduce the crash? I've confirmed that the Vulkan validation layers pick up on this, and stop complaining with this change, but on my Nvidia test system (Ubuntu 22.04 with driver 510.108.03), I don't get the crash for whatever reason.

A sanity-check on the code would also be helpful: as you can see, we don't actually know Vulkan :-)

Edited by Simon McVittie

Merge request reports