DobieStation icon indicating copy to clipboard operation
DobieStation copied to clipboard

FPU DIV Rounding - Mortal Kombat Shaolin Monks

Open refractionpcsx2 opened this issue 4 years ago • 0 comments

This game uses the FPU to do an equivalent to log2 on the texture size of 64 to get the 1<< value which the GS uses (in this case it is taking 64 and expect 6 to some out)

But due to rounding differences between the R5900 and x86 processors the result comes out as 5. Div result is actually 5.9999 and a bunch of digits.

PCSX2 cheats this by doing "round to nearest" just for the DIV instruction.

Here are the values that get thrown out in dobie

[FPU] div.s: 4.158883(0)(40851591) / 0.693147(20)(3f317217) = 6.000000(0)(40bfffff) [FPU] CVT_W_S: $00000005(1) from 40bfffff(0)

And this is the value PCSX2 gets as a result of the DIV

DIV_S FS = 0 value 4.158883(40851592) FT = 20 value 0.693147(3f317218) Result 6.000000 (40c00000)

refractionpcsx2 avatar Aug 31 '20 21:08 refractionpcsx2