Gets the vertex shader declaration.
HRESULT GetDeclaration( D3DVERTEXELEMENT9* pDecl, UINT* pNumElements );
If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be: D3DERR_INVALIDCALL.
The number of elements, pNumElements, includes the D3DDECL_END macro, which ends the declaration. So the element count is actually one higher than the number of valid vertex elements.
Here's an example that will return the vertex declaration array of up to 256 elements:
// assumes a valid pointer to a vertex declaration object D3DVERTEXELEMENT9 decl[256]; UINT numElements; HRESULT hr = m_pVertexDeclaration->GetDeclaration( decl, &numElements);
Header: Declared in D3d9.h.