protonscr

[BUG] Commit a287566 [dxgi] Implement frame statistics based on IDXGIVkSwapChain1 breaks S.T.A.L.K.E.R.: Call of Pripyat (at least it breaks the Anomaly standalone mod) - already bisected

dxvkclosed
doitsujin/dxvk#3531 · opened 2023-06-23 by gardotd426 · updated 2023-06-24 · 7 comments · github
Ggardotd426 2023-06-23 github

Someone had asked about running STALKER (sorry I'm not gonna type the periods after every letter every time I type it) games on Linux with Wine, and I don't play the games but like 2 years ago someone trying to run the Anomaly mod found that the Lutris installer was broken so I rewrote it and submitted it and the game worked back then, so I told the person that asked, and they asked me if I could point them to the Lutris script. I wanted to test it myself since it'd been two years before pointing anyone to it, and so I reinstalled.

Well, trying to launch the game in DX11 mode causes an instant crash:

Screenshot_20230623_012822

This is with current git master, not their included v2.2 build (it's my default for all games in Lutris). So I tried v2.2 and it worked fine (DX9 works fine regardless it seems).

So, I started a git bisect and after running through that, it turns out that commit a287566: [dxgi] Implement frame statistics based on IDXGIVkSwapChain1 was the culprit. So I cloned a fresh git and reverted only that commit, recompiled, and sure enough, the game works now in DX11.

Software information

S.T.A.L.K.E.R. - Call of Pripyat (Standalone Anomaly Mod)

Note: if anyone feels the need to try and reproduce this, you can use my Lutris installer, but for some reason Lutris is acting weird and for me it didn't pass $GAMEDIR to the executable location in the configure options so after installation just go into Configure -> Game options and prepend the path to the wineprefix to the executable line if you see it saying /drive_c/anomaly/AnomalyLauncher.exe (the wineprefix line and everything else properly pick up $GAMEDIR)

My install script is the second installer (the one that says "Anomaly Standalone" in the name) on https://lutris.net/games/stalker-call-of-pripyat. I'm not sure if the first installer is still broken (but it's also for the Anomaly mod).

The 7z archive that gets downloaded with the game contents is only 8.8GB but moddb's website was REALLY slow today. Like painfully slow.

System information

  • GPU: RTX 3090
  • Driver: 535.54.03
  • Wine version: Any (tried a few, mostly my system's 8.10-staging and lutris-GE-Proton8-8-x86_64)
  • DXVK version: Anything after a287566, initially current git master

Apitrace file(s)

I'm not exactly sure what the point of an apitrace would be, the bug doesn't occur in WineD3D. Game works fine.

I still went ahead and tried to get a trace, but putting the dlls in the game exe directory and setting the override causes the game to crash for a completely different unhandled exception error (just using WineD3D without the apitrace dlls works perfectly).

I'll upload the WineD3D trace, but I also got a DXVK trace if you all want that.

apitrace.tar.gz

What's weird though, is the apitrace for both WineD3D (when using the apitrace dlls, obviously, and getting the unhandled exception) and DXVK are both only 8.0K in size, and barely have anything in them. But regardless there it is.

Log files

Please attach Proton or Wine logs as a text file:

So, weirdly, even though the bad commit was to dxgi stuff, AnomalyDX11AVX_dxgi.log is completely empty when running with DXVK_LOG_LEVEL=debug. AnomalyDX11AVX_d3d11.log contains the usual output. I'll upload here. I'm not sure what kind of WINEDEBUG log I should get, but I included one with WINEDEBUG=+dxgi.

winelog-and-dxvk-logs.tar.gz

IIglu47 2023-06-23 github

@gardotd426 Is there the issue with the base game without mods? (and what version is it - gog, steam)
Also please explain in more detail what graphics settings were used and how/which "dx11 mode" you need to use (as far as I remember, it is included as a non-standard option related to lighting or something like that) in order to get the problem.

BBlisto91 2023-06-23 github

@Iglu47 it's a standalone mod and doesn't need any of the official games. It uses a custom version of the original X-ray afaik. I think the common way to download it is moddb https://www.moddb.com/mods/stalker-anomaly

Edit: The legality of some of the standalone mods have been a bit ambiguous afaik since most don't check for ownership of the main games, but i don't know the details.

Ggardotd426 2023-06-23 github

@Iglu47, @Blisto91 is right. There is no base game. It's standalone. And yeah that's the correct launcher.

I have a script that the Lutris installer uses to grab the 7z archive for you. This is all the script is:

#!/bin/bash
url="$(wget -q -O -  https:// www.moddb.com/downloads/start/207799 | grep /downloads/mirror/207799 | cut -d= -f2 | cut -d">" -f1 | cut -d";" -f1 | grep https | jq -r)"

wget -q $url -O Anomaly-1.5.1.2.7z --show-progress

Put that in a script and run it and you'll have the archive. Extract that into a wineprefix inside /path/to/wineprefix/drive_c/Program\ Files/Anomaly and then run AnomalyLauncher.exe

If you want to skip the launcher and go straight to the crash, bin/AnomalyDX11.exe or bin/AnomalyDX11AVX.exe is the direct executable(s).

Also please explain in more detail what graphics settings were used and how/which "dx11 mode" you need to use (as far as I remember, it is included as a non-standard option related to lighting or something like that) in order to get the problem.

When you launch the launcher, it literally just asks you your resolution and DirectX API. That's it. Select 11. That's it.

The game won't ever launch after that (unless you revert the bad commit).

IIglu47 2023-06-23 github

Stalker Anomaly 1.5.2 works fine for me (nvidia pascal, 525.116.04) on curent master.

StalkerAnomaly_dxvk.log

screenshot

StalkerAnomaly_1 5 2

I will test with 535.54.03 driver.

IIglu47 2023-06-23 github

I manually updated DXVK files for current Proton experimental_8.0 - and got this crash with the initially described error.
steam-stalker-anomaly.log (it's still on 525.116.04)
probably my local build of Wine just has a very old winevulkan.

Ggardotd426 2023-06-23 github

I manually updated DXVK files for current Proton experimental_8.0 - and got this crash with the initially described error.
steam-stalker-anomaly.log (it's still on 525.116.04)
probably my local build of Wine just has a very old winevulkan.

Yeah that makes sense, it would make zero sense for me to have been able to completely bisect this bug to a specific commit and then it somehow be a 535 thing, when reverting the commit fixes it. I'm sure that's possible but it just wouldn't make sense to my admittedly less-knowledgeable brain.

@Iglu47 If you rebuild DXVK with the bad commit reverted and replace the dlls in Proton, does the crash go away?

Ggardotd426 2023-06-24 github

So, I cloned a fresh git, created a patch from the bad commit then reverted it, and removed the following section from the patch:

@@ -804,9 +833,27 @@ namespace dxvk {
   HRESULT DxgiSwapChain::AcquireMonitorData(
           HMONITOR                hMonitor,
           DXGI_VK_MONITOR_DATA**  ppData) {
-    return m_monitorInfo != nullptr
-      ? m_monitorInfo->AcquireMonitorData(hMonitor, ppData)
-      : E_NOINTERFACE;
+    if (m_monitorInfo == nullptr || !hMonitor)
+      return E_NOINTERFACE;
+
+    HRESULT hr = m_monitorInfo->AcquireMonitorData(hMonitor, ppData);
+
+    if (FAILED(hr)) {
+      // We may need to initialize a DXGI output to populate monitor data.
+      // If acquiring monitor data has failed previously, do not try again.
+      if (hMonitor == m_monitor && !m_monitorHasOutput)
+        return E_NOINTERFACE;
+
+      Com<IDXGIOutput1> output;
+
+      if (SUCCEEDED(GetOutputFromMonitor(hMonitor, &output)))
+        hr = m_monitorInfo->AcquireMonitorData(hMonitor, ppData);
+    }
+
+    if (hMonitor == m_monitor)
+      m_monitorHasOutput = SUCCEEDED(hr);
+
+    return hr;
   }

Then I ran the patch, built DXVK, and tried to run the game with that build. And it launched.

Then I reverted the patch, re-applied the whole commit and tried again, and got the original crash.

So that code above is the bad code, seemingly. Obviously it might just make OTHER parts of the commit non-functional, but removing that bit does fix it.

Proton versions

Launch options