D3DVERTEXELEMENT9 endMarker = D3DDECL_END();
//todo - fill in elements - elements
elements = endMarker;
IDirect3DVertexDeclaration9* result = 0;
HRESULT hr = device->CreateVertexDeclaration(elements, &result);
//todo - check hr for error/success
For each element, you set the Usage and UsageIndex to match the HLSL semantic, e.g.
//element for "half2 texCoord3 : TEXCOORD2;"
element.Usage = D3DDECLUSAGE_TEXCOORD;
element.UsageIndex = 2;
However, the rest of the settings aren't based on your HLSL code; these settings are based on your model data format (i.e. how your vertex data is laid out):
element.Method = D3DDECLMETHOD_DEFAULT; //pretty much always use default method...
element.Stream = ...;
element.Offset = ...;
element.Type = ...;
To fill these out, you'll have to tell us how your vertex data is stored in memory.
One small additional question is when I pass "vertcol"s not the material colors for xoliulshader.fx, would the scene look exactly the same as 3dsmax?
You've been asking lots of questions about this xoliulshader thing, but you've got to assume that we don't know what xoliulshader is... Can you give us some context?
Edited by Hodgman, 20 November 2012 - 01:08 AM.
You need to make an array of D3DVERTEXELEMENT9's, one element for each item in your vertex input structure, plus one extra for the "end" marker.