3.1. Command Function Pointers

Vulkan commands are not necessarily exposed statically on a platform. Function pointers for all Vulkan commands can be obtained with the command:


PFN_vkVoidFunction vkGetInstanceProcAddr(
    VkInstance                                  instance,
    const char*                                 pName);

vkGetInstanceProcAddr itself is obtained in a platform- and loader- specific manner. Typically, the loader library will export this command as a function symbol, so applications can link against the loader library, or load it dynamically and look up the symbol using platform-specific APIs. Loaders are encouraged to export function symbols for all other core Vulkan commands as well; if this is done, then applications that use only the core Vulkan commands have no need to use vkGetInstanceProcAddr.

Function pointers to commands that don’t operate on a specific instance can be obtained by using this command with instance equal to NULL. The following commands can be accessed this way:

If instance is a valid VkInstance, function pointers to any commands that operate on instance or a child of instance can be obtained. The returned function pointer must only be called with a dispatchable object (the first parameter) that is a child of instance.

If pName is not the name of a core Vulkan command, or is an extension command for any extension not supported by any available layer or implementation, then vkGetInstanceProcAddr will return NULL.


(Jon, Bug 14886 / Gitlab issue 4) The WSI group tentatively agreed that the WSI extensions were special, and should get static entry points in link libraries and prototypes in vulkan.h, while future extensions would have to be dynamically loaded. If this decision is upheld by the group as a whole, it would probably be encoded in the previous paragraph, in the WSI extensions branch of the Specification.

However, this decision hasn’t been fully signed off on by the entire Vulkan WG yet AFAIK. Note that implementations typically won’t support many of the WSI extensions, so “static entry points” doesn’t relieve apps of the neccessity of runtime enabling and testing of each extension before using it.

In order to support systems with multiple Vulkan implementations comprising heterogeneous collections of hardware and software, the function pointers returned by vkGetInstanceProcAddr may point to dispatch code, which calls a different real implementation for different VkDevice objects (and objects created from them). The overhead of this internal dispatch can be avoided by obtaining device-specific function pointers for any commands that use a device or device-child object as their dispatchable object. Such function pointers can be obtained with the command:


PFN_vkVoidFunction vkGetDeviceProcAddr(
    VkDevice                                    device,
    const char*                                 pName);

If pName is not the name of one of these Vulkan commands, and is not the name of an extension command belonging to an extension enabled for device, then vkGetDeviceProcAddr will return NULL.