Retrieving Vertex Buffer Descriptions

Applications often need to retrieve information about existing vertex buffers at run time. Direct3D makes this possible through the IDirect3DVertexBuffer::GetVertexBufferDesc method. Call this method using the IDirect3DVertexBuffer interface of any vertex buffer to retrieve its current description.

The GetVertexBufferDesc accepts only one parameter: the address of a properly initialized D3DVERTEXBUFFERDESC structure. To initialize the structure, set the dwSize member to the structure size, in bytes, and set the remaining members to 0. After the method returns, the structure will contain information about the vertex buffer capabilities, the vertex format in the buffer, and the total number of vertices that it can contain.

Note  Optimizing a vertex buffer sets the D3DVBCAPS_OPTIMIZED capability flag in the dwFlags member of the D3DVERTEXBUFFERDESC structure. If this flag is set, the vertex buffer cannot be locked, and its contents are not made available to anything but rendering methods and the IDirect3DVertexBuffer::ProcessVertices method.

For general information, see Vertex Buffer Descriptions.