[PATCH 1/4] winex11.drv: Only return vulkan functions if the host function is available.

Liam Middlebrook lmiddlebrook at nvidia.com
Sat Jul 3 13:45:16 CDT 2021


I like how simple this solution is.

At first I was a bit worried that this would make the outstanding 
patchset from Derek Lesho more complex, but I think the same strategy 
you're applying here for a map of Win32 function to Unix platform 
function could be applied. That said, it's still not the cleanest feeling.


When I filed https://bugs.winehq.org/show_bug.cgi?id=51360 I was 
thinking a solution for this would look like the follow steps (roughly):

1. Add logic in make_vulkan to correspond what extensions must be 
supported by the host implementation for a command to be enabled.

2. At Get*ProcAddr time check that function name against the list of 
extensions, and ensure that said extensions are supported by the 
VkInstance/VkDevice.


You're solution is a lot simpler, and I like it. But I can't help but 
worry that with Derek's pending work (or any potential future work in 
the same vein) this will cause issues.


I'm not conceptually opposed to this, but I want to make sure the 
implications of this simpler solution are discussed before I give my 
sign-off on it.


Thanks,

Liam Middlebrook

On 7/3/21 9:42 AM, Georg Lehmann wrote:
> Signed-off-by: Georg Lehmann <dadschoorse at gmail.com>
> ---
>   dlls/winex11.drv/vulkan.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/dlls/winex11.drv/vulkan.c b/dlls/winex11.drv/vulkan.c
> index bdc287afeea..1bbdba2ce1d 100644
> --- a/dlls/winex11.drv/vulkan.c
> +++ b/dlls/winex11.drv/vulkan.c
> @@ -435,12 +435,25 @@ static VkResult X11DRV_vkGetDeviceGroupSurfacePresentModesKHR(VkDevice device,
>       return pvkGetDeviceGroupSurfacePresentModesKHR(device, x11_surface->surface, flags);
>   }
>   
> +static const char *wine_vk_native_fn_name(const char *name)
> +{
> +    if (!strcmp(name, "vkCreateWin32SurfaceKHR"))
> +        return "vkCreateXlibSurfaceKHR";
> +    if (!strcmp(name, "vkGetPhysicalDeviceWin32PresentationSupportKHR"))
> +        return "vkGetPhysicalDeviceXlibPresentationSupportKHR";
> +
> +    return name;
> +}
> +
>   static void *X11DRV_vkGetDeviceProcAddr(VkDevice device, const char *name)
>   {
>       void *proc_addr;
>   
>       TRACE("%p, %s\n", device, debugstr_a(name));
>   
> +    if (!pvkGetDeviceProcAddr(device, wine_vk_native_fn_name(name)))
> +        return NULL;
> +
>       if ((proc_addr = X11DRV_get_vk_device_proc_addr(name)))
>           return proc_addr;
>   
> @@ -453,6 +466,9 @@ static void *X11DRV_vkGetInstanceProcAddr(VkInstance instance, const char *name)
>   
>       TRACE("%p, %s\n", instance, debugstr_a(name));
>   
> +    if (!pvkGetInstanceProcAddr(instance, wine_vk_native_fn_name(name)))
> +        return NULL;
> +
>       if ((proc_addr = X11DRV_get_vk_instance_proc_addr(instance, name)))
>           return proc_addr;
>   
> 



More information about the wine-devel mailing list