Skip to content

Commit

Permalink
Library Forwarding/vulkan: Fix query of vkCreateInstance function poi…
Browse files Browse the repository at this point in the history
…nter

The Vulkan specification states that "global commands" like vkCreateInstance
may only be queried with a NULL instance. Some implementations return null
pointers otherwise.

Fixes #3519.
  • Loading branch information
neobrain committed Mar 26, 2024
1 parent 1450c92 commit eb4b433
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion ThunkLibs/libvulkan/Host.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ static void DoSetupWithInstance(VkInstance instance) {
}

// Query pointers for functions customized below
(void*&)LDR_PTR(vkCreateInstance) = (void*)LDR_PTR(vkGetInstanceProcAddr)(instance, "vkCreateInstance");
// NOTE: The Vulkan specification requires vkCreateInstance to be queried with a nullptr parameter.
(void*&)LDR_PTR(vkCreateInstance) = (void*)LDR_PTR(vkGetInstanceProcAddr)(nullptr, "vkCreateInstance");
(void*&)LDR_PTR(vkCreateDevice) = (void*)LDR_PTR(vkGetInstanceProcAddr)(instance, "vkCreateDevice");

// Only do this lookup once.
Expand Down

0 comments on commit eb4b433

Please sign in to comment.