kirides / GD3D11

D3D11-Renderer for Gothic and Gothic 2
GNU General Public License v3.0
200 stars 18 forks source link

Crash in Verbindung mit AMD Grafikkarte #132

Open cptalex97 opened 1 year ago

cptalex97 commented 1 year ago

Hey,

viele unserer Spieler von "Gothic Online: Untold Chapters" nutzen diesen Renderer. Wir bespielen Khorinis, als auch das Minental. Wir haben schon seit paar Monaten das Phänomen, dass Spieler, die auf Khorinis spielen und eine AMD Grafikkarte besitzen, mit diesem Renderer und generell allen anderen, häufig crashen, manchmal gar nicht ins Spiel kommen (im Ladescreen crashen). Wir haben schon einiges probiert, vermuten dass es irgendwie mit Schatten oder Licht in Verbindung stehen muss, können aber die Ursache, bzw. Lösung nicht finden. Wäre super, wenn man versuchen könnte dieses Problem anzugehen. Ich könnte über Discord auch noch konkretere Infos bieten, bzw. zur Reproduktion beitragen. cpt_alex#3287

Vielen Dank!

kirides commented 1 year ago

ich selbst spiele mit einer AMD 7900 XTX und hatte bisher keine solche Probleme, vorher mit einer RX 470, Vega 56 und dann wieder zeitweilen auf einer nvidia RTX 2080.

Nicht ein einziges Mal hatte ich in der Zeit einen Crash der auf die Grafikkarte zurückzuführen wäre.

Mehr Details wären in der Tat hilfreich.

cptalex97 commented 1 year ago

Ja ich denke mal das wird in Verbindung mit etwas stehen, das in der Welt existiert. Vermutlich etwas das gespacert wurde, was auf der anderen Welt nicht existiert oder ähnliches.

Log.txt

DxDiag.txt

cptalex97 commented 1 year ago

Hatte gedacht, dass es an NewWorld Sky Texturen liegt. Tatsächlich war eine der Dateien dort kleiner als im original in unserer Mod. Habe die ersetzt, crasht dennoch weiter mit der selben Meldung

cptalex97 commented 1 year ago

Hatte folgendes mal versucht aus Jux: https://github.com/kirides/GD3D11/issues/102

Jetzt kriege ich actually eine Meldung beim Crash, aber es scheint tatsächlich mit AMD zusammenzuhängen. Also wieso auch immer, der Treiber scheint zu crashen

dxgi_error_device_hung

image (2)

cptalex97 commented 1 year ago

https://github.com/ataulien/GD3D11/releases/tag/X11.2 Diese alte Version in Kombination mit https://github.com/doitsujin/dxvk/releases scheint das Problem irgendwie zum umgehen, aber lässt sich aufgrund der begrenzten Einstellungsmöglichkeiten auch nicht optimal spielen, kein Plan woran das Problem liegt, aber anscheinend wird mit dem Renderer die GPU überlastet und windows lässt den Treiber dann kurz crashen, was wohl für den gothic crash sorgt

Mit dem alten Renderer hat die GPU aber auch eine ordentliche Auslastung, was dafür spricht, dass das Game die Leistung der Karte auch nutzt, mit dem neuen sind es max 14% Auslastung, irgendwas stimmt da nicht

Alron11 commented 1 year ago

I might just join in on this topic (sorry for not speaking German), as I have had multiple issues on my RX 6800 XT (with latest AMD drivers) with DX11 renderer in Gothic 2, especially with mods. It doesn't result in a driver crash, but it can result in a game crash.

I've had two major issues that are easily reproducible with the DX11 renderer:

  1. Trying to play VarusBikerEdition - the game will crash soon after trying to start a new game.
  2. Playing Atariar Edition - game will stop showing notifications (e.g. experience + X/new entry to journal) and the performance will drop drastically. Restarting the game and loading a save will show all of the notifications that should have been shown, but all at once, which will return the performance to original 200+ fps.

For the first one, just downloading Union and VarusBikerEdition from Steam workshop and starting a new game will crash it. For the second one, almost the same story - download Union and Atariar edition from Steam. Then change yourself into a dragon snapper and go kill stuff (experience notifications will stop showing up). Both obviously with the latest DX11 mod (17.8 dev10)

Should I be able to get any more debug information, just let me know how - I'll gladly help out in tracking the issue.

Oh, and my system specs: Ryzen 9 7950X 64GB DDR5 6000MHz RX 6800 XT everything running off SSDs

kirides commented 1 year ago

@cptalex97

Es kam vor kurzem ein Treiberupdate für AMD Karten heraus welches Treiber-Timeout fixes beinhaltet. Ggf. hilft es. Andernfalls könntest du probieren mit einem Fps-Limit zu spielen (z.B. V-Sync wenn unter 165 FPS, den eingebauten, oder Rivatuner RTSS)

@Alron11

to point 2: Thats a common issue in Atariar Edition, that also just as well happens on my RTX 2080 as on my 7900 XTX. The mod-code is just broken.

i will need to test point 1 - but i would assume it works fine-ish if the game is "installed" correctly (i.e. not installed in C:\Program Files\steam\steamapps\common\Gothic II\ but rather something like C:\MyGames\Gothic2\ - no spaces, small path, non-secured directory (C:\Program Files\ Directory is usually protected and stops applications from properly writing into it.)

Alron11 commented 1 year ago

I'm afraid changing the directory does not help at all. I've literally placed it in C:\Gothic2 and the game just crashes when trying to start a new game.

What did help though, was installing the DXVK libraries - the game loaded flawlessly. Obviously, the F11 menu doesn't work, but it is at the very least playable.

I doubt it's an issue with the installation itself - I can pack the whole installed directory and upload it for you to debug, should that help.

kirides commented 1 year ago

@Alron11 try deleting the Gothic2\System\D3DCompiler_47.dll, the DLL might cause issues with your installation.

it might also be that you're missing some VC Redist x86 Version or need to re-install some dx_webinstall for latest directX dlls

Alron11 commented 1 year ago

None of those solutions helped, I'm afraid. I've installed the latest VC Redist (both x86 and x64), the DirectX installator didn't want to install anything as it's seen that I've got the latest version and deleting that DLL hadn't changed a thing.

Using the _mod starter I've managed to get a crash popup, it doesn't however say much, other than the unknown stacktrace.

======================================= UNHANDLED EXCEPTION OCCURED ====================================================== ======================================= CRASH INFOS: ===================================================================== Gothic II - 2.6 (fix), Parser Version: 50 User: jurcz, CPUType: 586, Mem: 0 MB total, 0 MB free Startup Options:-game:varusbikereditionpl.ini -zlog:10,s =============================================== CALLSTACK : ============================================================== 0023:95FB2A18 (0x5C5A8A01 0x00000024 0x0000003F 0x00000000)

zSpy logs aren't much help either image

image

kirides commented 1 year ago

@Alron11 Do you perhaps have the 4GB Patch enabled? Try to disable it (there are tools to toggle the LAA Flag on a binary) You'd need to toggle it off for the Gothic2.exe It looks like Varusbiker does not support negative pointers, which happen if you use the 4GB Patch.

Alron11 commented 1 year ago

I disabled that using editbin from VS. The good news is, now the game doesn't crash immediately. The bad thing is, it still crashes, just a little bit further down the loading bar.

======================================= UNHANDLED EXCEPTION OCCURED ====================================================== ======================================= CRASH INFOS: ===================================================================== Gothic II - 2.6 (fix), Parser Version: 50 User: jurcz, CPUType: 586, Mem: 2048 MB total, 2048 MB free Startup Options:-game:varusbikereditionpl.ini -zlog:10,s =============================================== CALLSTACK : ============================================================== 0023:00791B6A (0x000005F8 0x00AB4108 0x00000000 0x00AB40C0) Gothic2.exe, zCParser::DoStack()+522 byte(s), P:\dev\g2addon\release\ZenGin_ulf\zParser.cpp, line 1369+14 byte(s) 0023:00792504 (0x000005F8 0x5D04ADD0 0x00AB4118 0x00AB40C0) Gothic2.exe, zCParser::DoStack()+2980 byte(s), P:\dev\g2addon\release\ZenGin_ulf\zParser.cpp, line 1415 0023:00792504 (0x000301EB 0x00009C5D 0x0082E6F0 0x0C2C8488) Gothic2.exe, zCParser::DoStack()+2980 byte(s), P:\dev\g2addon\release\ZenGin_ulf\zParser.cpp, line 1415 0023:00792CBF (0x00AB40C0 0x00009C5D 0x0135F830 0x0135F834) Gothic2.exe, zCParser::CallFunc()+719 byte(s), P:\dev\g2addon\release\ZenGin_ulf\zParser.cpp, line 1551 0023:006C1DDB (0x0135F998 0x0C2C8488 0x0135F994 0x0135F894) Gothic2.exe, oCGame::CallScriptStartup()+363 byte(s), P:\dev\g2addon\release\Gothic_ulf\oGame.cpp, line 860 0023:006C9FD9 (0x0135F830 0x0135F900 0xFFFFFFFE 0x0135F900) Gothic2.exe, oCGame::LoadWorldStartup()+969 byte(s), P:\dev\g2addon\release\Gothic_ulf\oGame.cpp, line 3149 0023:006C92DE (0xFFFFFFFE 0x0135F894 0x0135F994 0xFFFFFFFE) Gothic2.exe, oCGame::LoadWorld()+558 byte(s), P:\dev\g2addon\release\Gothic_ulf\oGame.cpp, line 2902 0023:006C6696 (0x0082E6F0 0x00429BF9 0xFFFFFFFE 0x0135F994) Gothic2.exe, oCGame::LoadGame()+246 byte(s), P:\dev\g2addon\release\Gothic_ulf\oGame.cpp, line 2147 0023:004032AB (0x00000100 0x0135FA64 0x0082E6F0 0x0082E600) Gothic2.exe, std::basic_string<char,std::char_traits,std::allocator >::_Tidy()+43 byte(s), P:\vs6\VC98\INCLUDE\xstring, line 591+6 byte(s) 0023:54860269 (0x00000000 0x00503270 0x0000002C 0x00000000) MSVCR100.dll, malloc()+54 byte(s) 0023:0082933B (0x00831450 0x00000000 0x0135FE38 0x00502DFD) Gothic2.exe, SetFileAttributesA()+284535 byte(s) 0023:007D3544 (0x00843D80 0x00000000 0x0135FF80 0x779E00F9) Gothic2.exe, _except_handler3 0023:007D3544 (0xA68AB3F1 0x00000000 0x0135FFEC 0x77E37B8E) Gothic2.exe, _except_handler3 0023:77E4AE60 (0x00000000 0x00000000 0x007D4318 0x002B2000) ntdll.dll, wcstombs()+112 byte(s) 0023:77E58D3B (0x00000000 0x00000000 0x00000000 0x00000000) ntdll.dll, RtlCaptureContext()+267 byte(s)

Log.zip

There's a stack trace now, as well as the DX11 log is no longer empty.

One thing I'm wondering about is why it doesn't crash when using DXVK, as it just seems to be convering DX calls into Vulkan calls. Those Vulkan calls can still use negative memory pointers, so it shouldn't really matter if LAA flag is on, or off.

Alron11 commented 1 year ago

Oh, and to confirm my suspicion - there's nothing wrong with the installation itself. Just copying and pasting that whole installation folder to a different PC (with a GTX 770) and it's working perfectly over there, so it has to be something with the RX 6800 XT, or, maybe, with my new Ryzen CPU?

kirides commented 1 year ago

Looks like a d3d11 error indeed. Creating the D3D11ConstantBuffer doesn't work. Perhaps we use some combination of flags that are not supported on said AMD 6xxx graphics cards.

This would explain why DXVK works, it doesn't use d3d11 and maybe even works-around incompatible creation flags.

we need to go deeper

Alron11 commented 1 year ago

Should you need any further information or testing, just let me know. You can also hit me up on Discord (Alron#5698).

kirides commented 1 year ago

@Alron11 The issue seems to stem from a "-2147024882" (E_OUTOFMEMORY) out-of-memory error.

So,

could you try an older driver, like 22.5.1? That one seems to universally be known for its "stability"

Alron11 commented 1 year ago

Indeed, it seemed to work well on 22.5.1. That is, until the game started crashing after just a couple minutes of gameplay.

Alron11 commented 1 year ago

Actually, let me retract that. The game had crashed during gameplay, with a memory error.

======================================= UNHANDLED EXCEPTION OCCURED ====================================================== ======================================= CRASH INFOS: ===================================================================== Gothic II - 2.6 (fix), Parser Version: 50 User: jurcz, CPUType: 586, Mem: 0 MB total, 0 MB free Camera: Pos(23532.873/1234.71497/-10102.5742), At(0.860964179/-0.31164071/0.402020782) Startup Options:-game:varusbikereditionpl.ini -zlog:10,s =============================================== CALLSTACK : ============================================================== 0023:00791B68 (0x0001081F 0x00AB4108 0x00000000 0x00AB40C0) Gothic2.exe, zCParser::DoStack()+520 byte(s), P:\dev\g2addon\release\ZenGin_ulf\zParser.cpp, line 1369+12 byte(s) 0023:00792504 (0x00000B9A 0x00AB4108 0x00000000 0x00AB40C0) Gothic2.exe, zCParser::DoStack()+2980 byte(s), P:\dev\g2addon\release\ZenGin_ulf\zParser.cpp, line 1415 0023:00792504 (0x0000C21E 0x00AB4108 0x00000000 0x00AB40C0) Gothic2.exe, zCParser::DoStack()+2980 byte(s), P:\dev\g2addon\release\ZenGin_ulf\zParser.cpp, line 1415 0023:00792504 (0x00000B9A 0x00AB4108 0x00000000 0x00AB40C0) Gothic2.exe, zCParser::DoStack()+2980 byte(s), P:\dev\g2addon\release\ZenGin_ulf\zParser.cpp, line 1415 0023:00792504 (0x00000B9A 0x3583FF08 0x00AB4118 0x00AB40C0) Gothic2.exe, zCParser::DoStack()+2980 byte(s), P:\dev\g2addon\release\ZenGin_ulf\zParser.cpp, line 1415 0023:00792504 (0x0000C21E 0x00000000 0x0BEAB948 0x0135F9DC) Gothic2.exe, zCParser::DoStack()+2980 byte(s), P:\dev\g2addon\release\ZenGin_ulf\zParser.cpp, line 1415 0023:00792CBF (0x0C30C5D8 0x00000000 0x00000000 0x0C30C5D8) Gothic2.exe, zCParser::CallFunc()+719 byte(s), P:\dev\g2addon\release\ZenGin_ulf\zParser.cpp, line 1551 0023:504CB831 (0x00400000 0x01603BC6 0x0135FC88 0x00000000) SHW32.DLL, UnionCore::CUnion::DefineCRTVersion()+6305 byte(s) 0023:00425E6E (0x0082F0EC 0x00000001 0x00030A7C 0x0C30C5D8) Gothic2.exe, CGameManager::Run()+1598 byte(s), P:\dev\g2addon\release\Gothic_bert\oGameManager.cpp, line 767+47 byte(s) 0023:0078188B (0x0000002C 0x00000000 0x00000000 0x00000000) Gothic2.exe, MainProg()+75 byte(s), P:\dev\g2addon\release\Gothic_ulf\Phoenix.cpp, line 111 0023:00503270 (0x00400000 0x00000000 0x01603BC6 0x00000001) Gothic2.exe, HandledWinMain()+928 byte(s), P:\dev\g2addon\release\ZenGin_carsten\zWin32.cpp, line 1169 0023:00502DFD (0x0135FC8C 0x00000000 0x01603BC6 0x00000001) Gothic2.exe, WinMain()+141 byte(s), P:\dev\g2addon\release\ZenGin_carsten\zWin32.cpp, line 1054+17 byte(s) 0023:58AB41D2 (0x00000004 0x0000FFFF 0x000000B8 0x00000000) g2a_avx2.dll, RegisterSpecialCase()+178 byte(s)

image

kirides commented 1 year ago

@Alron11

oh, so you're not even playing regular varus biker (german) but polish version. Can you send me a link to the exacT version you use? i will have to decompile it and find out what the "zCParser::DoStack(...)" operations do in the mod.

Alron11 commented 1 year ago

Sure thing, here's the whole installation with the mod packed: https://drive.google.com/file/...

Should you prefer to use steam workshop, the mod can be found here: https://steamcommunity.com/sharedfiles/filedetails/?id=2793694464

EDIT by @kirides: removed url to the game

kirides commented 1 year ago

@Alron11

after further investigation, the mod crashes at the call to morealphapolys(16384) in Startup_Global

it might be that the chosen value of 16384 is incompatible with whatever happens on Gothic's side combined with the graphics card. Or...

Can you try to toggle off all 4GB flags on every binary/DLL in your installation?

if none of this works, i'm lost. i can't reproduce the issue on my side (amd 7900 xtx)

Alron11 commented 1 year ago

So yeah, it didn't help. I'll be sending an extensive bug report to AMD, as it seems to be very much a driver issue. Using DXVK is the only way to go as of now, and even that, only the 32-bit DLLs can be used. The good news is, with the 32bit DXVK DLLs is seems to work flawlessly.

Thank you for your time though, it's awesome that you've tried to help out so much.

kirides commented 1 year ago

32-bit DLLs

well, Gothic is only 32-bit, so you can only use 32-bit DLLs for that :)

It's quite sad that we found no workaround for that :/

cptalex97 commented 1 year ago

Wollte nochmal ein Update meinerseits bringen. Selbiges Problem bleibt bestehen, dxvk zu nutzen scheint bei manchen zu klappen, bei manchen nicht, bei manchen eine Weile und irgendwann nicht mehr. Was klar ist: Der Crash passiert nur in Verbindung mit Renderer + AMD + Wenn man bei unserem GMP Server auf Khorinis Seite einloggt. Minental Seite funktioniert alles. Minental Seite hat aber auch circa 40k weniger Verticles auf der Map. Meine Vermutung ist -> beim Einloggen auf Khorinis Seite werden so viele Sachen gleichzeitig instant geladen, dass es den AMD Treiber zum crashen bringt. Afaik hatte ich sogar schonmal einen Treibercrash report bei einem Gothic Crash. Also glaube tbh, da gibt es nicht viel, was du machen kannst leider. Interessanterweise konnte ich ohne den dxvk mal einloggen und mein Char ist auch da bewegt sich auch etc, ich sehe nur nichts, weil ich kompletten Blackscreen habe. Das deutet für mich tatsächlich daraufhin, dass der Grakatreiber einfach den Geist aufgibt und dann (normalerweise) einfach das Game schließt ohne zspy Fehlermeldung

Alron11 commented 1 year ago

AMD isn't really going to fix the issue, as it seems to affect a small amount of users. Still, the issue is the dxnavi on 6000 series cards.

https://www.reddit.com/r/AMDHelp/comments/zx95x9/psa_disable_dxnavi/

Disabling it resolved all of the issues, although performance in some newer games suffered because of it.

FakeMichau commented 10 months ago

You could try using dxvk with gothic, and not disabling dxnavi so other games can benefit from that