if pred - ps

Start of an if bool - ps...else - ps...endif - ps block, with the condition taken from the content of the predicate register.


if [!]pred.replicateSwizzle



  • [!] is an optional NOT modifier. This modifies the value in the predicate register.
  • pred is the Predicate Register.
  • replicateSwizzle is a single component that is copied (or replicated) to all four components (swizzled). Valid components are: [x, y, z, w] or [r, g, b, a].


Pixel shader versions1_11_21_31_42_02_x2_sw3_03_sw


This instruction is used to skip a block of code, based on a channel of the predicate register. Each if_pred block must end with an else - ps or endif - ps instruction.

Restrictions include:

if_pred blocks can be nested. This counts to the total dynamic nesting depth along with if_comp blocks.

An if_pred block cannot straddle a loop block; it should either be completely inside it or surround it.

Related topics

Pixel Shader Instructions