rhi manual test: Bump Vulkan instance API version request

Do what Qt Quick would do.

Change-Id: I82743a39808601752f4ecbdb74b87f3a757a9310
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
This commit is contained in:
Laszlo Agocs 2023-03-08 11:31:13 +01:00
parent ed6a3ce0af
commit 6626578036

View File

@ -476,11 +476,14 @@ int main(int argc, char **argv)
inst.setLayers({ "VK_LAYER_KHRONOS_validation" });
}
const QVersionNumber supportedVersion = inst.supportedApiVersion();
qDebug() << "Supported Vulkan API version:" << supportedVersion;
if (supportedVersion >= QVersionNumber(1, 1)) {
qDebug("Requesting Vulkan API 1.1 on the VkInstance");
if (supportedVersion >= QVersionNumber(1, 3))
inst.setApiVersion(QVersionNumber(1, 3));
else if (supportedVersion >= QVersionNumber(1, 2))
inst.setApiVersion(QVersionNumber(1, 2));
else if (supportedVersion >= QVersionNumber(1, 1))
inst.setApiVersion(QVersionNumber(1, 1));
}
qDebug() << "Requesting Vulkan API" << inst.apiVersion().toString();
qDebug() << "Instance-level version was reported as" << supportedVersion.toString();
inst.setExtensions(QRhiVulkanInitParams::preferredInstanceExtensions());
if (!inst.create()) {
qWarning("Failed to create Vulkan instance, switching to OpenGL");