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

rsx: Optimizations and refactoring #13201

Merged
merged 22 commits into from
Jan 11, 2023
Merged

rsx: Optimizations and refactoring #13201

merged 22 commits into from
Jan 11, 2023

Conversation

kd-11
Copy link
Contributor

@kd-11 kd-11 commented Jan 10, 2023

This PR grew a little large, but largely consists of 4 parts:

  • Code refactoring to improve readability. This is far from finished, RSXThread class is a monstrosity that needs to be gelded. This will take many more PRs to finish, so I did the basics to get them out of my way.
  • Move all gcm enums to a simpler model. Rsx enums are a 1:1 translation with the PS3 values, and most to_xxxx are now inlined and consist of a basic range check. The codegen is pretty nice, most of these evaluate to like 4 instructions now. An added benefit is that we don't need to assert that the values are correct anymore, the caller will decide whether they want to assert or not. This avoids wastefulness. The name of the wrapper is rsx::expected (stolen from std::expected, but doesn't behave the same).
  • Move non-essential signal methods to simple signal lists. Instead of taking a CPU branch only to set a flag, we can just do that inline which saves on CPU resources. Using this we can, without any additional overhead, pass any kind of signals we like to the backend.
  • Use the signal mechanism above to completely ellide the expensive shader load process for vulkan. This is still incomplete. With the power of EXT_dynamic_state GPU extensions, we can do much, much more, but I decided to not implement it with this PR to minimize the amount of changed code (I failed 😆 )

Fixes #13095

@Megamouse Megamouse added RSX Optimization Optimizes existing code Refactoring Refactors or simplifies existing code labels Jan 10, 2023
@ghost
Copy link

ghost commented Jan 10, 2023

Sonic Generations appears to be running good on this build

@cipherxof
Copy link
Contributor

Performance seemed to be about the same on MGS4.

@ghost
Copy link

ghost commented Jan 10, 2023

Midnight Club: Los Angeles Gained 2 frames on my rig, which is a huge leap considering the circumstances.

also worth mentioning that Oblivion is running at stable 30 fps on my rig for the very first time.

@kd-11 kd-11 marked this pull request as draft January 11, 2023 00:00
@kd-11
Copy link
Contributor Author

kd-11 commented Jan 11, 2023

Last commit breaks some games, I'll investigate tomorrow.

- TODO: Incorporate VK_EXT_extended_dynamic_state
- Dumping invalid data should not crash
- This will change when EXT_dynamic_state is integrated
…er changed

- Handles a common case where a game engine switches materials but uses the same configuration
  e.g rendering two types of wall or ground may need different shaders but similar state properties
- Surprisingly some games actually exhaust the entire 16k pool causing slowdown
@kd-11 kd-11 marked this pull request as ready for review January 11, 2023 10:34
@kd-11
Copy link
Contributor Author

kd-11 commented Jan 11, 2023

Finally fixed all the problems I could find. Hopefully no major regressions!

@kd-11 kd-11 changed the title [TESTERS NEEDED] rsx: Optimizations and refactoring rsx: Optimizations and refactoring Jan 11, 2023
@kd-11 kd-11 merged commit 6809d84 into RPCS3:master Jan 11, 2023
@kd-11 kd-11 deleted the azdo branch January 11, 2023 13:49
@Triticum0
Copy link

Triticum0 commented Jan 11, 2023

This build makes Folklore crash on Manjaro Linux I drop the log below

F {RSX.W4} SIG: Thread terminated due to fatal error: Verification failed
(in file ../rpcs3/Emu/RSX/VK/VKPipelineCompiler.cpp:125, in function int_compile_graphics_pipe)

RPCS3.log.gz

@AniLeo
Copy link
Member

AniLeo commented Jan 11, 2023

Cannot reproduce, file an issue report with detailed repro steps

image

@caffeinekid
Copy link

Disgaea 3 worked in previous pr and freezes on startup and takes down the whole emulated system in this version.

F {RSX [0x0001ddc]} SIG: Thread terminated due to fatal error: Verification failed
(in file C:\Users\ContainerAdministrator\AppData\Local\Temp\cirrus-ci-build\rpcs3\Emu\RSX\Common\expected.hpp:80[:13], in function front_face)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Optimization Optimizes existing code Refactoring Refactors or simplifies existing code RSX
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Regression] Persona 5 [NPEB02436] :- Minor performance regression since 0.0.25-14481 #13082
6 participants