The vertex data in an execute buffer is followed by an instruction stream. Each instruction is represented by:
Execute buffer instructions are commands to the driver. Each instruction is identified by an operation code (opcode). All execute data is prefixed by an instruction header. Data accompanies each iteration of each opcode. Each opcode can have multiple arguments, including multiple triangles or multiple state changes. There are only a few main instruction types, as discussed in the following paragraphs:
Drawing Instructions
The most important of the drawing instructions defines a triangle. In a triangle, vertices are zero-based indices into the vertex list that begins the execute buffer. For more information about triangles, see Triangles.
Other important drawing instructions include line-drawing instructions (D3DLINE) and line-drawing instructions (D3DPOINT).
State-change Instructions
The system stores the state of each of the modules in the graphics pipeline until the state is overridden by an instruction in an execute buffer.
Transformation state | World, view and projection matrices |
Light state | Surface material, fog, ambient lighting |
Render state | Texture, antialiasing, z-buffering, and so on |
Flow-control Instructions
The flow-control instructions allow you to branch on an instruction or to jump to a new position in the execute buffer, skipping or repeating instructions as necessary. This means that you can use the flow-control instructions as a kind of programming language.
The last flow-control instruction in an execute buffer must be D3DOP_EXIT.
Other Instructions
Some other execute-buffer instructions do not fall neatly into the other categories. These include:
Texturing | Download a texture to the device |
Matrices | Download or multiply a matrix |
Span, SetState | Advanced control for primitives and rendering states. |