HansKristian-Work / vkd3d-proton

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

CP77 DXR freeze #652

Closed aguinet closed 2 years ago

aguinet commented 3 years ago

Hello everyone,

For the record, I tried Cyberpunk 2077 with DXR activated. Activating DXR in the game config works, but then it freezes after a few seconds of rendering in the actual game. I have to kill the process with kill -9. I tried to gdb into the process, but I don't really know which thread should I inspect to debug this...

I launched the game from Steam, using Proton experimental [1]. The command line is the following:

VKD3D_CONFIG=dxr %command% --launcher-skip

I use the official Nvidia driver through their official installer, version 465.24.02.

I verified that raytracing works natively on my setup with https://github.com/GPSnoopy/RayTracingInVulkan .

[1] ~/.local/share/Steam/steamapps/common/Proton - Experimental$ cat version 1619725651 experimental-6.3-20210429

kakra commented 3 years ago

This happens for me, too. Seems to also affect Control (it freezes early in the logo screens or on a black screen, very rarely getting to the menu screen, it would then freeze when continuing your savepoint).

CP77 first launched up the menu, then froze a few seconds within the game. Successive launches then made it crash until I disabled DXR again.

luigifcruz commented 3 years ago

In my case, Control works flawlessly and Cyberpunk hangs on load.

Continous commented 3 years ago

This is almost certainly an issue with VKD3D's incomplete implementation of DXR, as through my testing Cyberpunk does not hang simply on enabling of DXR. If you enable DXR but do not enable any of the other features, while the game does run like dogshit; the game does not crash. At all. It is only if you enable Raytraced Lighting, Sun Shadows, or Reflections that Cyberpunk 2077 will crash.

Tracking issue #154 maybe be more productive and relevant.

shmerl commented 2 years ago

Just for the reference, combining recent radv with RADV_PERFTEST=rt (RX 6800 XT) and recent vkd3d-proton, CP2077 simply doesn't allow enabling ray tracing in the settings since it claims the card doesn't support it.

I guess you can force it in the config file manually somewhere.

Continous commented 2 years ago

This may be because the RADV version properly reports only supported extensions, as opposed to just any and all RT extensions.

shmerl commented 2 years ago

@Continous: judging from #154, vkd3d-proton still doesn't support much so it's likely not a radv issue.

Joshua-Ashton commented 2 years ago

It probably is a RADV issue, it works on NV.

shmerl commented 2 years ago

Is #154 missing some info on the progress? I see like all checkboxes are unchecked.

shmerl commented 2 years ago

Is there some way to see in some log what is missing in radv that CP2077 doesn't detect DXR support?

Joshua-Ashton commented 2 years ago

It does detect DXR support.

shmerl commented 2 years ago

In CP2077 it just doesn't allow to turn it on in the UI with a tooltip "Requires a DXR-ready graphics card". So how can you see that it detects it?

From my vulkaninfo

RADV_PERFTEST=rt vulkaninfo | rg -i raytrac
VkPhysicalDeviceRayTracingPipelinePropertiesKHR:
VkPhysicalDeviceRayTracingPipelineFeaturesKHR:
        rayTracingPipeline                                    = true
        rayTracingPipelineShaderGroupHandleCaptureReplay      = false
        rayTracingPipelineShaderGroupHandleCaptureReplayMixed = false
        rayTracingPipelineTraceRaysIndirect                   = false
Joshua-Ashton commented 2 years ago

Are you setting VKD3D_CONFIG=dxr?

shmerl commented 2 years ago

Ah, that must be it, I didn't know I need that env var. Let me try that.

shmerl commented 2 years ago

Yep, that was it, thanks!

It detects it now and allows playing around with settings, but crashes when I for example tried to enable ray traced lighting.

0114:err:vkd3d_dxil_log_callback: dxil-spirv: Requested an alignment of < 4 bytes in RawBufferLoad with texel buffer. This is unimplementable.
0114:err:vkd3d_dxil_log_callback: dxil-spirv: Failed to emit instruction.
bmd7297 commented 2 years ago

I have the same problem with AMD (RADV).

I don't know how to help but I'm getting literally the exact same error.

I've set RADV_PERFTEST=rt VKD3D_CONFIG=dxr in the launch settings, but yeah it won't work in CP77.

Strangely it works just fine in Control (albeit with very low FPS), but it doesn't work like at all with CP77.

bmd7297 commented 2 years ago
[Information][ (0)] [TID 328][red-launcher]: Shutting down SSL manager.
libGL error: failed to create drawable
libGL error: failed to create drawable
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  5 (X_GLXMakeCurrent)
  Serial number of failed request:  2649
  Current serial number in output stream:  2649
0620:err:vkd3d_dxil_log_callback: dxil-spirv: Requested an alignment of < 4 bytes in RawBufferLoad with texel buffer. This is unimplementable.
0620:err:vkd3d_dxil_log_callback: dxil-spirv: Failed to emit instruction.
0620:err:vkd3d_dxil_log_callback: dxil-spirv: Failed to convert function.

There's the best log I can give.

jarrard commented 2 years ago

Got a 6800XT and mesa-git, tried RADV_PERFTEST=rt VKD3D_CONFIG=dxr in Control Ultimate Edition and well, upon loading it just freezes and soon after I must force restart the desktop. Once it causes graphical distortion on screen.

Its a shame AMD cards are still not ready for RT under Linux :(

shmerl commented 2 years ago

dxil-spirv: Requested an alignment of < 4 bytes in RawBufferLoad with texel buffer. This is unimplementable.

Unimplementable - does this mean some feature won't ever be supported or this isn't a blocker for ray tracing working in CP2077?

shmerl commented 2 years ago

I found out (just in case anyone wasn't aware) that at least radv is still missing some ray tracing Vulkan extensions, namely VK_KHR_ray_query, this impacts CP2077.

tizzir commented 2 years ago

As of the 1.5 update, the game hangs with a Nvidia GPU after just enabling raytracing in the graphics menu and returning to the game. This is without enabling any of the 3 raytracing effects (reflections/shadows/lighting.)

kakra commented 2 years ago

Update 1.5 also freezes the system hard when I tried opening the perks menu: The system no longer responded, audio looped, Alt+SysRq+B didn't reboot the system. Pressing the reset button took around 5 seconds before I could see the desktop slowly drawing from top to bottom, then the system rebooted. Looks like the GPU freezes.

NVIDIA 1660 Ti with 510 beta driver, Proton Experimental as of 2022-02-15, DLSS enabled, raytracing disabled

I didn't yet try to reproduce the problem. Similar freezes could be seen one time or another before, occurring seemingly random in the game but usually when opening the map, the perk tree or the inventory.

OTOH, performance seems to have much improved.

nalyDylan commented 2 years ago

I found out (just in case anyone wasn't aware) that at least radv is still missing some ray tracing Vulkan extensions, namely VK_KHR_ray_query, this impacts CP2077.

https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14565 I'm too lazy to build this merge and see if raytacing works but this is what you're looking for I believe.

There's a ton of work on raytracing being done for radv all of a sudden, assumedly in anticipation of the SteamDeck. Seems to be an all around net positive for AMD owners though

jarrard commented 2 years ago

Yeah the severe lack of RT feature and optimization (its less then half the perf of NVIDIA atm) has been whats made me consider a 4080 (if I get a pre-order in).

NVIDIA has made RT and DLSS work (with bugs) even within Proton which a surprising allot of games are adding support for. The only thing that stops me is the driver bugs with NVIDIA that can cause all sorts of problems and at times seem worse then radv for modern features like RT/DLSS. (bugs related to crashes or slow-downs, stutters..)

tizzir commented 2 years ago

FWIW, I am encountering these crashes on a NVidia 30 series GPU, with the most up to date feature driver.

I don't know if it's of any use, but when enabling logging, I see plenty of:

011c:err:vkd3d_dxil_log_callback: dxil-spirv: TODO: RDAT SubobjectTable is not handled
! RTPSO creation will likely fail.
011c:err:d3d12_state_object_parse_subobjects: Failed to parse DXIL library.

followed by even more:

0118:err:d3d12_device_GetRaytracingAccelerationStructurePrebuildInfo: Acceleration structure is not supported. Calling this is invalid.

This occurs when I start the game and turn on raytracing (which crashes the game.)

full log attached: cp2077rt.log

eaglemmoomin commented 2 years ago

Just to confirm with the 1.5 patch on a RTX 3080 and the 5.10 driver I also see a crash to desktop after enabling any RT options then trying to run the benchmark,

Lsfhv commented 2 years ago

also 1.5 patch on RTX 3070, with these launch options : VKD3D_CONFIG=dxr %command% --launcher-skip Crash to desktop after enabling any RT options in game.

shmerl commented 2 years ago

radv just implemented VK_KHR_ray_query and I tried enabling ray tracing in Cyberpunk 2077, but it's still hanging after that.

triffid commented 2 years ago

CP2077 (v1.52) doesn't even open a window for me if I specify VKD3D_CONFIG=dxr or dxr11, just thinks for a few seconds then exits.

I'm running the GOG build through lutris with nvidia drivers v510.54, DXVK v1.10L (L for lutris I guess), VKD3D v2.6, DXVK NVAPI v0.5.3, wine version "lutris-fshack-7.2-x86_64", and launch options -dx12 --launcher-skip -skipStartScreen with an RTX3070 GPU.

Works great without dxr, but it would be nice if I could make it a bit prettier…

eXt73 commented 2 years ago

CP2077 (v1.52) doesn't even open a window for me if I specify VKD3D_CONFIG=dxr or dxr11, just thinks for a few seconds then exits.

I'm running the GOG build through lutris with nvidia drivers v510.54, DXVK v1.10L (L for lutris I guess), VKD3D v2.6, DXVK NVAPI v0.5.3, wine version "lutris-fshack-7.2-x86_64", and launch options -dx12 --launcher-skip -skipStartScreen with an RTX3070 GPU.

Works great without dxr, but it would be nice if I could make it a bit prettier…

I can say it. While in version 1.3 it was possible to launch RT shadows and lighting [although with distortions - blue/metallic discoloration], but without RT reflections, from version 1.5 we have a crash immediately. Tested under NVIDIA RTX 3960 and the latest 510.60.02 drivers

sigzegv commented 2 years ago

I confirm on nvidia RT was working fine with CP77 v1.3, and totally crashes with v1.5.. Looks like a regression or maybe cdprojekt implemented a new thing on RT that is not in vkd3d yet ? ( nv drivers 510 )

shmerl commented 2 years ago

Ray tracing started working in Cyberpunk 2077 in latest Mesa main and vkd3d-proton without crashing the game! Performance is completely tanked though with ray tracing enabled 😆, but I wouldn't expect much from this generation of RDNA2 anyway.

Also, looks like some graphics might be not fully correct when ray tracing is enabled.

Set up: Sapphire Pulse RX 6800 XT, 2560x1440.

No RT:

cp2077_no_rt

RT (all options enabled, lighting setting on ultra):

cp2077_rt

eXt73 commented 2 years ago

Ray tracing started working in Cyberpunk 2077 in latest Mesa main and vkd3d-proton without crashing the game! Performance is completely tanked though with ray tracing enabled laughing, but I wouldn't expect much from this generation of RDNA2 anyway.

Also, looks like some graphics might be not fully correct when ray tracing is enabled.

Wow ... not bad ;) Under Nvidia the game still crashes right away ... my mistake ! Right, under the latest vkd3d implemented for GE-Proton7-19 works ;) Under optimized Kubuntu [our solutions netext73.pl], all over the ULtra - including RT + DLSS Balanced FullHD, it works great - Asus ROG Zephyrus G14 RTX 3060 6 GB VRAM 60 Watt > Nvidia 510.73.05 ;)

Screenshot_20220529_141405 Screenshot_20220529_141345 Screenshot_20220529_140308 Screenshot_20220529_140253

jp7677 commented 2 years ago

Actually it works really nice on NVIDIA RTX when using this PR/branch: https://github.com/HansKristian-Work/vkd3d-proton/pull/1094 (note this is still a draft PR). I needed some time to see the differences between RTX en non-RTX since I have no Windows to compare, but once you know where to look for differences (e.g. reflections in the water, shadows in the desert or shadows from bike headlights), it looks really stunning.

eaglemmoomin commented 2 years ago

Can confirm with Proton-GE-7.19 RT with NVidia RTX seems to be working. Running the benchmark actually works over several runs. Seeing 71 fps average on balanced with a 3080 and tweaked normal settings plus all the RT settings on at Psycho.

spinktvis commented 2 years ago

Confirmed working here as well, Proton GE 7.20. Amazing work! Performance hit is not as severe as I expected. Running on Ultra RT settings.

eXt73 commented 2 years ago

Unfortunately, there are some bugs - plant shadows in the case of a close source of light, e.g. a street lamp: Screenshot_20220529_183048

K0bin commented 2 years ago

And you're sure those bugs do not happen on Windows?

shmerl commented 2 years ago

There are definitely graphical bugs with radv at least. As I posted above.

I'm going to make another test shortly with a recent PR that improves performance.

eXt73 commented 2 years ago

And you're sure those bugs do not happen on Windows?

I do not have Windows on any machine = therefore I will not confirm it - is it a result of game errors or VKD3D implementation

shmerl commented 2 years ago

With pending PR !15030 for radv performance gets better with ray tracing than without it, though it's still not a playable level on those settings.

No ray tracing ~ 86 fps:

cp2077_no_rt

Ray tracing ~11 fps:

cp2077_rt

Notice also that visuals don't look correct (for example reflections don't seem to work at all), so things aren't fully implemented yet I assume.

jp7677 commented 2 years ago

Unfortunately, there are some bugs - plant shadows in the case of a close source of light, e.g. a street lamp:

From what I'm seeing, Proton GE uses vkd3d-proton from master. As stated earlier, you really need this (draft-) PR/branch https://github.com/HansKristian-Work/vkd3d-proton/pull/1094

eXt73 commented 2 years ago

Unfortunately, there are some bugs - plant shadows in the case of a close source of light, e.g. a street lamp:

From what I'm seeing, Proton GE uses vkd3d-proton from master. As stated earlier, you really need this (draft-) PR/branch #1094

Unfortunately, I do not have time to compile VKD3D on my own - so I will probably have to wait for these patches to be transferred to master and compilation by GE ;)

jarrard commented 2 years ago

Yeah AMDGPU+RADV are pretty terrible still. I doubt even RDNA3 will change that. Could be years before RT becomes viable for AMD cards under Linux.

NVIDIA REALLY have complete dominance if your even remotely interested in stuff like RayTracing and DLSS. Many still consider those two things fake and scam effects but their not.

I don't know how the AMDGPU-PRO or amdvlk does with RT but I wouldn't be surprised if it didn't even boot the game in most instances.

It's a real shame as RT under Windows for AMD cards is not terrible, normally about %30 slower then NVIDIA if you ignore DLSS!

jarrard commented 2 years ago

I do not have Windows on any machine = therefore I will not confirm it - is it a result of game errors or VKD3D implementation

I could test this out under Win10 sometime. (win10 6800XT RT performance numbers if anyone wants them, ask) I have it on dual-boot backup (separate SSD) for testing purposes like this.
Allot of people using NVIDIA vs AMD RT comparisons forget they turn on DLSS. You gotta turn that off to really compare. It be nice if FSR2 was in more games but that will likely take a few years.

shmerl commented 2 years ago

Yeah AMDGPU+RADV are pretty terrible still. I doubt even RDNA3 will change that. Could be years before RT becomes viable for AMD cards under Linux.

Let's not get off-topic. It's about the stack not using hardware fully. It's very usable already if the driver would actually be optimized for it. And it indeed has nothing to do with DLSS. radv and vkd3d-proton are progressing there.

jarrard commented 2 years ago

It's very usable already if the driver would actually be optimized for it. And it indeed has nothing to do with DLSS. radv and vkd3d-proton are progressing there.

First sentence is contradiction. Secondly DLSS is relevant because people are DIRECTLY comparing AMD performance with NVIDIA+DLSS... Lets not do that shall we!

shmerl commented 2 years ago

Not sure what people are comparing, DLSS is irrelevant to the above really, so I agree that it's not appropriate to bring it into the comparison even.

mercuriete commented 2 years ago

Remember to enable dynamic resolution scaling and FSR to auto. I have a 6900XT and on windows I need to enable that in order to have 60fps on cyberpunk.

I will do some test on my gaming rig when I have some time.

thanks to the vkd3d-proton team for the amazing job :)

atomicflag commented 2 years ago

Is this arfifact (it's a recent CI run from #1094) a debug or a release build? Can we use that until it's merged upstream/GE?

It seems to work fairly well but the perf diff is noticable.

tizzir commented 2 years ago

@coffee-lord I'm not sure about the artifact you've linked, but here is a version I've compiled that seems to work just fine for all RT features in the game: cp2077rt_vkd3d-proton.zip .