Processing the vertices in a vertex buffer applies the current transformation matrices for the device, and can optionally apply vertex operations such as lighting, generating clip flags, and updating extents. The IDirect3DVertexBuffer interface exposes the IDirect3DVertexBuffer::ProcessVertices method to process vertices.
You process vertices from a source vertex buffer into a destination vertex buffer by calling the ProcessVertices method of the destination vertex buffer, not the source buffer. The method accepts seven parameters that describe the operations to be performed, the location of the source vertex buffer's IDirect3DVertexBuffer interface, the rendering device that will perform the vertex operations, and the location and quantity of vertices that the method targets. After the call, the destination buffer contains the processed vertex data, and the source buffer is unchanged.
When preparing to process vertices, set the first parameter, dwVertexOp, to indicate the vertex operations you want to perform. You must include the D3DVOP_TRANSFORM flag, or the method will fail, but the remaining operations are optional. You can include any combination of optional flags to light the vertices, generate clip flags, and update extents during vertex processing.
The second and third parameters, dwDestIndex and dwCount, reflect the index within the destination buffer at which the vertices will be placed and the total number of vertices that should be processed and placed in the destination buffer. The fourth parameter, lpSrcBuffer, should be set to the address of the IDirect3DVertexBuffer of the vertex buffer object that contains the source vertices. The dwSrcIndex specifies the index at which the method should start processing vertices. (The total number of source vertices to be processed is implied from the dwCount parameter.) Set the lpD3DDevice parameter to the address of the IDirect3DDevice3 interface for the rendering device that process the vertices. The final parameter is reserved for future use, and must be set to 0.
Take care to create vertex buffers that use compatible vertex formats. At the least, the source buffer should contain untransformed vertices (using the D3DFVF_XYZ flag in the vertex format of the buffer description), and the destination buffer should contain transformed vertices (using the D3DFVF_XYZRHW flag). Any lighting or clipping services require that the source and destination vertex formats contain the appropriate fields. For instance, don't request lighting on vertices when the vertex format doesn't include a vertex normal. Likewise, you can't request that the system produce clip flags for a destination vertex buffer that was created without clipping capabilities. Attempts to perform operations on incompatible buffers will fail in debug builds.
You cannot process vertices when the source or destination vertex buffers are locked.