Let's know vkGetInstanceProcAddr and vkGetDeviceProcAddr

 Hello friends. Please keep in mind. English is NOT my first language. Please correct me when you reads wrong sentences. I really want to enhance my English.


 We can retrieve Vulkan functions using the system function likes GetProcAddress on Windows and dlsym on Linux. Thus vkGetInstanceProcAddr and vkGetDeviceProcAddr look like useless. But I think that there is some benefits from using these functions.


 This figure illustrates Vulkan loader architecture. Vulkan loader can know how many Vulkan ICDs are on the system. For instance, your system has an integration GPU and a discrete GPU. In this case, Vulkan loader will find two Vulkan ICDs. If you chooses a discrete GPU and creates Vulkan resources then Vulkan loader will find proper Vulkan ICD which is related with  a discrete GPU somehow and call functions. However if we use vkGetInstanceProcAddr and vkGetDeviceProcAddr, we can skip finding proper Vulkan ICD in Vulkan loader because we can retrieve Vulkan functions from Vulkan ICD directly. It means we can optimize CPU slightly.

 Let's see the first figure below. Functions are retrieved using the system function.


 You can see functions are mapped to Vulkan loader.

 Let's see the second figure below. Functions are retrieved using vkGetInstanceProcAddr and vkGetDeviceProcAddr.


 You can see functions are mapped to Vulkan ICD.

댓글