Microsoft DirectX 8.0 (C++) |
Computes the product of the input vector and a 3x4 matrix.
m3x4 rDest, vSrc0, mSrc1
SetDestReg(); SetSrcReg(0); SetSrcReg(1, 4); m_TmpReg.x = m_Source[0].x * m_Source[1].x + m_Source[0].y * m_Source[1].y + m_Source[0].z * m_Source[1].z; m_TmpReg.y = m_Source[0].x * m_Source[2].x + m_Source[0].y * m_Source[2].y + m_Source[0].z * m_Source[2].z; m_TmpReg.z = m_Source[0].x * m_Source[3].x + m_Source[0].y * m_Source[3].y + m_Source[0].z * m_Source[3].z; m_TmpReg.w = m_Source[0].x * m_Source[4].x + m_Source[0].y * m_Source[4].y + m_Source[0].z * m_Source[4].z; WriteResult();
The following m3x4 instruction
m3x4 r5, v[0], c[3]
expands to
dp3 r5.x, v[0], c[3] dp3 r5.y, v[0], c[4] dp3 r5.z, v[0], c[5] dp3 r5.w, v[0], c[6]
Therefore, this macro instruction consumes four instruction slots from the instruction count. Note that the last w-component in c[3], c[4], and c[5] is ignored in this computation.
The input vector is at vSrc0 and the input 3x4 matrix is at mSrc1 and the two subsequent registers in the same register file.
This operation is commonly used for transforming a position vector by a matrix that has a projective effect, but applies no translation. This macro instruction is implemented as a series of dot products.