We can let Qt handle loading the Vulkan library and resolving functions for us. It works similar to the QOpenGLFunctions set of classes. Qt provides two functions classes for Vulkan:
- The QVulkanFunctions class provides access to the Vulkan functions that are not device-specific
- The QVulkanDeviceFunctions class provides functions that work on a specific VkDevice
You can obtain these objects by calling the functions() and deviceFunctions(VkDevice device) methods of the QVulkanInstance class, respectively. You will usually use the device functions a lot in the renderer, so a common pattern is to add the QVulkanDeviceFunctions *m_devFuncs private field to your renderer class and initialize it in the initResources() ...