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

Propagate Shader phi nodes with the same source value from all blocks #3457

Merged
merged 2 commits into from
Jul 11, 2022

Conversation

gdkchan
Copy link
Member

@gdkchan gdkchan commented Jul 10, 2022

In order to ensure that all variables only have a single assignment to keep optimizations simple, we keep the IR in SSA form. It is possible for a variable to be set to the same value in multiple blocks, and currently the shader translator will insert a copy on each one of them. Since it does not know that the values are actually the same, it will insert a Phi on blocks with multiple predecessors where the value is used. But the Phi is not actually needed in this case, if the value is actually the same on all of them, it doesn't matter from where it comes from.

This change extends the optimizer to also propagate the Phi source values if the value is always the same, regardless of the incoming block. This makes the generated shader code smaller and better.

The main noticeable benefit here is that bindless elimination now works on more cases, which fixes the flickering that Monster Hunter Rise had with latest update and Sunbreak expansion.

Note: The game still needs the other fixes (#3431 and #3425) to actually run, of course.

@gdkchan gdkchan added gpu Related to Ryujinx.Graphics fix Fix something labels Jul 10, 2022
@marysaka marysaka enabled auto-merge (squash) July 10, 2022 10:35
@zombie167
Copy link

Almost perfect ! Thank you very much.
Except for the occasional color error of the textures on Palico & Palamute

c1
c2

@marysaka marysaka merged commit 4523a73 into Ryujinx:master Jul 11, 2022
@gdkchan gdkchan deleted the prop-phi branch July 11, 2022 22:43
@Alyasa42
Copy link

not work stuck and crash on
HLE.OsThread.16 ServicePctl CheckFreeCommunicationPermission: Stubbed

@MetrosexualGarbodor
Copy link
Collaborator

@Alyasa42 read the PR

Note: The game still needs the other fixes (#3431 and #3425) to actually run, of course.

santibe added a commit to santibe/Ryujinx that referenced this pull request Jul 18, 2022
@GodwynMiles
Copy link

Almost perfect ! Thank you very much. Except for the occasional color error of the textures on Palico & Palamute

c1 c2

zombie167 how do you install MH Rise v10.0.3 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Fix something gpu Related to Ryujinx.Graphics
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants