|Microsoft DirectX 9.0|
In the fixed function vertex pipeline, processing the vertices in a vertex buffer applies the current transformation matrices for the device. Vertex operations such as lighting, generating clip flags, and updating extents can also be applied, optionally. When using fixed function vertex processing, modifying the elements in the destination vertex buffer is controlled by the D3DPV_DONOTCOPYDATA flag. This flag applies only to fixed function vertex processing. The IDirect3DDevice9 interface exposes the IDirect3DDevice9::ProcessVertices method to process vertices. You process vertices from a vertex shader to the set of input data streams, generating a single stream of interleaved vertex data to the destination vertex buffer by calling the IDirect3DDevice9::ProcessVertices method. The method accepts five parameters that describe the location and quantity of vertices that the method targets, the destination vertex buffer, and the processing options. After the call, the destination buffer contains the processed vertex data.
The first, second, and third parameters, SrcStartIndexDestIndex, and VertexCount, reflect the index of the first vertex to load, the index within the destination buffer at which the vertices will be placed, and the total number of vertices to process and place in the destination buffer. The fourth parameter, pDestBuffer should be set to the address of the IDirect3DVertexBuffer9 interface of the vertex buffer object that will receive the source vertices. The SrcStartIndex parameter specifies the index at which the method should start processing vertices.
The final parameter, Flags, determines special processing options for the method. You can set this parameter to 0 for default vertex processing, or to D3DPV_DONOTCOPYDATA to optimize processing in some situations. When you set Flags to 0, vertex components of the destination vertex buffer's vertex format that are not affected by the vertex operation are still copied from the vertex shader or set to 0. However, when using D3DPV_DONOTCOPYDATA, IDirect3DDevice9::ProcessVertices does not overwrite color and texture coordinate information in the destination buffer unless this data is generated by Microsoft?Direct3D? Diffuse color is generated when lighting is enabled, that is, D3DRS_LIGHTING is set to TRUE. Specular color is generated when lighting is enabled and specular is enabled, that is, D3DRS_SPECULARENABLE and D3DRS_LIGHTING are set to TRUE. Specular color is also generated when fog is enabled. Texture coordinates are generated when texture transform or texture generation is enabled. xref rid="_dx_idirect3ddevice9_processvertices_graphics"/> uses the current render states to determine what vertex processing should be done.
The IDirect3DDevice9::ProcessVertices method requires specific settings for the D3DFVF of the destination vertex buffer. The flexible vertex format (FVF) usage settings must be compatible with the current settings for vertex processing.
For fixed function vertex processing, IDirect3DDevice9::ProcessVertices requires the following FVF settings.
In addition, the texture coordinate count must be set in the following manner.
Thus, for each texture stage, a new set of texture coordinates is generated if a texture is bound to that stage and any of the following conditions are true.
When Direct3D is generating texture coordinates, the application is required to perform the following actions.
Finally, texture coordinate dimensionality (D3DFVF_TEX0 through D3DFVF_TEX8) must be set in the following manner.
When IDirect3DDevice9::ProcessVertices fails due to an incompatible destination vertex buffer FVF code, the expected code is printed to the debug output (debug builds only).