[PATCH v2] winevulkan: Implement vkEnumerateDeviceLayerProperties

Victor Hermann Chiletto v at hnn.net.br
Sun Mar 21 23:17:33 CDT 2021


Currently, this function is passed through winevulkan to the system's
Vulkan loader, which causes the loader to write the system's device
layers properties in pProperties.

Unreal Engine 4 then calls vkEnumerateDeviceExtensionProperties, using
VkLayerProperties::layerName as the pLayerName.

winevulkan's implementation of vkEnumerateDeviceExtensionProperties then
returns VK_ERROR_LAYER_NOT_PRESENT, crashing UE4.

This issue was found while debugging Project Wingman (Steam appid
895870), but it should also happen to any UE4 application using the
Vulkan RHI.

Signed-off-by: Victor Hermann Chiletto <v at hnn.net.br>
---
v2: Improve the patch's description

 dlls/winevulkan/make_vulkan | 1 +
 dlls/winevulkan/vulkan.c    | 8 ++++++++
 2 files changed, 9 insertions(+)

diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan
index 3ad210e4701..a0e59a0370e 100755
--- a/dlls/winevulkan/make_vulkan
+++ b/dlls/winevulkan/make_vulkan
@@ -153,6 +153,7 @@ FUNCTION_OVERRIDES = {
     "vkCreateDevice" : {"dispatch" : True, "driver" : False, "thunk" : False},
     "vkDestroyInstance" : {"dispatch" : False, "driver" : True, "thunk" : False },
     "vkEnumerateDeviceExtensionProperties" : {"dispatch" : True, "driver" : False, "thunk" : False},
+    "vkEnumerateDeviceLayerProperties": {"dispatch": True, "driver": False, "thunk": False},
     "vkEnumeratePhysicalDeviceGroups" : {"dispatch" : True, "driver" : False, "thunk" : False},
     "vkEnumeratePhysicalDevices" : {"dispatch" : True, "driver" : False, "thunk" : False},
     "vkGetPhysicalDeviceExternalBufferProperties" : {"dispatch" : False, "driver" : False, "thunk" : False},
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c
index 971394eb9dd..23087c9df2e 100644
--- a/dlls/winevulkan/vulkan.c
+++ b/dlls/winevulkan/vulkan.c
@@ -1061,6 +1061,14 @@ VkResult WINAPI wine_vkEnumerateInstanceExtensionProperties(const char *layer_na
     return *count < num_properties ? VK_INCOMPLETE : VK_SUCCESS;
 }
 
+VkResult WINAPI wine_vkEnumerateDeviceLayerProperties(VkPhysicalDevice phys_dev, uint32_t *count, VkLayerProperties *properties)
+{
+    TRACE("%p, %p, %p\n", phys_dev, count, properties);
+
+    *count = 0;
+    return VK_SUCCESS;
+}
+
 VkResult WINAPI wine_vkEnumerateInstanceLayerProperties(uint32_t *count, VkLayerProperties *properties)
 {
     TRACE("%p, %p\n", count, properties);
-- 
2.31.0




More information about the wine-devel mailing list