Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total War : Shogun 2 istability when using d3d9.dll and d3d11.dll from DXVK #2591

Closed
llde opened this issue Apr 6, 2022 · 21 comments
Closed

Comments

@llde
Copy link

llde commented Apr 6, 2022

Total War : Shogun 2 load both d3d9.dll and d3d11.dll on start before the DX selector (skipped usin g DXVK DXGI)
This seems to cause some instability during gameplay, in battles and when transitioning between battles
The presence of DXVK DXGI seems to affect instability (seems more unstable with DXVK DXGI then without)
If I put on builtin one of d3d9.dll or d3d11.dll wasn't able to experience crash (excpet a couple of unrelated and reproducible crashes)
EDIT: I'm failing to crash again with Wine DXGI and both other DXVK dll under DX11 renderer at least. Need to do more test with and without DXVK DXGI and the 2 other DLLs (can't test wine d3d dlls and dxvk dxgi however, at least for d3d11). I can replicate the crash using dxvk dxgi

Software information

Total War : Shogun 2, High settings

System information

-GPU: RX580 8G
-Driver: RADV 22.0.1
-Wine version: 7.5
-DXVK version: 42c66c4

Apitrace file(s)

  • apitrace is extremly slow and this seems to prevent me to experience the unstability. If this is necessary I will try to make it but not in short time.

Log files

Shogun2_dxgi.log
Shogun2_d3d9.log
Shogun2_d3d11.log

@doitsujin
Copy link
Owner

doitsujin commented Apr 6, 2022

See #1318. All "modern" 32-bit games have this issue with DXVK, and this isn't really something we can fix without bascally writing a dedicated 32-bit version that is optimized solely for reducing address space usage.

@Blisto91
Copy link
Contributor

Blisto91 commented Apr 7, 2022

@llde If it's a memory issue you could try to see if this PR alleviates the issue.

You can grab a non release build of it here

@llde
Copy link
Author

llde commented Apr 7, 2022

I'm not sure if this an address space issue. Other games that were affected with this got explicit allocation error in wine or dxvk log. Nothing was present here.

@Blisto91
Copy link
Contributor

Blisto91 commented Apr 7, 2022

I can try to test here later when i have time, think i have the game if i remember correctly.

@doitsujin
Copy link
Owner

doitsujin commented Apr 7, 2022

@llde If it's a memory issue you could try to see if this PR alleviates the issue.

This would only have an effect for D3D9 though, D3D11 doesn't work that way.

I just don't see what else this is supposed to be, two very different API implementations running into the same kind of random bugs only in one specific game seems about as likely as entering your Covid vaccine batch number into a lottery ticket and winning. Especially if just changing DXGI already improves things.

@llde
Copy link
Author

llde commented Apr 7, 2022

There are other know instances of games that load both APIs at the start? I was thinking that maybe is that the issue, as by loading only one of the DXVK DLLs seems to works stable (at least in the tutorial)

@Blisto91
Copy link
Contributor

Blisto91 commented Apr 8, 2022

I tried playing a bit through proton in dx9 mode (the only one i can get working since i cant get past D3DX11 errors in dx11 mode) and i did notice it can crash when exiting a battle. When i looked at the vram usage and system memory usage i didn't notice anything worrying on that front. Not completely sure what crashes it yet or if it's dxvk.
Gonna try some more later.

@patmann03
Copy link

patmann03 commented Apr 10, 2022

See #1318. All "modern" 32-bit games have this issue with DXVK, and this isn't really something we can fix without bascally writing a dedicated 32-bit version that is optimized solely for reducing address space usage.

In proton in my log I get this after 10-20 minutes on Total War: Rome 2 which I believe uses the same game engine as Shogun 2. Is this the memory issue you're referring to?

Been desperately trying to get Rome 2 to work well on linux. Interestingly I added the latest GE Proton GE release (which is using the latest git as of 6 days ago) on Attila and DXVK isn't crashing.. I used to have to run that game with wined3d. Played for 2+ hours last night without a single crash was very happy.

4172.818:0254:02dc:warn:seh:dispatch_exception EXCEPTION_ACCESS_VIOLATION exception (code=c0000005) raised
4172.818:0254:02dc:trace:seh:dispatch_exception  eax=00000004 ebx=1ed59500 ecx=00100000 edx=11014fac esi=ffff8001 edi=00000000
4172.818:0254:02dc:trace:seh:dispatch_exception  ebp=00000000 esp=1073fc20 cs=0023 ss=002b ds=002b es=002b fs=0063 gs=006b flags=00010216
4172.818:0254:02dc:trace:seh:call_vectored_handlers calling handler at 62538170 code=c0000005 flags=0
4172.818:0254:02dc:trace:seh:call_vectored_handlers handler at 62538170 returned 0
4172.818:0254:02dc:trace:seh:call_stack_handlers calling handler at 7BC68240 code=c0000005 flags=0
wine: Unhandled page fault on write access to 00000008 at address F188D013 (thread 02dc), starting debugger...
4172.832:0254:02dc:trace:seh:start_debugger Starting debugger L"winedbg --auto 596 1568"

@Blisto91
Copy link
Contributor

Blisto91 commented Apr 10, 2022

Testing it for shogun 2 now.
Proton log stuff from crash

10053.847:0130:0134:err:virtual:try_map_free_area mmap() error Cannot allocate memory, range 0xffde0000-(nil), unix_prot 0.
10053.847:0130:0134:err:virtual:try_map_free_area mmap() error Cannot allocate memory, range 0xffde0000-(nil), unix_prot 0.
terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
10053.858:0130:0134:trace:seh:raise (22)
10053.859:0130:0134:fixme:msvcrt:__clean_type_info_names_internal (031FAB88) stub
10053.871:0130:0134:fixme:msvcrt:__clean_type_info_names_internal (59339348) stub
10053.871:0130:0134:fixme:msvcrt:__clean_type_info_names_internal (5BA7F78C) stub
10053.871:0130:0134:fixme:msvcrt:__clean_type_info_names_internal (5BA41894) stub
10053.871:0130:0134:fixme:msvcrt:__clean_type_info_names_internal (5B6A3A60) stub
_RECORD>,class CA_STD::ALLOCATOR<struct CA::UniString const *>,struct MEMORY::CAAllocator>::record_index
WS_LOADING_SCREEN_IMP::pf_on_destroy()
Imposter budget: 437Mb
Imposter quality 5 (size 2048, step 0.10): 36Mb
WS_SPRITE_IMP::pf_on_create() create_vertex_buffer() called, size:432000
WS_SPRITE_IMP::pf_on_create CreateIndexBuffer() called, size:48000
Setting breakpad minidump AppID = 34330

Gonna try with the unmap pr to see if it changes anything

Edit: It didn't. According to the hud it doesnt use managed memory anyway

Edit 2: I have this save game where i crash everytime i get out of a campaign battle i go in to.
I haven't found that any of the conf settings change anything and neither does setting the game graphics to low. no esync or fsync also doesnt prevent the crash.
If i launch the game with WINED3D it does not crash however.

Here is logs with DXVK_LOG_LEVEL=trace
Shogun2_d3d9.log
Shogun2_dxgi.log

Edit: 3 Using WINEDLLOVERRIDES for dxgi in the games steam launch options does not prevent the crash i'm experiencing from happening. But maybe this dxvk crash is unrelated to the one the OP is talking about.

@Blisto91
Copy link
Contributor

Blisto91 commented Apr 10, 2022

Okay managed to get d11 working. Had to install d3dx11_42 and not d3dx11_43 i think. Although i have both so not sure.
Anyway, the specific crash above doesn't happen in d11 mode, only d9.

Gonna test Rome 2 a bit

@Blisto91
Copy link
Contributor

Blisto91 commented Apr 10, 2022

I can run Rome 2 dx11 mode without messing with anything extra so thats nice.

I am very suspect with how Rome 2 handles Vram while loading into a battle or the other way. Dunno if it shortly spikes or what since i can never actually obverse my whole system Vram reach it's limit.
I have a save game on the campaign where when i end my turn i will get attacked in a sea battle. I could pretty consistently reproduce a crash while loading into this battle (tho did manage a very few times). I then found that the game sets my graphics level to Ultra by default and when i lower it to low i can enter the battle. (It resets my graphics after the crash)
When i load into this map i will crash if graphics are set to Very High or above, UNLESS i have set Unlimited video memory.
The strange thing is tho if i set Unlimited Vmem on and set graphics to extreme when i get into the battle my overall system Vram usage is still only 3GB out of 4.
And if i don't set Unlimited Vmem i can enter the battle when graphics are below Very high, and then i can still set them to extreme in the battle without issue.

This might be half off topic, but maybe Shogun 2 behaves in a similar way. Haven't played much in dx11 mode yet.
But since the other people in this issue seem to have 8 & 16GB i guess vram shouldn't be a issue unless the games set it really low when Unlimited isn't selected. I gather online the limit might be 3 or 3.5GB? Maybe the unlimited option raises it from there which would make sense with my observations i guess. Or maybe i'm being stupid again.

Gonna go back to testing Shogun 2 which is what the original issue is about.

@Blisto91
Copy link
Contributor

Blisto91 commented Apr 11, 2022

I haven't experienced a dx11 crash yet in shogun 2, but VRAM is generally a lot lower than in Rome 2 if that was the issue above. But need to play some more.

For the dx9 crash would a apitrace in either WINED3D or windows be helpful along with the save game?

@patmann03
Copy link

I haven't experienced a dx11 crash yet in shogun 2, but VRAM is generally a lot lower than in Rome 2 if that was the issue above. But need to play some more.

For the dx9 crash would a apitrace in either WINED3D or windows be helpful along with the save game?

Seeing Rome 2 is a 32-bit game, would having unlimited vram or overriding it in the preferences file have any impact? I have a 6900xt, game only shows 3gb. Is this forced by DXVK as stated in the other issue? #1318 ? When I'd run the game in older version of DXVK I wouldn't get the 'ACCESS VIOLATION' it would just crash with seemingly no error code in the proton log. This is the only game I have a windows install for at the moment. I tried adding the DLLs for the API trace to the game folder but when I override them with winecfg WINED3D fails to launch the game in Steam. Never had to do a trace before so perhaps it didn't work. When I tried running the API trace with DXVK the game would load, but when it went to load a campaign it would grind to a halt with less than 1FPS and I could never really get into the campaign (no issues with the main loading screen or settings) So whatever I can do to help identify the issue I'm game so I can delete windows once and for all.

@Blisto91
Copy link
Contributor

Blisto91 commented Apr 11, 2022

@patmann03 An explanation for Unlimited video memory in Rome 2 can be found here
Basically when it's off the game supposedly downgrades the graphical settings when you go over budget and when it's on you allow it to use swap from system memory or storage. Why it instead chooses to crash with that option turned off i don't know.

@patmann03
Copy link

patmann03 commented Apr 11, 2022 via email

@Blisto91
Copy link
Contributor

Blisto91 commented Apr 11, 2022

@patmann03 I tried running going into the crashing battle in WINED3D with unlimited memory off and it crashed the same. I got into it when i set graphics to medium. So maybe that particular one isn't dxvk.

You should probably make a separate issue for Rome 2 so we don't pollute this one too much hehe. Even tho the engines are similar it's not necessarily the same issues. :)

Edit: I tried to compile a dxvk version where the 32bit memory limit was raised to around 4GB and now i don't seems to crash in this battle anymore even if i set my graphics to Ultra or Extreme before loading.

@patmann03
Copy link

Edit: I tried to compile a dxvk version where the 32bit memory limit was raised to around 4GB and now i don't seems to crash in this battle anymore even if i set my graphics to Ultra or Extreme before loading.

Interesting, how can I do that? I can do additional testing tonight once I figure out out to build dxvk for myself and install in my pfx (heh). I'll also run a trace in windows and create a separate issue. Thank you for helping was hoping these issues were related to the game engine.

@Blisto91
Copy link
Contributor

@patmann03 I have made a separate issue. Tho i am a bit confused what is going on with it.
On windows native i can load the battle fine on Extreme even with a 2GB card because it will lower the details, but on Linux dxvk it instead just crashes.

@Blisto91
Copy link
Contributor

@llde could i get you to retest this issue with latest master when you have time? 🙂
https://github.com/doitsujin/dxvk/actions/runs/4397579062

@Blisto91
Copy link
Contributor

Blisto91 commented May 6, 2023

@llde Friendly ping 🙂

@K0bin
Copy link
Collaborator

K0bin commented Dec 31, 2023

I'll assume this was fixed by the state block memory change.

Feel free to reopen if the issue persists.

@K0bin K0bin closed this as completed Dec 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants