Home > front end >  Where to find vulkan loader and understanding vulkan linking process (using the vulkan SDK on Window
Where to find vulkan loader and understanding vulkan linking process (using the vulkan SDK on Window

Time:04-22

In order to start learning vulkan I want to make sure I understand how programs call out and actually use vulkan. So I know to start developers would download the vulkan header files or the vulkan SDK package which includes the official Khronos vulkan header files. I downloaded the SDK and in there I found the vulkan headers and I also linked my program to the provided vulkan-1.lib. My first question is is the the vulkan-1.lib the actual loader library for vulkan? Or is it an import library of sorts that searches my Windows system for the actual vulkan loader, vulkan-1.dll? And then is it the vulkan-1.dll which actually goes and finds any vulkan drivers on my system? If so, where are standard installs of vulkan drivers that I could view?

CodePudding user response:

vulkan-1.lib is just a linking library for the vulkan-1.dll loader.

The spec for how the loader interfaces with with the Installable Client Drivers can be found here archive. On Windows it will search the registry key HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Class\{Adapter GUID}\000X\VulkanDriverName for a path to JSON file which contains the path to the driver. On my system the driver is in C:\Windows\System32\DriverStore\FileRepository\nv_dispi.inf_amd64_{some base64 hash}/nvoglv64.dll, which stands for the NVida OpenGL and Vulkan 64 Bit ICD. It contains both OpenGL and Vulkan because they have a lot of similiarites, the biggest being that they both communicate with the Kernel Mode Display Miniport Driver through gdi32.dll.

There's not really much to actually see inside the driver, as the main thing it exports is the vk_icdGetInstanceProcAddr function which is used by the loader to query all of the drivers functions. The loader will build up dispatch tables which will handle calling all of the layers and drivers (until you've selected a physical device it has to query each of the drivers). Internally in the driver it basically implements every function in Vulkan, and exposes them through the vk_icdGetInstanceProcAddr function. If you want to learn more about what it's doing you'd be much better off reading the Vulkan Spec archive.

  • Related