loop - ps

Starts a loop...endloop - ps block.

Syntax

loop aL, i#

 

Where:

Remarks

Pixel shader versions 1_1 1_2 1_3 1_4 2_0 2_x 2_sw 3_0 3_sw
loop x x

 

  • The Loop Counter Register (aL) holds the current loop count and can be used for relative addressing into Input Color Register (v#) 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 by the loop block and has to be 0.
  • Loop blocks may be nested. See Flow Control Limitations.
  • 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, v2[ aL ]
endloop

Pixel Shader Instructions