Skip to content

Commit 42d74b3

Browse files
committed
GS:SW: Use accurate fog equation
1 parent 34ca40f commit 42d74b3

File tree

5 files changed

+5
-30
lines changed

5 files changed

+5
-30
lines changed

pcsx2/GS/GSVector4i.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -985,10 +985,6 @@ class alignas(16) GSVector4i
985985
__forceinline GSVector4i modulate16(const GSVector4i& f) const
986986
{
987987
// a * f << shift
988-
if (shift == 0)
989-
{
990-
return mul16hrs(f);
991-
}
992988

993989
return sll16<shift + 1>().mul16hs(f);
994990
}

pcsx2/GS/GSVector4i_arm64.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -958,10 +958,6 @@ class alignas(16) GSVector4i
958958
__forceinline GSVector4i modulate16(const GSVector4i& f) const
959959
{
960960
// a * f << shift
961-
if (shift == 0)
962-
{
963-
return mul16hrs(f);
964-
}
965961

966962
return sll16<shift + 1>().mul16hs(f);
967963
}

pcsx2/GS/GSVector8i.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -798,11 +798,6 @@ class alignas(32) GSVector8i
798798
{
799799
// a * f << shift
800800

801-
if (shift == 0)
802-
{
803-
return mul16hrs(f);
804-
}
805-
806801
return sll16<shift + 1>().mul16hs(f);
807802
}
808803

pcsx2/GS/Renderers/SW/GSDrawScanlineCodeGenerator.all.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,15 +174,8 @@ void GSDrawScanlineCodeGenerator::broadcastGPRToVec(const XYm& vec, const Xbyak:
174174

175175
void GSDrawScanlineCodeGenerator::modulate16(const XYm& a, const Operand& f, u8 shift)
176176
{
177-
if (shift == 0)
178-
{
179-
pmulhrsw(a, f);
180-
}
181-
else
182-
{
183-
psllw(a, shift + 1);
184-
pmulhw(a, f);
185-
}
177+
psllw(a, shift + 1);
178+
pmulhw(a, f);
186179
}
187180

188181
void GSDrawScanlineCodeGenerator::lerp16(const XYm& a, const XYm& b, const XYm& f, u8 shift)

pcsx2/GS/Renderers/SW/GSDrawScanlineCodeGenerator.arm64.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,14 +2352,9 @@ void GSDrawScanlineCodeGenerator::modulate16(const VRegister& a, const VRegister
23522352

23532353
void GSDrawScanlineCodeGenerator::modulate16(const VRegister& d, const VRegister& a, const VRegister& f, u8 shift)
23542354
{
2355-
// potentially going to cause issues due to saturation
2356-
armAsm->Shl(d.V8H(), a.V8H(), shift + 1);
2357-
if (shift != 0)
2358-
armAsm->Sqdmulh(a.V8H(), a.V8H(), f.V8H());
2359-
else
2360-
armAsm->Sqrdmulh(a.V8H(), a.V8H(), f.V8H());
2361-
2362-
armAsm->Sshr(a.V8H(), a.V8H(), 1);
2355+
if (shift)
2356+
armAsm->Shl(d.V8H(), a.V8H(), shift);
2357+
armAsm->Sqdmulh(d.V8H(), d.V8H(), f.V8H());
23632358
}
23642359

23652360
void GSDrawScanlineCodeGenerator::lerp16(const VRegister& a, const VRegister& b, const VRegister& f, u8 shift)

0 commit comments

Comments
 (0)