Microsoft DirectX 8.1 (C++)

Vertex Shader Declaration

The syntax for a shader declaration is shown below.

DECL 
{
    STREAM n;
    SKIP n;
    FVF a|b|c;

    type v#;
    type v#[n];
}

The following table describes the type of values used for the above syntax.

Syntax Description
n A number between 1 and 4
a|b|c DWORD expression which can consist of DWORDs and flexible vector format flags. To use a flexible vertex format (FVF), just strip off the D3DFVF_ prefix.
type One of the following types: UBYTE, SHORT, FLOAT, D3DCOLOR.
v# A valid vertex shader input register. See the table below for the list of FVF flags and their corresponding vertex shader input register.

The following table lists the FVF codes and the corresponding vertex shader input registers.

FVF Name Register Number
D3DFVF_XYZ D3DVSDE_POSITION 0
D3DFVF_XYZRHW D3DVSDE_BLENDWEIGHT 1
D3DFVF_XYZB1 through

D3DFVF_XYZB5

D3DVSDE_BLENDINDICES 2
D3DFVF_NORMAL D3DVSDE_NORMAL 3
D3DFVF_PSIZE D3DVSDE_PSIZE 4
D3DFVF_DIFFUSE D3DVSDE_DIFFUSE 5
D3DFVF_SPECULAR D3DVSDE_SPECULAR 6
D3DFVF_TEX0 D3DVSDE_TEXCOORD0 7
D3DFVF_TEX1 D3DVSDE_TEXCOORD1 8
D3DFVF_TEX2 D3DVSDE_TEXCOORD2 9
D3DFVF_TEX3 D3DVSDE_TEXCOORD3 10
D3DFVF_TEX4 D3DVSDE_TEXCOORD4 11
D3DFVF_TEX5 D3DVSDE_TEXCOORD5 12
D3DFVF_TEX6 D3DVSDE_TEXCOORD6 13
D3DFVF_TEX7 D3DVSDE_TEXCOORD7 14
  D3DVSDE_POSITION2 15
  D3DVSDE_NORMAL2 16