Surface Locks in Direct3D Mobile (Windows Embedded CE 6.0)
1/6/2010
In Microsoft® Direct3D® Mobile, locking refers to the driver returning a pointer to the bits of a buffer. Direct3D Mobile only requires that the driver be able to create lockable image surfaces, index buffers, and vertex buffers. The driver identifies the types of resources that it can or cannot lock through the capability bits in the SurfaceCaps member of the D3DMCAPS structure.
It is sometimes useful for application developers to be able to access depth buffer or back buffer bits. The driver should only support such capabilities if it is convenient or a direct requirement for the driver.
It is recommended that drivers not allow lockable back buffers, front buffers, or depth and stencil buffers because locking these can result in pipeline stalls and adverse performance side effects.
When Direct3D Mobile middleware needs to lock a surface, it calls the driver's D3DM_LockSurface function, passing it a pointer to a D3DM_LOCKSURFACE_DATA structure.
After an application is finished with a locked surface pointer, it should unlock the surface to allow the surface to be reused. The Direct3D Mobile middleware processes unlock requests from an application into calls to the driver's D3DM_UnlockSurface function.
The Direct3D Mobile middleware does not maintain a list of rectangles that are locked on a particular surface. Direct3D Mobile only allows one rectangle to be locked at one time. The driver can continue to update pixels outside of the locked region of the surface.