Magnum/Vk/Integration.h file

Conversion of Vulkan math types.

Provides conversion for the following types:

Magnum typeEquivalent Vulkan type
Vector2iVkOffset2D, VkExtent2D
Vector3iVkOffset3D, VkExtent3D
Vector4, Color4, Vector4i, Vector4uiVkClearColorValue
Vector3, Color3VkClearColorValue

VkClearColorValue is an union, so it's convertible from/to a floating-point type as well as integer types, but you have to ensure the type is correct for the API call it'll be used in. Conversion of VkClearColorValue to Color3 is not allowed, as it would lead to loss of the alpha value. In the other direction, alpha is set to 1.0f.

Third dimension of VkViewport is a depth range, third dimension of VkClearRect is an attachment layer range. In both cases you can use Range3D::xy() to slice it into a two-dimensional range type.

Since Magnum uses a signed type for all offsets, sizes and rectangles, the unsigned VkExtent2D / VkExtent3D types are convertible to signed types as well. The VkRect2D and VkClearRect is a mixed unsigned + signed type, which corresponds to a signed range on Magnum side.

Example usage:

VkOffset2D a{64, 32};
Vector2i b(a);

using namespace Math::Literals;
VkClearColorValue c = VkClearColorValue(0xff9391_srgbf);