diff options
| author | Tony Wasserka <NeoBrainX@gmail.com> | 2014-03-24 14:54:17 +0100 |
|---|---|---|
| committer | Tony Wasserka <NeoBrainX@gmail.com> | 2014-03-26 00:23:58 +0100 |
| commit | 1dead05cae47aeb9cb9e14a65a286e0f0de8dc95 (patch) | |
| tree | ed48e9f94a7e53aef8599e4416b5d29a9dbb3e77 /Source/Core/VideoBackends/Software/Tev.cpp | |
| parent | a8c8db8da7487b4bc3bcfb549c296a811c691042 (diff) | |
Software renderer: Properly calculate tev combiner output.
As pointed out by dolphin-emu/hwtests@461476112.
Diffstat (limited to 'Source/Core/VideoBackends/Software/Tev.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Software/Tev.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/Source/Core/VideoBackends/Software/Tev.cpp b/Source/Core/VideoBackends/Software/Tev.cpp index 3c294ef5f6..8ee3715e03 100644 --- a/Source/Core/VideoBackends/Software/Tev.cpp +++ b/Source/Core/VideoBackends/Software/Tev.cpp @@ -185,10 +185,11 @@ void Tev::DrawColorRegular(TevStageCombiner::ColorCombiner &cc, const InputRegTy u16 c = InputReg.c + (InputReg.c >> 7); s32 temp = InputReg.a * (256 - c) + (InputReg.b * c); - temp = cc.op?(-temp >> 8):(temp >> 8); + temp <<= m_ScaleLShiftLUT[cc.shift]; + temp += (cc.shift != 3) ? 0 : (cc.op == 1) ? 127 : 128; + temp = cc.op ? (-temp >> 8) : (temp >> 8); - s32 result = InputReg.d + temp + m_BiasLUT[cc.bias]; - result = result << m_ScaleLShiftLUT[cc.shift]; + s32 result = ((InputReg.d + m_BiasLUT[cc.bias]) << m_ScaleLShiftLUT[cc.shift]) + temp; result = result >> m_ScaleRShiftLUT[cc.shift]; Reg[cc.dest][BLU_C + i] = result; @@ -259,10 +260,11 @@ void Tev::DrawAlphaRegular(TevStageCombiner::AlphaCombiner &ac, const InputRegTy u16 c = InputReg.c + (InputReg.c >> 7); s32 temp = InputReg.a * (256 - c) + (InputReg.b * c); - temp = ac.op?(-temp >> 8):(temp >> 8); + temp <<= m_ScaleLShiftLUT[ac.shift]; + temp += (ac.shift != 3) ? 0 : (ac.op == 1) ? 127 : 128; + temp = ac.op ? (-temp >> 8) : (temp >> 8); - s32 result = InputReg.d + temp + m_BiasLUT[ac.bias]; - result = result << m_ScaleLShiftLUT[ac.shift]; + s32 result = ((InputReg.d + m_BiasLUT[ac.bias]) << m_ScaleLShiftLUT[ac.shift]) + temp; result = result >> m_ScaleRShiftLUT[ac.shift]; Reg[ac.dest][ALP_C] = result; |
