Vulkan: difference between vkGetInstanceProcAddress and vkGetDeviceProcAddress

vkGetInstanceProcAddr and vkGetDeviceProcAddr completely missing from the API documentation. However, they must execute commands with swatchchains (and thus make any meaningful Vulkan application). In addition, the cubic / three demos that come with the SDK use them very inconsistently.

Are these two methods interchangeable, and if not, what's the difference?

+7
c ++ vulkan
source share
2 answers

vkGetInstanceProcAddress - get a pointer to a function that will always work with any device created from the instance passed to.

However, the returned functions may include sending logic (usually to account for extensions that may or may not be activated for the device) that may slow down the call. This is why vkGetDeviceProcAddress exists to get a function that does not have send logic. You are not required to use them, but this can help get extra speed.

This is especially noticeable when you have activated several layers:

enter image description here

With a pointer to a specific function of the device, the final dispatch can be deleted:

enter image description here
images from khonos loader and layer interface document

If you use only one device, the procedure for the application will be as follows:

  • get vkGetInstanceProcAddress from the platform / bootloader.

  • download vkCreateInstance from it and extension and level requests. (using null as an instance parameter)

  • create an instance. (you will use this as the first parameter to load other functions)

  • Download vkEnumeratePhysicalDevices and associate with request devices.

  • create a device with vkCreateDevice with the required extensions.

  • load all other functions that you need with vkGetDeviceProcAddress and passing the device as the first parameter.

+11
source share

Above is the correct answer. I will add that for WSI extensions, Windows, Linux, and Android bootloaders have stated that they will export WSI extension entry points. Therefore, on these platforms, vkGetInstanceProcAddr and vkGetDeviceProcAddr should NOT be used to obtain WSI entry points. But in general, entry points for expansion must be obtained through vkGet * ProcAddr in Vulcan.

+1
source share

All Articles