[PATCH 1/4] winex11.drv: Only return vulkan functions if the host function is available.
Georg Lehmann
dadschoorse at gmail.com
Mon Jul 5 06:32:59 CDT 2021
On 03.07.21 20:45, Liam Middlebrook wrote:
> 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.
>
Yes, for platform specific extensions we have to manually replace the
name of the win32 function. For Derek's (CC'ed) patches this should be
relatively simple as far as I can tell, vkGetMemoryWin32HandleKHR maps
to vkGetMemoryFdKHR and vkGetMemoryWin32HandlePropertiesKHR to
vkGetMemoryFdPropertiesKHR.
It's the same story for the external semaphore/fence extensions, if we
ever get around to support those.
I share your general skepticism but given that there aren't many
platform specific extensions and I see none which could cause issues, I
think this is good enough. If we have to in the future, we can still go
for something similar to your proposed solution. But I don't really want
to make make_vulkan more complex without a good reason.
Thanks,
Georg Lehmann
>
> 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