Jump to content

  • Log In with Google      Sign In   
  • Create Account


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Lee_Hillvith   Members   -  Reputation: 142

Like
0Likes
Like

Posted 28 September 2012 - 12:22 AM

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){ //...... ......//}[/source]

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!

Sponsor:

#2 Necrolis   Members   -  Reputation: 1231

Like
0Likes
Like

Posted 28 September 2012 - 01:10 AM

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.

#3 kubera   Members   -  Reputation: 858

Like
0Likes
Like

Posted 28 September 2012 - 01:28 AM

[source lang="cpp"]Draw(ID3D11Device* device, XMMATRIX & view, XMMATRIX & projection)Draw(ID3D11Device* device, XMMATRIX * view, XMMATRIX * projection)[/source]
Will work also.

Please, consider reading that thread.
http://xboxforums.cr...ms/t/84299.aspx




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS