Share via


Direct3D Mobile Architecture

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

There are three fundamental aspects to the Microsoft Direct3D Mobile design.

  • Models are described in terms of primitives.
  • The options for drawing primitives can be encapsulated by a state machine known as the rendering pipeline.
  • Output is provided through a frame-based presentation model.

Primitives are points, lines, triangles, and common assemblies of triangles. These are all described in terms of vertices in a Cartesian space. The data for those vertices are loaded into arrays called vertex buffers. Direct3D Mobile provides methods for applications to create vertex buffers, load them with data, and describe that data.

Various options for drawing primitives can be encapsulated by a state machine known as the rendering pipeline. The input to the rendering pipeline is the data describing the primitives. The output from the rendering pipeline is pixel color values in the frame buffer. Direct3D Mobile provides a set of controls and options, called states, for setting up the rendering pipeline. You can set up the rendering pipeline for very simple 2-D operations, very complex 3-D operations, and many possible combinations in between. For more information see Direct3D Mobile Rendering Pipeline.

The states available to the application developer are dictated by a combination of both definition of the Direct3D Mobile API and the capabilities of the Direct3D Mobile driver. Direct3D Mobile provides two methods for a driver to report its set of supported capabilities to an application. The lowest-level method is through a standard set of predefined capability bits that map to individual graphics functions. Applications can query these capability bits to determine the level of graphics support in the driver. Building on top of these individual capability bits, Direct3D Mobile also employs a system of device profiles. Each profile is defined to be a specific set of capability bits tailored to the needs of specific categories of embedded devices. Applications that are written to a target profile will run on devices with Direct3D Mobile display drivers supporting that profile. The approach simplifies application development by eliminating the tedium, and possible error, of having to query each individual capability bit. For more information see Direct3D Mobile Device Capabilities.

Direct3D Mobile utilizes a presentation model based on frames. As a result, applications execute with a strong sense of time, which is usually provided in the form of a frame clock. Applications are expected to issue all of the commands necessary for drawing a particular scene and then signal when they are done with the scene. An application notifies the Direct3D Mobile middleware that it is ready to create a scene by calling the IDirect3DMobileDevice::BeginScene method. While the application is defining the scene, Direct3D Mobile is filling a command buffer that holds the application's drawing commands. When the application is done defining the scene it calls IDirect3DMobileDevice::EndScene. At that point the scene is queued for rendering but it is yet not sent to the driver. The application must explicitly call for the scene to be presented to the display surface by calling the IDirect3DMobileDevice::Present method. This flushes the command buffer to the driver for processing. This arrangement allows for maximum asynchronous operation between the CPU and any supporting graphics hardware.

Direct3D Mobile Files

The Direct3D Mobile middleware is implemented on Windows Mobile devices by a dynamic-link library (DLL) called D3dm.dll. The following table shows the files included in Direct3D Mobile SDKs.

File Description

D3dm.lib

The import library for D3Dm.dll.

D3dm.h

Contains the declarations of Direct3D Mobile's COM interfaces and other function prototypes.

D3dmtypes.h

Contains the declarations for Direct3D Mobile's structures and enumerations.

D3dmcaps.h

Contains the declarations for Direct3D Mobile's capability bits and profiles.

All Direct3D Mobile header files are dependant on Windows.h. In addition, Direct3D Mobile drivers require the header file D3dmddk.h.

Drivers and Processes

At process creation time the loader will automatically map d3dm.dll into the process address space of any application that linked to d3dm.lib at build time. Once this is complete, the application can begin making Direct3D Mobile calls.

Every Windows® phone with Direct3D Mobile in its OS design has a single default system driver. The Direct3D Mobile middleware handles the chores of identifying the drivers, setting up communications to the driver selected by the application, and then communicating with that driver. Direct3D Mobile display drivers are implemented as dynamic link libraries.

There are two primary forms of driver communication: local hooking and remote hooking. Direct3D Mobile's default system driver may be either locally or remotely hooked. Direct3D Mobile cannot simultaneously instantiate both a locally and a remotely hooked driver. Additionally, there is also a variety of local hooking provided through IDirect3DMobile::RegisterSoftwareDevice that an application can use to replace the system driver entry points with its own entry points.

The following topics provide more information about these subjects.

See Also

Other Resources

Direct3D Mobile Application Development