Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rafael-57 opened this issue Nov 18, 2024 · 7 comments
Open

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

rafael-57 opened this issue Nov 18, 2024 · 7 comments

Comments

@rafael-57
Copy link

rafael-57 commented Nov 18, 2024

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:
    const bool calibrated_timestamps = add_extension(VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME);
  3. In liverpool.cpp comment out all FiberEnter/FiberExit markers
@Foul-Tarnished
Copy link

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

does it cause any broken graphics or missing effects ?

@rafael-57
Copy link
Author

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
Copy link

hgh32 commented Nov 24, 2024

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

@rafael-57
Copy link
Author

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

Thank you! Nice to see it done for confirmation. So yeah it's used a lot

@rafael-57
Copy link
Author

rafael-57 commented Nov 26, 2024

image
image

Turtle suggested that it's not strictly an issue in how the emu interprets the game code, but that the game code is actually requesting a vsharp with 2GB.

I've asked Bloo if he can develop a game patch to lower this value to try a pissible workaround for this issue :p

Edit: Seems like it's not simple to find the value and develop a patch for this. We'll probably have to wait for future emu developements.

@BeethovenNotes
Copy link

image image

Turtle suggested that it's not strictly an issue in how the emu interprets the game code, but that the game code is actually requesting a vsharp with 2GB.

I've asked Bloo if he can develop a game patch to lower this value to try a pissible workaround for this issue :p

Edit: Seems like it's not simple to find the value and develop a patch for this. We'll probably have to wait for future emu developements.

Why does it not run out of mem on PS4? Is something missing?

@rafael-57
Copy link
Author

image image
Turtle suggested that it's not strictly an issue in how the emu interprets the game code, but that the game code is actually requesting a vsharp with 2GB.
I've asked Bloo if he can develop a game patch to lower this value to try a pissible workaround for this issue :p
Edit: Seems like it's not simple to find the value and develop a patch for this. We'll probably have to wait for future emu developements.

Why does it not run out of mem on PS4? Is something missing?

Like turtle said in the first screenshot of my previous comment, on PS4 the allocation is managed differently (I think at startup) so the game asking for this 2gb vsharp doesn't allocate any new memory on console. It basically does nothing.

On the other hand, the emu is currently reading that game code and doing what the code is asking it to do, for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants