Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17560

Matrix 16 byte alignment

$
0
0

Hey

 

Im having some trouble with the DirectX 11 matrix functions.

Not 100%, but maybe 80% of the time im getting the following assertion:

 

((uintptr_t)pSource & 0xF) == 0

 

It happens when i call the function:

 

XMLoadFloat4x4A

 

Relevant code

class Matrix4v4 {
public:
    __declspec(align(16)) float m[4][4];
};
 

void matrixMultiply( Matrix4v4 * p_Result, const Matrix4v4 * p_A, const Matrix4v4 * p_B ) {
    using namespace DirectX;
    XMMATRIX a = XMLoadFloat4x4A( (const XMFLOAT4X4A *)p_A );
    XMMATRIX b = XMLoadFloat4x4A( (const XMFLOAT4X4A *)p_B );
    XMMATRIX r = XMMatrixMultiply( a, b );
    XMStoreFloat4x4A( (XMFLOAT4X4A *)p_Result, r );
}

This must have something to do with the alignment of my data i take it.

But the above code is just like they do it in UE4.

 

I dont know what to do really..
Is it a compiler setting? (Im using vs2015)


Viewing all articles
Browse latest Browse all 17560

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>