?/TD>
Microsoft DirectX 9.0

dp3 (Pixel Shader)


Computes the three-component dot product of the source registers.

Syntax

dp3 dst, src0, src1

where

Remarks

Pixel shader versions1_11_21_31_42_02_x2_sw3_03_sw
dp3xxxxxxxxx

The following code fragment shows the operations performed:

dest.w = (src0.x * src1.x) + (src0.y * src1.y) + 
         (src0.z * src1.z) + (src0.w * src1.w);
dest.x = dest.y = dest.z = unused;

In version 1_X, this instruction cannot be co-issued.

In version 1_X, this instruction does not automatically clamp the output result between zero and one. If clamping is necessary, use the Instruction Modifiers.

This instruction runs in the vector pipeline, always writing out to the color channels. For version 1_4, this instruction still uses the vector pipeline but may write to any channel.

dp3 r0.rgb, t0, v0            // Copy scalar result to RGB components.

An instruction with a destination register RGB write mask may be co-issued with dp3 as shown below.

dp3 r0.rgb, t0, v0            // Copy scalar result to color components.
+mov r2.a, t0                 // Copy alpha component from t0 in parallel. 

The dp3 instruction can be modified using the Signed Scaling input argument modifier (_bx2) applied to its input arguments if they are not already expanded to signed dynamic range. For a lighting shader, the saturate instruction modifier (_sat) is often used to clamp the negative values to black, as shown in the following example.

dp3_sat r0, t0_bx2, v0_bx2    // Here t0 is a bump map, v0 contains the light direction.

Instruction Information

Minimum operating systemWindows 98


© 2002 Microsoft Corporation. All rights reserved.