if_comp - ps
Microsoft DirectX 9.0 SDK Update (October 2004)

if_comp - ps


Start an if bool...else...endif block, with a condition based on values that could be computed in a shader. This instruction is used to skip a block of code, based on a condition.

Syntax

if_comp src0, src1

Where:

Remarks

Pixel shader versions1_11_21_31_42_02_x2_sw3_03_sw
if_compxxxx

This instruction is used to skip a block of code, based on a condition.

if (src0 comparison src1)
   jump to the corresponding else or endif instruction;

Be careful using the equals and not equals comparison modes on floating point numbers. Because rounding occurs during during floating point calculations, the comparison can be done against an epsilon value (small nonzero number) to avoid errors.

Restrictions include:

Example

This instruction provides conditional dynamic flow control.

if_lt r3.x, r4.y
// Instructions to run if r3.x < r4.y

else
// Instructions to run otherwise

endif



© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.