Share via


Depth and Stencil Buffers (Windows Embedded CE 6.0)

1/6/2010

Microsoft® Direct3D® Mobile does not differentiate between depth and stencil buffers. If Direct3D Mobile stencil data is present, it is stored as one channel per pixel in the same memory as the depth data.

The process of creating depth and stencil buffers is similar to the process of creating back buffers. The middleware calls D3DM_CreateSurface with D3DM_CREATESURFACE_DATA->SurfaceType set to D3DMRTYPE_SURFACE and possibly D3DMUSAGE_LOCKABLE as well.   The middleware also provides data for the width, height, format, and multisampling type for the depth and stencil buffer. The driver must determine and set the values for SurfaceDesc.Pool and SurfaceDesc.Size so that information is available to the middleware.

As with back buffers, middleware checks on the SurfaceDesc.Height, SurfaceDesc.Width, SurfaceDesc.Format, and SurfaceDesc.MultisampleType parameters are only performed in Direct3D Mobile debug builds.

If the driver does not expose the D3DMSURFCAPS_LOCKDEPTHBUFFER capability bit, it is not required to lock the buffer. Additionally, it is not required to support stencil buffering. The D3DMPRASTERCAPS_STENCIL capability bit indicates whether the driver supports stenciling.

The driver may expose pool constraints for depth and stencil buffers by means of the D3DMSURFCAPS_SYSDEPTHBUFFER and D3DMSURFCAPS_VIDDEPTHBUFFER capability bits.

The driver must allow the creation of a depth buffer of one of the formats in the D3DMFORMAT enumeration with the D3DMMULTISAMPLE_NONE type. Like the back buffer and front buffer, if the driver uses an implementation that does not include a frame buffer, these may simply be dummy objects.

See Also

Concepts

Surface Creation by Direct3D Mobile Drivers
Resources in Direct3D Mobile Drivers