   Error when drawing mesh
  Whenever I try to draw a mesh with D3D I am getting the following error with the debug runtimes enabled the program runs perfectly fine in release mode.Vertex shader function usage (D3DDECLUSAGE_BLENDINDICES,0) does not have corresponding usage in the current vertex declaration.Dark Age World Editor-d.exe has triggered a breakpointDirect3D9: (INFO) :The vertex declaration is (Stream, Offset, Type, Method, Usage, UsageIndex):Direct3D9: (INFO) :0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0Direct3D9: (INFO) :0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0Direct3D9: (INFO) :0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0The model doesn't have any animation  I don't know why it is even trying to use BLENDINDICES.Any thoughts?Here is the code that draws the mesh.void D3D9Renderer::drawModelMeshContainer( LPD3DXMESHCONTAINER meshContainerBase, LPD3DXFRAME frameBase, const EffectPtr& effect, const D3DXMATRIX& entityWorldMatrix ){// Cast to our extended frame typeD3DXFRAME_EXTENDED *frame = (D3DXFRAME_EXTENDED*)frameBase;// Cast to our extended mesh containerD3DXMESHCONTAINER_EXTENDED *meshContainer = (D3DXMESHCONTAINER_EXTENDED*)meshContainerBase;// calculate the final model matrix// exCombineTransformationMatrix is the models own transformation for this frameD3DXMATRIX modelFinalWorldMatrix = frame->exCombinedTransformationMatrix*(entityWorldMatrix);//set parameters in the effect filesetPerModelEffectParameters(effect,meshContainer,modelFinalWorldMatrix);UINT passes = 0;effect->Begin(&passes,0);// Loop through all the materials in the mesh rendering each subsetfor (unsigned int iMaterial = 0; iMaterial < meshContainer->NumMaterials; iMaterial++){if(meshContainer->exTextures[iMaterial])setModelEffectTexture(effect,meshContainer->exTextures[iMaterial]->m_Texture);elsesetModelEffectTexture(effect,NULL);for (UINT pass=0; pass<passes; ++pass){effect->BeginPass(pass);// Finally draw the meshmeshContainer->MeshData.pMesh->DrawSubset(iMaterial);effect->EndPass();}}effect->End();}
  I found the problem my vertex shader was just one big mess with a header like this : VS_OUTPUT OutsideVertexShader(float4 positionObjectSpace : POSITION0,  float3 normal : NORMAL,  float2 texCoord : TEXCOORD0,  float  weights: BLENDWEIGHT0,  int4   boneIndices : BLENDINDICES0,bool animatedMesh)Static models were using this shader too and they were setting the animatedMesh flag to false but I guess the shader is still expecting the BLENDINDICES vertex usage.I seperated the shaders and made 2 different vertex shaders for static and animated meshes the problem is gone now, I have no idea if this is the optimal way to do it though.My code looks like this now.VS_OUTPUT OutsideVertexShader(float4 positionObjectSpace : POSITION0,  float3 normal : NORMAL,  float2 texCoord : TEXCOORD0){//code for static models}VS_OUTPUT OutsideVertexShaderSkinned(float4 positionObjectSpace : POSITION0,  float3 normal : NORMAL,  float2 texCoord : TEXCOORD0,  float  weights: BLENDWEIGHT0,  int4   boneIndices : BLENDINDICES0){//code for animated models}VertexShader vertexShaders[] = {compile vs_3_0 OutsideVertexShader(), //static modelcompile vs_3_0 OutsideVertexShaderSkinned(), // skinned model}technique Standard{pass P0    {   AlphaBlendEnable = true;   SrcBlend = SrcAlpha;   DestBlend = InvSrcAlpha;VertexShader = vertexShaders[(g_EntitySkinned)?(1):(0)];PixelShader  = pixelShaders[(g_DrawShadows)?(1):(0)];    }}  There are other technique in this fx file and I pick the correct shader base on the global flag.That flag is set from the C++ application before drawing an entity.If the entity has skinning information it sets it true.   