do Statement

Execute a series of statements continuously until the conditional expression fails.

[Attribute] do { Statement Block; } while( Conditional );



An optional parameter that controls how the statement is compiled.

Attribute Description
fastopt Reduces the compile time but produces less aggressive optimizations. If you use this attribute, the compiler will not unroll loops.
This attribute affects only shader model targets that support break instructions. This attribute is available in shader model vs_2_x and shader model 3 and later. It is particularly useful in shader model 4 and later when the compiler compiles loops. The compiler simulates loops by default to evaluate whether it can unroll them. If you do not want the compiler to unroll loops, use this attribute to reduce compile time.

Statement Block

One or more statements.


A conditional expression. The statement block is executed before the expression is evaluated. The loop is exited when the expression evaluates to false.



See also

Flow Control