Vulkan is a C++ API and as such inherits all common pitfalls of using a general C programming library. The motivation of a low-level Vulkan C++ API is to avoid these common pitfalls by applying commonly known C++ features while keeping the overall structure of a VulkanRT program and preserving the full freedom it provides as low-level graphics API. An additional guideline we followed was not to introduce additional runtime overhead by providing a header-only library with inline functions.
There may be some issues than can happen when filling the structure which cannot be caught at compile time:
- initialization of ‘ci.sType’ using wrong emu values
- uninitialized data fields.
- use of invalid bits for ‘ci.flags’
- use of incorrect emu for fields
These initializations will most likely show up as random runtime errors, which usually are nasty and time-consuming to debug. Our auto-generated, C++ 11-conform layer uses commonly known C++ features like implicit initialization through constructors to avoid incorrect or missing initializations and introduces type-safety with scoped emu to turn explicit initialization errors into compile errors.
Following is a list of features and conventions introduced by our Vulkan C++ layer:
Works along the official C version of the API
Defines all symbols within the ‘vk’ namespace and to avoid redundancy the ‘vk/Vk/VK_ prefixes’ have been removed from all symbols.
Camel case syntax with an ‘e’ prefix has been introduced for all emu, i.e. vk::ImageType::e2D.
Removes the ‘BIT’ suffix from all flag related emu.
Introduces constructors for all structs, which by default set the appropriate sType and all other values to zero.
Encapsulates member variables of the structs with getter and setter functions.
Who’s Behind Vulkan?
Vulkan-transparent-web Vulkan was created by the Khronos Group(https://www.khronos.org/), a standards organization that brings together a wide range of hardware and software companies, including NVIDIA, for the creation of open standard, royalty-free APIs for authoring and accelerated playback of dynamic media on a wide variety of platforms and devices. We’re proud to have played a leadership role in creating Vulkan. And we’re committed to helping developers use Vulkan to get the best from our GPUs.