Microsoft DirectX 8.0 (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 is provided to allow applications to work with hardware requiring that certain depth formats can only work with certain render target formats. The following code fragment shows how you could 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 = False Else IsDepthStencilFormatOK = True End If End function
The preceding call returns False if DepthFormat cannot be used in conjunction with AdapterFormat and BackBufferFormat.