summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2022-01-19 18:34:52 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-21 22:31:32 +0000
commit7888d846ebd337d586971aa92bbd21cd227c2bc5 (patch)
treecc5a4d98875a8fb4f8a3dd4e100ce1bde2e31ee9
parent8f69c4ba5cfcd5170417ffd44480b1db70583907 (diff)
downloadqtbase-7888d846ebd337d586971aa92bbd21cd227c2bc5.tar.gz
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. Task-number: QTBUG-99803 Change-Id: Ib9cfcd449904c67b07e0e2d4ade5bcaeb4cb0ce6 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 79aad61fc1fe5295086bc27de2a3e8917649505a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/gui/vulkan/qvulkanwindow.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp
index 8b7fdc5478..5a6171d281 100644
--- a/src/gui/vulkan/qvulkanwindow.cpp
+++ b/src/gui/vulkan/qvulkanwindow.cpp
@@ -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