doitsujin / dxvk

Vulkan-based implementation of D3D8, 9, 10 and 11 for Linux / Wine
zlib License
13.34k stars 859 forks source link

CoD MW Remasters crashing with AMD path #3537

Closed Blisto91 closed 1 year ago

Blisto91 commented 1 year ago

In both Modern Warfare Remasters on the games AMD path the game will crash with dxvk when you load in to the campaign. This does not happen with wined3d. To reproduce the issue make sure the dxvk vendor id is set to AMD and using Protons builtin amd ags to be able to launch after that.

This is not a issue most people will ever run in to since both Modern Warfare Remaster campaigns are spoofed to Nvidia to prevent a crash when the native amd ags doesn't load properly. But it might still be interesting to look at if it's a dxvk bug that could affect other games or allow using the Proton amd ags if people want to.

Software information

Call of Duty: Modern Warfare Remastered (Steam) Call of Duty: Modern Warfare 2 Campaign Remastered (battle.net)

AMD gpu without customVendorId spoofed to Nvidia and WINEDLLOVERRIDES="amd_ags_x64=b" with Proton. Have not found graphical settings to affect the issue.

System information

Apitrace file(s)

Game will not launch with wined3d + apitrace so i've instead captured one from native Windows and one on Linux with dxvk where it crashes. Note the native Windows one replays fine with dxvk without any crashes.

https://drive.proton.me/urls/RJEJR0G3T8#xRkXKoJtwWnE

Log files

MW2CR_d3d11.log MW2CR_dxgi.log

Edit: As noted in the comments below i now found this to be a regression on Experimental and BE since commit https://github.com/ValveSoftware/wine/commit/8bb9861b7930316c97544e0c688da1472c6415b9 Reverting this commit makes it not crash anymore with dxvk.

Log with PROTON_LOG=+amd_ags steam-393080+amd_ags.tar.gz

Blisto91 commented 1 year ago

Ugh. First checked after i made the issue if it happens with older Protons and it doesn't happen with either 7.0-6 or 8.0-2 even with dxvk master.

Blisto91 commented 1 year ago

Issue starts with experimental-bleeding-edge-8.0-42591-20230505-p642afe-w474232-d242ac2-v453d27 which in it's Wine update adds the 3 amd ags commits seen here https://github.com/ValveSoftware/wine/commits/4742323dcbda8853734f4442b7675c8adc542a93

Edit: Bisected it further to start happening with the latest of the 3 amd ags commits https://github.com/ValveSoftware/wine/commit/4742323dcbda8853734f4442b7675c8adc542a93 Proton log: steam-393080.tar.gz

pchome commented 1 year ago

The commit is different on experimental_8.0 branch https://github.com/ValveSoftware/wine/commits/experimental_8.0/dlls/amd_ags_x64 https://github.com/ValveSoftware/wine/commit/8bb9861b7930316c97544e0c688da1472c6415b9

ID3D11VkExtContext_SetBarrierControl(ext_context, set ? D3D11_VK_BARRIER_CONTROL_IGNORE_WRITE_AFTER_WRITE : 0); part ?

Blisto91 commented 1 year ago

Thx did not see it was different on current experimental. Reverting it there also makes it work again with dxvk.

doitsujin commented 1 year ago

Does this actually crash on our end or what is going on? I can't really see UAV overlap being responsible for any sort of crash unless there's an ABI mismatch somehow so this is extremely weird.

Can you get a log with WINEDEBUG=amd_ags?

Blisto91 commented 1 year ago

I am not sure tbh. I first noticed it started with a recent amd ags commit after i made the issue. I can try and poke Gofman

Edit: Will get the log

Blisto91 commented 1 year ago

steam-393080+amd_ags.tar.gz

gofman commented 1 year ago

It is crashing in amd_ags_x64.dll in agsDriverExtensionsDX11_BeginUAVOverlap(). The problem here that Proton builtin amd_ags failed to determine the version of native amd_ags_x64.dll which the game is using and defaulted to 5.4.1 (while game's one appears to be 5.1 and agsDriverExtensionsDX11_BeginUAVOverlap have different prototype between these versions). For some reason game ships some special amd_ags_x64.dll which doesn't have version info resource. Dropping a pristine 5.1 amd_ags from here: https://github.com/GPUOpen-LibrariesAndSDKs/AGS_SDK/releases/tag/v5.1.0 is said to fix the issue (tested by @Blisto91 ). Before the blamed commit the crashing function was just a stub and so that worked. So it does with wined3d which doesn't expose custom interface for actually setting uav overlap. But the issue is not in the commit, it is absent version and version affects more things (other structures layout) and the game worked with wrong version mostly by chance.

So if we have to enable amd_ags_x64 builtin in Proton for the game we will have to code amd_ags version for the game (detecting that without version resource for some custom dll is too convoluted and still probably won't work for any possible custom version). This is not a dxvk issue apparently.

RiantAnda commented 4 months ago

Looks like it is no more necessary to spoof Nvidia for both games. When spoofing back to AMD, both launch.

Here is the new behavior: 0128:trace:amd_ags:agsInit context 0000000141167B98, config 0000000000000000, gpu_info 000000000011F720. 0128:trace:amd_ags:determine_ags_version *ags_version 0. 0128:err:amd_ags:get_ags_version_from_resource File version info not found, err 1812. 0128:trace:amd_ags:guess_version_from_exports agsDriverExtensionsDX11_Init found. 0128:trace:amd_ags:determine_ags_version Using AGS v5.0.6 (internal 1) interface

Maybe due to https://github.com/ValveSoftware/wine/commit/691c56de8261707e51339e24aedc0275ca33464d ?