Microsoft DirectX 8.0 (C++) |
The processor that executes the pixel shader has two parallel pipelines, one for vector processing (RGB), and one for scalar processing (alpha). Using these pipelines in parallel results in substantially better processor utilization and performance by reducing the total number of clock cycles required. In essence, this affects the pixel fill rate performance.
The output masks can affect how the two pipelines are allocated, but there can be ambiguities in the order of operations unless explicit pairing syntax is used. The following table illustrates the output masks and their associated pipe.
Output mask | Pipe |
---|---|
.a | The operation is in the scalar pipe. |
.rgb | The operation is in the vector pipe. |
.rgba | The operation is in both the scalar and vector pipes. It already counts as a pair. |
Pairing is indicated by a plus sign (+) preceding the second instruction of the pair.
mul r0.rgb, t0, v0 // Component-wise multiply the colors, + add r0.a, t0, v0 // but add the alpha components.
The dot product instructions are a special case. They are vector operations and always executed in the vector pipeline. Therefore, you can specify a different instruction in the scalar pipe and still get pairing, as shown in the following pixel shader example code.
dp3 r0.rgb, t0, v0 mul r0.a, t0, v0
You cannot specify a dot product operation as a scalar instruction without a dot product operations as a vector instruction.