loop - vs

Start a loop...endloop block.

Syntax

loop aL, i#

 

Where:

Remarks

Vertex shader versions 1_1 2_0 2_x 2_sw 3_0 3_sw
loop x x x x x

 

  • The Loop Counter Register (aL) holds the current loop count, and can be used for relative addressing into Constant Integer Register (c#) or Output Registers (o#) inside the loop block.
  • i#.x specifies the iteration count. The legal range is [0, 255]. Note that this instruction does not increment or decrement the value of i#.x.
  • i#.y specifies the initial value of the Loop Counter Register (aL) register. The legal range is [0, 255]. Note that this instruction does not increment or decrement the value of i#.y.
  • i#.z specifies the step/stride size. The legal range is [-128, 127].
  • i#.w is not used and must be set to 0.
  • Loop blocks may be nested. See Flow Control Nesting Limits.
  • When nested, the value of the Loop Counter Register (aL) refers to the immediate enclosing loop block.
  • Loop blocks are allowed to be either completely inside an if* block or completely surrounding it. No straddling is allowed.

Example

loop aL, i3
    add r1, r0, c2[aL]
endloop

Vertex Shader Instructions