After a marathon debugging session, I've isolated a really bizarre behavior
that I just can't explain, and I was wondering if someone could take a look
at this.
I have need to convert a date/time to the Julian format -- and, long story
short, the task requires a double precision floating point calculation. I
have a function that works just fine BEFORE THE D3D DEVICE CONSTRUCTOR IS
CALLED, but not after! This function in question manipulates some doubles
and returns a double. However, after the D3D Device construction, it seems
to act as if it were manipulating float (single precision) numbers instead.
I have no idea why this is. I've reproduced the bug on two computers. One
has the Debug build of DX9.0b and the other runs the Release build of the
same version. Both run WinXP, one is a P4 and the other a P3.
Here is the source for a version that can reproduce the bug.
http://www.mle.ie/~rob/d3dissue/index.htm
And you can download a ready-built solution, project and the one source file
here.
http://www.mle.ie/~rob/d3dissue/d3dissue.zip
I am really stumped by this one and I would be most grateful for any advice
you can provide! Perhaps this is a bug somewhere deep in there?
Many thanks in advance,
Rob
p.s. please forgive accidental cross-posting to directx.graphics list!!
--
Robert Burke
Research Associate
MindGames Group, MIT MediaLabEurope
"Rob Burke" <rcb...@rogers.com> spake the secret code
<#VhFkQcY...@TK2MSFTNGP12.phx.gbl> thusly:
>I have need to convert a date/time to the Julian format -- and, long story
>short, the task requires a double precision floating point calculation. I
>have a function that works just fine BEFORE THE D3D DEVICE CONSTRUCTOR IS
>CALLED, but not after! [...]
The Direct3D runtime modifies the FPU to suit itself. You can do one
of two things to compensate for this:
1) manage the FPU mode yourself when you need something different than
what D3D wants to use, ensuring that you restore what D3D needs when
you call into D3D
2) use the FPU preserve flag when creating the device. D3D will then
save and restore the FPU mode whenever you call into it.
Look at CreateFlags.FpuPreserve and the device constructors that take
CreateFlags as a parameter.
--
"The Direct3D Graphics Pipeline"-- code samples, sample chapter, FAQ:
<http://www.xmission.com/~legalize/book/>
Pilgrimage: Utah's annual demoparty
<http://pilgrimage.scene.org>