Jump to content
  • Advertisement
Sign in to follow this  
Quat

XM math

This topic is 3155 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Are the new XM math library functions in the latest DirectX SDK the new recommended math library to use instead of the old D3DX math functions?

Share this post


Link to post
Share on other sites
Advertisement
I haven't seen the XM math functions on the latest SDK. I've only seen them used in Direct3D9 code for the Xbox 360, so they are probably optimized for the Xbox 360 usage. Afaik, it shouldn't really matter. You can always to simple tests to see which ones are faster like this:


dwStartTime1 = GetTickCount();
XMMatrixPerspectiveFovLH(...);
dwElapsedTime1 = GetTickCount() - dwStartTime1;

...

dwStartTime2 = GetTickCount();
D3DXMatrixPerspectiveFovLH(...);
dwElapsedTime2 = GetTickCount() - dwStartTime2;


Share this post


Link to post
Share on other sites
Well one of the big features of the new library is that it's cross-platform with the Xbox 360. So if you were working on both PC and the 360, you could use the same math code. Aside from that I would think it's better optimized (I'm not really sure though, I'm no CPU math expert), but harder to use. I would also think that there would be less overhead from these new functions since the compiler should be able to directly inline a lot of them since they don't reside in an outside DLL.

Also I really doubt that using GetTickCount to measure the performance of a single function is going to give you anything useful. This is is because...

A) GetTickCount's precision is about 10ms, and any math function isn't going to take anywhere near that amount of time to execute

B) You'll want to measure performance of the functions in situations where they would actually have a performance impact, for example transforming a thousand Vector3's by a matrix in a loop.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!