Jump to content

View more

Image of the Day

Isn't this a lovely apple tempart placeholder thing  #gamedev worth a #screenshotsaturday even I would say. https://t.co/fQH1d0ySIG
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

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

2: Adsense

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   

143
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!

#2 Necrolis   Members   

1463
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   

1568
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.