In 05_window_surface.cpp, isDeviceSuitable() checks whether the physical device has a queue family that supports graphics:
bool supportsGraphics =
std::ranges::any_of(
queueFamilies,
[](auto const& qfp) {
return !!(qfp.queueFlags &
vk::QueueFlagBits::eGraphics);
});
However, createLogicalDevice() later requires a queue family that supports both graphics and presentation to the selected surface:
if ((queueFamilyProperties[qfpIndex].queueFlags &
vk::QueueFlagBits::eGraphics) &&
physicalDevice.getSurfaceSupportKHR(
qfpIndex, *surface))
{
queueIndex = qfpIndex;
break;
}
It seems possible for a physical device to pass isDeviceSuitable() because it has a graphics-capable queue family, but then fail in createLogicalDevice() because no queue family supports both graphics and presentation to the surface.
Would it make sense for isDeviceSuitable() to also check presentation support, so that its suitability criteria match the requirements later used by createLogicalDevice()?
In 05_window_surface.cpp,
isDeviceSuitable()checks whether the physical device has a queue family that supports graphics:However, createLogicalDevice() later requires a queue family that supports both graphics and presentation to the selected surface:
It seems possible for a physical device to pass isDeviceSuitable() because it has a graphics-capable queue family, but then fail in createLogicalDevice() because no queue family supports both graphics and presentation to the surface.
Would it make sense for isDeviceSuitable() to also check presentation support, so that its suitability criteria match the requirements later used by createLogicalDevice()?