hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.03k stars 2.15k forks source link

Metal Gear Acid 2 severe performance regression D3D11, AMD graphics glitches #17680

Closed oboewan42 closed 5 days ago

oboewan42 commented 1 year ago

Game or games this happens in

ULUS-10077 - Metal Gear Acid 2

What area of the game

After new game.

Speed seen in PPSSPP

76.7% (26/30) - fluctuates

GE frame capture and debug statistics

image ULUS10077_0001.zip

Platform

Windows

Mobile phone model or graphics card

AMD RX480

PPSSPP version affected

v1.15.4

Last working version

v1.13.2

Graphics backend (3D API)

Direct3D 11

Any other notes or things you've tried

Regression from 1.13.2 to 1.14 - performance dropped by over 90% between those two versions. Used to get 1000% speed or so when setting speed to unlimited, now the game struggles to hit fullspeed.

Checklist

anr2me commented 1 year ago

Were you using the release version 1.15.4 ? Have you tried the latest dev/git build from https://buildbot.orphis.net/ppsspp/ ?

hrydgard commented 1 year ago

That is quite weird indeed! Going to have to investigate. Wonder why it would be AMD-only, if it is...

oboewan42 commented 1 year ago

Did some more testing, with an updated git build (1.15.4-549-g6b574e97), since I recently ran into some AMD driver issues and I thought it might be related (it's not). Turns out that it works fine on D3D9 backend, the slowdown is only there on D3D11 and OpenGL.

The Vulkan backend runs at OK speed, but has broken graphics. ULUS10077_0002.zip ULUS10077_00002

unknownbrackets commented 1 year ago

It would help a lot if you could try some builds in between to find when the performance got worse.

Mathematically, the fastest way to do this is to go by halves. For example, there were 4371 separate improvements/changes between v1.13.2 and v1.15.4. You noted this happened in v1.14.x too, that's only 2513 changes.

That may sound like a lot, but you can actually figure out the cause most of the time with around 11-12 tries for 2500 changes. Unfortunately, some of the oldest builds aren't even available anymore. Could you try the oldest build here and see?

https://buildbot.orphis.net/ppsspp/index.php?m=fulllist

If we can narrow it down, it makes it a lot easier to fix most of the time.

-[Unknown]

oboewan42 commented 1 year ago

Did some more investigation and it looks like two separate issues.

On the D3D11 backend, the oldest build on the list (v1.13.2-1900-g7c5ddcecb) does still have the issue, so it happened some time between 1.13.2 and then. However I also noticed that it only affects the x64 build, not the x86 build.

On the OpenGL backend, the regression actually happened all the way back between 1.10.3 and 1.11. (Then again, AMD's OpenGL performance under Windows specifically is notoriously terrible.)

Unfortunately the Vulkan issue I mentioned earlier appears to be inconsistent; sometimes it works fine and sometimes it doesn't. It might have something to do with me fast forwarding through the opening logos and such.

hrydgard commented 1 year ago

So this is weird. I'm finally in a position to try to reproduce this, I've put a used RX480 in my old PC.

I seem to be getting maybe a partial repro, OpenGL is slower, but that might be because we're not applying the clever frame reordering we do in Vulkan in this game. Rendering is correct in all backends and Vulkan and D3D11 seem to perform about as expected.

This is with the latest drivers and the latest builds.

hrydgard commented 9 months ago

A lot of changes have happened since this was reported, wouldn't surprise me if this is better now - please test!

kirbysuperstar commented 5 months ago

It seems to run okay in both OGL and DX11 on Windows now at least. Vulkan is still very broken, visually. On Android (RP4+), Vulkan runs well but is visually broken while OGL works but does not run well and gives slowdown warnings during gameplay, even at 1x resolution.

hrydgard commented 5 days ago

The problem on Vulkan seems to be that the "renderArea" property of render passes is not correctly merged, when we merge render passes in the game-specific Vulkan optimization. Oops! Will fix.