if bool - ps
Microsoft DirectX 9.0 SDK Update (October 2004)

if bool - ps


Start of an if block.

Syntax

if bool

Where:

Remarks

Pixel shader versions1_11_21_31_42_02_x2_sw3_03_sw
if boolxxxx

If the source Boolean register in the if statement is true, the code enclosed by the if statement and the matching endif or else is executed. Otherwise, the code enclosed by the else...endif statements is executed. This instruction consumes one instruction slot.

An if block can be nested.

An if block cannot straddle a loop block.

An if block can be followed by a statement block, and/or an else instruction, and/or an endif instruction.

Example

This instruction provides conditional static flow control.

defb b3, true

if b3
// Instructions to run if b3 is nonzero
else
// Instructions to run otherwise
endif

Related Topics



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