Microsoft DirectX 8.0 (Visual Basic) |
Computes the four-component dot product of the sources.
dp4 vDest, vSrc0, vSrc1
The following code fragment shows the operations performed by the dp4 instruction to write a result to the destination.
SetDestReg(); SetSrcReg(0); SetSrcReg(1); m_TmpReg.x = m_TmpReg.y = m_TmpReg.z = m_TmpReg.w = 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; WriteResult();
The following example illustrates how the dp4 instruction might be used.
dp4 r2, r0, r1 dp4 r2.w, r0, r1