summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-01-14 17:42:47 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2021-01-18 13:21:15 +0100
commit7d378bd7804343652fdf1e28744523382280e90e (patch)
treec508cc9f518ca58eabbfa70e1437c8f32638243f /tests
parent957344123672e891a25e55b54dcb012d2017b27a (diff)
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 <andy.nichols@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui/qvulkan/tst_qvulkan.cpp16
1 files changed, 14 insertions, 2 deletions
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)