vulkan: Do not set the portability bit with old SDKs

Because it's a validation error with old ones, but required
in some cases from 1.3.216 on (MoltenVK). Ridiculous.

Amends 7fbc741d107ab679f6abd680ec909ce9b2bf333a and
b018bc6e2d27b95024ee8f1b8c719199df47c264.

Fixes: QTBUG-117412
Pick-to: 6.5
Change-Id: I9b4cacbe611d4e557ee1c156527142eb919d6b77
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
(cherry picked from commit 8a5a5f6c9773dc41b4c8685bc1c6bd34ce49a320)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Laszlo Agocs 2023-09-21 10:16:03 +02:00 committed by Qt Cherry-pick Bot
parent 730959d6ce
commit 78d7004755

View File

@ -259,8 +259,13 @@ void QBasicPlatformVulkanInstance::initInstance(QVulkanInstance *instance, const
VkInstanceCreateInfo instInfo = {};
instInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
instInfo.pApplicationInfo = &appInfo;
if (!flags.testFlag(QVulkanInstance::NoPortabilityDrivers))
instInfo.flags |= 0x00000001; // VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR
if (!flags.testFlag(QVulkanInstance::NoPortabilityDrivers)) {
// With old Vulkan SDKs setting a non-zero flags gives a validation error.
// Whereas from 1.3.216 on the portability bit is required for MoltenVK to function.
// Hence the version check.
if (m_supportedApiVersion >= QVersionNumber(1, 3, 216))
instInfo.flags |= 0x00000001; // VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR
}
QList<const char *> layerNameVec;
for (const QByteArray &ba : std::as_const(m_enabledLayers))