Lightweight C++ wrapper for Vulkan
#include <volk.h> // or other vulkan API header
#include <vklite/vulkan.hpp>
#include <vklite/vk_mem_alloc.hpp>
namespace vk = vklite;
namespace vma = vk::vma;- Type safety for enums and bitfields.
- Compile-time viability checking for struct extensions (i.e. those chained with
pNext). - No need to specify
sTypeyourself. - Informative comments from
vk.xmlregistry. - Code arranged in a way such that you can lookup the related info for an entity (e.g. enum/struct/function) quickly.
- Default parameters.
It's too heavyweight and almost unusable without using the C++ module version.
VkName -> vk::Name
vkName->vk::namevkName(handle, ...)->handle.name(...)
VK_ENUM_NAME -> vk::Enum::eName
VK_ENUM_NAME_BIT -> vk::EnumFlagBits::bName
In all cases the extension suffix is preserved.
sTypeis automatically set for extensible structs.- Default constructor is value-initialized.
- Parametric constructor is available if all members are required.
prop->setProp/getProppProp->setProp/getProp
setProp is available if the struct is not returnedonly.
If a struct is extensible, attach member functions for each extension are available.
If the attachment must be the first one, it's named attachHead instead.
vk::PipelineShaderStageCreateInfo shaderStageInfo;
vk::ShaderModuleCreateInfo moduleInfo;
vk::DebugUtilsObjectNameInfoEXT objectNameInfo;
shaderStageInfo.attachHead(moduleInfo);
shaderStageInfo.attach(objectNameInfo);void function(..., T* out)->T function(...)VkResult function(..., T* out)->vk::Ret<T> function(...)
std::system_error with vk::errorCategory() is used for exceptions.
check(vk::Result)throws ifResultis noteSuccess.vk::Ret<T>::get()throws ifRet<T>::resultis noteSuccess.