locked
Why is DirectXMath a step backwards from being able to do anything efficiently? RRS feed

  • General discussion

  • Case in point:

    D3DXVECTOR3 out,temp,blank(0,0,0);
    D3DXVec3Subtract(&temp,&in,&p->View);


    XMFLOAT3 out,temp,blank(0,0,0); XMVector aVector1 = XMLoadFloat3(in);

    XMVector aVector2 = XMLoadFloat3(p->View); VMVector temp2 = XMVectorSubtract(aVector1, aVector2);

    XmStoreFloat3(temp, temp2);

    That's just stupid.. stupid. We are going backwards and this is the 'new standard'? I can't write 2 lines without having to look up something. 2 lines becomes 6, 10 becomes like 30..

    Why does XMStoreFloat3 exist, and why doesn't it even work the same as XMLoadFloat3 with a return value? It's just mixing random garbage.

    Directxmath.h is garbage. Currently reverting back to D3DX10math or making my own math structs.

    Discuss.






    • Edited by esLeg Wednesday, June 22, 2016 4:25 AM already made a mistake using garbage DirectXMath, made by pros
    Wednesday, June 22, 2016 4:18 AM

All replies

  • I believe it's because the data types have to be 16-byte aligned for max CPU performance, so you need a new data-type.  C++ isn't quite up to the alignment task without pushing all the pieces out to RAM.

    I believe the "stupid garbage" is faster.  Unfortunately, sometimes it's about technical constraints and performance, not code beauty.


    Monday, June 27, 2016 7:06 PM
  • Yeah, DirectXMath uses SSE where it can, so the extra alignment is needed due to most SSE instructions needing to be 16 byte aligned.

    This is a signature Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

    Monday, June 27, 2016 7:32 PM