Proton icon indicating copy to clipboard operation
Proton copied to clipboard

Path of Exile (238960)

Open DataBeaver opened this issue 7 years ago • 376 comments

It gives a dialog saying "Failed to create WIC factory" followed by a bunch of reference count errors. The behaviour matches this bug in the Wine bug tracker.

DataBeaver avatar Aug 22 '18 07:08 DataBeaver

The game comes further with DX9 but then has a lot of other issues, and bad performance. From the winehq.org bug it looks like there's only very small changes needed to get the DX11 version running fine!

ernstp avatar Aug 22 '18 09:08 ernstp

It runs with DX9 but performance is indeed bad and it crashes frequently. In one hour-long session I had it crash four or five times. I've tried getting the DX11 version work on Wine and DXVK but after applying that CoInitialize patch it freezes at a black screen on startup. I was hoping Proton might do something differently and make it work.

DataBeaver avatar Aug 22 '18 09:08 DataBeaver

According to this it only needs one line change in wine nowadays, not sure how much it affects other games

dumpsters avatar Aug 22 '18 09:08 dumpsters

Note that PoE isn't whitelisted so I doubt if we get any official support just yet.

I was recently ironing out a process to get PoE running for more people and posted those steps here

The gist is that PoE runs great with DX11 (DXVK) with a shader patch. Right now Proton is just running it in DX9 mode that doesn't work for very many people. We need to dig into this new configuration they've provided and figure out how to get DXVK enabled and how to inject custom patches.

0xjon0 avatar Aug 22 '18 10:08 0xjon0

I realize it isn't whitelisted but was hoping to raise interest in the game by opening the issue. Maybe if we can figure out the problem here it will result in the game being whitelisted sooner.

PoE does not run great with DX11 for me. In fact it does not run at all. The furthest I've got is avoiding all the outright crashes on startup, but the game only hangs at a black screen (it actually only renders a single black frame), eating 100% of CPU time. I don't know if it's trying to load something in the background but even after an hour of waiting it hasn't gotten anywhere. Using Lutris, PlayOnLinux or plain Wine does not make a difference. The DXVK async patch does not make a difference. Trying to use Wine's builtin D3D 11 implementation errors out with "Failed to create deferred context".

I've tried using WINEDEBUG, DXVK_LOG_LEVEL, even gdb, but so far I'm completely clueless about what's wrong. If you have any ideas for what I should check I'd love to hear it.

DataBeaver avatar Aug 22 '18 11:08 DataBeaver

@DataBeaver What is your OS, graphics card model and graphics card driver version?

0xjon0 avatar Aug 22 '18 11:08 0xjon0

Debian unstable, GTX 980, 396.51. The Lutris DXVK howto mentions that 396.45 is missing a Vulkan extension; I figured if that was the case with this version as well, DXVK would simply fail to initialize. I've tried a few different builds of Wine 3.13 and 3.14, both staging and not. Staging does not seem to make a difference as long as the CoInitialize patch is present.

DataBeaver avatar Aug 22 '18 11:08 DataBeaver

@DataBeaver That is a Maxwell chip that supports Vulkan & DX11 so there's likely a software/configuration problem somewhere. Are you using a version of the driver that comes with the NVIDIA control panel? If so, does it indicate any problems?

0xjon0 avatar Aug 22 '18 16:08 0xjon0

You mean nvidia-settings? I have it installed and can't find any problem indicators. I can also successfully run vkmark (https://github.com/vkmark/vkmark) so Vulkan appears to be working.

DataBeaver avatar Aug 22 '18 17:08 DataBeaver

My experience with PoE DX11 (AMD Radeon RX470) and wine is very good with following prerequisites applied:

  • Must have: WIC patch (CoInitialize)

  • Variant 1: DXVK 0.70 - strong shader compilation stuttering at first until cache ready, but then very stable and good performance (with occasional shader compilation when entering new areas)

  • Variant 2: Patched DXVK 0.65 with shader hack (https://github.com/jomihaka/dxvk-poe-hack) to avoid stuttering - some glitches and flickering during compilation but no stuttering and good performance DXVK_USE_PIPECOMPILER=1 DXVK_USE_PLACEHOLDER_SHADERS=1 DXVK_HUD=1 WINEPREFIX=/mnt/storage/wine/poe wine64-staging-3.13 PathOfExile.exe --nologo

~~I could be interesting to port the hack to the new DXVK 0.70 config system and maybe allow to activate it for very stuttering games when no cache is ready.~~ EDIT: Or a much better and simpler implementation as suggested here https://github.com/doitsujin/dxvk/pull/564#issuecomment-413160155

edmondo avatar Aug 22 '18 19:08 edmondo

I downloaded the Unigine Heaven benchmark (https://benchmark.unigine.com/heaven) and it works with both DXVK and Wine's builtin D3D 11 support. So whatever the issue with Path of Exile is, it seems to be specific enough to affect only some programs but not others.

DataBeaver avatar Aug 22 '18 19:08 DataBeaver

By applying the patchset d3d11-Deferred_Context from wine-staging Wine's builtin D3D 11 implementation now behaves the same way as DXVK. In other words, it hangs on a black screen at startup.

DataBeaver avatar Aug 22 '18 20:08 DataBeaver

After yet more staring at logs and scouring the web I found out that the windowscodecs-* patches from wine-staging are also necessary. The game now launches up to the login screen at least, with both DXVK and Wine's D3D 11. I'll report when I've had time to actually play it and test stability and performance.

Why the Lutris approach didn't work for me when it does for many others is still a mystery.

DataBeaver avatar Aug 22 '18 21:08 DataBeaver

I don't even get the dialog to pop, and DX11 should be possible to use based on my LLVM install.

I ran PoE under regular old Wine a couple years back, but it involved a lot of tweaking. Excited to figure out how to get it working again inside Proton.

jaccarmac avatar Aug 23 '18 07:08 jaccarmac

Let's not turn this into a support forum for PoE on all different versions of Wine. This is about Proton...

ernstp avatar Aug 23 '18 07:08 ernstp

I didn't have a lot of time to test stability yet but I ran a few maps and didn't see any problems.

I did some more investigation to find the minimal set of changes required to get the game working. It boils down to this (with Wine 3.14 as a starting point):

  1. The CoInitialize patch. I created my own version which handles the call in a smarter way: https://gist.github.com/DataBeaver/5e1f1a256c7f1abb339831fc2b72a5db

  2. windowscodecs-32bppPRGBA from wine-staging. It pulls in most of the other windowscodecs-* patches as dependencies, but I verified the game does not work without this particular patchset.

  3. DXVK. Wine's own D3D 11 lacks support for deferred contexts, but using DXVK bypasses this issue. The placeholder shader hack is optional.

Looking at the Wine source tree included in Proton as a submodule, it does not include either the CoInitialize or windowscodecs patches. The base Wine version is fairly old (3.0-rc1 according to git tags) so I don't know if something else would be required on that version as well. DXVK is included and although it's version 0.65 I have no reason to believe it wouldn't work.

DataBeaver avatar Aug 23 '18 09:08 DataBeaver

I downloaded the proton source and applied the patches that @DataBeaver is talking about. After the CoInitialize and windowscodec patches the game works flawlessly with DX11. However the 0002 winecodec patch failed but after applying it manually it wasn't a problem.

c0r73x avatar Aug 24 '18 08:08 c0r73x

@c0r73x any chance you could share your Proton dist build? I'm trying to build it with the PoE patches myself, but I'm hitting build errors with winegcc...

GregSutcliffe avatar Aug 25 '18 11:08 GregSutcliffe

@GregSutcliffe sure, here it is https://mega.nz/#!3253ECqJ!WViplmIgM6FNDSJwnsWFJwEXUUY3_Qzm1c1LVYGfSJ8

c0r73x avatar Aug 25 '18 12:08 c0r73x

@c0r73x thanks, I can confirm that works for me too. Appreciated!

GregSutcliffe avatar Aug 25 '18 16:08 GregSutcliffe

@c0r73x Thanks for sharing! Makes testing easy.

Unfortunately that build is only partially successful for me.

PoE will load and run with DX11 (DXVK) now, but the coinitialize patch isn't working as well as the old replacement shaders patch. I get lots of stuttering and freezing with this in Steam, whereas the shader patch has PoE running near flawlessly in Lutris+DXVK for me.

EDIT: Tried again with different driver version but still no luck with the shader stuttering. I'm also getting some odd graphics behavior with the in-game item filter and atlas now.

EDIT: The other version (shader patch + DXVK + Lutris) is otherwise still working great for me. I can't figure out why the Proton configuration has such worse performance.

0xjon0 avatar Aug 26 '18 11:08 0xjon0

@tainium did you try to disable steam overlay?

c0r73x avatar Aug 26 '18 17:08 c0r73x

@c0r73x Yes.

0xjon0 avatar Aug 26 '18 17:08 0xjon0

@tainium Ok, I applied the shader patch to dxvk in proton and you are right. The game runs much better with it. The microstutter form playing necro with alot of pets is gone :p

Here is the patched dxvk files if anyone wants it https://mega.nz/#!nnBylIpB!0KNQwsTf48V861IoFGPBtbZ_sZtX4LRDSA3FdEampnM

c0r73x avatar Aug 26 '18 21:08 c0r73x

@c0r73x Thanks for the new patch, will test it ASAP. Yeah, its like the coinitialize patch definitely enables DXVK and better performance than without it, but the full shader patch takes performance a step up.

0xjon0 avatar Aug 26 '18 22:08 0xjon0

@c0r73x Confirmed, that's a huge improvement - thanks! Since you have builds working, any chance you could comment on #494? Then I can stop bugging you for builds :)

GregSutcliffe avatar Aug 26 '18 23:08 GregSutcliffe

As confirmed by @DataBeaver the game needs the windowscodecs patch series from staging to work, probably because textures are stored with some uncommon image formats in the data files. I'm not sure if CoInitialize is really needed: I see the same crash with or without it if windowscodecs is missing.

With DXVK and windowscodecs, I can play sessions as long as multiple hours, memory usage settles around 2.7G RAM. The original wined3d with DX9 goes up above 3.5G memory usage (in less than one hour), then starts missing textures and text characters, then usually crashes in the loading screens. So IMHO, falling back to DX9 support is no option.

Proton should include the windowscodecs patch series. I'd prefer if these would be upstreamed to vanilla wine because it is a quite big patchset and would make rebasing Proton to later wine versions more difficult.

kakra avatar Aug 28 '18 18:08 kakra

Well it was fun while it lasted. Then Delve introduced fancy new graphics features...

I had PoE running well in both Lutris w/DXVK and SteamPlay before the update. Both environments updated the game but then failed to launch. The game starts up with the gear logo but then (mostly)freezes and never loads any actual 3d graphics. I have to either remote in to my machine and kill the process or do a hard reboot. So far none of the launch options seems to make any difference.

Ideas?

I'll try cleaning out any artifacts of our patches to test with a clean environment and then perhaps re-patch.

0xjon0 avatar Aug 31 '18 18:08 0xjon0

Same for me. I was planning to start the league on Windows anyway, so I'll do some more debugging in a week or two unless someone beats me to it.

DataBeaver avatar Aug 31 '18 18:08 DataBeaver

@tainium Pressing Ctrl+Alt+Esc should bring up the skull mouse pointer to kill a window.

kakra avatar Aug 31 '18 18:08 kakra