Skip to content

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
uint32_t colorWriteMask; float mipBias;
// Fragment data
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.

_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.

3 participants