[PATCH v5 3/3] winevulkan: Implement VK_EXT_debug_utils.

Georg Lehmann dadschoorse at gmail.com
Thu Nov 19 09:39:31 CST 2020



On 18.11.20 23:42, Paul Gofman wrote:
> I was testing Serious Sam 4 crash on start on Nvidia and found that it 
> also happens due to debug function implementation in winevulkan. More 
> precisely, in case of Serious Sam, the crash happens in host 
> vkSetDebugUtilsObjectNameEXT() when called with objectType 
> VK_OBJECT_TYPE_SURFACE_KHR. wine_vk_unwrap_handle() returns an unwrapped 
> handler for this object type, while the native handle is actually 
> wrapped in struct wine_vk_surfaceby wine driver (winex11.drv). I tested 
> that correctly unwrapping it fixes the crash.

I wasn't aware that the wine drivers wrap VkSurfaceKHR, but now that I
think about it makes sense.

>  > I am a bit unsure how to properly fix it. The straightforward way is to
> pull all the debug functions to wine[x11|mac].drv, but that means 
> pulling rather lot. Besides, debugging functions have to be queried from 
> device which winex11 currently doesn't do so we would probably need to 
> also pull vkCreateDevice() to initialize native function pointers.

This would duplicate a lot of code and make changes harder. I would like
to avoid this solution.

> The other much shorter way would be to export the unwrapping function 
> from the wine driver which will be unwrapping handles wrapped in there. 
> It would probably be unfortunate to introduce a special export for that, 
> maybe we could put it in the generated 'struct vulkan_funcs' somehow?

That would fix the unwrapping issue, but it's not really a full 
solution: We also need to handle VkSurfaceKHR in the debug callbacks
wrappers.

> > Any suggestions?
> 

Another solution is defining a struct similar to this:

struct wine_vk_driver_surface_base
{
     VkSurfaceKHR surface; /* native surface */
     struct wine_vk_mapping mapping;
};

The wine drivers would use that as the first member in their wrapper, 
set the native surface and winevulkan can handle VkSurfaceKHR like every
other wrapped handle.
I have already done a bit of work [0] on that and it should fix your
issue.

Thanks,

Georg Lehmann

[0] - https://github.com/DadSchoorse/wine/tree/wrapped-surface



More information about the wine-devel mailing list