Add environment variables for customizing Vulkan
QT_VULKAN_INSTANCE_EXTENSIONS to specify additional instance extensions. QT_VULKAN_INSTANCE_LAYERS to specify additional instance layers. QT_VULKAN_DEVICE_EXTENSIONS to specify additional device extensions. These will apply to all QVulkanWindows and everything that uses RHI, including Qt Quick with the Vulkan RHI backend. Task-number: QTBUG-80499 Change-Id: I912495affa987d62a9823d55d06d6a8209f6adc6 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
parent
6d201aa1bd
commit
908df199d0
@ -501,6 +501,17 @@ bool QRhiVulkan::create(QRhi::Flags flags)
|
||||
}
|
||||
}
|
||||
|
||||
QByteArrayList envExtList;
|
||||
if (qEnvironmentVariableIsSet("QT_VULKAN_DEVICE_EXTENSIONS")) {
|
||||
envExtList = qgetenv("QT_VULKAN_DEVICE_EXTENSIONS").split(';');
|
||||
for (auto ext : requestedDevExts)
|
||||
envExtList.removeAll(ext);
|
||||
for (const QByteArray &ext : envExtList) {
|
||||
if (!ext.isEmpty())
|
||||
requestedDevExts.append(ext.constData());
|
||||
}
|
||||
}
|
||||
|
||||
VkDeviceCreateInfo devInfo;
|
||||
memset(&devInfo, 0, sizeof(devInfo));
|
||||
devInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
||||
|
@ -689,6 +689,15 @@ void QVulkanWindowPrivate::init()
|
||||
QVulkanInfoVector<QVulkanExtension> supportedExtensions = q->supportedDeviceExtensions();
|
||||
QByteArrayList reqExts = requestedDevExtensions;
|
||||
reqExts.append("VK_KHR_swapchain");
|
||||
|
||||
QByteArray envExts = qgetenv("QT_VULKAN_DEVICE_EXTENSIONS");
|
||||
if (!envExts.isEmpty()) {
|
||||
QByteArrayList envExtList = envExts.split(';');
|
||||
for (auto ext : reqExts)
|
||||
envExtList.removeAll(ext);
|
||||
reqExts.append(envExtList);
|
||||
}
|
||||
|
||||
for (const QByteArray &ext : reqExts) {
|
||||
if (supportedExtensions.contains(ext))
|
||||
devExts.append(ext.constData());
|
||||
|
@ -214,6 +214,22 @@ void QBasicPlatformVulkanInstance::initInstance(QVulkanInstance *instance, const
|
||||
for (const QByteArray &ext : extraExts)
|
||||
m_enabledExtensions.append(ext);
|
||||
|
||||
QByteArray envExts = qgetenv("QT_VULKAN_INSTANCE_EXTENSIONS");
|
||||
if (!envExts.isEmpty()) {
|
||||
QByteArrayList envExtList = envExts.split(';');
|
||||
for (auto ext : m_enabledExtensions)
|
||||
envExtList.removeAll(ext);
|
||||
m_enabledExtensions.append(envExtList);
|
||||
}
|
||||
|
||||
QByteArray envLayers = qgetenv("QT_VULKAN_INSTANCE_LAYERS");
|
||||
if (!envLayers.isEmpty()) {
|
||||
QByteArrayList envLayerList = envLayers.split(';');
|
||||
for (auto ext : m_enabledLayers)
|
||||
envLayerList.removeAll(ext);
|
||||
m_enabledLayers.append(envLayerList);
|
||||
}
|
||||
|
||||
// No clever stuff with QSet and friends: the order for layers matters
|
||||
// and the user-provided order must be kept.
|
||||
for (int i = 0; i < m_enabledLayers.count(); ++i) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user