IDirect3DVertexDeclaration9::GetDeclaration method (d3d9.h)

Gets the vertex shader declaration.

Syntax

HRESULT GetDeclaration(
  [in, out] D3DVERTEXELEMENT9 *pElement,
  [out]     UINT              *pNumElements
);

Parameters

[in, out] pElement

Type: D3DVERTEXELEMENT9*

Array of vertex elements (see D3DVERTEXELEMENT9) 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.

[out] pNumElements

Type: UINT*

Number of elements in the array. The application needs to allocate enough room for this.

Return value

Type: HRESULT

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:

 
D3DVERTEXELEMENT9 decl[MAXD3DDECLLENGTH];
UINT numElements;
HRESULT hr = m_pVertexDeclaration->GetDeclaration( decl, &numElements);

Specify NULL for pDeclto get the number of elements in the declaration.

Requirements

Requirement Value
Target Platform Windows
Header d3d9.h (include D3D9.h)
Library D3D9.lib

See also

IDirect3DVertexDeclaration9