Partager via


Command Stream

At the driver level, instructions come in the form of calls to D3dDrawPrimitives2. The input structure D3DHAL_DRAWPRIMITIVES2DATA contains a pointer into a command buffer. This is a sequence of D3DHAL_DP2COMMAND structures. Each of these structures contains a bCommand member that specifies what type of data follows it in the buffer. This specification comes in the form of a D3DHAL_DP2OPERATION enumerated type, such as D3DDP2OP_INDEXEDTRIANGLESTRIP or, in the case of setting up texture states, D3DDP2OP_TEXTURESTAGESTATE.

In other words, the D3DHAL_DP2OPERATION operation code specifies what type of structures follow it in the command buffer. The number of structures to follow is specified by either wPrimitiveCount or wStateCount, members of a union that is in turn a member of the D3DHAL_DP2COMMAND structure. The wPrimitiveCount member keeps track of the number of graphics primitives to render, while the wStateCount member keeps track of the number of state changes to process.

For an example of how a driver process operation codes, see Processing Texture Stages.