Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Am I correct in understanding that there is a bug in `D3DXMatrixInverse`, or is it that some assumption is wrong?


No, it's not necessarily a bug but rather multiple systems working as designed, yet coming together to produce incorrect results. `D3DXMatrixInverse` makes use of hardware-implemented fast math routines by design, for performance reasons. These implementations may differ depending on the CPU model but they are all valid, provided they remain within the IEEE 754 spec.

What has happened here is that a new implementation of these fast math routines appeared that returned results that were unexpected by the game engine and the engine was not robust enough to deal with these variations. This is not too surprising as these AMD CPUs did not exist yet when the game was developed so QA will not have tested the game's compatibility with these CPUs.

The solution was to divert calls to `D3DXMatrixInverse` to another matrix inversion routine that makes use of more accurate floating point math, which produces identical results on all tested hardware.


Yes, it evidently uses sse2 instructions when doing the matrix inversion resulting in the NaN values inside the matrix.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: