I am using DirectXMath in building my 3D simulation project
void SetConstantBuffer(ID3D11DeviceContext*_device_context, DirectX::XMMATRIX _world, DirectX::XMMATRIX _view, DirectX::XMMATRIX _projection)
{
ConstantBuffer const_buffer;
const_buffer.View = DirectX::XMMatrixTranspose(_world);
const_buffer.World = DirectX::XMMatrixTranspose(_view);
const_buffer.Projection = DirectX::XMMatrixTranspose(_projection);
_device_context->UpdateSubresource(m_const_buffer, 0, NULL, &const_buffer, 0, 0);
}
I get these kind of compiler errors probably on SIMD flag inside DirectXMath:
error C2719: '_world': formal parameter with __declspec(align('16')) won't be aligned
error C2719: '_view': formal parameter with __declspec(align('16')) won't be aligned
error C2719: '_projection': formal parameter with __declspec(align('16')) won't be aligned
Is there any other way without converting it to DirectX::XMFLOAT4X4?
By the way I'm using an x86 machine and compiling on Visual Studio 2012 Express.
__declspec(align('16'))declaration but when using aligned types such asXMFLOAT4A. The solution below applies too. - PinkTurtle