Microsoft DirectX 8.0 (C++) |
Multiplies and adds sources.
mad vDest, vSrc0, vSrc1, vSrc2
The following code fragment shows the operations performed by the mad instruction to write a result to the destination.
SetDestReg(); SetSrcReg(0); SetSrcReg(1); SetSrcReg(2); m_TmpReg.x = m_Source[0].x * m_Source[1].x + m_Source[2].x; m_TmpReg.y = m_Source[0].y * m_Source[1].y + m_Source[2].y; m_TmpReg.z = m_Source[0].z * m_Source[1].z + m_Source[2].z; m_TmpReg.w = m_Source[0].w * m_Source[1].w + m_Source[2].w; WriteResult();
The following examples illustrate how the mad instruction might be used.
mad r0,r1,r2,v3