From 4933583f7ff347af2d7901a7e83e5cb64f4e1e70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Mon, 7 Dec 2020 23:31:07 +0100 Subject: [PATCH] Vk: Device(..., const DeviceCreateInfo&) wasn't covered. Interestingly enough, apparently I was always constructing it in-place in the Device constructor. Which leads me to the next issue... --- src/Magnum/Vk/Test/DeviceVkTest.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Magnum/Vk/Test/DeviceVkTest.cpp b/src/Magnum/Vk/Test/DeviceVkTest.cpp index 16e6a3bc7..25f00c89a 100644 --- a/src/Magnum/Vk/Test/DeviceVkTest.cpp +++ b/src/Magnum/Vk/Test/DeviceVkTest.cpp @@ -60,6 +60,7 @@ struct DeviceVkTest: VulkanTester { void construct(); void constructQueueFromFlags(); void constructExtensions(); + void constructDeviceCreateInfoConstReference(); void constructTransferDeviceProperties(); void constructExtensionsCommandLineDisable(); void constructExtensionsCommandLineEnable(); @@ -141,6 +142,7 @@ DeviceVkTest::DeviceVkTest(): VulkanTester{NoCreate} { &DeviceVkTest::construct, &DeviceVkTest::constructQueueFromFlags, &DeviceVkTest::constructExtensions, + &DeviceVkTest::constructDeviceCreateInfoConstReference, &DeviceVkTest::constructTransferDeviceProperties}); addInstancedTests({&DeviceVkTest::constructExtensionsCommandLineDisable, @@ -370,6 +372,23 @@ void DeviceVkTest::constructExtensions() { CORRADE_VERIFY(device->TrimCommandPoolKHR); } +void DeviceVkTest::constructDeviceCreateInfoConstReference() { + Queue queue{NoCreate}; + DeviceProperties deviceProperties = pickDevice(instance()); + DeviceCreateInfo info{deviceProperties}; + info.addQueues(0, {0.0f}, {queue}); + + /* Just to verify the overload taking const DeviceProperties& works as + well (most of the above tests verified a move) */ + Device device{instance(), info}; + CORRADE_VERIFY(device.handle()); + + /* Device properties should be lazy-populated and different from the + above instances because we didn't transfer the ownership here either */ + CORRADE_COMPARE(device.properties().name(), deviceProperties.name()); + CORRADE_VERIFY(&device.properties().properties() != &deviceProperties.properties()); +} + void DeviceVkTest::constructTransferDeviceProperties() { DeviceProperties deviceProperties = pickDevice(instance()); const void* vkProperties = &deviceProperties.properties();