I am trying to create/use a vertex declaration for use in a vertex shader, but I am having problems getting the declaration validated. My original declaration is as follows:
D3DVERTEXELEMENT9 dwDecl[] =
{
{0, sizeof( float ) * 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
{0, sizeof( float ) * 3, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0},
{0, sizeof( float ) * 6, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 1},
{0, sizeof( float ) * 9, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BINORMAL, 2},
{0, sizeof( float ) * 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 3},
{0, sizeof( float ) * 15, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 0},
D3DDECL_END()
};
and here is the corresponding input struct in the vertex shader:
struct a2vConnector {
float3 objCoord : POSITION;
float3 texCoord : TEXCOORD;
float3 objTangent : TANGENT0;
float3 objBinormal : BINORMAL0;
float3 objNormal : NORMAL;
float4 color : COLOR;
};
To simplify things, I even tried to reduce the struct to just the POSITION variable and the declaration to just the D3DDECLUSAGE_POSITION, but it still is not getting validated, which leads me to believe that the problem lies somewhere else besides the syntax of my struct and declaration.
I am also a bit confused about what exactly usage indices (the last parameter in each element of the vertex declaration) are, and the documentation online isnt very descriptive either, so additional help on this would be appreciated.
Any ideas?