i realize that in d3dx math library or xnamath library, there matrix is saved row major in memory. in effect framework, when we set a matrix parameter by effect interface setvarible, it will transpose the target matrix. if i am not use effect framework, i must set shader parameter by SetVertexConstantF...
but when i use effect framework, i must transform vertices by this code:
OutPosition = mul( InPosition, mViewProj );
in normal shader code without effect framework, i must use:
OutPosition = mul( mViewProj, InPosition );
if i change the order of this , it will work incorrectly.
i found some article, they sait that hlsl store matrix as column major. if it is true, i think i must use pre-multiply matrix:
OutPosition = mul( mViewProj, InPosition );
but when i debug this in pix or nsight, i found that the marix parameter is store in register as it in the memory, for example: if mViewProj is:
x0 y0 z0 w0
x1 y1 z1 w1
x2 y2 z2 w2
x3 y3 z3 w3
in vertex shader register:
c0:x0 y0 z0 w0
c1:x1 y1 z1 w1
c2:x2 y2 z2 w2
c3:x3 y3 z3 w3
it looks like store as row major. why?
is this conflict with the basic rules of matrix multiplication: column major: matrix * vec row major : vec * matrix.