Archived

This topic is now archived and is closed to further replies.

SKREAMZ

doubles instead of floats

Recommended Posts

If you mean the D3DX libraries, then no, I don''t think there''s a way to make them use doubles instead of floats.

But if you''re talking about the rendering pipeline, you can create your D3D device by using the D3DCREATE_FPU_PRESERVE flag. This will make the hardware use doubles instead of floats to calculate things inside the card. Note that this will cause a performance hit.

neneboricua

Share this post


Link to post
Share on other sites
quote:
Original post by neneboricua19
If you mean the D3DX libraries, then no, I don''t think there''s a way to make them use doubles instead of floats.

But if you''re talking about the rendering pipeline, you can create your D3D device by using the D3DCREATE_FPU_PRESERVE flag. This will make the hardware use doubles instead of floats to calculate things inside the card. Note that this will cause a performance hit.

neneboricua


That''s Right !

Share this post


Link to post
Share on other sites
All the D3DCREATE_FPU_PRESERVE flag does, is tell D3D to save/restore the floating point control word at all API entrypoints. I don''t believe there is any way to tell D3D to use doubles internally. Even if you could, it would not matter really, since to my knowledge, there is no consumer 3D hardware available which supports them anyway.

xyzzy

Share this post


Link to post
Share on other sites
quote:
Original post by neneboricua19
But if you''re talking about the rendering pipeline, you can create your D3D device by using the D3DCREATE_FPU_PRESERVE flag. This will make the hardware use doubles instead of floats to calculate things inside the card. Note that this will cause a performance hit.


No, this isn''t what D3DCREATE_FPU_PRESERVE does. As its name suggests it simply preserves the FPU state when it makes it''s own calls which requires that it save the save, do it''s own work with floats, then restore the state. And it does this with EVERY D3D call you make. So unless you really need it, don''t do it.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
quote:
Original post by xyzzy00
I don''t believe there is any way to tell D3D to use doubles internally. Even if you could, it would not matter really, since to my knowledge, there is no consumer 3D hardware available which supports them anyway.



Well, even without hw support, it would help with any calculations done in software. Even if those values are truncated down to a float when passed to hw, they''d be calculated at a higher resolution. But it''s a moot point since you can''t do it anyway.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
quote:
Original post by DrunkenHyena
No, this isn''t what D3DCREATE_FPU_PRESERVE does. As its name suggests it simply preserves the FPU state when it makes it''s own calls which requires that it save the save, do it''s own work with floats, then restore the state. And it does this with EVERY D3D call you make. So unless you really need it, don''t do it.

My mistake then. I must have missunderstood the docs on this.

Thanks to xyzzy and DrunkenHyena for clearing this up.

neneboricua

Share this post


Link to post
Share on other sites
the reason why i need to use doubles as im writing a level editor and i want to make huge landscape level could i do this using D3DCREATE_FPU_PRESERVE flag as im using directx as my graphics api
thanks for your help

Share this post


Link to post
Share on other sites
Yes, if your editor is doing floating-point computations using doubles, you''ll want to use the D3DCREATE_FPU_RESERVE flag, since D3D will set the FPU to float precision internally for perforance reasons.

Keep in mind that D3D and HW will still only take floats. This means that before you draw a region of your landscape, you''ll need to offset your double coordinates so that they are close to zero and cast them to floats.

xyzzy

Share this post


Link to post
Share on other sites