setp_comp - ps

Set the predicate register.

Syntax

setp_comp dst, src0, src1

Where:

Remarks

Pixel shader versions 1_1 1_2 1_3 1_4 2_0 2_x 2_sw 3_0 3_sw
setp_comp x x x x

This instruction operates as:

per channel in destination write mask
{
  dst.channel = src0.channel cmp src1.channel
}

For each channel that can be written according to the destination write mask, save the boolean result of the comparison operation between the corresponding channels of src0 and src1 (after the source modifier swizzles have been resolved).

Source registers allow arbitrary component swizzles to be specified.

The destination register allows arbitrary write masks.

The dst register must be the predicate register.

Applying the Predicate Register

Once the predicate register has been initialized with setp_comp, it can be used to control an instruction per component. Here's the syntax:

([!]p0[.swizzle]) instruction dest, src0, ...

Where:

Assuming the predicate register has been set up with (true, true, false, false) component values, it can be applied to this instruction:

(p0) add r1, r2, r3

to perform a 2 component add.

r1.x = r2.x + r3.x
r1.y = r2.y + r3.y

The z and w components of r1 will not be written since the predicate register contained false in components z and w.

Applying the predicate register to an arithmetic or texture instruction increases its instruction slot count by 1.

The predicate register can also be applied to if pred - ps, callnz pred - ps and breakp - ps instructions. These flow control instructions do not have any increase in the instruction slot count when using the predicate register.