Flow Control Nesting Limits

Vertex shader flow control instructions have two special restrictions. Nesting depths restrict the number of instructions that can be called inside of each other. In addition, each instruction has an instruction slot count that applies against the maximum number of instruction that a shader can support.

Depth Count per Instruction for vs_2_0

Each instruction counts against one or more nesting depth limits. This table shows the depth count that each instruction adds or subtracts from the existing depth:

Instruction Static nesting Dynamic nesting loop/rep nesting call nesting Static flow count
if bool - vs 0 0 0 0 1
if_comp - vs n/a n/a n/a n/a n/a
if pred - vs n/a n/a n/a n/a n/a
else - vs 0 0 0 0 1(if bool - vs only)
endif - vs -1 0 0 0 0
rep - vs 0 0 1 0 1
endrep - vs 0 0 -1 0 0
loop - vs 0 0 1 0 1
endloop - vs 0 0 -1 0 0
break - vs n/a n/a n/a n/a n/a
break_comp - vs n/a n/a n/a n/a n/a
breakp - vs n/a n/a n/a n/a n/a
call - vs 0 0 0 1 1
callnz bool - vs 0 0 0 1 1
callnz pred - vs n/a n/a n/a n/a n/a
ret - vs 0 0 0 -1 0
setp_comp - vs n/a n/a n/a n/a n/a

Nesting Depth

Nesting depth define how many instructions can be called inside of each other. Each type of instruction has one or more nesting limits:

Instruction Type Maximum
Static nesting Only limited by the static flow count
Dynamic nesting n/a
loop/rep nesting 1
call nesting 1
Static flow count 16

Depth Count per Instruction for vs_2_x

Each instruction counts against one or more nesting depth limits. This table shows the depth count that each instruction adds or subtracts from the existing depth:

Instruction Static nesting Dynamic nesting loop/rep nesting call nesting Static flow count
if bool - vs 1 0 0 0 1
if_comp - vs 0 1 0 0 0
if pred - vs 0 1 0 0 0
else - vs 0 0 0 0 1(if bool - vs only)
endif - vs -1(if bool - vs) -1(if pred - vs or if_comp - vs) 0 0 0
rep - vs 0 0 1 0 1
endrep - vs 0 0 -1 0 0
loop - vs 0 0 1 0 1
endloop - vs 0 0 -1 0 0
break - vs 0 0 0 0 0
break_comp - vs 0 1, -1 0 0 0
breakp - vs 0 0 0 0 0
call - vs 0 0 0 1 1
callnz bool - vs 0 0 0 1 1
callnz pred - vs 0 1 0 1 0
ret - vs 0 -1 (callnz pred - vs) 0 -1 0
setp_comp - vs 0 0 0 0 0

Nesting Depth

Nesting depth define how many instructions can be called inside of each other. Each type of instruction has one or more nesting limits:

Instruction Type Maximum
Static nesting Only limited by the static flow count
Dynamic nesting 0 or 24, see D3DCAPS9.VS20Caps.DynamicFlowControlDepth
loop/rep nesting 1 to 4, see D3DCAPS9.VS20Caps.StaticFlowControlDepth
call nesting 1 to 4, see D3DCAPS9.VS20Caps.StaticFlowControlDepth (independent of loop/rep limit)
Static flow count 16

Depth Count per Instruction for vs_2_sw

Each instruction counts against one or more nesting depth limits. This table shows the depth count that each instruction adds or subtracts from the existing depth:

Instruction Static nesting Dynamic nesting loop/rep nesting call nesting Static flow count
if bool - vs 1 0 0 0 n/a
if_comp - vs 0 1 0 0 n/a
if pred - vs 0 1 0 0 n/a
else - vs 0 0 0 0 n/a
endif - vs -1(if bool - vs) -1(if pred - vs or if_comp - vs) 0 0 n/a
rep - vs 0 0 1 0 n/a
endrep - vs 0 0 -1 0 n/a
loop - vs 0 0 1 0 n/a
endloop - vs 0 0 -1 0 n/a
break - vs 0 0 0 0 n/a
break_comp - vs 0 1, -1 0 0 n/a
breakp - vs 0 0 0 0 n/a
call - vs 0 0 0 1 n/a
callnz bool - vs 0 0 0 1 n/a
callnz pred - vs 0 1 0 1 n/a
ret - vs 0 -1 (callnz pred - vs) 0 -1 n/a
setp_comp - vs 0 0 0 0 n/a

Nesting Depth

Nesting depth define how many instructions can be called inside of each other. Each type of instruction has one or more nesting limits:

Instruction Type Maximum
Static nesting 24
Dynamic nesting 24
loop/rep nesting 4
call nesting 4
Static flow count No limit

Depth Count per Instruction for vs_3_0

Each instruction counts against one or more nesting depth limits. This table shows the depth count that each instruction adds or subtracts from the existing depth:

Instruction Static nesting Dynamic nesting loop/rep nesting call nesting Static flow count
if bool - vs 1 0 0 0 n/a
if_comp - vs 0 1 0 0 n/a
if pred - vs 0 1 0 0 n/a
else - vs 0 0 0 0 n/a
endif - vs -1(if bool - vs) -1(if pred - vs or if_comp - vs) 0 0 n/a
rep - vs 0 0 1 0 n/a
endrep - vs 0 0 -1 0 n/a
loop - vs 0 0 1 0 n/a
endloop - vs 0 0 -1 0 n/a
break - vs 0 0 0 0 n/a
break_comp - vs 0 1, -1 0 0 n/a
breakp - vs 0 0 0 0 n/a
call - vs 0 0 0 1 n/a
callnz bool - vs 0 0 0 1 n/a
callnz pred - vs 0 1 0 1 n/a
ret - vs 0 -1 (callnz pred - vs) 0 -1 n/a
setp_comp - vs 0 0 0 0 n/a

Nesting Depth

Nesting depth define how many instructions can be called inside of each other. Each type of instruction has one or more nesting limits:

Instruction Type Maximum
Static nesting 24
Dynamic nesting 24
loop/rep nesting 4
call nesting 4
Static flow count No limit

Depth Count per Instruction for vs_3_sw

Each instruction counts against one or more nesting depth limits. This table shows the depth count that each instruction adds or subtracts from the existing depth:

Instruction Static nesting Dynamic nesting loop/rep nesting call nesting Static flow count
if bool - vs 1 0 0 0 n/a
if_comp - vs 0 1 0 0 n/a
if pred - vs 0 1 0 0 n/a
else - vs 0 0 0 0 n/a
endif - vs -1(if bool - vs) -1(if pred - vs or if_comp - vs) 0 0 n/a
rep - vs 0 0 1 0 n/a
endrep - vs 0 0 -1 0 n/a
loop - vs 0 0 1 0 n/a
endloop - vs 0 0 -1 0 n/a
break - vs 0 0 0 0 n/a
break_comp - vs 0 1, -1 0 0 n/a
breakp - vs 0 0 0 0 n/a
call - vs 0 0 0 1 n/a
callnz bool - vs 0 0 0 1 n/a
callnz pred - vs 0 1 0 1 n/a
ret - vs 0 -1 (callnz pred - vs) 0 -1 n/a
setp_comp - vs 0 0 0 0 n/a

Nesting Depth

Nesting depth define how many instructions can be called inside of each other. Each type of instruction has one or more nesting limits:

Instruction Type Maximum
Static nesting 24
Dynamic nesting 24
loop/rep nesting 4
call nesting 4
Static flow count No limit