From 5e1c6aba331d2a3cb0f0ce32cce78b4b9b12fa01 Mon Sep 17 00:00:00 2001 From: magumagu Date: Tue, 15 Apr 2014 14:01:22 -0700 Subject: [PATCH 1/2] Software backend: make TEV rounding match hardware. Formulas stolen from gxtest. (Not sure how "==" got turned into "!=", but I'm pretty confident the patched version is correct.) --- Source/Core/VideoBackends/Software/Tev.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp index 89e8efc5c6..699c51d433 100644 --- a/Source/Core/VideoBackends/Software/Tev.cpp +++ b/Source/Core/VideoBackends/Software/Tev.cpp @@ -185,8 +185,9 @@ void Tev::DrawColorRegular(TevStageCombiner::ColorCombiner &cc, const InputRegTy s32 temp = InputReg.a * (256 - c) + (InputReg.b * c); temp <<= m_ScaleLShiftLUT[cc.shift]; - temp += (cc.shift != 3) ? 0 : (cc.op == 1) ? 127 : 128; - temp = cc.op ? (-temp >> 8) : (temp >> 8); + temp += (cc.shift == 3) ? 0 : (cc.op == 1) ? 127 : 128; + temp >>= 8; + temp = cc.op ? -temp : temp; s32 result = ((InputReg.d + m_BiasLUT[cc.bias]) << m_ScaleLShiftLUT[cc.shift]) + temp; result = result >> m_ScaleRShiftLUT[cc.shift]; From 685d612c8c755c81ae1ca6b9e379aed1886d0656 Mon Sep 17 00:00:00 2001 From: magumagu Date: Tue, 15 Apr 2014 14:05:12 -0700 Subject: [PATCH 2/2] Software backend: don't skip red component in TEV. --- Source/Core/VideoBackends/Software/Tev.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp index 699c51d433..9e6191c315 100644 --- a/Source/Core/VideoBackends/Software/Tev.cpp +++ b/Source/Core/VideoBackends/Software/Tev.cpp @@ -198,7 +198,7 @@ void Tev::DrawColorRegular(TevStageCombiner::ColorCombiner &cc, const InputRegTy void Tev::DrawColorCompare(TevStageCombiner::ColorCombiner &cc, const InputRegType inputs[4]) { - for (int i = BLU_C; i < RED_C; i++) + for (int i = BLU_C; i <= RED_C; i++) { switch ((cc.shift<<1)|cc.op|8) // encoded compare mode {