Microsoft DirectX 8.0 (Visual Basic) |
Computes the product of the input vector and a 3x3 matrix.
m3x3 rDest, vSrc0, mSrc1
SetDestReg(); SetSrcReg(0); SetSrcReg(1, 3); 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; WriteResult();
The following m3x3 instruction
m3x3 r5, v0, c[3]
expands to
dp3 r5.x, v0, c[3] dp3 r5.y, v0, c[4] dp3 r5.z, v0, c[5]
Therefore, this macro instruction consumes three 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 3x3 matrix is at mSrc1 and the two subsequent registers in the same register file.
This operation is commonly used for transforming normal vectors during lighting computations. This macro instruction is implemented as a series of dot products.