rhi: vulkan: use the clamped api version for vma

caps.apiVersion is inst->apiVersion() limited by the version the
physical device reports. Therefore, use caps.apiVersion when
setting up the memory allocator, like it is done everywhere else.

This is expected prevent vma init failures on lavapipe in some Linux
distros.

Change-Id: I4e693820c95a5e0174846afb20e42aadd56034d6
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit f9d473ac726fe012fe05a9e6f7502ca50c2245e5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Laszlo Agocs 2023-07-19 11:10:28 +02:00 committed by Qt Cherry-pick Bot
parent ac6fcaf565
commit 226f84d5ac

View File

@ -774,12 +774,9 @@ bool QRhiVulkan::create(QRhi::Flags flags)
allocatorInfo.device = dev;
allocatorInfo.pVulkanFunctions = &funcs;
allocatorInfo.instance = inst->vkInstance();
const QVersionNumber apiVer = inst->apiVersion();
if (!apiVer.isNull()) {
allocatorInfo.vulkanApiVersion = VK_MAKE_VERSION(apiVer.majorVersion(),
apiVer.minorVersion(),
apiVer.microVersion());
}
allocatorInfo.vulkanApiVersion = VK_MAKE_VERSION(caps.apiVersion.majorVersion(),
caps.apiVersion.minorVersion(),
caps.apiVersion.microVersion());
VmaAllocator vmaallocator;
VkResult err = vmaCreateAllocator(&allocatorInfo, &vmaallocator);
if (err != VK_SUCCESS) {