Microsoft DirectX 8.0 (C++)

Transformation and Constant Shading

The following shader performs a one-matrix transform with constant color. The input vertex register v0 is the position, which is assumed to be homogeneous. The transform matrix is in the constant registers (c[0] through c[3]). Diffuse color is loaded into c[4].

dp4 r0.x, v0, c[0] 
dp4 r0.y, v0, c[1] 
dp4 r0.z, v0, c[2] 
dp4 r0.w, v0, c[3] 
mov oD0, c[4]         ; The constant color.
mov oPos, r0          ; Emit the output.

This shader executes in six clock cycles.