HansKristian-Work / vkd3d-proton

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

Fix Persona 3 Reload performance #1877

Closed HansKristian-Work closed 6 months ago

HansKristian-Work commented 6 months ago

DXIL PR: https://github.com/HansKristian-Work/dxil-spirv/pull/183

Root cause was some very broken shaders that caused horrendous spilling. DXC apparently fails to optimize some alloca() -> store -> load patterns properly, so we have to do it :( Apparently AMD native managed to optimize through it, which is likely what caused Windows to run much faster.

So far I've yet to see a section below 60 fps on Deck with RT off / medium shadows, but I haven't tested exhaustively of course ... Tartarus blue lights and Velvet room both hit 60 for me easily now at least. Point lights had associated shaders that triggered the massive slowdown.

Before:

gamescope_2024-02-05_23-22-49

After:

gamescope_2024-02-05_23-24-45

Settings:

gamescope_2024-02-05_23-24-59

(game throttles itself to 30 on settings)

Performance on my RX 7600 was boosted with 40% in 4k on the Tartarus light.

This opt also affects a bunch of other games to various degrees, but it's unsure how much perf is improved. For our testers to go through to make sure there are no regressions. Anything not pinned to Proton Stable is of particular interest here.

Lacroixs commented 6 months ago

Huh, interesting. Is there a way for us to test this out? Esp curious about how performance is on the Steam Deck now

HansKristian-Work commented 6 months ago

It should hit Proton Experimental bleeding edge within an hour. It should hit a non-bleeding edge build eventually, but I don't have exact timeline on that.

Lacroixs commented 6 months ago

Thank you for your hard work, I have almost no knowledge on this stuff so i am glad you guys work so diligently on this.

Logge1002 commented 6 months ago

If you change the fps to 60 the menus are 60 as well. Hope with this the steam deck performance will finally be up to snuff. Because it's otherwise extremely enjoyable on the deck!

runar-work commented 6 months ago

Testing with RX 7600 and (mostly) Mesa 23.3.5 on 6.7.3-arch1-2. Didn't see any signs of regressions while testing in:

I had to use latest Mesa main for F1 2021 to avoid GPU hangs, but had no issues with that version.

Lacroixs commented 6 months ago

Issue with Monad area in p3r, drops are horrid down to 20, the lighting is quite intense so I think that might be the case.

HansKristian-Work commented 6 months ago

Issue with Monad area in p3r, drops are horrid down to 20, the lighting is quite intense so I think that might be the case.

And that's with these changes? Are there save files for anyone to repro?

simifor commented 6 months ago

Didn't notice a measurable difference in Guardians of the Galaxy. Tested on a RX 6600, Mesa 23.3.5 on 6.7.3-arch1-2.

PiTTi616 commented 6 months ago

Weird. I still have the same issues in windows with a amd processor and igpu. Any idea why this happens?

runar-work commented 6 months ago

A few more tests:

I tested Resident Evil 4 on Deck with main OS.

runar-work commented 6 months ago

Last ones for today:

PenguinRap commented 6 months ago

Working great with Daily Life/Tartarus! (Medium Shadows/100% Resolution/RT OFF) However I did see drops to the 30/40's during the 1st Full Moon boss area. Not sure if due to the shaders or not but that was the first instance of seeing some major drops since this fix. Thanks again for all the hard work so far!

HansKristian-Work commented 6 months ago

We've root caused why Velvet Room and some other places drops below 60. The game relies on very inefficient use of GS to render shadow maps.

https://gitlab.freedesktop.org/mesa/mesa/-/issues/6260#note_2272979

I had another place in floor 22 where I dipped to about 51 fps, but with the proposed "fix" I hit 60 fps.

runar-work commented 6 months ago

I've tested Elden Ring (both on desktop and deck) and Cyberpunk and didn't see any issues there either.

Logge1002 commented 6 months ago

Any improvements on stranger of paradise with this? Ran horrible on steam deck before but maybe someone could check that?

mbriar commented 6 months ago

@Logge1002 definitely not with this, SoP uses d3d11.

edit: if you were referring to the RADV_DEBUG=nongg workaround and not about the changes from this PR, that might have an effect, though i'd guess it's somewhat unlikely since all the other games affected seem to be UE4-based.

Blisto91 commented 6 months ago

Checked a few with no issues found:

Tested on a RX 6800 with a couple of days old mesa main

StoryArts commented 6 months ago

We've root caused why Velvet Room and some other places drops below 60. The game relies on very inefficient use of GS to render shadow maps.

https://gitlab.freedesktop.org/mesa/mesa/-/issues/6260#note_2272979

I had another place in floor 22 where I dipped to about 51 fps, but with the proposed "fix" I hit 60 fps.

Is there a way to use this fix or is it coming to proton experimental (bleeding-edge)?

HansKristian-Work commented 6 months ago

We've root caused why Velvet Room and some other places drops below 60. The game relies on very inefficient use of GS to render shadow maps. https://gitlab.freedesktop.org/mesa/mesa/-/issues/6260#note_2272979 I had another place in floor 22 where I dipped to about 51 fps, but with the proposed "fix" I hit 60 fps.

Is there a way to use this fix or is it coming to proton experimental (bleeding-edge)?

you can experiment with it by using launch options RADV_DEBUG=nongg %command%. Expect some shader compilation stutter on first run however. A proper fix needs Mesa work though, this isn't really something we can work around in vkd3d-proton.

StoryArts commented 6 months ago

We've root caused why Velvet Room and some other places drops below 60. The game relies on very inefficient use of GS to render shadow maps. https://gitlab.freedesktop.org/mesa/mesa/-/issues/6260#note_2272979 I had another place in floor 22 where I dipped to about 51 fps, but with the proposed "fix" I hit 60 fps.

Is there a way to use this fix or is it coming to proton experimental (bleeding-edge)?

you can experiment with it by using launch options RADV_DEBUG=nongg %command%. Expect some shader compilation stutter on first run however. A proper fix needs Mesa work though, this isn't really something we can work around in vkd3d-proton.

Ah I see, I'm going to assume a fix like this is probably going to come after a quite a bit of time. Disappointingly, the windows version has shader compilation stutter as well so I'd probably wait just for the pre-complied shaders on SD.

HansKristian-Work commented 6 months ago

There's a pending Mesa MR to resolve this, I'll keep an eye out for when it lands on devices.

Lacroixs commented 6 months ago

@HansKristian-Work does this mesa mr update need to be manually applied?

HansKristian-Work commented 6 months ago

@HansKristian-Work does this mesa mr update need to be manually applied?

For Deck, you should just wait until an update is shipped. The mesa MR basically applies the nongg hack only for the troublesome geometry shaders, where nongg is just a very crude hack to get the same effect (but all normal vertex shading is a bit slower as a result).

Lacroixs commented 6 months ago

@HansKristian-Work does this mesa mr update need to be manually applied?

For Deck, you should just wait until an update is shipped. The mesa MR basically applies the nongg hack only for the troublesome geometry shaders, where nongg is just a very crude hack to get the same effect (but all normal vertex shading is a bit slower as a result).

Oh I see. I assume we can expect this in a week or so? Hoping this fixes more than just one game though, also all across the board should be benefited from this

Logge1002 commented 6 months ago

Would Judgment improve with that hotfix?

runar-work commented 6 months ago

More tests without any noticeable issues:

On 6.7.4-arch1-1:

HansKristian-Work commented 6 months ago

@HansKristian-Work does this mesa mr update need to be manually applied?

For Deck, you should just wait until an update is shipped. The mesa MR basically applies the nongg hack only for the troublesome geometry shaders, where nongg is just a very crude hack to get the same effect (but all normal vertex shading is a bit slower as a result).

Oh I see. I assume we can expect this in a week or so? Hoping this fixes more than just one game though, also all across the board should be benefited from this

Mesa fix is live on preview branch.

Lacroixs commented 6 months ago

Thank you

runar-work commented 6 months ago

Also tested these without any noticeable difference or issues:

I had some initial launch issues with Uncharted, but I wasn't able to reproduce it later, so it seems to have been unrelated.