As with any feature, don't assume that the driver your application uses supports depth buffering; you should always check the driver's capabilities. Although most driver support z-based depth buffering, not all will be able to provide support to w-based depth buffering. (For general information about depth buffering, see What Are Depth Buffers?) Drivers do not fail if you attempt to enable an unsupported scheme, falling-back on another depth buffering method instead, or sometimes disabling depth buffering altogether, which can result in rendered scenes that show major depth sorting artifacts.
You can check for general support for depth buffers by querying the DirectDraw for the display device your application uses before you create a Direct3D device. If the DirectDraw object reports that it supports depth buffering, any hardware devices you create from this DirectDraw object will support z-buffering (but you don't yet know if the driver supports w-buffering).
To query for general depth buffering support
Once you know that the driver supports z-buffers, you can verify w-buffer support. Although z-buffers are supported for all software rasterizers, w-buffers are only supported by the reference rasterizer, which is hardly suited for use by real-world applications. No matter what type of device your application uses, you should verify support for w-buffers before you attempt to enable w-based depth buffering.
To determine support for w-buffers