Microsoft DirectX 8.0 (Visual Basic)

m4x3

Computes the product of the input vector and a 4x3 matrix.

m4x3   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, 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_Source[0].w * m_Source[1].w;
    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_Source[0].w * m_Source[2].w;
    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_Source[0].w * m_Source[3].w;

    WriteResult();

Expansion

The following m4x3 instruction

m4x3   r5, v[0], c[3]

expands to

dp4   r5.x, v[0], c[3]
dp4   r5.y, v[0], c[4]
dp4   r5.z, v[0], 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 unless the input vector has a w-value of 1.0. If this w-value is 0.0, then no translation of the input vector will occur; that is, the translation elements of the matrix will not be applied.

Remarks

The input vector is at vSrc0 and the input 4x3 matrix is at mSrc1 and the two next higher registers in the same register file.

This operation is commonly used for transforming a position vector by a matrix that has no projective effect, such as occurs in model-space transformations. This macro instruction is implemented as a series of dot products.