dp4 - ps

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


dp4 dst, src0, src1



  • dst is the destination register.
  • src0 is a source register.
  • src1 is a source register.


Pixel shader versions1_11_21_31_42_02_x2_sw3_03_sw


The following code snippet shows the operations performed:

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

Limitations for ps_1_2 and ps_1_3:

  • Each shader can use up to a maximum of four dp4 instructions.
  • Each dp4 instruction counts as two arithmetic instructions.

Limitations for 1_X versions:

  • This instruction cannot be co-issued because dp4 runs in both the vector and alpha pipeline.

Related topics

Pixel Shader Instructions