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

Ravenswatch shader issue on Steam Deck #1706

Closed Vincent-P closed 1 year ago

Vincent-P commented 1 year ago

A specific decal shader is invisible most of the time. This issue happens only on Steam Deck, when there is no vulkan layer. (So the issue is not reproducible when capturing with Renderdoc or gfxreconstruct).

Software information

Ravenswatch, steam id: 2071280

System information

Steam Deck

Log files

I can provide logs privately in mail. There is not much vkd3d logs, a lot of:

10615.193:013c:0140:warn:vkd3d-proton:vkd3d_get_image_allocation_info: Padding allocation requirements. Requested alignment 4096 < 65536 (dim 3, 128 x 128 x 1, 1 levels, 1 samples, fmt #1c, flags #0).
10615.332:013c:0140:warn:vkd3d-proton:d3d12_pipeline_state_init_graphics_create_info: Ignoring stencilTestEnable due to lack of stencil aspect.

Which I assume is not important.

Blisto91 commented 1 year ago

Could you post a screenshot or video? And ideally also a save game if it isn't right at the beginning.

Which SteamOS version are you using? I assume Stable channel.

Vincent-P commented 1 year ago

Here is a screenshot with the decal (on Windows) and without (on Steam Deck) rw_decal_bad rw_decal_ok

To reproduce you don't need a save game, as some hero abilities have this issue. You can select Beowulf and hold down the shield ability. The steam deck is using "SteamOS Holo" 3.4.10

Vincent-P commented 1 year ago

I forgot to mention that I'm a dev on the game, and I wrote the entire D3D12 backend for the game. I'm more than happy to make changes to work around this, but I've had no luck with debugging so far.

Etaash-mathamsetty commented 1 year ago

could you try steam deck preview channel (steam os 3.5)?

K0bin commented 1 year ago

@Vincent-P You don't happen to use a depth bias for drawing the decal, do you?

HansKristian-Work commented 1 year ago

@runar-work or @Blisto91 Can you get a renderdoc capture of the game so we can study what the app is trying to do for that effect?

Blisto91 commented 1 year ago

rdna2 and rdna3 captures on Proton Exeperimental with radv 23.0.3 (driver i know it reproduces with) https://drive.proton.me/urls/8SGJ1TV4K0#8YVus33P41uV I can confirm that the issue doesn't reproduce when either renderdoc or gfxreconstruct is used.

It also seems like this might only be an issue with older radv drivers including the one on SteamOS stable. On desktop using 23.0.4 and above i have not been able to reproduce it an ditto when using beta SteamOS channel. But the exact cause is still being investigated.

HansKristian-Work commented 1 year ago

@Vincent-P I think I've root caused the issue:

In the fragment shader that renders the effect, you seem to have:

SamplerState bindless[] : register(space2, s1);

This ends up causing a subtle overflow in address computation in Mesa that was fixed in https://gitlab.freedesktop.org/mesa/mesa/-/commit/20b252c4c8ba23b3bb2d6cd0a4db7930b74ddb85.

I think you should be able to work around the bug by using: SamplerState bindless[] : register(space2, s0); instead.

I'll look into a workaround on vkd3d-proton's end though, since the code we emit for this scenario looks funny anyways.

It's possible this affects resources as well if you have arrays with register not equal to 0.

Vincent-P commented 1 year ago

Thank you! The workaround is working.