From 0327e6acb4a4f883003fb00b04a8092a1914090a Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 24 Jan 2022 22:05:31 -0800 Subject: Use the same logic for lerp bias for color and alpha It doesn't make sense for alpha to add the bias ONLY when dividing by 2, while color doesn't apply the bias for divide by 2 only; hardware testing indicates that alpha should have the bias. This fixes the menus in Mario Kart Wii (https://bugs.dolphin-emu.org/issues/11909) but reintroduces the white rectangle in Fortune Street. This reverts commit 5aaa5141ed76acc3fffc70561a6b6e7fe3b9b470 (and several other matching changes elsewhere). --- Source/Core/VideoBackends/Software/Tev.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoBackends/Software/Tev.cpp') diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp index 28c6c5f29d..ee0a789ec6 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 = -- cgit v1.2.3 From 444f6fd0cb84a673329cf33eacf8907bf96b5951 Mon Sep 17 00:00:00 2001 From: Pokechu22 Date: Mon, 24 Jan 2022 22:48:43 -0800 Subject: Treat alpha as 0 if alpha is 1 for blending This removes the white box in fortune street again, without causing Mario Kart Wii to regress. --- Source/Core/VideoBackends/Software/Tev.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Source/Core/VideoBackends/Software/Tev.cpp') diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp index ee0a789ec6..6905920405 100644 --- a/Source/Core/VideoBackends/Software/Tev.cpp +++ b/Source/Core/VideoBackends/Software/Tev.cpp @@ -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) { -- cgit v1.2.3