shadps4-emu / shadPS4

PS4 emulator for Windows,Linux,MacOS
https://shadps4.net/
GNU General Public License v2.0
11.09k stars 701 forks source link

[Bloodborne] Shader fefebf9f causes 2gb buffers to be created #1547

Open rafael-57 opened 6 days ago

rafael-57 commented 6 days ago

This shader seems present in every area, and it can lead to single digit performance or crashes due to out of memory in the worst cases. image

For example the performance issues get particulary bad in Upper Cathedral Ward and even worse in Cainhurst: image

It's a simple copy shader, for some reason it gets interpreted by the emu as needing 2gb: image

But it's actually writing around 26KB: image

It seems like an issue in how the emulator's texture cache interprets the shader.

Tracy profile analyses were taken with guidance of psucien (nullptr), tracy doesn't seem to work in main.

Dumping the shader will write these two files: cs_0x00000000fefebf9f_0.spv cs_0x00000000fefebf9f_0.bin

Trace link: https://drive.google.com/file/d/1wfw-5vCHwyE-X7jQVgn9L0LgSDcWqotf/view?usp=sharing

These are the workarounds used to make tracy work: (this disables gpu work tracing, but it's the only workaround we have for now)

  1. Use this client: https://github.com/wolfpld/tracy/releases/tag/v0.11.0
  2. Make this bool false: https://github.com/shadps4-emu/shadPS4/blob/76f440889b28b01a32dc47b427e85a13bfb8e32d/src/video_core/renderer_vulkan/vk_instance.cpp#L263
  3. In liverpool.cpp comment out all FiberEnter/FiberExit markers
Foul-Tarnished commented 2 days ago

What happens if we skip this shader ? As a workaround ofc

does it cause any broken graphics or missing effects ?

rafael-57 commented 2 days ago

What happens if we skip this shader ? As a workaround ofc

does it cause any broken graphics or missing effects ?

I haven't tested this personally since shader skipping was kinda killed by the geoshaders PR. I've heard it's possible to do it with tess builds on some shaders.

But since this shader is used in most areas to copy things so I don't expect the game to work well without it so I haven't taken the time. Feel free to try and report though

hgh32 commented 1 day ago

I did this a long time ago This seems to cause most of the scenes and characters to disappear s