Validating Index Values

A user-mode display driver can pass "Designed for Microsoft Windows" for Hardware Logo testing, regardless of whether it performs index validation. However, to ensure that the driver works with Microsoft DirectX applications that might pass invalid indexes, a user-mode display driver should perform index validation.

You should consider the following items:

  • DirectX 8.0 and DirectX 9.0 applications can pass a stride value of 0 when they render with a vertex buffer. In this situation, only vertex 0 should be referenced. The stride value is set in the Stride member of the D3DDDIARG_SETSTREAMSOURCE structure in a call to the user-mode display driver's SetStreamSource function.

  • A call to the driver's SetStreamSourceUM function does not include the size of the vertex data. That is, the size of the user-memory buffer that supplies the vertex data that the pUMBuffer parameter of SetStreamSourceUM points to is not specified.

  • The NumVertices member of the D3DDDIARG_DRAWINDEXEDPRIMITIVE or D3DDDIARG_DRAWINDEXEDPRIMITIVE2 structure is never set to 0 in a call to the driver's DrawIndexedPrimitive or DrawIndexedPrimitive2 function. The driver should set the maximum allowable index to (NumVertices - 1).