summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/Tev.cpp
diff options
context:
space:
mode:
authorJMC47 <JMC4789@gmail.com>2022-02-11 06:26:35 -0500
committerGitHub <noreply@github.com>2022-02-11 06:26:35 -0500
commit30a9777c5afa1e8cb32d4cf919ce30d240372efb (patch)
tree23d06cd0b5d33fa9c962e5907c7e1ed1d2519b5f /Source/Core/VideoBackends/Software/Tev.cpp
parenta6f9dd5a83e5eca872d294524ef624dfde5237ee (diff)
parent444f6fd0cb84a673329cf33eacf8907bf96b5951 (diff)
Merge pull request #10394 from Pokechu22/alpha-1-blend
Revert TEV alpha lerp change and special-case alpha=1 in blending
Diffstat (limited to 'Source/Core/VideoBackends/Software/Tev.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/Tev.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp
index 28c6c5f29d..6905920405 100644
--- a/Source/Core/VideoBackends/Software/Tev.cpp
+++ b/Source/Core/VideoBackends/Software/Tev.cpp
@@ -297,7 +297,7 @@ void Tev::DrawAlphaRegular(const TevStageCombiner::AlphaCombiner& ac, const Inpu
s32 temp = InputReg.a * (256 - c) + (InputReg.b * c);
temp <<= m_ScaleLShiftLUT[u32(ac.scale.Value())];
- temp += (ac.scale != TevScale::Divide2) ? 0 : (ac.op == TevOp::Sub) ? 127 : 128;
+ temp += (ac.scale == TevScale::Divide2) ? 0 : (ac.op == TevOp::Sub) ? 127 : 128;
temp = ac.op == TevOp::Sub ? (-temp >> 8) : (temp >> 8);
s32 result =
@@ -714,6 +714,19 @@ void Tev::Draw()
if (!TevAlphaTest(output[ALP_C]))
return;
+ // Hardware testing indicates that an alpha of 1 can pass an alpha test,
+ // but doesn't do anything in blending
+ // This situation is important for Mario Kart Wii's menus (they will render incorrectly if the
+ // alpha test for the FMV in the background fails, since they depend on depth for drawing a yellow
+ // border) and Fortune Street's gameplay (where a rectangle with an alpha value of 1 is drawn over
+ // the center of the screen several times, but those rectangles shouldn't be visible).
+ // Blending seems to result in no changes to the output with an alpha of 1, even if the input
+ // color is white.
+ // TODO: Investigate this further: we might be handling blending incorrectly in general (though
+ // there might not be any good way of changing blending behavior)
+ if (output[ALP_C] == 1)
+ output[ALP_C] = 0;
+
// z texture
if (bpmem.ztex2.op != ZTexOp::Disabled)
{