Dxvk: Gothic 2 GD3D11 - regression in 19e0829 causes D3DXERR_CAPSNOTSUPPORTED

Created on 24 Mar 2018  路  25Comments  路  Source: doitsujin/dxvk

Since commit 54382ae, game crashes at startup with D3DXERR_CAPSNOTSUPPORTED.

Software information

Gothic 2 2.6 Night of the Raven - Russian version - with GD3D11 17.5 by Liker. Default settings, since attempt to show configuration dialog causes segfault. Worked in 0ab27aa; in 4ce64bd everything was black, but that was reverted).

System information

  • GPU: RX 480
  • Driver: AMDGPU @ Linux 4.15.11-ARCH, Mesa 17.3.7 (RADV) + LLVM 6.0.0
  • Wine version: 3.4-staging (from Arch)
  • DXVK version: commit 19e0829

Apitrace file(s)

I can't create apitrace without DXVK, since game does not work without DXVK at all.

Log files

  • d3d11.log:
info:  D3D11CreateDevice: Probing D3D_FEATURE_LEVEL_11_0
info:  D3D11CreateDevice: Using feature level D3D_FEATURE_LEVEL_11_0
err:   D3D11Device::CreateGeometryShaderWithStreamOutput: Not implemented
warn:  D3D11RasterizerState: Depth clamp not properly supported
err:   D3D11RasterizerState: Antialiased lines not supported
warn:  D3D11RasterizerState: Depth clamp not properly supported
err:   D3D11RasterizerState: Antialiased lines not supported
warn:  D3D11RasterizerState: Depth clamp not properly supported
warn:  D3D11RasterizerState: Depth clamp not properly supported
err:   D3D11RasterizerState: Antialiased lines not supported
warn:  D3D11RasterizerState: Depth clamp not properly supported
warn:  D3D11RasterizerState: Depth clamp not properly supported
warn:  D3D11RasterizerState: Depth clamp not properly supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
err:   D3D11: Invalid blend factor: 268632064
err:   D3D11: Invalid blend factor: 44564480
err:   D3D11: Invalid blend op: 20277480
err:   D3D11: Invalid blend factor: 269485384
err:   D3D11: Invalid blend factor: 268632064
err:   D3D11: Invalid blend op: 44564480
err:   D3D11: Invalid blend factor: -1073741766
err:   D3D11: Invalid blend factor: 20277540
err:   D3D11: Invalid blend op: 3100260
err:   D3D11: Invalid blend factor: 2116467847
err:   D3D11: Invalid blend factor: 20277504
err:   D3D11: Invalid blend op: 49020928
err:   D3D11: Invalid blend factor: 49117152
err:   D3D11: Invalid blend factor: 49100232
err:   D3D11: Invalid blend op: 3100260
err:   D3D11: Invalid blend factor: 49094704
err:   D3D11: Invalid blend op: 20277764
err:   D3D11: Invalid blend factor: 3100260
err:   D3D11: Invalid blend op: 49117152
err:   D3D11: Invalid blend factor: 49020928
err:   D3D11: Invalid blend factor: 1734960462
err:   D3D11: Invalid blend op: 1919902312
err:   D3D11: Invalid blend factor: 49114064
err:   D3D11: Invalid blend factor: 3080
err:   D3D11: Invalid blend op: 20277560
err:   D3D11: Invalid blend factor: 2076649185
err:   D3D11: Invalid blend factor: -1
err:   D3D11: Invalid blend op: 2076654139
err:   D3D11: Invalid blend factor: 49100232
err:   D3D11: Invalid blend factor: 3080
err:   D3D11: Invalid blend op: 20277656
err:   D3D11: Invalid blend factor: 2076657409
err:   D3D11: Invalid blend factor: 2120708096
err:   D3D11: Invalid blend op: 268970376
err:   D3D11: Invalid blend factor: 49161104
err:   D3D11: Invalid blend factor: 49114072
err:   D3D11: Invalid blend factor: 49020928
err:   D3D11: Invalid blend factor: 2077282304
err:   D3D11: Invalid blend op: 3080
err:   D3D11: Invalid blend factor: 269485392
err:   D3D11: Invalid blend op: 49020948
err:   D3D11: Invalid blend factor: 1038516736
err:   D3D11: Invalid blend factor: 49021112
err:   D3D11: Invalid blend op: 24
err:   D3D11: Invalid blend factor: -1073741766
err:   D3D11: Invalid blend factor: 20277540
err:   D3D11: Invalid blend op: 3100260
err:   D3D11: Invalid blend factor: 2116467847
err:   D3D11: Invalid blend factor: 20277504
err:   D3D11: Invalid blend op: 49020928
err:   D3D11: Invalid blend factor: 49117152
err:   D3D11: Invalid blend factor: 49100232
err:   D3D11: Invalid blend op: 3100260
err:   D3D11: Invalid blend factor: 49094704
err:   D3D11: Invalid blend op: 20277764
err:   D3D11: Invalid blend factor: 3100260
err:   D3D11: Invalid blend op: 49117152
err:   D3D11: Invalid blend factor: 49020928
err:   D3D11: Invalid blend factor: 1734960462
err:   D3D11: Invalid blend op: 1919902312
err:   D3D11: Invalid blend factor: 49114064
err:   D3D11: Invalid blend factor: 3080
err:   D3D11: Invalid blend op: 20277560
err:   D3D11: Invalid blend factor: 2076649185
err:   D3D11: Invalid blend factor: -1
err:   D3D11: Invalid blend op: 2076654139
err:   D3D11: Invalid blend factor: 49100232
err:   D3D11: Invalid blend factor: 3080
err:   D3D11: Invalid blend op: 20277656
err:   D3D11: Invalid blend factor: 2076657409
err:   D3D11: Invalid blend factor: 2120708096
err:   D3D11: Invalid blend op: 268970376
err:   D3D11: Invalid blend factor: 49161104
err:   D3D11: Invalid blend factor: 49114072
err:   D3D11: Invalid blend factor: 49020928
err:   D3D11: Invalid blend factor: 2077282304
err:   D3D11: Invalid blend op: 3080
err:   D3D11: Invalid blend factor: 269485392
err:   D3D11: Invalid blend op: 49020948
err:   D3D11: Invalid blend factor: 1038516736
err:   D3D11: Invalid blend factor: 49021112
err:   D3D11: Invalid blend op: 24
err:   D3D11: Invalid blend factor: -1073741766
err:   D3D11: Invalid blend factor: 20277540
err:   D3D11: Invalid blend op: 3100260
err:   D3D11: Invalid blend factor: 2116467847
err:   D3D11: Invalid blend factor: 20277504
err:   D3D11: Invalid blend op: 49020928
err:   D3D11: Invalid blend factor: 49117152
err:   D3D11: Invalid blend factor: 49100232
err:   D3D11: Invalid blend op: 3100260
err:   D3D11: Invalid blend factor: 49094704
err:   D3D11: Invalid blend op: 20277764
err:   D3D11: Invalid blend factor: 3100260
err:   D3D11: Invalid blend op: 49117152
err:   D3D11: Invalid blend factor: 49020928
err:   D3D11: Invalid blend factor: 1734960462
err:   D3D11: Invalid blend op: 1919902312
err:   D3D11: Invalid blend factor: 49114064
err:   D3D11: Invalid blend factor: 3080
err:   D3D11: Invalid blend op: 20277560
err:   D3D11: Invalid blend factor: 2076649185
err:   D3D11: Invalid blend factor: -1
err:   D3D11: Invalid blend op: 2076654139
err:   D3D11: Invalid blend factor: 49100232
err:   D3D11: Invalid blend factor: 3080
err:   D3D11: Invalid blend op: 20277656
err:   D3D11: Invalid blend factor: 2076657409
err:   D3D11: Invalid blend factor: 2120708096
err:   D3D11: Invalid blend op: 268970376
err:   D3D11: Invalid blend factor: 49161104
err:   D3D11: Invalid blend factor: 49114072
err:   D3D11: Invalid blend factor: 49020928
err:   D3D11: Invalid blend factor: 2077282304
err:   D3D11: Invalid blend op: 3080
err:   D3D11: Invalid blend factor: 269485392
err:   D3D11: Invalid blend op: 49020948
err:   D3D11: Invalid blend factor: 1038516736
err:   D3D11: Invalid blend factor: 49021112
err:   D3D11: Invalid blend op: 24
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
warn:  D3D11Device::CreateShaderModule: Class linkage not supported
  • dxgi.log:
info:  Enabled instance layers:
info:  Enabled instance extensions:
info:    VK_KHR_surface
info:    VK_KHR_win32_surface
info:  AMD RADV POLARIS10 (LLVM 6.0.0):
info:    Driver: 17.3.7
info:    Vulkan: 1.0.57
warn:  Vulkan extension VK_KHR_maintenance2 not supported
info:  Enabled device extensions:
info:    VK_AMD_rasterization_order
info:    VK_KHR_descriptor_update_template
info:    VK_KHR_maintenance1
info:    VK_KHR_shader_draw_parameters
info:    VK_KHR_swapchain

UPDATE
I have missed 87d6fde, but with that, game runs, but everything is black.

bug

All 25 comments

Can't debug without an apitrace.

Also, it makes very little sense that 54382ae is causing the issue since it actually makes shaders compile that otherwise would just fail to compile. Did the commit right before that work?

Also, please don't use Mesa 17.3.7, use mesa-git instead.

You were right. It is caused by 19e0829 which I have accidentally skipped in initial testing and in later check.
Since mesa 18 was planned for release yesterday, I'll wait for it. I hope that mesa 18 will be fine for testing.
This might be renderer bug as well, since it is not exactly pinnacle of safe software - it does very little error checking. This might be reason why it does not work in wine, not even with native d3d11_43 and just segfaults.

I have also found, that it failed with same error even for some people on Windows.

Hm, interesting. Can you try commenting out these lines:
https://github.com/doitsujin/dxvk/blob/master/src/dxgi/dxgi_output.cpp#L193-L194

It works!

Alright, thanks for testing that.

So it's an issue with how the DXGI part enumerates resolutions. No idea how to fix that to be honest, especially without breaking other games (like Dark Souls 3), where the old code caused issues.

Maybe time will tell.
For now, I might be only person who plays G2 with GD3D11 in wine. I'll be more than happy to write my personal build script that will remove the lines. Now I can play G2 in 60 FPS instead of around 17 in city with stock DX7 renderer.
Many thaks for DXVK and for solution to my problem.

I have added game name and renderer name into title so others could find this if necessary.

One thing you could actually try is to record an apitrace with the broken version of DXVK. It won't get you any further, but getting an idea of what the game is trying to do and where it's failing would be helpful.

I have something better - native apitrace: https://drive.google.com/file/d/1vRNuUjEcUcByC_oh4Kg-hWO-HLTvpFGp/view?usp=sharing (267.7 MiB compressed; 519 MiB extracted). I had to rewrite imports in game exe file to load "ddrav.dll" instead of "ddraw.dll" (I have renamed ddraw.dll of GD3D11 to ddrav.dll) and then it worked with native d3d11_43. For some reason WINEDLLOVERRIDES="d3d11_43=n;ddraw=n" or "n,b" was not working and caused segfault (propably GD3D11 bug or weird interference with wine). Now the game works... with 2 FPS, but it does at last. There are some wirds thing, like short flashes of texts over the screen and white ground for short period of time when I loaded save game. This does not happen with DXVK - game works perfectly with it. Well, except for the settings dialog - works with native d3d11_43 but crashes with DXVK (that dialog is in the trace file too).
Quite interestingly, d3dretrace of captured trace works with clean wine and renders exaclty the same as game running with native d3d11_43. Is it normal? I'd expect that it would not work, when game itself does not work with clean wine.

Proof that game works with DXVK and that it's not just my imagination:
screenshot_20180325_140205
I run it with
WINEDLLOVERRIDES="dxgi,d3d11=n;ddraw=n,b" wine Gothic2.exe

Thanks, will take a look at it later.

Can you test this again with the latest commit?

Looking at your apitrace file, I don't really see anything that would cause such an issue. There's something else though, the game seems to be using Direct3D 10.1 on top of D3D11 - which is weird, and currently doesn't work on DXVK at all. I'm quite surprised that the game even runs.

No change, but workaround with deletion of two lines still works.
Also after around 5 minutes something broke and huge chunk of land and some walls got covered in grass. I have never seen it before, but I guess it is just some random driver or GD3D11 bug and I was lucky it never happended before (I am still on mesa 17).
Could there be some kind of dynamic selection beween 10.1 and 11 and it chose 10.1 with native d3d11_43? If you tell me, what in particular is supposed to not work, I'll look into source code of GD3D11 and check that out.

@neVERberleRfellerER How did you exactly changed the imports of the Gothic2.exe ?
Because i get this error:
0009:err:module:attach_dlls "ddrav.dll" failed to initialize, aborting

@MordragTV Just rewrite it in exe with hex editor. I think there was just one near the end. Beware that you do NOT have to do this when you plan to use DXVK. Rewriting imports was only necessary to run the game with native d3dx11_43 but that way it runs only at 4 FPS max.

Update:
@doitsujin @MordragTV Big news: I screwed here badly. Game was loading forgotten native d3dx11_43 from game directory. I didn't even know it's possible to use DXVK with native d3dx11_43 and I have not found any mentions of this combinations on the Internet. I am sorry for misleading infomation in this thread.
Summary:

  • wined3d: crash
  • wined3d + native d3dx11_43: crash
  • wined3d + imports hack + native d3dx11_43: works but incredibly slow
  • DXVK: crash
  • DXVK + native d3dx11_43: D3DXERR_CAPSNOTSUPPORTED
  • DXVK with 2 line workaround + native d3dx11_43: works!

(these are results of new tests)

Mhh maybe i am doing something wrong but when i comment out those two lines my build fails.
I have to comment out the lines from 210 to 212, too
210 mode.Scaling = isStretched 211 ? DXGI_MODE_SCALING_STRETCHED 212 : DXGI_MODE_SCALING_CENTERED;
But when i then try to start gothic i get access violation fail
This is my Wine Bash Output https://pastebin.com/YuhWpATj
And this is the Access Violation Error Message http://i.imgur.com/AdDw4qQ.png
I tried to install dotnet and vcruntimes but i somewhat get the feeling the error layes in the d3d11.dll and dxgi.dll. I get no output in the d3d11 and dxgi logs neither.
I start it with env DRI_PRIME=1 WINEPREFIX=/home/tom/.wineprefix/gothic-dxvk WINEARCH=win32 WINEDLLOVERRIDES=dxgi,d3d11,ddraw=n wine '/home/tom/.wineprefix/gothic-dxvk/drive_c/Program Files/JoWooD/Gothic II/System/Gothic2.exe'

@MordragTV Your WINEDLLOVERRIDES is wrong. It must be exactly
WINEDLLOVERRIDES="dxgi,d3d11=n;ddraw=n,b"
Notice the "n,b" instead of "n" and the semicolon and... well, just copy it. It works for me

You are suppoosed to comment ONLY
https://github.com/doitsujin/dxvk/blob/e06300d592f17ade25511e4f92a679192f1d8df3/src/dxgi/dxgi_output.cpp#L196-L197
original comment references master, but lines were pushed down since.

Well youre right i commented out the wrong lines . Now the build runs flawlessly.
But i get stil the Access Violation Error altough it is a different now and the d3d11 and dxgi logs got output now ,too.
Did you install any packages in wine like dotnet ?

@MordragTV Hmm. I have these native DLLs in my Gothic2/System directory:

  • D3DCompiler_43.dll
  • d3dcompiler_47.dll
  • d3dx11_43.dll

Both D3DCompilers are from GD3D11 package (i think). If not, you can get them from http://www.dege.freeweb.hu/dgVoodoo2/dgVoodoo2.html . The d3dx11_43.dll is from DX redistributables - you can get it from Windows or from winetricks (I have NOT installed it into my main wineprefix - I have just put that one DLL in my Gothic2/System directory, but even installing it directly should work - UNTESTED!!). Then you need directmusic/dsound as stated in wine wiki - I have these in my main wineprefix installed using winetricks. Without dsound and directmusic game crashed with music enabled.

Thank you for helping me i am getting closer to get the game to work.
It seems like not every version of the Directx11 Renderer works.
I tried to use the x17 version from degenerated wich wont work.
Now i downloaded the x14 version ... The game starts but ingame are really weird glitches and as soon as i try to get in the settings with f11 the game crashes.
Maybe this has something to do with unimplemented features.
Can u maybe send me the link to youre gd3d11 version because i cant find it on google.

@MordragTV I have the one from Liker, which is used in Returning 2.0:
https://yadi.sk/d/GoU3_0_L3GMPJh
Settings don't work with DXVK. I am using default settings. It works with wind3d+d3dx11_43+imports hack, but settings decrease FPS to something between 0 and 1 and changing settings freezes the game (maybe it would work after more minutes of waiting, but I doubt).

Update: it's actually 17.5, not 14.5. Sorry. I have updated OP.

@neVERberleRfellerER Its working now!
Just had to install a 4gb patch and now everything exept the settings work.

@neVERberleRfellerER Can you test if bb3e3c9e4f15e5232d1a60ffbda00d9fd55064c4 fixes the issue?

@doitsujin It works. Thanks a lot for everything.

@neVERberleRfellerER do you happen to have a gist or some notes available on how to use gothic2 with dx11renderer on linux with wine through dxvk? that dx7 renderer is really not that geat :o
I've got my old gothic2 gold install from original cd's still in my prefix, and I've got a spine.exe with wine-5.7 (didn't work prior to that due to missing symlink support), so that should enable me to follow any instructions.

@stefson There isn't much to document. Make sure you have working DXVK. Then just download your favourite GD3D11 version (I use https://github.com/Kirides/GD3D11 - binaries are available in Releases) and extract it to your Gothic/System directory. And that's it. I don't use Spine.

@neVERberleRfellerER it never worked for me, but after some time I realized that one has to set an additional dll override for ddraw. This is discouraged, yet it doesn't work otherwise. Tested with this version of dx11 renderer: https://www.worldofgothic.de/download_590.htm

Was this page helpful?
0 / 5 - 0 ratings

Related issues

linuxwrper picture linuxwrper  路  4Comments

ThePiggyBanks picture ThePiggyBanks  路  5Comments

HunterCZ122 picture HunterCZ122  路  4Comments

torokati44 picture torokati44  路  4Comments

knuxyl picture knuxyl  路  5Comments