Flow Control Nesting Limits
Microsoft DirectX 9.0 SDK Update (October 2004)

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:

InstructionStatic nestingDynamic nestingloop/rep nestingcall nestingStatic flow count
if bool00001
if_compn/an/an/an/an/a
if predn/an/an/an/an/a
else00001(if bool only)
endif-10000
rep00101
endrep00-100
loop00101
endloop00-100
breakn/an/an/an/an/a
break_compn/an/an/an/an/a
breakpn/an/an/an/an/a
call00011
callnz bool00011
callnz predn/an/an/an/an/a
ret000-10
setp_compn/an/an/an/an/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 TypeMaximum
Static nestingOnly limited by the static flow count
Dynamic nestingn/a
loop/rep nesting1
call nesting1
Static flow count16

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:

InstructionStatic nestingDynamic nestingloop/rep nestingcall nestingStatic flow count
if bool10001
if_comp01000
if pred01000
else00001(if bool only)
endif-1(if bool)-1(if pred or if_comp)000
rep00101
endrep00-100
loop00101
endloop00-100
break00000
break_comp01, -1000
breakp00000
call00011
callnz bool00011
callnz pred01010
ret0-1 (callnz pred)0-10
setp_comp00000

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 TypeMaximum
Static nestingOnly limited by the static flow count
Dynamic nesting0 or 24, see D3DCAPS9.VS20Caps.DynamicFlowControlDepth
loop/rep nesting1 to 4, see D3DCAPS9.VS20Caps.StaticFlowControlDepth
call nesting1 to 4, see D3DCAPS9.VS20Caps.StaticFlowControlDepth (independent of loop/rep limit)
Static flow count16

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:

InstructionStatic nestingDynamic nestingloop/rep nestingcall nestingStatic flow count
if bool1000n/a
if_comp0100n/a
if pred0100n/a
else0000n/a
endif-1(if bool)-1(if pred or if_comp)00n/a
rep0010n/a
endrep00-10n/a
loop0010n/a
endloop00-10n/a
break0000n/a
break_comp01, -100n/a
breakp0000n/a
call0001n/a
callnz bool0001n/a
callnz pred0101n/a
ret0-1 (callnz pred)0-1n/a
setp_comp0000n/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 TypeMaximum
Static nesting24
Dynamic nesting24
loop/rep nesting4
call nesting4
Static flow countNo 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:

InstructionStatic nestingDynamic nestingloop/rep nestingcall nestingStatic flow count
if bool1000n/a
if_comp0100n/a
if pred0100n/a
else0000n/a
endif-1(if bool)-1(if pred or if_comp)00n/a
rep0010n/a
endrep00-10n/a
loop0010n/a
endloop00-10n/a
break0000n/a
break_comp01, -100n/a
breakp0000n/a
call0001n/a
callnz bool0001n/a
callnz pred0101n/a
ret0-1 (callnz pred)0-1n/a
setp_comp0000n/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 TypeMaximum
Static nesting24
Dynamic nesting24
loop/rep nesting4
call nesting4
Static flow countNo 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:

InstructionStatic nestingDynamic nestingloop/rep nestingcall nestingStatic flow count
if bool1000n/a
if_comp0100n/a
if pred0100n/a
else0000n/a
endif-1(if bool)-1(if pred or if_comp)00n/a
rep0010n/a
endrep00-10n/a
loop0010n/a
endloop00-10n/a
break0000n/a
break_comp01, -100n/a
breakp0000n/a
call0001n/a
callnz bool0001n/a
callnz pred0101n/a
ret0-1 (callnz pred)0-1n/a
setp_comp0000n/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 TypeMaximum
Static nesting24
Dynamic nesting24
loop/rep nesting4
call nesting4
Static flow countNo limit


© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.