Skip to main content
GameDev.net gamedev.net
🔒 Locked

SharpDX Matrix Order

Started by montify Oct 1, 2018 at 7:39 PM 1 replies 1.3k views
Original Post
montify
montify

Hello Guys,


I'm using scharpDX 4, and wonder why the matrix class uses row_major matrixes, because HLSL uses column_major

Can anyone tell me if there is a specific reason why the matrix class uses exactly the wrong matrix order?

markypooch
markypooch

HLSL can use any ordering that you specify. Last I checked, though this may be a more recent feature, you can specify the row_major keyword in your shader code. Insofar as why is a hand-wavy, "Historical reasons". Generally 2D Arrays are stored in row_major on the CPU side, so my guess is they just kept with that convention.

It's not a wrong ordering, it's a perfectly valid one, and iirc, it's more efficient to work with a row_major organized data-construct for looping on the cpu side if you plan to modify the matrices sub-elements e.g., but it is a different ordering, and ultimately one you want to be aware of in D3D in particular.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.