Input Register

Vertex shader input register.

Data from each vertex (using one or more input vertex streams) is loaded into the vertex input registers before the vertex shader is run. The input registers consist of 16 four-component floating-point vectors, designated as v0 through v15. These registers are read-only. An input register is bound to vertex data through a vertex declaration.

The following register properties control how each register behaves:

PropertyDescription
Namev[n] - n is an optional register number. 0 is the default value used, if it is omitted.
CountA maximum of 16 registers, v0 - v15.
I/O permissionsRead-only. This register cannot be written by the API or within the shader.
Read ports1. This is the number of times a register can be read within a single instruction. See below.

 

Any single instruction can access only one vertex input register. However, each source in the instruction can independently swizzle and negate that vector as it is read.

Example

Here is an example using a vertex declaration to bind 2D vertex position data to register v0.

The vertex declaration belongs in the application:



D3DVERTEXELEMENT9 decl[] =
{
    { 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
      D3DDECL_END()
};


Here is the corresponding vertex shader declaration:



dcl_position v0


Vertex shader versions1_12_02_sw2_x3_03_sw
Position Registerxxxxxx

 

Related topics

Vertex Shader Registers

 

 

Show: