Partager via


Device Types and Vertex Processing Requirements

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

The performance of vertex processing operations, including transformation and lighting, depends heavily on where the vertex buffer exists in memory and what type of rendering device is being used. Applications control the memory allocation for vertex buffers when they are created. When the D3DMPOOL_SYSTEMMEM memory flag (see D3DMPOOL) is set, the vertex buffer is created in system memory. When the D3DMPOOL_VIDEOMEM memory flag is used, the device driver allocates the vertex buffer in video memory.

The reasoning you use to determine the memory location — system or video — for vertex buffers is the same as that for textures. Vertex processing, including transformation and lighting, in hardware works best when the vertex buffers are allocated in video memory, while software vertex processing works best with vertex buffers allocated in system memory. For textures, hardware rasterization works best when textures are allocated in video memory, while software rasterization works best with system-memory textures.

If your application performs its own vertex processing and passes transformed, lit, and clipped vertices to rendering methods, then the application can directly write vertices to a vertex buffer allocated in driver-optimal memory. This technique prevents a redundant copy operation later. Note that this technique will not work well if your application reads data back from a vertex buffer, because read operations done by the host from driver-optimal memory can be very slow. Therefore, if your application needs to read during processing or writes data to the buffer erratically, a system-memory vertex buffer is a better choice.

When using the Microsoft® Direct3D® Mobile vertex processing features (by passing untransformed vertices to vertex-buffer rendering methods), processing can occur in either hardware or software depending on the device type and device creation flags. It is recommended that vertex buffers be allocated in pool D3DMPOOL_VIDEOMEM for best performance in virtually all cases. When a device is using hardware vertex processing, there is a number of additional optimizations that may be done based on the flags D3DMUSAGE_DYNAMIC and D3DMUSAGE_WRITEONLY. See IDirect3DMobileDevice::CreateVertexBuffer and D3DMUSAGE Values for more information on using these flags.

See Also

Concepts

Vertex Buffers