Microsoft DirectX 8.1 (Visual Basic) |
Determines whether a surface format is available as a specified resource type and can be used as a texture, depth-stencil buffer, or render target—or any combination of the three—on a device representing this adapter.
object.CheckDepthStencilMatch( _ Adapter As Long, _ DeviceType As CONST_D3DDEVTYPE, _ AdapterFormat As CONST_D3DFORMAT, _ RenderTargetFormat As CONST_D3DFORMAT, _ DepthStencilFormat As CONST_D3DFORMAT) As Long
If the depth-stencil format is compatible with the render target format in the display mode, this method returns D3D_OK.
D3DERR_INVALIDCALL can be returned if one or more of the parameters is invalid. If a depth-stencil format is not compatible with the render target in the display mode, then this method returns D3DERR_NOTAVAILABLE.
Err.Number is not set for this method.
This method allows applications to work with hardware that requires certain depth formats for a given render target format. The following code fragment shows how to use CheckDeviceFormat to validate a depth stencil format.
Function IsDepthFormatOK( DepthFormat As CONST_D3DFORMAT, AdapterFormat As CONST_D3DFORMAT, _ BackBufferFormat As CONST_D3DFORMAT) as Boolean Dim check As Long check = d3d.CheckDeviceFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, AdapterFormat, _ D3DUSAGE_DEPTHSTENCIL, D3DRTYPE_SURFACE, DepthFormat) If (check < 0) Then Exit Function 'Returns False check = d3d.CheckDepthStencilFormat(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, AdapterFormat, _ RenderTargetFormat, DepthFormat) If (check < 0) Then IsDepthStencilFormatOK = 0 Else IsDepthStencilFormatOK = 1 End If End function
The behavior of this method has been changed for Microsoft® DirectX® 8.1. This method now pays attention to the D24x8 and D32 depth-stencil formats. The previous version assumed that these format would always be useable with 32- or 16-bit render targets. This method will now return D3D_OK for these formats only if the device is capable of mixed-depth operations.
The preceding call returns 0 (False) if DepthFormat cannot be used in conjunction with AdapterFormat and BackBufferFormat.