Partager via


Back Buffers and Image Surfaces (Windows CE 5.0)

Send Feedback

Back buffers and image surfaces are color buffers that are not shown on-screen directly. They are often referred to as off-screen surfaces. Back buffers are off-screen surfaces in the swap chain and image surfaces are temporary surfaces for loading texture maps. In both cases, as with other resources, the driver must allocate memory for the surface.

Back Buffer Creation

The Microsoft® Direct3D® Mobile middleware creates a back buffer by calling D3DM_CreateSurface with D3DM_CREATESURFACE_DATA->SurfaceType set to D3DMRTYPE_SURFACE. The description will include data for the surface's format, width, height, multisampling type, and usage. The middleware will set the D3DMUSAGE_RENDERTARGET bit in the SurfaceDesc.Usage. It may also set the D3DMUSAGE_LOCKABLE bit for lockable back buffers.

The driver can enforce a policy in which the width and height of the back buffer must be some multiple of the front buffer size, according to the kind of multisampling to be done. This type of checking is only done in the debug builds of the middleware. Similar checking on the validity of the format and the multisampling type is only be done in the debug middleware as well.

The driver must set the values of the SurfaceDesc.Pool and SurfaceDesc.Size parameters once the surface is created. The driver exposes its support for creating back buffers within memory pools through the D3DMSURFCAPS_SYSBACKBUFFER and D3DMSURFCAPS_VIDBACKBUFFER capability bits, see D3DMSURFCAPS Values.

The driver is not required to honor the D3DMUSAGE_LOCKABLE bit for back buffers. It must expose the D3DMSURFCAPS_LOCKBACKBUFFER capability bit if it allows the back buffer to be locked. The driver is, however, required to allow the creation of back buffers with at least the D3DMMULTISAMPLE_NONE type and the same pixel format as the front buffer.

Image Surface Creation

Image surfaces are also created with the D3DMRTYPE_SURFACE type. However, when Direct3D Mobile needs an image surface, the SurfaceDesc.Usage parameter might contain the D3DMUSAGE_LOCKABLE bit. The surface description will contain information for the height, width, and format, and the SurfaceDesc.MultiSampleType parameter will be set to D3DMMULTISAMPLE_NONE. After the surface is created, only the size and pool parameters must be registered by the driver.

In Direct3D Mobile debug builds, the format of the image surface will be checked against the driver's list of supported formats. The application will be informed of the driver's pool constraints (for example, no video memory), by means of the D3DMSURFCAPS_SYSIMAGESURFACE and D3DMSURFCAPS_VIDIMAGESURFACE capability bits.

The driver should honor the D3DMUSAGE_LOCKABLE bit for image surfaces. Direct3D Mobile requires that the driver be able to create lockable image surfaces for loading texture map data.

The members of D3DM_CLEAR.Rects (see D3DM_CLEAR) represent back buffer offsets. The D3DM_CLEAR.Rects members are not clipped to the viewport extents by the Direct3D Mobile middleware. The driver is responsible for clipping these parameters to the viewport.

See Also

Resources in Direct3D Mobile Drivers

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.