Jump to content
  • Advertisement
Sign in to follow this  

Get error when I try to use XMMATRIX type as an function variable

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

Hi gentlemen,

There is a function in my class for some rendering job, and I would like to pass two matrix , view and projection from my Camera class to this external function.

its prototype is like

[source lang="cpp"]Draw(ID3D11Device* device, XMMATRIX view, XMMATRIX projection)





I get error messages like

[source lang="cpp"]Error 10 error C2719: 'view': formal parameter with __declspec(align('16')) won't be aligned[/source]

I 've googled and some say it's a known vector and Align data issue and MS will fix this in VC11.

Any idea How I can fix this?

Thank you and have a nice day!

Share this post

Link to post
Share on other sites
Trying passing by reference or a pointer, the error occurs because the compiler cannot guarantee the alignment of function parameters passed on the stack (technically it can, but VS2010 and lower have horrible stack alignment handling). the alternative is to covert to a XMFLOAT4X4 which has no alignment requirement, but this adds extra overhead and painful conversion code.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!