Using PVRVk#
PVRVk follows the Vulkan spec, and all operations that would need to be performed in Vulkan are performed with PVRVk. The calls themselves are considerably shortened due to the constructors and default values, while reference counting again dramatically reduces the overhead code required.
For simplifying the operations and tasks themselves see PVRUtils.
Note that with PVRVk, the optimised, per-device function pointers are always called as devices and hold their function pointer tables internally. Function pointers do not need to be retrieved with VkGetDeviceProcaddress or similar, as this happens automatically during construction of the device.
There are obvious usage changes, due to the Object Oriented paradigm followed:
Vulkan functions whose first parameter is a Vulkan object become member functions of the class of that object. For example,
VkCreateBufferbecomes a member function ofpvrvk::Device, so usemyDevice->createBuffer().Functions without a dispatchable object as an input parameter object remain global functions in the
pvrvk::namespace. For example,pvrvk::CreateInstance(…).Simple structs like
Offset2Dare shadowed in thepvrvk::namespace.VkXXXCreateInfoobjects get shadowed bypvrvk::equivalents with default parameters and potentially setters. Obvious simplifications/automations are done, for instanceVK_STRUCTURE_TYPEis never required as it is populated automatically.Vulkan objects are wrapped in C++ reference-counted classes providing them with a proper C++ interface. Usage remains the same and the
Vk…prefix is dropped. For example,VkBufferbecomespvrvk::Buffer.All enums are shadowed by C++ scoped enums (enum class TypeName)
The
VK_ENUM_*TYPE_NAME*_prefix of enum members is dropped and replaced by e_. In many cases, for example after droppingVK_ FORMAT_2D, this would becomepvrvk::Format::2Dwhich is illegal as it starts with a number.Flags/Bitfields are used like every other enum as bitwise operators are defined for them.
VkCreateBufferFlagsandVkCreateBufferFlagBitsbecomepvrvk::CreateBufferFlagsand are directly passed to corresponding functions.