Skip to content

Latest commit

 

History

History
89 lines (48 loc) · 1.45 KB

if-bool---vs.md

File metadata and controls

89 lines (48 loc) · 1.45 KB
title description ms.assetid ms.topic ms.date topic_type api_name api_type api_location
if bool - vs
Starts an if...else...endif - vs block.
d77e2f81-400c-4997-9c34-426b6e6f47be
reference
05/31/2018
apiref

if bool - vs

Starts an if...else...endif - vs block.

Syntax

if bool

 

where bool is a bool register number. See Constant Boolean Register.

Remarks

Vertex shader versions 1_1 2_0 2_x 2_sw 3_0 3_sw
if bool x x x x x

 

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

if blocks can be nested.

An if block cannot straddle a loop block.

Example

This instruction provides conditional static flow control.

defb b2, TRUE

...

if b2
// Instructions to run if b2 is nonzero

else
// Instructions to run otherwise

endif

Related topics

Vertex Shader Instructions

else - vs

endif - vs