diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-08-02 13:20:16 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2022-08-03 19:06:19 +0200 |
commit | 0fb4b49d1dea97d2b4d9456810af9b3f3bc66e2c (patch) | |
tree | 357611f336bae83f68633c6ca476e1a3f3f1012d /src/gui/vulkan/qvulkandefaultinstance.cpp | |
parent | 5c0ce1b14c66ddd6aa6cad7661e7845c27bd3022 (diff) |
vulkan: Request an 1.3 instance if supported
This affects the users of the QVulkanInstance creation helper, which are
Qt Quick and the backingstore compositor for texture-based widgets.
Change-Id: I6c3eccfade3cf9be7811dda66aca9d63ece4534c
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'src/gui/vulkan/qvulkandefaultinstance.cpp')
-rw-r--r-- | src/gui/vulkan/qvulkandefaultinstance.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/gui/vulkan/qvulkandefaultinstance.cpp b/src/gui/vulkan/qvulkandefaultinstance.cpp index c106857691..7d6c478b4a 100644 --- a/src/gui/vulkan/qvulkandefaultinstance.cpp +++ b/src/gui/vulkan/qvulkandefaultinstance.cpp @@ -36,23 +36,25 @@ QVulkanInstance *QVulkanDefaultInstance::instance() s_vulkanInstance = new QVulkanInstance; // With a Vulkan implementation >= 1.1 we can check what - // vkEnumerateInstanceVersion() says and request 1.2 or 1.1 based on the - // result. To prevent future surprises, be conservative and ignore any > 1.2 + // vkEnumerateInstanceVersion() says and request 1.3/1.2/1.1 based on the + // result. To prevent future surprises, be conservative and ignore any > 1.3 // versions for now. For 1.0 implementations nothing will be requested, the // default 0 in VkApplicationInfo means 1.0. // // Vulkan 1.0 is actually sufficient for 99% of Qt Quick (3D)'s - // functionality. In addition, Vulkan implementations tend to enable 1.1 and 1.2 + // functionality. In addition, Vulkan implementations tend to enable 1.1+ // functionality regardless of the VkInstance API request. However, the // validation layer seems to take this fairly seriously, so we should be - // prepared for using 1.1 and 1.2 features in a fully correct manner. This also - // helps custom Vulkan code in applications, which is not under out control; it - // is ideal if Vulkan 1.1 and 1.2 are usable without requiring such applications - // to create their own QVulkanInstance just to be able to make an appropriate - // setApiVersion() call on it. + // prepared for using 1.1+ features in a fully correct manner. This also + // helps custom Vulkan code in applications, which is not under out + // control; it is ideal if Vulkan 1.1+ versions are usable without + // requiring such applications to create their own QVulkanInstance just to + // be able to make an appropriate setApiVersion() call on it. const QVersionNumber supportedVersion = s_vulkanInstance->supportedApiVersion(); - if (supportedVersion >= QVersionNumber(1, 2)) + if (supportedVersion >= QVersionNumber(1, 3)) + s_vulkanInstance->setApiVersion(QVersionNumber(1, 3)); + else if (supportedVersion >= QVersionNumber(1, 2)) s_vulkanInstance->setApiVersion(QVersionNumber(1, 2)); else if (supportedVersion >= QVersionNumber(1, 1)) s_vulkanInstance->setApiVersion(QVersionNumber(1, 2)); |