vkkhrdisplay: Silence validation complaints about presentation support

Zero reason to do this query, but the validation layer complains otherwise.

Pick-to: 6.4 6.3 6.2
Fixes: QTBUG-105527
Change-Id: I7a72e4d6d89f41279db94efe663a696302f05ded
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2022-08-11 10:00:17 +02:00
parent 5eacc974c7
commit dea9ed7e4c
2 changed files with 12 additions and 4 deletions

View File

@ -46,6 +46,9 @@ void QVkKhrDisplayVulkanInstance::createOrAdoptInstance()
m_enumeratePhysicalDevices = (PFN_vkEnumeratePhysicalDevices)
m_vkGetInstanceProcAddr(m_vkInst, "vkEnumeratePhysicalDevices");
m_getPhysicalDeviceSurfaceSupportKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceSurfaceSupportKHR>(
m_vkGetInstanceProcAddr(m_vkInst, "vkGetPhysicalDeviceSurfaceSupportKHR"));
// Use for first physical device, unless overridden by QT_VK_PHYSICAL_DEVICE_INDEX.
// This behavior matches what the Vulkan backend of QRhi would do.
@ -81,10 +84,14 @@ bool QVkKhrDisplayVulkanInstance::supportsPresent(VkPhysicalDevice physicalDevic
uint32_t queueFamilyIndex,
QWindow *window)
{
Q_UNUSED(physicalDevice);
Q_UNUSED(queueFamilyIndex);
Q_UNUSED(window);
return true;
if (!m_getPhysicalDeviceSurfaceSupportKHR)
return true;
VkSurfaceKHR surface = QVulkanInstance::surfaceForWindow(window);
VkBool32 supported = false;
m_getPhysicalDeviceSurfaceSupportKHR(physicalDevice, queueFamilyIndex, surface, &supported);
return supported;
}
bool QVkKhrDisplayVulkanInstance::chooseDisplay()

View File

@ -45,6 +45,7 @@ private:
QVulkanInstance *m_instance;
VkPhysicalDevice m_physDev = VK_NULL_HANDLE;
PFN_vkEnumeratePhysicalDevices m_enumeratePhysicalDevices = nullptr;
PFN_vkGetPhysicalDeviceSurfaceSupportKHR m_getPhysicalDeviceSurfaceSupportKHR = nullptr;
#if VK_KHR_display
PFN_vkGetPhysicalDeviceDisplayPropertiesKHR m_getPhysicalDeviceDisplayPropertiesKHR = nullptr;
PFN_vkGetDisplayModePropertiesKHR m_getDisplayModePropertiesKHR = nullptr;