• Advertisement
Sign in to follow this  

D3DXVec3 - Normalize, TransformCoord: Using same vector

This topic is 4796 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

How safe is it to pass in the same address to each parameter of such functions? Can it be assumed that they will work whether the out vector is the same as the in vector? Are certain optimizations made if they are different? Example:
D3DXVec3TransformCoord(&vRotateMe,&vRotateMe,&mRotation); //Safe?

D3DXVec3Normalize(&vNormal, &vNormal);  //Safe?  I think it is at least..
Thanks for your input!

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by n0ob
How safe is it to pass in the same address to each parameter of such functions? Can it be assumed that they will work whether the out vector is the same as the in vector? Are certain optimizations made if they are different? Example:


D3DXVec3TransformCoord(&vRotateMe,&vRotateMe,&mRotation); //Safe?

D3DXVec3Normalize(&vNormal, &vNormal); //Safe? I think it is at least..


Thanks for your input!


They will work fine if the output is the same as the input. For some routines, e.g. matrix multiply, there will be a small perf hit since it will have to make an internal copy. This isn't true for D3DXVec3TransformCoord, however, since the internal copy can be staged in the FPU registers.

For best performance, use the array version of these functions if possible. They can be much faster (general call overhead as well as keeping parts of the matrix stored in registers).



Share this post


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

  • Advertisement