[PR #1982] [MERGED] Speed up LiverpoolToVK::SurfaceFormat #2417

Closed
opened 2026-02-27 21:16:26 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/shadps4-emu/shadPS4/pull/1982
Author: @hspir404
Created: 12/30/2024
Status: Merged
Merged: 1/2/2025
Merged by: @raphaelthegreat

Base: mainHead: perf-liverpooltovk-surfaceformat


📝 Commits (3)

  • 949171d Speed up LiverpoolToVK::SurfaceFormat
  • 35b199d Implement SurfaceFormat with derived lookup table instead of switch
  • 25ac454 Clang format fixes

📊 Changes

1 file changed (+33 additions, -9 deletions)

View changed files

📝 src/video_core/renderer_vulkan/liverpool_to_vk.cpp (+33 -9)

📄 Description

In Bloodborne this shows up as the function with the very highest cumulative "exclusive time". This is true both in scenes that perform poorly, and scenes that perform well.

I took (approximately) 10s samples using an 8khz sampling profiler.

In the Nightmare Grand Cathedral (looking towards the stairs, at the rest of the level):

  • Reduced total time from 757.34ms to 82.61ms (out of ~10000ms).
  • Reduced average frame times by 2ms (though according to the graph, the gap may be as big as 9ms every N frames).

00-savedata.zip
Before:
00-before
After:
00-after
Before:
00-before-profile
After:
00-after-profile

In the Hunter's Dream (in the spawn position):

  • Reduced the total time from 486.50ms to 53.83ms (out of ~10000ms).
  • Average frame times appear to be roughly the same.

01-savedata.zip
Before:
01-before
After:
01-after
Before:
01-before-profile
After:
01-after-profile

These are profiles of the change vs the version currently in the main branch. These improvements also improve things in the locking branch. They might improve them even more in that branch, but I didn't bother keeping track of my measurements as well in that branch. I believe this change will still be useful even when that branch is stabilized and merged.

It could be there are other bottlenecks in rendering on the main branch that are preventing this code from being the critical path in places like the Hunter's Dream, where the frame times aren't as high. That might explain why the reduction in call times isn't resulting in a higher frame rate in every scene.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/shadps4-emu/shadPS4/pull/1982 **Author:** [@hspir404](https://github.com/hspir404) **Created:** 12/30/2024 **Status:** ✅ Merged **Merged:** 1/2/2025 **Merged by:** [@raphaelthegreat](https://github.com/raphaelthegreat) **Base:** `main` ← **Head:** `perf-liverpooltovk-surfaceformat` --- ### 📝 Commits (3) - [`949171d`](https://github.com/shadps4-emu/shadPS4/commit/949171d6cacf155e9d0f42fadec770435ca4fba5) Speed up LiverpoolToVK::SurfaceFormat - [`35b199d`](https://github.com/shadps4-emu/shadPS4/commit/35b199d7ebf128a129b5e3ba0c197d5646a251a3) Implement SurfaceFormat with derived lookup table instead of switch - [`25ac454`](https://github.com/shadps4-emu/shadPS4/commit/25ac45498c3a731639bac17a22e49e53f9649019) Clang format fixes ### 📊 Changes **1 file changed** (+33 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/video_core/renderer_vulkan/liverpool_to_vk.cpp` (+33 -9) </details> ### 📄 Description In Bloodborne this shows up as the function with the very highest cumulative "exclusive time". This is true both in scenes that perform poorly, and scenes that perform well. I took (approximately) 10s samples using an 8khz sampling profiler. In the Nightmare Grand Cathedral (looking towards the stairs, at the rest of the level): - Reduced total time from 757.34ms to 82.61ms (out of ~10000ms). - Reduced average frame times by 2ms (though according to the graph, the gap may be as big as 9ms every N frames). [00-savedata.zip](https://github.com/user-attachments/files/18276958/00-savedata.zip) Before: ![00-before](https://github.com/user-attachments/assets/d0a6547d-ae9a-41d5-b31e-07ef82f838fe) After: ![00-after](https://github.com/user-attachments/assets/ea18dbd6-3f22-4cf7-a7e2-55056ea21d13) Before: ![00-before-profile](https://github.com/user-attachments/assets/b0f605e2-b52c-49ae-9ccd-0e9a94847191) After: ![00-after-profile](https://github.com/user-attachments/assets/5807dc4c-9b4a-49f1-bf07-5d75d5a40824) In the Hunter's Dream (in the spawn position): - Reduced the total time from 486.50ms to 53.83ms (out of ~10000ms). - Average frame times appear to be roughly the same. [01-savedata.zip](https://github.com/user-attachments/files/18276964/01-savedata.zip) Before: ![01-before](https://github.com/user-attachments/assets/feef3cbf-92c3-46ee-9acb-28a1c074300f) After: ![01-after](https://github.com/user-attachments/assets/6a84dc24-8b1c-4df2-9ac9-a60fef599e6c) Before: ![01-before-profile](https://github.com/user-attachments/assets/e00b13b7-c3ce-48dc-8606-91bc81925d70) After: ![01-after-profile](https://github.com/user-attachments/assets/dcfe2472-da6e-4b42-a84c-5eb4eb9ca4c9) These are profiles of the change vs the version currently in the main branch. These improvements also improve things in the `locking` branch. They might improve them even more in that branch, but I didn't bother keeping track of my measurements as well in that branch. I believe this change will still be useful even when that branch is stabilized and merged. It could be there are other bottlenecks in rendering on the main branch that are preventing this code from being the critical path in places like the Hunter's Dream, where the frame times aren't as high. That might explain why the reduction in call times isn't resulting in a higher frame rate in every scene. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 21:16:26 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/shadPS4#2417
No description provided.