Thanks,
Phil
pwm <pwm...@newsgroups.nospam> spake the secret code
<OBNp24rX...@TK2MSFTNGP02.phx.gbl> thusly:
>Is there a double precision version of D3DXMATRIX?
No. The entire D3D pipeline uses single precision floats throughout,
so there's no benefit to providing D3DXMATRIX as a double.
They don't use any templates in D3DX, but there's nothing in D3DX that
you can't do yourself. There are some template-based numeric vector
libraries out there, however. Google for Blitz++.
--
"The Direct3D Graphics Pipeline" -- DirectX 9 draft available for download
<http://www.xmission.com/~legalize/book/download/index.html>
Legalize Adulthood! <http://blogs.xmission.com/legalize/>
As Richard mentioned, there will not be any benefit to use any double
precision objects in D3D. I just wonder if you still have any questions
around this? The following information explains the similar reason of why
setting D3DCREATE_FPU_PRESERVE flag for CreateDevice call actually
decreases performance.
Direct3D's pipeline operates entirely on 'float' single-precision values.
Left in it's default state by the CRT, the FPU will compute everything in
double-precision mode. Since the majority of users of Direct3D are
performance-sensitive applications rather than scientific ones, Direct3D's
CreateDevice routine overrides the CRT setting and puts the FPU into
single-precision mode globally. The D3DCREATE_FPU_PRESERVE flag prevents
this from taking place so that applications that wish to have either the
default 'double-precision' mode or some other settings can do so.
If you are using "double", then your structures will be larger and the
compiler will have limited options. Even if you are using "float" types,
however, if the FPU is in double-precision mode they are extended
internally to doubles and computed with the extra precision before being
truncated back to single-precision "floats".
Please update here if you have any further question or concern.
Have a great day.
Sincerely,
WenJun Zhang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at:
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Hi WenJun,
Thanks for your reply. I do not, unfortunately, fully understand it.
My question is really more from the perspective of developing a
scientific application than a specific D3D pipleline question. And, it
is rather simply "Is there a double precision version of D3DXMATRIX?" I
am asking because I would like to use the same C++ classes in my
scientific development that I am already using in my D3D development.
My scientific algorithms require double precision accuracy, but I do not
want to use yet another set of C++ classes to represent and perform 3-D
geometry operations.
I am particularly confused about your statement "Even if you are using
'float' types, however, if the FPU is in double-precision mode ...".
What do you mean by the FPU being in double-precision mode? Isn't
D3DXMATRIX using the FLOAT (typedef to a float) and won't I be limited
to single precision?
Thanks for your help and sorry to follow-up your clarification with yet
another question! :-)
Phil
The use of 'float' vs. 'double' data type in C/C++ determines the amount of
memory used (4 bytes vs. 8 bytes), but the actual computational precision of
the floating-point unit is controlled by a control-word setting. By default
the C Runtime (and the .NET CLR) sets it to "double-precision, no
exceptions".
To increase performance for games, Direct3D's CreateDevice sets the control
word to "single-precision, no exceptions". Even 'double' types will
therefore only have single-precision computation performed. To leave the FPU
control word alone, use pass the D3DCREATE_FPU_PRESERVE flag.
--
Chuck Walbourn
SDE, XNA Developer Connection