Skip to content

Commit

Permalink
winevulkan: Allow vkGetDeviceProcAddr to load instance functions for …
Browse files Browse the repository at this point in the history
…broken games.

Doom and Wolfenstein II use vkGetDeviceProcAddr to load all their function pointers,
while they are supposed to use vkGetInstanceProcAddr for the instance ones.
This is in violation of the Vulkan spec, but so far the loader allows this, but
Khronos is thinking about fixing the spec and potentially the loader.
KhronosGroup/Vulkan-LoaderAndValidationLayers#2323
  • Loading branch information
Roderick Colenbrander committed Jan 31, 2018
1 parent 21bc8f9 commit 9d86aa7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions dlls/winevulkan/vulkan.c
Original file line number Diff line number Diff line change
Expand Up @@ -829,6 +829,21 @@ PFN_vkVoidFunction WINAPI wine_vkGetDeviceProcAddr(VkDevice device, const char *
if (func)
return func;

/* vkGetDeviceProcAddr was intended for loading device and subdevice functions. Doom and Wolfenstein
* however use it also for loading of instance functions. This is undefined behavior as the specification
* clearly disallows using any of the returned function pointers outside of device / subdevice objects.
* Khronos recognizes the issue and is addressing the spec. The mentioned games may get updated. If they
* do we could remove the hack below.
* https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers/issues/2323
* https://github.com/KhronosGroup/Vulkan-Docs/issues/655
*/
func = wine_vk_get_instance_proc_addr(pName);
if (func)
{
WARN("Application relies on undefined behavior by requesting instance function '%s'!\n", pName);
return func;
}

TRACE("Function %s not found\n", pName);
return NULL;
}
Expand Down

0 comments on commit 9d86aa7

Please sign in to comment.