Device Types
A version of this page is also available for
4/8/2010
Microsoft® Direct3D® Mobile currently supports a hardware device driver and a reference driver. The hardware device is capable of hardware-accelerated rasterization and shading and both hardware and software vertex processing. The reference driver is a software-only device. The hardware device driver is used for shipping applications, and the reference driver is used for testing an application's Driect3D Mobile functionality during development.
The Direct3D Mobile device that an application creates must correspond to the capabilities of the hardware on which the application is running. Direct3D Mobile provides rendering capabilities by accessing 3-D hardware, it does not support emulating the capabilities of 3-D hardware in software.
The reference driver supports all the features of Direct3D Mobile. This is not always the case with hardware device drivers. Applications should always query for device capabilities to determine which Direct3D Mobile functionality a hardware device driver supports.
Because the behavior, but not the performance, of the reference driver provided with Direct3D Mobile is identical to that of a hardware device, application code authored to work with the reference driver will work on a hardware device without modification.
Hardware Device Driver
The primary device type for Microsoft® Direct3D® Mobile is the hardware device driver. It supports hardware accelerated rasterization and hardware-based vertex processing.
Applications do not access 3-D hardware directly. They call Direct3D Mobile functions and methods. Direct3D Mobile accesses the hardware through the hardware device driver.
To create a hardware device, call the IDirect3DMobile::CreateDevice method, and pass the D3DMDEVTYPE_DEFAULT constant as the device type. For details, see Creating a Direct3D Mobile Device.
Reference Driver
Microsoft® Direct3D® Mobile supports a device type called a reference driver. The reference driver supports every Direct3D Mobile feature. Because these features are implemented for accuracy, rather than speed, and are implemented in software, the results are not very fast. The reference driver does make use of special CPU instructions whenever it can, but it is not intended for retail applications. Use the reference driver only for testing functionality or for demonstration purposes.
In the Direct3D Mobile architecture, the reference driver is treated just like any other software device driver. This means that your application must load it through a call to IDirect3DMobile::RegisterSoftwareDevice.
To use the reference driver
Load the dynamically linked library D3dmref.dll by calling the LoadLibrary function.
Obtain the reference driver's initialization entry point through a call to the GetProcAddress function.
Register the reference driver with the Direct3D Mobile middleware by calling the IDirect3DMobile::RegisterSoftwareDevice method.
Create a Direct3D Mobile device from the reference driver by calling the IDirect3DMobile::CreateDevice method, setting the Adapter parameter to D3DMADAPTER_REGISTERED_DEVICE (see D3DMADAPTER Values) and setting the DeviceType parameter to D3DMDEVTYPE_DEFAULT (see D3DMDEVTYPE).
When your application exits, it should call IDirect3DMobile::RegisterSoftwareDevice and set the pInitializeFunction parameter to NULL. Unload the reference driver DLL with a call to the FreeLibrary function.
Device Behaviors
Microsoft® Direct3D® Mobile enables you to specify the behavior of a device, as well the device's type. The IDirect3DMobile::CreateDevice method enables a combination of one or more of the behavior flags to control the global behaviors of the Direct3D Mobile device. These behaviors specify what is and is not maintained in the Direct3D Mobile middleware, and the device types specify which driver to use. Although some combinations of device behaviors are not valid, it is possible to use all device behaviors with all device types.