?/TD>
Microsoft DirectX 9.0

Input Register


Vertex shader input register. An input register is bound to the vertex data, so that the vertex data can be input to the shader.

Syntax

Input Register 

Remarks

An input register is bound to vertex data through a vertex declaration. There is no way to set an input register inside the shader, or through the application programming interface (API).

A register consists of properties that determine 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 2-D vertex position data to register v0.

Here is the vertex declaration. This belongs in the application.

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

Here is the vertex shader declaration that binds the position data to register v0.

dcl_position v0

For a more complete code sample, see the VertexShader software development kit (SDK) sample.

Here is the vertex declaration that uses several vertex registers and data types.

dcl_position0 v0
dcl_position1 v1
dcl_position2 v2
dcl_normal0   v3
dcl_normal1   v4
dcl_normal2   v5
dcl_texcoord0 v6

This example is from the dolphin tweening SDK sample.

Instruction Information

Minimum operating systemWindows 98


© 2002 Microsoft Corporation. All rights reserved.