Copying Depth-Stencil Values
The Microsoft Direct3D runtime calls the user-mode display driver's Blt function to copy depth-stencil values from video memory to system memory, or vice versa. The driver and hardware must perform format conversions from, or to, all driver-supported opaque depth-stencil formats (that is, all formats defined by the D3DDDIFORMAT enumeration type except D3DDDIFMT_D*_LOCKABLE) to, or from, any of the following formats:
D3DDDIFMT_D16_LOCKABLE
D3DDDIFMT_D32_LOCKABLE
D3DDDIFMT_D32F_LOCKABLE
D3DDDIFMT_S8_LOCKABLE
The driver discards any channel (depth or stencil) present in the source format but not present in the destination format. The runtime does not permit copying between depth-stencil surfaces that do not share any common channel types.
The driver first converts a source depth value to a 32-bit unsigned integer value, and then from the 32-bit unsigned integer value to the destination representation. The following rules apply for both of these conversions:
If the source depth value is a floating-point value, a clamp to [0,1] is applied and the result is multiplied by _MAX_UINT.
If the source is integral and the destination is a lower-precision integer, the right-most extra bits are removed.
If the source is integral and the destination is a higher-precision integer, the rightmost extra bits are replicated from the left-most significant bits.
If the source is integral and the destination is a floating-point value, then the 32-bit integer is converted to a floating-point value and the result is divided by _MAX_UINT.
The driver is not required to provide special treatment to nonuniformly distributed depth values.
The driver expands a source stencil value to an 8-bit integer (that is, the driver pads the source stencil value with zeros on the left). If the destination representation uses lower precision, then the driver should discard the most significant bits to perform the conversion.
User-mode display drivers must support depth-stencil copies of arbitrary subrectangles. However, drivers are not required to perform mirror, stretch, or color-key operations during depth-stencil copies. Point sampling is implicitly required during depth-stencil copies.