Index Buffers

DirectX 8.0 introduces the concept of index buffers. These buffers are very similar to vertex buffers but store simple 16- or 32-bit indices into vertex data rather than the vertex data itself. Index buffers extend all the benefits of vertex buffers, for example optimal download and caching, to index data.

Index buffers are created, locked, unlocked and destroyed with the same driver entry points as those used for vertex buffers. A driver can distinguish between these buffer types using the new surface capability bit DDSCAPS2_INDEXBUFFER. For index buffers, this flag is set in the ddsCapsEx.dwCaps2 field of the surface's DD_SURFACE_MORE structure. It will be clear for vertex buffers.

Unlike many other surface types, a driver does not need to set the capability DDSCAPS2_INDEXBUFFER when reporting its capabilities to the runtime to receive driver calls for index buffer creation, destruction, and locking. A DirectX 8.0 driver that supports vertex buffers is assumed to support index buffers also. If the underlying hardware has no direct support for index buffers, then the driver should handle index buffer creation by allocating system memory for the surface.