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

Always do the vertex shader part of the fog computation. #16111

Merged
merged 1 commit into from
Sep 26, 2022

Conversation

hrydgard
Copy link
Owner

@hrydgard hrydgard commented Sep 26, 2022

In #16104, we drastically reduced the number of shader variants for games that use flexible lighting setups.

I looked at a few games and it seems that a lot of games have the same shaders with fog on/off, while fog is super cheap to compute. So let's just always do it, reducing vertex shader variants further (though the amount of pipelines will probably remain the same, since we still specialize the fragment shader).

Might also be worth adding a dynamic bool for the fragment shader, but if so, doing it in a separate PR (or possibly set the fog coefficients so no fog is applied...)

In #16104, we drastically reduced the number of shader variants for
games that use flexible lighting setups. I looked at a few games and it
seems that a lot of games have the same shaders with fog on/off, while
fog is super cheap to compute. So let's just always do it, reducing
vertex shader variants further (though the amount of pipelines will probably
remain the same, since we still specialize the fragment shader).

Might also be worth adding a dynamic bool for the fragment shader, but
if so, doing it separately.
@hrydgard hrydgard added the GE emulation Backend-independent GPU issues label Sep 26, 2022
@hrydgard hrydgard added this to the v1.14.0 milestone Sep 26, 2022
@hrydgard hrydgard merged commit 94e4392 into master Sep 26, 2022
@hrydgard hrydgard deleted the always-compute-fog-in-vs branch September 26, 2022 09:20
float fogColor[4]; // .w is unused
float fogColor[4];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this still true?

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is, it just wasn't in an intermediate stage of this PR :P I'll sneak in a revert of this line in some other thing later.

@@ -83,14 +82,12 @@ void ComputeVertexShaderID(VShaderID *id_out, u32 vertType, bool useHWTransform,
_assert_(hasNormal);
}

bool enableFog = gstate.isFogEnabled() && !isModeThrough && !gstate.isModeClear();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a note: if we remove the flag from the frag shader too, we just have to make sure it isn't enabled in clearMode (should be easy, already has a bit.) Note that clear can be used in transform mode.

-[Unknown]

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, so I noticed when I tried earlier today, and decided to not bother for now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GE emulation Backend-independent GPU issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants