Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FPU DIV Rounding - Mortal Kombat Shaolin Monks #453

Open
refractionpcsx2 opened this issue Aug 31, 2020 · 0 comments
Open

FPU DIV Rounding - Mortal Kombat Shaolin Monks #453

refractionpcsx2 opened this issue Aug 31, 2020 · 0 comments

Comments

@refractionpcsx2
Copy link
Contributor

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant