|Microsoft DirectX 9.0|
In the older shader models, including the fixed function, the vertex shader was invoked once per vertex. With every invocation, the input registers were initialized with unique vertex elements from the vertex streams.
This feature allows a subset of the input registers to be initialized at a less frequent rate. This feature is supported by all devices that support vs_3_0.
The application sets a frequency for a given stream. All elements in that stream are affected by this value. Frequency is "after how many vertices is the data from that stream fetched into the vertex processing machine." That is, if it is 2, the data from that stream is fetched into the Vn registers every two vertices.
The vertex offset (in the vertex buffer) is computed using the following formula.
VertexOffset = VertexIndex / Divider * StreamStride + StreamOffset
The division is an integer division.
This state is recorded in state blocks as vertex state.
Stream frequency is ignored for indexed primitives and if the current vertex shader set is less than version 3_0 (including fixed function).
Two new methods have been introduced.
HRESULT IDirect3DDevice9::SetStreamSourceFreq( UINT StreamIndex, UINT Frequency ); HRESULT IDirect3DDevice9::GetStreamSourceFreq( UINT StreamIndex, UINT* Frequency );
The frequency range is:
0 < frequency <= 216 - 1