IDirect3DVertexDeclaration9::GetDeclaration

Gets the vertex shader declaration.

HRESULT GetDeclaration(
  D3DVERTEXELEMENT9* pDecl,
  UINT* pNumElements
);

Parameters

pDecl
[in, out] Array of vertex elements that make up a vertex shader declaration. The application needs to allocate enough room for this. The vertex element array ends with the D3DDECL_END macro.
pNumElements
[in, out] Number of elements in the array. The application needs to allocate enough room for this.

Return Values

If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be: D3DERR_INVALIDCALL.

Remarks

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);

Requirements

Header: Declared in D3d9.h.