Processing Vertex Data (Direct3D 9)
The IDirect3DDevice9 interface supports vertex processing in both software and hardware. In general, the device capabilities for software and hardware vertex processing are not identical. Hardware capabilities are variable, depending on the display adapter and driver, while software capabilities are fixed.
The following flags control vertex processing behavior for the hardware abstraction layer (HAL) and reference devices.
Specify one of the vertex processing behavior flags when calling IDirect3D9::CreateDevice. The mixed-mode flag enables the device to perform both software and hardware vertex processing. Only one vertex processing flag may be set for a device at any one time. Note that the D3DCREATE_HARDWARE_VERTEXPROCESSING flag is required to be set when creating a pure device (D3DCREATE_PUREDEVICE).
To avoid dual vertex processing capabilities on a single device, only the hardware vertex processing capabilities can be queried at run time. Software vertex processing capabilities are fixed and cannot be queried at run time.
The VertexProcessingCaps member of the D3DCAPS9 structure determines the hardware vertex processing capabilities of the device.
For software vertex processing the following capabilities are supported.
- the D3DVTXPCAPS_DIRECTIONALLIGHTS member of D3DVTXPCAPS
- the D3DVTXPCAPS_LOCALVIEWER member of D3DVTXPCAPS
- the D3DVTXPCAPS_MATERIALSOURCE7 member of D3DVTXPCAPS
- the D3DVTXPCAPS_POSITIONALLIGHTS member of D3DVTXPCAPS
- the D3DVTXPCAPS_TEXGEN member of D3DVTXPCAPS
- the D3DVTXPCAPS_TWEENING member of D3DVTXPCAPS
In addition, the following table lists the values that are set for members of the D3DCAPS9 structure for a device in software vertex processing mode.
|Member||Software vertex processing capabilities|
In general, any application that is vertex processing bound should use a HAL device. Software vertex processing provides a guaranteed set of vertex processing capabilities, including an unbounded number of lights and full support for programmable vertex shaders. You can toggle between software and hardware vertex processing at any time when using the HAL device (which is the only device type that supports both hardware and software vertex processing). The only requirement is that vertex buffers used for software vertex processing must be allocated in system memory.