From 5e1c6aba331d2a3cb0f0ce32cce78b4b9b12fa01 Mon Sep 17 00:00:00 2001 From: magumagu Date: Tue, 15 Apr 2014 14:01:22 -0700 Subject: [PATCH] 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];