Enable all supported 1.0 device features in QVulkanWindow

[ChangeLog][QtGui][QVulkanWindow] QVulkanWindow is now enabling all
Vulkan 1.0 features reported as supported from the physical device.

Pick-to: 6.2 6.3 5.15
Task-number: QTBUG-99803
Change-Id: Ib9cfcd449904c67b07e0e2d4ade5bcaeb4cb0ce6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2022-01-19 18:34:52 +01:00
parent c7539876f6
commit 79aad61fc1

View File

@ -195,6 +195,23 @@ Q_LOGGING_CATEGORY(lcGuiVk, "qt.vulkan")
\note QVulkanWindow does not expose device layers since this functionality
has been deprecated since version 1.0.13 of the Vulkan API.
\section1 Layers, device features, and extensions
To enable instance layers, call QVulkanInstance::setLayers() before creating
the QVulkanInstance. To query what instance layer are available, call
QVulkanInstance::supportedLayers().
To enable device extensions, call setDeviceExtensions() early on when setting
up the QVulkanWindow. To query what device extensions are available, call
supportedDeviceExtensions().
Specifying an unsupported layer or extension is handled gracefully: this will
not fail instance or device creation, but the layer or extension request is
rather ignored.
When it comes to device features, QVulkanWindow enables all Vulkan 1.0
features that are reported as supported from vkGetPhysicalDeviceFeatures().
\sa QVulkanInstance, QWindow
*/
@ -712,6 +729,12 @@ void QVulkanWindowPrivate::init()
devInfo.enabledExtensionCount = devExts.count();
devInfo.ppEnabledExtensionNames = devExts.constData();
// Enable all 1.0 features.
VkPhysicalDeviceFeatures features;
memset(&features, 0, sizeof(features));
f->vkGetPhysicalDeviceFeatures(physDev, &features);
devInfo.pEnabledFeatures = &features;
// Device layers are not supported by QVulkanWindow since that's an already deprecated
// API. However, have a workaround for systems with older API and layers (f.ex. L4T
// 24.2 for the Jetson TX1 provides API 1.0.13 and crashes when the validation layer