loop (Pixel Shader)
Starts a
loop...
endloop block.
Syntax
Where:
- aL is the Loop Counter Register, holding the current loop count. The address register can be used to index into the Color Registers, ( v#).
- integerRegister is an input source register. integerRegister.x specifies the iteration count, integerRegister.y specifies the initial value of the current loop counter register, and integerRegister.z specifies the increment for the current loop counter register.
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 |
---|
Only integer registers may be used in this instruction The loop instruction is provided for iteration, and supports an auto-incremented loop counter register that can be used to index the constant array. When nested, any time the loop counter register is used, it refers to the current loop.
This instruction works as shown below.
StartLoopOffset = next instruction offset
LoopCounter = IntegerReg.x
IterationCount = IntegerReg.y
LoopStep = InteferReg.z
if (IterationCounter <= 0)
Continue execution after the next EndLoop instruction
- The endloop instruction must follow the last instruction of a loop block.
- The endloop instruction offset must be greater than the corresponding loop instruction offset.
- Loops cannot be nested for ps_2_x or ps_2_sw.
- Loops can be nested between 0 and 4 levels in ps_3_0 and ps_3_sw.
- Loops are allowed to be either completely inside an if block or completely surrounding it; no straddling is allowed.
- The maximum loop initial value (base offset) is 255.
- The maximum loop iteration count is 255.
- The maximum step/stride size is 127 as signed strides, for example, -128 are supported.
- The loop initial value and loop iteration count cannot be negative.