Magnum::Vk::VulkanTester class new in Git master

Base class for Vulkan tests and benchmarks.

Extends Corrade::TestSuite::Tester with features for Vulkan testing and benchmarking. Be sure to read its documentation first to have an overview of the base features.

This class is built into a separate static library and only if WITH_VULKANTESTER is enabled when building Magnum. To use it with CMake, request the VulkanTester component of the Magnum package. Derive your test class from this class instead of Corrade::TestSuite::Tester and either link to Magnum::VulkanTester target or add it to the LIBRARIES section of the corrade_add_test() macro:

find_package(Magnum REQUIRED VulkanTester)

# ...
corrade_add_test(YourTest YourTest.cpp LIBRARIES Magnum::VulkanTester)

Additionally, if you're using Magnum as a CMake subproject, ensure it's enabled as it's not built by default:

set(WITH_OPENGLTESTER ON CACHE BOOL "" FORCE)
add_subdirectory(magnum EXCLUDE_FROM_ALL)

See Downloading and building, Usage with CMake and Testing and benchmarking for more information.

Vulkan device and instance creation

The class implicitly creates a Vulkan Instance and Device with default layers and extensions and one graphics queue. These are then available through instance(), device() and queue() getters.

If you want to create a custom device, use the VulkanTester(NoCreateT) constructor. You can then move the device and queue instances to the getters to make them available through common interfaces again. If you want to create a custom instance as well, use the VulkanTester(NoCreateT, NoCreateT) variant.

Constructors, destructors, conversion operators

VulkanTester() explicit
Default constructor.
VulkanTester(NoCreateT) explicit
Construct without creating a device.
VulkanTester(NoCreateT, NoCreateT) explicit
Construct without creating an instance or device.

Protected functions

auto instance() -> Instance&
Vulkan instance.
auto device() -> Device&
Vulkan device.
auto queue() -> Queue&
Vulkan queue.

Function documentation

Magnum::Vk::VulkanTester::VulkanTester() explicit

Default constructor.

Creates an instance using implicit settings, picks a default device and creates a graphics queue on that device. These are then exposed through instance(), device() and queue() getters.

Magnum::Vk::VulkanTester::VulkanTester(NoCreateT) explicit

Construct without creating a device.

Use the instance() to pick and create a device. You can then move it to device() and queue() to have them accessible through common interfaces again.

Magnum::Vk::VulkanTester::VulkanTester(NoCreateT, NoCreateT) explicit

Construct without creating an instance or device.

Leaves the initialization completely on the user. You can move the instances to instance(), device() and queue() to have them accessible through common interfaces.

Instance& Magnum::Vk::VulkanTester::instance() protected

Vulkan instance.

In case the class was constructed using VulkanTester(NoCreateT, NoCreateT), this instance is initially not created. Move a created instance onto it to make it useful.

Device& Magnum::Vk::VulkanTester::device() protected

Vulkan device.

In case the class was constructed using VulkanTester(NoCreateT) or VulkanTester(NoCreateT, NoCreateT), this instance is initially not created. Move a created instance onto it to make it useful.

Queue& Magnum::Vk::VulkanTester::queue() protected

Vulkan queue.

In case the class was constructed using VulkanTester(), the queue corresponds to DeviceProperties::pickQueueFamily() with QueueFlag::Graphics called on Device::properties().

In case the class was constructed using VulkanTester(NoCreateT) or VulkanTester(NoCreateT, NoCreateT), this instance is initially not created. Move a created instance onto it to make it useful.