Mapping FVF Codes to a DirectX 9 Declaration
Microsoft DirectX 9.0 SDK Update (October 2004)

Mapping FVF Codes to a DirectX 9 Declaration


This table maps flexible vertex format (FVF) codes to a D3DVERTEXELEMENT9 structure.

FVFData typeUsageUsage index
D3DFVF_XYZD3DDECLTYPE_FLOAT3D3DDECLUSAGE_POSITION0
D3DFVF_XYZRHWD3DDECLTYPE_FLOAT4D3DDECLUSAGE_POSITIONT0
D3DFVF_XYZWD3DDECLTYPE_FLOAT4D3DDECLUSAGE_POSITION0
D3DFVF_XYZB5 and D3DFVF_LASTBETA_UBYTE4D3DVSDT_FLOAT3

D3DVSDT_FLOAT4

D3DVSDT_UBYTE4

D3DDECLUSAGE_POSITION

D3DDECLUSAGE_BLENDWEIGHT

D3DDECLUSAGE_BLENDINDICES
0
D3DFVF_XYZB5 and D3DFVF_LASTBETA_D3DCOLORD3DVSDT_FLOAT3

D3DVSDT_FLOAT4

D3DVSDT_D3DCOLOR

D3DDECLUSAGE_POSITION

D3DDECLUSAGE_BLENDWEIGHT

D3DDECLUSAGE_BLENDINDICES
0
D3DFVF_XYZB5D3DDECLTYPE_FLOAT3

D3DDECLTYPE_FLOAT4

D3DDECLTYPE_FLOAT1

D3DDECLUSAGE_POSITION

D3DDECLUSAGE_BLENDWEIGHT

D3DDECLUSAGE_BLENDINDICES
0
D3DFVF_XYZBn (n=1..4)D3DDECLTYPE_FLOAT3

D3DDECLTYPE_FLOATn
D3DDECLUSAGE_POSITION

D3DDECLUSAGE_BLENDWEIGHT
0
D3DFVF_XYZBn (n=1..4) and D3DFVF_LASTBETA_UBYTE4D3DDECLTYPE_FLOAT3

D3DDECLTYPE_FLOAT(n-1)

D3DDECLTYPE_UBYTE4
D3DDECLUSAGE_POSITION

D3DDECLUSAGE_BLENDWEIGHT

D3DDECLUSAGE_BLENDINDICES
0
D3DFVF_XYZBn (n=1..4) and D3DFVF_LASTBETA_D3DCOLORD3DDECLTYPE_FLOAT3

D3DDECLTYPE_FLOAT(n-1)

D3DDECLTYPE_D3DCOLOR
D3DDECLUSAGE_POSITION

D3DDECLUSAGE_BLENDWEIGHT

D3DDECLUSAGE_BLENDINDICES
0
D3DFVF_NORMALD3DDECLTYPE_FLOAT3D3DDECLUSAGE_NORMAL0
D3DFVF_PSIZED3DDECLTYPE_FLOAT1D3DDECLUSAGE_PSIZE0
D3DFVF_DIFFUSED3DDECLTYPE_D3DCOLORD3DDECLUSAGE_COLOR0
D3DFVF_SPECULARD3DDECLTYPE_D3DCOLORD3DDECLUSAGE_COLOR1
D3DFVF_TEXCOORDSIZEm(n)D3DDECLTYPE_FLOATmD3DDECLUSAGE_TEXCOORDn

Vertex Declarations with D3DDECLUSAGE_POSITIONT

The presence of a vertex element with (D3DUSAGE_POSITIONT, 0) is used to indicate to the device that the vertex data coming in has already been through vertex processing (like an FVF with D3DFVF_XYZRHW bit set). At draw time, if the currently set declaration has an element with the (D3DUSAGE_POSITIONT, 0) semantic, the entire vertex processing is skipped (just as if an FVF with D3DFVF_XYZRHW bit has been set).

There are some restrictions on vertex declarations with (D3DDECLUSAGE_POSITIONT, 0):

In addition, there are some restrictions on such declaration related to the device driver version. These restrictions are in effect because Microsoft Direct3D sends such declarations directly to the driver without doing any conversion.

Vertex Declarations without D3DDECLUSAGE_POSITIONT

Runtime validates the creation of declarations. Following are the general rules for what declarations are legal.

Driver Considerations

Pre-DirectX 9.0 Drivers

DirectX 9.0 Drivers without Pixel Shader Version 3 Support

DirectX 9.0 Drivers with Pixel Shader Version 3 Support

More general declarations are allowed.

Vertex Declaration Usage with the Programmable Vertex Pipeline

There are additional restrictions when using with hardware vertex processing on a Microsoft DirectX 8.x driver:

The CreateVertexDeclaration might fail if the declaration provided cannot be converted to a DirectX 8.x-style declaration. For a mixed mode device, this failure will happen at Draw* time because that is the only time it can be known whether this shader is being used with hardware or software vertex processing.

Vertex Declaration Usage with the Fixed Function Pipeline

Only declarations that adhere to the following rules can be used:

When a declaration is used with hardware vertex processing on a DirectX 8.x driver, the Direct3D runtime converts it to a DirectX 8.x-style declaration with the following rules:

Using Vertex Declarations with ProcessVertices

A vertex declaration could be used to describe the output of ProcessVertices. Such declaration should adhere to the following rules:



© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.