Microsoft DirectX 8.0 (Visual Basic)

m3x2

Computes the product of the input vector and a 3x2 matrix.

m3x2   rDest, vSrc0, mSrc1

Registers

rDest
Destination register, holding the result of the operation.
vSrc0
Source register, specifying the input argument.
mSrc1
Source register, specifying the input argument.

Operation

    SetDestReg();
    SetSrcReg(0);
    SetSrcReg(1, 2);
    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;

    WriteResult();

Expansion

The following m3x2 instruction

m3x2   r5, v0, c[3]

expands to

dp3   r5.x, v0, c[3]
dp3   r5.y, v0, c[4]

Therefore, this macro instruction consumes two instruction slots from the instruction count. Note that the last w-component in c[3] and c[4] is ignored in this computation.

Remarks

The input vector is at vSrc0, the input 3x2 matrix is at mSrc1, and the next higher register in the same register file. A 2-D result is produced, leaving the other elements of rDest (z and w) unaffected.

This operation is commonly used for 2-D transforms. This macro instruction is implemented as a pair of dot products.