From 7d378bd7804343652fdf1e28744523382280e90e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 14 Jan 2021 17:42:47 +0100 Subject: vulkan: Add instance-level version getter ...as described in the Vulkan >= 1.1 spec. One can now call supportedApiVersion() (before create(), similarly to the other supported* functions) to determine the available Vulkan (instance-level) version. Fixes: QTBUG-90333 Change-Id: Ibe8482402b7f07e4abc48c88252ff0365e4e2faa Reviewed-by: Andy Nichols --- tests/auto/gui/qvulkan/tst_qvulkan.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/gui/qvulkan/tst_qvulkan.cpp b/tests/auto/gui/qvulkan/tst_qvulkan.cpp index 020448af8b..82183c395c 100644 --- a/tests/auto/gui/qvulkan/tst_qvulkan.cpp +++ b/tests/auto/gui/qvulkan/tst_qvulkan.cpp @@ -86,8 +86,8 @@ void tst_QVulkan::vulkanInstance() void tst_QVulkan::vulkanCheckSupported() { - // Test the early calls to supportedLayers/extensions that need the library - // and some basics, but do not initialize the instance. + // Test the early calls to supportedLayers/extensions/apiVersion that need + // the library and some basics, but do not initialize the instance. QVulkanInstance inst; QVERIFY(!inst.isValid()); @@ -103,6 +103,9 @@ void tst_QVulkan::vulkanCheckSupported() QVERIFY(!ve.isEmpty()); QVERIFY(ve == inst.supportedExtensions()); } + + qDebug() << inst.supportedApiVersion(); + QVERIFY(inst.supportedApiVersion().majorVersion() >= 1); } void tst_QVulkan::vulkanPlainWindow() @@ -162,6 +165,15 @@ void tst_QVulkan::vulkanVersionRequest() // succeed for any bogus api version). if (!result) QCOMPARE(inst.errorCode(), VK_ERROR_INCOMPATIBLE_DRIVER); + + inst.destroy(); + + // Verify that specifying the version returned from supportedApiVersion + // (either 1.0.0 or what vkEnumerateInstanceVersion returns in Vulkan 1.1+) + // leads to successful instance creation. + inst.setApiVersion(inst.supportedApiVersion()); + result = inst.create(); + QVERIFY(result); } static void waitForUnexposed(QWindow *w) -- cgit v1.2.3