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 querying "global commands" like
vkCreateInstance with a non-NULL instance is undefined behavior. Indeed, some
implementations will return null pointers in such cases.

Instead, we can drop the query from DoSetupWithInstance altogether, since
the library initializer will load the function pointer using dlsym instead.

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

// Query pointers for functions customized below
(void*&)LDR_PTR(vkCreateInstance) = (void*)LDR_PTR(vkGetInstanceProcAddr)(instance, "vkCreateInstance");
(void*&)LDR_PTR(vkCreateDevice) = (void*)LDR_PTR(vkGetInstanceProcAddr)(instance, "vkCreateDevice");

// Only do this lookup once.
Expand Down

0 comments on commit 4d8ffa2

Please sign in to comment.