Skip to content

Commit fe70af0

Browse files
committed
twistedmetal2
1 parent 98906eb commit fe70af0

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

rpcs3/Emu/RSX/Program/FragmentProgramDecompiler.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,10 @@ template<typename T> std::string FragmentProgramDecompiler::GetSRC(T src)
792792
}
793793

794794
// Warning: Modifier order matters. e.g neg should be applied after precision clamping (tested with Naruto UNS)
795+
const bool precision_before_abs = precision_modifier == RSX_FP_PRECISION_SATURATE;
796+
if (precision_before_abs) ret = ClampValue(ret, precision_modifier);
795797
if (src.abs) ret = "abs(" + ret + ")";
796-
if (precision_modifier) ret = ClampValue(ret, precision_modifier);
798+
if (precision_modifier && !precision_before_abs) ret = ClampValue(ret, precision_modifier);
797799
if (src.neg) ret = "-" + ret;
798800

799801
return ret;

rpcs3/Emu/RSX/Program/GLSLInterpreter/FragmentInterpreter.glsl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@ vec4 read_src(const in int index)
242242
ur1 = GET_INST_BITS(index + 1, 9, 8);
243243
vr0 = shuffle(vr0, ur1);
244244

245+
if (GET_INST_BITS(2, 19 + index * 3, 3) == RSX_FP_PRECISION_SATURATE)
246+
{
247+
vr0 = clamp(select(vr0, vr_zero, isnan(vr0)), 0., 1.);
248+
}
249+
245250
// abs
246251
if (index == 0)
247252
{

0 commit comments

Comments
 (0)