Microsoft DirectX 9.0

Vertex Shader 2_0 Extended

A programmable vertex shader is made up of a set of instructions that operate on vertex data. Registers transfer data in and out of the arithmetic logic unit (ALU). Additional control can be applied to modify the instruction, the results, or what data gets written out.

Vertex shader version 2_x extends the feature set supported by vs_2_0. Each additional feature is represented by a corresponding cap in the D3DCAPS9 structure within the VS20Caps member. To use any of the enhanced features represented by these caps, the vertex shader version must be specified as vs_2_x.

New Features

New features are as follows:

Dynamic Flow Control

D3DCAPS9.VS20Caps.DynamicFlowControlDepth represents the nesting depth of dynamic flow control instructions: if, if_comp, if_pred, break, and break_comp. The value is equal to the nesting depth of the if_comp block. The range of values for this cap is 0 to 24. If this cap is zero, the device does not support dynamic flow control instructions.

Number of Temporary Registers

This cap represents the number of temporary registers (r#) supported by the device. The range of values for this cap is 12 to 32.

Static Flow Control Nesting Depth

D3DCAPS9.VS20Caps.StaticFlowControlDepth represents the nesting depth of two types of static flow control instructions: loop/rep and call/callnz. The range of values for this cap is 1 to 4. loop/rep instructions can be nested up to StaticFlowControlDepth deep. Independently, call/callnz instructions can be nested up to StaticFlowControlDepth deep.


If the D3DVS20CAPS_PREDICATION flag is set on D3DCAPS9.VS20Caps, the device supports predication.

Instruction Count

Each vertex shader can have up to 256 instructions stored. The number of instructions run can be much higher because of the looping support. The MaxVShaderInstructionsExecuted cap in D3DCAPS9 should be at least 2^16.

The total number of instructions run should be clamped to the device driver render state D3DRS_MAXVERTEXSHADERINST. The legal values for this render state are numbers that are powers of 2; if any other integer is set, the next nearest pow2 number is assumed. This defaults to D3DINFINITEINSTRUCTIONS.

© 2002 Microsoft Corporation. All rights reserved.