Magnum::Vk namespace

Vulkan wrapping layer.

Contents

C++14 wrappers and helpers for Vulkan development.

This library is built if WITH_VK is enabled when building Magnum. To use this library with CMake, you need to request the Vk component of the Magnum package and link to the Magnum::Vk target:

find_package(Magnum REQUIRED Vk)

# ...
target_link_libraries(your-app Magnum::Vk)

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

Functions

auto hasVkPrimitiveTopology(Magnum::MeshPrimitive primitive) -> bool
Check availability of a generic mesh primitive.
auto vkPrimitiveTopology(Magnum::MeshPrimitive primitive) -> VkPrimitiveTopology
Convert generic mesh primitive to Vulkan primitive topology.
auto hasVkIndexType(Magnum::MeshIndexType type) -> bool
Check availability of a generic index type.
auto vkIndexType(Magnum::MeshIndexType type) -> VkIndexType
Convert generic mesh index type to Vulkan mesh index type.
auto hasVkFormat(Magnum::PixelFormat format) -> bool
Check availability of a generic pixel format.
auto hasVkFormat(Magnum::CompressedPixelFormat format) -> bool
Check availability of a generic compressed pixel format.
auto vkFormat(Magnum::PixelFormat format) -> VkFormat
Convert a generic pixel format to Vulkan format.
auto vkFormat(Magnum::CompressedPixelFormat format) -> VkFormat
Convert a generic pixel format to Vulkan format.
auto vkFilter(Magnum::SamplerFilter filter) -> VkFilter
Convert generic sampler filter to Vulkan filter.
auto vkSamplerMipmapMode(Magnum::SamplerMipmap mipmap) -> VkSamplerMipmapMode
Convert generic sampler mipomap mode to Vulkan sampler mipmap mode.
auto hasVkSamplerAddressMode(Magnum::SamplerWrapping wrapping) -> bool
Check availability of a generic sampler wrapping mode.
auto vkSamplerAddressMode(Magnum::SamplerWrapping wrapping) -> VkSamplerAddressMode
Convert generic sampler filter mode to Vulkan sampler address mode.
template<UnsignedInt dimensions>
auto vkSamplerAddressMode(const Array<dimensions, Magnum::SamplerWrapping>& wrapping) -> Array<dimensions, VkSamplerAddressMode>

Function documentation

bool Magnum::Vk::hasVkPrimitiveTopology(Magnum::MeshPrimitive primitive)

Check availability of a generic mesh primitive.

In particular, Vulkan doesn't support the MeshPrimitive::LineLoop primitive. Returns false if Vulkan doesn't support such primitive, true otherwise. The primitive value is expected to be valid.

VkPrimitiveTopology Magnum::Vk::vkPrimitiveTopology(Magnum::MeshPrimitive primitive)

Convert generic mesh primitive to Vulkan primitive topology.

Not all generic mesh primitives are available in Vulkan and this function expects that given primitive is available. Use hasVkPrimitiveTopology() to query availability of given primitive.

bool Magnum::Vk::hasVkIndexType(Magnum::MeshIndexType type)

Check availability of a generic index type.

In particular, Vulkan doesn't support the MeshIndexType::UnsignedByte type. Returns false if Vulkan doesn't support such type, true otherwise. The type value is expected to be valid.

VkIndexType Magnum::Vk::vkIndexType(Magnum::MeshIndexType type)

Convert generic mesh index type to Vulkan mesh index type.

Not all generic index types are available in Vulkan and this function expects that given type is available. Use hasVkIndexType() to query availability of given index type.

bool Magnum::Vk::hasVkFormat(Magnum::PixelFormat format)

Check availability of a generic pixel format.

Some Vulkan targets don't support all generic formats. Returns false if current target can't support such format, true otherwise. Moreover, returns true also for all formats that are isPixelFormatImplementationSpecific(). The format value is expected to be valid.

bool Magnum::Vk::hasVkFormat(Magnum::CompressedPixelFormat format)

Check availability of a generic compressed pixel format.

Some Vulkan targets don't support all generic formats. Returns false if current target can't support such format, true otherwise. Moreover, returns true also for all formats that are isCompressedPixelFormatImplementationSpecific(). The format value is expected to be valid.

VkFormat Magnum::Vk::vkFormat(Magnum::PixelFormat format)

Convert a generic pixel format to Vulkan format.

In case isPixelFormatImplementationSpecific() returns false for format, maps it to a corresponding Vulkan format. In case isPixelFormatImplementationSpecific() returns true, assumes format stores Vulkan-specific format and returns pixelFormatUnwrap() cast to VkFormat.

Not all generic pixel formats may be available on all targets and this function expects that given format is available on the target. Use hasVkFormat() to query availability of given format.

VkFormat Magnum::Vk::vkFormat(Magnum::CompressedPixelFormat format)

Convert a generic pixel format to Vulkan format.

In case isCompressedPixelFormatImplementationSpecific() returns false for format, maps it to a corresponding Vulkan format. In case isCompressedPixelFormatImplementationSpecific() returns true, assumes format stores Vulkan-specific format and returns compressedPixelFormatUnwrap() cast to VkFormat.

Not all generic pixel formats may be available on all targets and this function expects that given format is available on the target. Use hasVkFormat() to query availability of given format.

VkFilter Magnum::Vk::vkFilter(Magnum::SamplerFilter filter)

Convert generic sampler filter to Vulkan filter.

VkSamplerMipmapMode Magnum::Vk::vkSamplerMipmapMode(Magnum::SamplerMipmap mipmap)

Convert generic sampler mipomap mode to Vulkan sampler mipmap mode.

Vulkan doesn't support the SamplerMipmap::Base value directly, instead VK_SAMPLER_MIPMAP_MODE_NEAREST is used and you have to configure the sampler to use just a single mipmap level.

bool Magnum::Vk::hasVkSamplerAddressMode(Magnum::SamplerWrapping wrapping)

Check availability of a generic sampler wrapping mode.

Some Vulkan targets don't support all generic sampler wrapping modes (for example the SamplerWrapping::MirrorClampToEdge). Returns false if current target can't support such format, true otherwise. The wrapping value is expected to be valid.

VkSamplerAddressMode Magnum::Vk::vkSamplerAddressMode(Magnum::SamplerWrapping wrapping)

Convert generic sampler filter mode to Vulkan sampler address mode.

Not all generic sampler wrapping modes may be available on all targets and this function expects that given format is available on the target. Use hasVkSamplerAddressMode() to query availability of given mode.

template<UnsignedInt dimensions>
Array<dimensions, VkSamplerAddressMode> Magnum::Vk::vkSamplerAddressMode(const Array<dimensions, Magnum::SamplerWrapping>& wrapping)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.