ppsspp icon indicating copy to clipboard operation
ppsspp copied to clipboard

Outrun 2006 [Vulkan performance issues]

Open Cristobal15 opened this issue 9 months ago • 18 comments

Game or games this happens in

ULES00262 - Outrun 2006

What area of the game

Problem location:

Single player / heart attack mode / Outrun 2006 SP / fourth stage (Left).

Description: During the race there are different missions to win hearts. In the fourth stage going left there is a mission to go through some hoops with fire to win hearts. In this moment the game suffers an abrupt fps drop. Resolution settings, filters, hacks or drivers do not affect the performance (I get 22fps no matter if I use 1X or 5X resolution). This does not happen with OpenGL where the performance is a constant 60fps.

Unfortunately I have no means to generate the adb log.

Speed seen in PPSSPP

32% (22/60 fps)

GE frame capture and debug statistics

No response

Platform

Android

Mobile device model or graphics card (GPU)

Adreno 650

PPSSPP version affected

v1.18.1-1502-gd07d7f7ec4.

Last working version

I can't track down a version where it works well.

Graphics backend (3D API)

Vulkan

Any other notes or things you've tried

No response

Checklist

  • [x] Test in the latest git build in case it's already fixed.
  • [x] Search for other reports of the same issue.
  • [x] Try resetting settings or older versions and include if the issue is related.
  • [x] Try changing graphics settings to determine if one causes the slowdown.
  • [x] Include logs or screenshots of issue.

Cristobal15 avatar Mar 28 '25 03:03 Cristobal15

https://youtu.be/F_6MSNi6MDo?si=tGNm2i6WEo71hqb8

Cristobal15 avatar Mar 28 '25 03:03 Cristobal15

@Cristobal15 Can you upload a savestate, maybe from around 10 seconds before it happens?

hrydgard avatar Mar 28 '25 07:03 hrydgard

Outrun.zip

Cristobal15 avatar Mar 28 '25 14:03 Cristobal15

I can confirm the sudden frame drops.

https://github.com/user-attachments/assets/bfd71aaf-68e3-46de-b76a-ae0cd25f4c17

But with psp emulated cpu to 111Mhz can avoid slow down in that particular area.

https://github.com/user-attachments/assets/e4a4fdc2-b8b1-4aa7-8fd3-0f7e9cd18adb

Unknowncat1991 avatar Mar 29 '25 06:03 Unknowncat1991

Well, it seems that with 111 it drops from 60 to 30 hz, and then it's able to handle whatever goes slowly there.. so it doesn't really fix it (as the slowness appears to be on the GPU for some reason)

Thanks for providing the save state!

hrydgard avatar Mar 29 '25 06:03 hrydgard

Thanks again for the state. Hm. I'm watching the rendering and our various performance counters when driving through that stretch, and there are two things that stand out:

  • We do an absurd amount of texture hashing (to detect changes, but there aren't any), not sure why we detect that some textures need re-hashing every frame but we do, and this is probably fixable. We spend a lot of CPU on that.
  • All those clouds create a lot of overdraw. But since resolution changes don't affect performance, this is probably not the cause. I assume you don't have MSAA set to 8x or something...

It's a heavy scene with a lot of draws, but I can't find anything pointing to why Vulkan would be slower, yet... Very odd...

Hm, I am seeing the same behavior on my Galaxy S21 though... OpenGL is using a lot less CPU for some reason.

hrydgard avatar Mar 30 '25 14:03 hrydgard

Playing around with the settings I found a partial solution? By disabling the "hardware transformation" the game returns to its speed and ironically doing it by software is faster even though it spends more CPU as you mention.

https://youtu.be/KRNmUC6eB0A?si=kf1l7nCHlRVJ0rt9

Cristobal15 avatar Mar 30 '25 14:03 Cristobal15

Wow, that is really super strange! Something really unusual is going on here, software transform should practically never be faster...

hrydgard avatar Mar 30 '25 16:03 hrydgard

I tested other games to see if there was the same behavior with the hardware transformation option and with vulkan. In the games I tested indeed the hardware transformation is much faster except in two games "OutRun" and "Motorm Storm" where by disabling the option the fps almost doubles.

Hardware transform

Image Image

Software transform

Image Image

Save state

motor storm PPSSPP_STATE.zip

Use the code 60 fps to make the difference more noticeable.

Cristobal15 avatar Mar 30 '25 18:03 Cristobal15

Add this game id to compat.ini [ForceMax60FPS]

Unknowncat1991 avatar Apr 03 '25 23:04 Unknowncat1991

Wow, that is really super strange! Something really unusual is going on here, software transform should practically never be faster...

Hi, sorry to bother you here, this problem also appears in LEGO - batman, I'm posting it here because I don't want to fragment the problem.

I tried openGL and it lags intermittently while vulkan is constant, also turning off ‘hardware transform’ doesn't work in LEGO - batman.

chip-64bit avatar Apr 08 '25 20:04 chip-64bit

Profiled a little bit on PC, and it's much, much faster with hardware transform than with software transform. Strange that it's so different!

Will have to experiment with profiling on Android... been a while since I did that.

hrydgard avatar Apr 10 '25 20:04 hrydgard

I can confirm the sudden frame drops.

XRecorderLite_ppsspp.deafult.settings.mp4 But with psp emulated cpu to 111Mhz can avoid slow down in that particular area.

XRecorderLite.ppsspp.emulated.cpu.111Mhz.mp4

What device do you have? I recently bought a Poco F6 (SD 8sGen2 / Adreno735 / 12G RAM) and the results with Outrun 2006 were very different.

With the SD 8sGen2 there are no FPS drops. Everything works as expected. The hardware transformation is much faster than the software transformation (including in the other games like MotorStorm).

Next I will try to test the behavior on a tablet with SD 680/ Adreno 610/ 8 RAM.

Does anyone have a device with Mali GPU to test if the same thing happens? Maybe the Adreno 6XX GPU series is missing features?

Cristobal15 avatar Apr 25 '25 19:04 Cristobal15

I was able to reproduce this on my Galaxy S21 with Mali, so it's definitely a real problem. I don't understand what could possibly be so slow on the CPU thread in this case... I need to dig into it properly when I have some time.

hrydgard avatar Apr 26 '25 08:04 hrydgard

Messing around with the profiler on Android, I still have no explanation why software transform would be faster.

However this flame effect is using morph heavily, which we don't JIT in the vertex decoder on ARM:

Image

The morphCount used is 4.

Additionally as previously suspected, we're spending a ridiculous amount of time hashing textures. The way we deal with texture hashing will need a re-work in the future.

Hm, noticed that some of these decoder functions are accumulating into (and thus reading from) the destination. That's bad!

hrydgard avatar May 26 '25 08:05 hrydgard

There should be a noticeable improvement with #20398. That's enough for 1.19, but there's more to do here so I'm re-tagging to 1.20 instead of closing.

hrydgard avatar May 26 '25 09:05 hrydgard

It seems that Android is a problem in itself (no surprise). Indeed the speed improved quite a lot, it's impressive.

Cristobal15 avatar May 26 '25 13:05 Cristobal15

Can't blame Android here, it's my mistake, although a really old one that's only noticeable in a few games.

hrydgard avatar May 26 '25 13:05 hrydgard