wgpu: Executable cross-compiled from Linux to Windows will not run on Wine

Description Executable cross-compiled from Linux to Windows will not run on Wine. Memory types offered by Wine are not compatible with what WGPU wants.

fixme:vkd3d_allocate_device_memory: Failed to find suitable memory type (allowed types 0x82).

Here’s the Vulkan spec for those bits.

I realize this is likely to result in finger-pointing between the WGPU side (“Wine doesn’t support the memory type we want”) and the Wine side (“WGPU should be more flexible in the types of memory it accepts.”) The NVidia position is stated here: Discussion by NVidia: “A memory allocator that follows the rules and guidance of the Vulkan specification should be able to handle all these memory types gracefully by properly interpreting the VkMemoryRequirements::memoryTypeBits member when selecting an allocation for a specific resource.”

Repro steps

  1. Install current Rust on Ubuntu Linux (20.04 LTS used).
  2. Install current Wine (6.0.1) or use Wine 5 that ships with 20.04 LTS.
  3. Install Rust target for x86_64-pc-windows-gnu
  4. Build WGPU examples for that target, debug mode.
  5. wine cube.exe

Expected vs observed behavior Expected cube to appear in a window. Got errors. See attachment.

Extra materials Screenshots to help explain your problem. Validation logs can be attached in case there are warnings and errors. Zip-compressed API traces and GPU captures can also land here.

Platform Information about your OS, version of wgpu, your tech stack, etc. Ubuntu 20.04 LTS. Tried two different machines, one with Wine 6.0.1 (current stable) and one with the Wine 5 that ships with Ubuntu.

wgpubug01.txt

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 32 (8 by maintainers)

Most upvoted comments

WGPU people, here’s the Wine bug report: https://bugs.winehq.org/show_bug.cgi?id=51662 There’s no code here by me. You guys work it out.

Cool, so that sounds like everything here is resolved. I don’t think there’s really any bugs left (besides “stable distributions are shipping too-old versions”, which doesn’t really sound like much of a bug).

Not sure why the executable John compiled for me didn’t include a call to D3DCompile(), though.

Actually, now that I think about it, I probably had native d3dcompiler in the prefix by accident.

Wine-7.0 will probably (usually does) be released around newyears. Wine is and will always be a work in progress (as most things are), although a lot of things DO work. DX11 is still being worked on, and is faaaaaaaaar from running anything useful (like games) when it comes to Wine.

So in short NO, at this time - and in my personal opinion - you cannot expect to run anything resembling a modern game on bare-bones wine. That is why proton (and dxvk, vkd3d-proton) has been developed in the first place. It does a fair job at that, but not near perfection. (You might need to swap proton versions around depending on what game you are playing too).

For what it’s worth, I don’t think the situation is nearly that bad. Plenty of d3d11 games run already, especially now that deferred contexts are implemented upstream. I won’t pretend that wined3d doesn’t have some pretty huge glaring problems when it comes to performance, but the nice thing is that I think we really are close to supporting that well upstream (in fact I’m working on it right now as we speak).

@kvark

Perhaps, your Intel GPU doesn’t have Vulkan drivers installed, or these drivers don’t support one of the requirements - https://github.com/gfx-rs/wgpu/wiki/Vulkan-Requirements . We could dig up more, but this isn’t really important of this issue in particular. FWIW, WGPU_BACKEND=vulkan environment can force this switch.

I did a bit of testing both with wine-6.0.1 and wine-staging-6.15, but it seems that if i run wine-staging-6.15 the wgpu-cube.exe falls back to (Vulkan) rendering, instead of (DX12) like it tried on wine-6.0.1.

As I mentioned, we don’t “fall back” to Vulkan, it’s the other way around. Perhaps, you could try setting the WGPU_BACKEND=dx12 environment?

Thanks! Yeah, that helped with testing. 👍

Setting WGPU_BACKEND=dx12 worked for my win10 box, so my HP with IGPU might not have a working vulkan setup then, since it was not default selected like it was on my GTX970 adapter.

Using wine-staging-6.14 + vkd3d @ a08d99e0265deeaad80c43f62738399b9203157a did not work for me, neither did vkd3d-proton either when using WGPU_BACKEND=dx12.

For some odd reason, wine-6.0.1 does not seem to work with vulkan when using WGPU_BACKEND=vulkan for me, so i need to investigate that a bit… Running Shadertoy/seascape from the GeexLAB package works using wine-6.0.1 tho, so not sure why this wgpu thing would fail.

@zfigura Is it worth investigating this with vkd3d? Running WGPU_BACKEND=dx12 wine ./wgpu-cube.exe does seem to force using vkd3d and create some useful logs.