summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/Tev.cpp
diff options
context:
space:
mode:
authormagumagu <magumagu9@gmail.com>2014-04-15 14:01:22 -0700
committermagumagu <magumagu9@gmail.com>2014-04-15 14:04:46 -0700
commit5e1c6aba331d2a3cb0f0ce32cce78b4b9b12fa01 (patch)
tree46dc85a19bc990e118458b841135eb0855636bfc /Source/Core/VideoBackends/Software/Tev.cpp
parent12d7ffac1349f27c8e20962305866cd73247cbd4 (diff)
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.)
Diffstat (limited to 'Source/Core/VideoBackends/Software/Tev.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/Tev.cpp5
1 files 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];