HansKristian-Work / vkd3d-proton

Fork of VKD3D. Development branches for Proton's Direct3D 12 implementation.
GNU Lesser General Public License v2.1
1.91k stars 199 forks source link

Dying Light 2: raytracing effects don't function #990

Closed tizzir closed 2 years ago

tizzir commented 2 years ago

Dying light 2 requires D3D feature level 12_1 to be available before it presents raytracing options in the menu.

After launching the game with VKD3D_FEATURE_LEVEL=12_1 or VKD3D_FEATURE_LEVEL=12_2 (alongside VKD3D_CONFIG=dxr11,) all raytracing options are present in the menu, but none of them appear to work, with the game logging the following at initialization:

[dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl'
[dx12] Detected shader model: 6.5
[dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl' failed, raytracing will be disabled

I am assuming that feature level 12_1 has not been implemented yet in vkd3d-proton?

I'm not sure if it's of any use, but I've attached the VKD3D log with VKD3D_DEBUG VKD3D_SHADER_DEBUG set to warn. dl2-vkd3d.log

Please let me know if there's anything else I can do.

doitsujin commented 2 years ago

Doesn't look like the game is trying to actually compile any raytracing pipelines, maybe it's trying to invoke DXC or something and that fails? Can you post the full Proton/Wine log?#

FWIW, for FL 12_1 the only thing we're missing is rasterizer ordered views, which doesn't have a widely supported Vulkan equivalent and is also not really being used by any games, so the override should be fine. We'd be seeing errors if there were missing features.

eXt73 commented 2 years ago

I can confirm what tizzir wrote. ... ok I can CONFIRM that under Proton-7.1-GE-2 full Ray Tracing works with the settings [for me]:

mangohud PROTON_HIDE_NVIDIA_GPU=0 PROTON_ENABLE_NVAPI=1 VKD3D_FEATURE_LEVEL=12_1 VKD3D_CONFIG=dxr11

https://www.dropbox.com/sh/gslz3u0mr4n9daq/AAA8yOPNe3Hz-2QeAwQ0tLW5a?dl=0

ghost commented 2 years ago

RT crashes if I enable DLSS:

39929.166:010c:0110:warn:debugstr:OutputDebugStringA "{21:01:15.698} INFO: [INFO] > [dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl' failed, raytracing will be disabled" 39929.166:010c:0110:trace:seh:dispatch_exception code=40010006 flags=0 addr=000000007B01241E ip=000000007B01241E tid=0110 39929.166:010c:0110:warn:seh:dispatch_exception "{21:01:15.698} INFO: [INFO] > [dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl' failed, raytracing will be disabled"

It's not consistent, sometimes it crashes when I switch DLSS mode and sometimes it does it at startup(it no longer starts when it happens). I used the settings from the previous user.

ghost commented 2 years ago

This is what happens if I enable RT without DLSS: https://pastebin.com/geUkzR5U

XapaJIaMnu commented 2 years ago

I can confirm ray tracing works for me (no DLSS), but the game crashes at certain points, every time you reach them. Eg, the first cut scene where the zombie bytes you (It's easy to skip the crash by pressing space a few times before the problematic scene is loaded).

The second place where this happens is the first time you have to pick a lock. Whenever you try to enter a lock pick menu, the black outline appears and then the game crashes. Log: https://pastebin.com/9Gj0WXP8

I haven't tried with ray-tracing off. Would someone be interested in an apitrace?

tizzir commented 2 years ago

@XapaJIaMnu have you confirmed that you're seeing the raytracing effects in action? I can enable the features in the menu, and the game continues to run, but the game remains visually identical, and the framerate does not change (I would expect a massive drop in performance based on how RT runs on Windows in this game.)

It should be pretty easy to tell it's enabled if you can see offscreen reflections in things like puddles.

XapaJIaMnu commented 2 years ago

Yeah I do see the ray tracing effect. My GPU usage and the memory usage also doubled when i turned it on. I don't have a windows machine to test it though.

eXt73 commented 2 years ago

Well, gentlemen, I can also connect in the RT menu - even I have a VRAM consumption of 8.5 GB ... but rather, the reflection of light in objects does NOT work, for example on the windows [even if it's turned on] ... what about to the rest - I am not sure either

https://youtu.be/Vq9oIinqNS0

XapaJIaMnu commented 2 years ago

For en the most noticeable Ray tracing thing was the different gamma that things take during the different day night stages. Very visible during the tutorial beginning. But maybe not everything displays properly? Idk

tizzir commented 2 years ago

@XapaJIaMnu it's good to hear that RT is working for you in some capacity! It's too bad the game doesn't let you progress very far because of that lockpicking crash... Maybe the crashing is localized to RT ON?

Was there anything particular you ended up doing to get RT functioning? I've been using Proton-GE 7.2-2 with VKD3D_FEATURE_LEVEL=12_1 VKD3D_CONFIG=dxr11 %command% -nologos launch attributes, and I'm still seeing

[dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl' failed, raytracing will be disabled

in the game's logs, and no visual/performance differences with RT enabled.

I've also tried including PROTON_ENABLE_NVAPI=1 in those launch parameters.

I'm using a Nvidia RTX 3080 Ti with version 510.54 drivers.

eXt73 commented 2 years ago

Ok, I do not understand some of this - on Zephyrus G14 with RTX 3060 [6 GB VRAM] it looks like it works ... look at the number of fps ... and on Desktop with RTX 3060 12 GB I'm not sure ... same drivers, entries, kernel and Proton Experimental ... but that would be the weak mobile RTX? and that with DLSS performance ?

https://www.dropbox.com/sh/b6fzmbpat4xz93v/AAAorpQfWa7eZdcGU5o3iZfDa?dl=0

tizzir commented 2 years ago

@eXt73 You should be able to confirm if raytracing is loaded by taking a look at the game's log file, located at <proton prefix>/drive_c/users/steamuser/Documents/dying light 2/out/logs.

When it fails to load, I see the following in the latest log:

{09:08:55.963} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl'
{09:08:55.963} INFO: [INFO]       > [dx12] Detected shader model: 6.5
{09:08:56.485} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl' failed, raytracing will be disabled

Presumably, if RT is working you shouldn't see the failed message that I get.

doitsujin commented 2 years ago

I'd still like to know what the game is actually trying to do there, does it require system-wide dxcompiler.dll or something to compile those? It's fairly clear that it fails before even trying to do anything on the VKD3D side of things.

eXt73 commented 2 years ago

@eXt73 You should be able to confirm if raytracing is loaded by taking a look at the game's log file, located at <proton prefix>/drive_c/users/steamuser/Documents/dying light 2/out/logs.

When it fails to load, I see the following in the latest log:

{09:08:55.963} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl'
{09:08:55.963} INFO: [INFO]       > [dx12] Detected shader model: 6.5
{09:08:56.485} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl' failed, raytracing will be disabled

Presumably, if RT is working you shouldn't see the failed message that I get.

You're right, DL2 turns off RT ...:

{17:46:40.808} INFO: [Renderer] > [r_Initialize] Loaded from rd3d12_x64_rwdi.dll. {17:46:40.808} INFO: [Renderer] > [r_Initialize] Asked for DXRT {17:46:40.851} INFO: [INFO] > [dx12] Allow Tearing: 1 {17:46:40.851} INFO: [Renderer] > Adapter 0: NVIDIA GeForce RTX 3060 12288MB/23942MB/0MB {17:46:40.851} INFO: [Renderer] | Output 0: [0,0 - 1920,1080] \.\DISPLAY1 {17:46:40.852} INFO: [Renderer] > Sorted adapter 0: NVIDIA GeForce RTX 3060 12288MB/23942MB/0MB ... {17:46:42.722} INFO: [INFO] > [dx12] Allocating new heap 'buffer_vb [heap_0042]' (134217728 B | 128 MB) {17:46:42.731} INFO: [INFO] > [dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl' {17:46:42.731} INFO: [INFO] > [dx12] Detected shader model: 6.5 {17:46:43.138} INFO: [INFO] > [dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl' failed, raytracing will be disabled[dx12] Allocating new heap 'texture_immediate [heap_0043]' (67108864 B | 64 MB) {17:46:43.605} INFO: [INFO] > [dx12] Failed to allocate 0MB in upload heap. It has 0MB of free space and 1428 allocated chunks. Flushing... {17:46:43.605} INFO: [INFO] > [dx12] Flushing uploads to 1259 resources {17:46:43.627} INFO: [INFO] > [dx12] Allocating new heap 'texture_immediate [heap_0044]' (67108864 B | 64 MB)

eXt73 commented 2 years ago

I'd still like to know what the game is actually trying to do there, does it require system-wide dxcompiler.dll or something to compile those? It's fairly clear that it fails before even trying to do anything on the VKD3D side of things.

Hi, I gave a few crash logs:

https://www.dropbox.com/sh/wc9di6jtq2dsc6t/AABx2c7JuozAihpyHsu4OxLga?dl=0

doitsujin commented 2 years ago

Those are fairly useless, can you post a full Proton log (preferably with a debug build of vkd3d and VKD3D_DEBUG=trace, although that might be too slow)?

eXt73 commented 2 years ago

Ok, I'll try - but only tomorrow evening ... today and tomorrow I will not be at home ;)

XapaJIaMnu commented 2 years ago

Hmm, you are right, I guess I don't see ray tracing:

{09:04:41.052} INFO: [INFO]       > [dx12] Allocating new heap 'buffer_vb [heap_0042]' (134217728 B | 128 MB)
{09:04:41.056} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl'
{09:04:41.056} INFO: [INFO]       > [dx12] Detected shader model: 6.5
{09:04:41.490} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl' failed, raytracing will be disabled[dx12] Allocating new heap 'texture_immediate [heap_0043]' (67108864 B | 64 MB)
{09:04:41.916} INFO: [INFO]       > [dx12] Failed to allocate 0MB in upload heap. It has 0MB of free space and 1428 allocated chunks. Flushing...
{09:04:41.916} INFO: [INFO]       > [dx12] Flushing uploads to 1259 resources
{09:04:41.935} INFO: [INFO]       > [dx12] Allocating new heap 'texture_immediate [heap_0044]' (67108864 B | 64 MB)

However the game definitely looks different between dx12 and dx12rt prefixes. I will try to post a debug log from vkd3d, when i find some time, unless someone beats me to it.

XapaJIaMnu commented 2 years ago

I cloned https://github.com/HansKristian-Work/vkd3d-proton , compiled with ./package-release.sh master /your/target/directory --no-package --debug Replaced d3d12.dll in $HOME/.steam/steam/steamapps/compatdata/534380/pfx/drive_c/windows/system32 with the newly compiled one, run the game with PROTON_LOG=1 VKD3D_DEBUG=trace PROTON_HIDE_NVIDIA_GPU=0 PROTON_ENABLE_NVAPI=1 VKD3D_FEATURE_LEVEL=12_1 VKD3D_CONFIG=dxr11 %command% And I got the following log: steam-534380.log.gz Not sure if I did everything right, but if I didn't, please correct me. It doesn't look like very useful output, or I have done something wrong.

eXt73 commented 2 years ago

I cloned https://github.com/HansKristian-Work/vkd3d-proton , compiled with ./package-release.sh master /your/target/directory --no-package --debug Replaced d3d12.dll in $HOME/.steam/steam/steamapps/compatdata/534380/pfx/drive_c/windows/system32 with the newly compiled one, run the game with PROTON_LOG=1 VKD3D_DEBUG=trace PROTON_HIDE_NVIDIA_GPU=0 PROTON_ENABLE_NVAPI=1 VKD3D_FEATURE_LEVEL=12_1 VKD3D_CONFIG=dxr11 %command% And I got the following log: steam-534380.log.gz Not sure if I did everything right, but if I didn't, please correct me. It doesn't look like very useful output, or I have done something wrong.

As you have done nice tests, I'm not doing it now and I'm waiting for any suggestions.

eXt73 commented 2 years ago

Those are fairly useless, can you post a full Proton log (preferably with a debug build of vkd3d and VKD3D_DEBUG=trace, although that might be too slow)?

Hi, have you been able to diagnose something about this topic ?

adamnv commented 2 years ago

From https://github.com/HansKristian-Work/vkd3d-proton/issues/990#issuecomment-1046087877 : 0110:fixme:d3d12_state_object_parse_subobjects: Got unsupported subobject association type 1.

... so, adding a case which handles type 1 (D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE) with, ahem, the simplest possible thing code can do, should do the trick.

...works here, anyway. :wink: I'd issue a one-liner PR for it but it'd have to wait until at least Monday.

tizzir commented 2 years ago

From #990 (comment) : 0110:fixme:d3d12_state_object_parse_subobjects: Got unsupported subobject association type 1.

... so, adding a case which handles type 1 (D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE) with, ahem, the simplest possible thing code can do, should do the trick.

...works here, anyway. wink I'd issue a one-liner PR for it but it'd have to wait until at least Monday.

Well I'll be... That really is all it takes to get the RT suite up and running on this game.

Now, in the game's own logs I see

{16:24:02.957} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_dbg_tlas.hlsl'
{16:24:02.957} INFO: [INFO]       > [dx12] Detected shader model: 6.5
{16:24:03.474} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_dbg_z.hlsl'
{16:24:03.474} INFO: [INFO]       > [dx12] Detected shader model: 6.5
{16:24:03.980} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_dbg_nrm.hlsl'
{16:24:03.980} INFO: [INFO]       > [dx12] Detected shader model: 6.5
{16:24:04.499} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_dbg_pos.hlsl'
{16:24:04.499} INFO: [INFO]       > [dx12] Detected shader model: 6.5
{16:24:05.007} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_dbg_uv.hlsl'
{16:24:05.007} INFO: [INFO]       > [dx12] Detected shader model: 6.5
{16:24:05.513} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_soft_shadows.hlsl'
{16:24:05.513} INFO: [INFO]       > [dx12] Detected shader model: 6.5
{16:24:06.125} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_lit.hlsl'
{16:24:06.126} INFO: [INFO]       > [dx12] Detected shader model: 6.5
{16:24:06.707} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_gi_diff.hlsl'
{16:24:06.707} INFO: [INFO]       > [dx12] Detected shader model: 6.5
{16:24:07.400} INFO: [INFO]       > [dx12] Loading DXRT shader 'dxrt_gi_spec.hlsl'
{16:24:07.400} INFO: [INFO]       > [dx12] Detected shader model: 6.5

I haven't tested each feature out one-by-one, but AO, reflections, and GI all seem to be working. Here's very terrible screenshot of my own character being reflected! Screenshot from 2022-03-06 16-26-57

@adamnv you have my sincerest gratitude for sharing your findings!

eXt73 commented 2 years ago

Hi, where in the code have you made the changes - because here I see it points to '1' ?

https://github.com/HansKristian-Work/vkd3d-proton/blob/bc40528b6fcdcfaeec52cc7a3f70328553877d1e/include/vkd3d_d3d12.idl

D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE = 1,

HansKristian-Work commented 2 years ago

... so, adding a case which handles type 1 (D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE) with, ahem, the simplest possible thing code can do, should do the trick.

As long as the subobject reference references only the single global root signature, this should be fine.

LemiSt24 commented 2 years ago

Hi, where in the code have you made the changes - because here I see it points to '1' ?

https://github.com/HansKristian-Work/vkd3d-proton/blob/bc40528b6fcdcfaeec52cc7a3f70328553877d1e/include/vkd3d_d3d12.idl

D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE = 1,

libs/vkd3d/raytracing_pipeline.c under line 554, add the following: case D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE:

so it looks like case D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_SHADER_CONFIG: case D3D12_STATE_SUBOBJECT_TYPE_RAYTRACING_PIPELINE_CONFIG: case D3D12_STATE_SUBOBJECT_TYPE_GLOBAL_ROOT_SIGNATURE: break;

HansKristian-Work commented 2 years ago

Do you want to PR that oneliner, or should I do it?

adamnv commented 2 years ago

Do you want to PR that oneliner, or should I do it?

If that was directed at me - I'm totally fine if you're okay Just Doing It. Happy to PR if you'd prefer though.

adamnv commented 2 years ago

Ah, https://github.com/HansKristian-Work/vkd3d-proton/pull/1026 ... cool.

LemiSt24 commented 2 years ago

Ah, #1026 ... cool.

@adamnv I didn't mean to step on anyone's toes here, if you wanted to PR this yourself I will ask @HansKristian-Work to revert mine (if that's possible). Sorry if this came across as me stealing your idea, I honestly thought it was directed at me since I was the last one to respond to the issue and stated the solution explicitly.

adamnv commented 2 years ago

It's totally fine, I'm just happy to see it in there. Thanks for doing the PR. :)

eXt73 commented 2 years ago

The newest GE-Proton7-9 already includes this patch - in my opinion everything [RT] works; Screenshot_20220308_092009 Screenshot_20220308_103144 Screenshot_20220308_123657 Screenshot_20220308_114342 Screenshot_20220308_110154 Screenshot_20220308_090220

tizzir commented 2 years ago

I agree; closing the issue. If there are DXR features that we realise are missing/broken later, we can re-open this ticket or create a new one.

Thanks!

eXt73 commented 2 years ago

It looks like after the 1.4 update RT = global lighting stopped working ... Screenshot_20220623_233328 Screenshot_20220623_233342

tizzir commented 2 years ago

Hmm, how frequently are you seeing the issue? I've played for a few minutes at nighttime on version 1.4.0 and haven't run anything anything looking too bright like that Screenshot from 2022-06-23 20-15-26

eXt73 commented 2 years ago

Hi, all the time ... since Update 1.4 - the same inside the rooms. Here I use your latest VKD3D build - the one with CP2077 patches

tizzir commented 2 years ago

Strange... On Nvidia, with driver 515.43.04, I'm not seeing that issue when using the default proton experimental VKD3D-Proton version.

eXt73 commented 2 years ago

Strange... On Nvidia, with driver 515.43.04, I'm not seeing that issue when using the default proton experimental VKD3D-Proton version.

hmm, maybe there are some changes that line 510 can't handle ... I'll check

eXt73 commented 2 years ago

ok, I uninstalled the game, reinstalled it and it's ok with 515 drivers ;) There must have been an error while updating. Screenshot_20220625_015910

Rabcor commented 2 months ago

Game won't launch if I enable raytracing steam-534380.log