hrydgard/ppsspp — pull request #4322 by unknownbrackets (2013-10-26 09:26:19+00:00)
Title: Make sure frag shader ID matches generated code

If `IsAlphaTestTriviallyTrue()` returned true, we would compute an id with the alpha test flag on, since gstate.isAlphaTestEnabled() is true. Then we would generate a shader that skips alpha testing.

If later, `IsAlphaTestTriviallyTrue()` was false, we would still use this shader - and not get alpha testing at all.

The reverse was also true; we might use a shader with alpha testing even when we detected that we don't need to apply the test.

I found this in Tales of Phantasia X, since it switches between shaders a ton, I wondered if any of the shaders had the same code, which they did - these. It looks like color testing is affected too.

This could break games that this was "accidentally working" for, it could also improve performance by correctly skipping testing when we can. I haven't tested it a ton, since it seems obviously correct, but at least games are still generally applying alpha testing correctly.

-[Unknown]