IDirect3D9::CheckDeviceMultiSampleType method (d3d9.h)
Determines if a multisampling technique is available on this device.
Syntax
HRESULT CheckDeviceMultiSampleType(
[in] UINT Adapter,
[in] D3DDEVTYPE DeviceType,
[in] D3DFORMAT SurfaceFormat,
[in] BOOL Windowed,
[in] D3DMULTISAMPLE_TYPE MultiSampleType,
[out] DWORD *pQualityLevels
);
Parameters
[in] Adapter
Type: UINT
Ordinal number denoting the display adapter to query. D3DADAPTER_DEFAULT is always the primary display adapter. This method returns FALSE when this value equals or exceeds the number of display adapters in the system. See Remarks.
[in] DeviceType
Type: D3DDEVTYPE
Member of the D3DDEVTYPE enumerated type, identifying the device type.
[in] SurfaceFormat
Type: D3DFORMAT
Member of the D3DFORMAT enumerated type that specifies the format of the surface to be multisampled. For more information, see Remarks.
[in] Windowed
Type: BOOL
bool value. Specify TRUE to inquire about windowed multisampling, and specify FALSE to inquire about full-screen multisampling.
[in] MultiSampleType
Type: D3DMULTISAMPLE_TYPE
Member of the D3DMULTISAMPLE_TYPE enumerated type, identifying the multisampling technique to test.
[out] pQualityLevels
Type: DWORD*
pQualityLevels returns the number of device-specific sampling variations available with the given sample type. For example, if the returned value is 3, then quality levels 0, 1 and 2 can be used when creating resources with the given sample count. The meanings of these quality levels are defined by the device manufacturer and cannot be queried through D3D. For example, for a particular device different quality levels at a fixed sample count might refer to different spatial layouts of the sample locations or different methods of resolving. This can be NULL if it is not necessary to return the quality levels.
Return value
Type: HRESULT
If the device can perform the specified multisampling method, this method returns D3D_OK. D3DERR_INVALIDCALL is returned if the Adapter or MultiSampleType parameters are invalid. This method returns D3DERR_NOTAVAILABLE if the queried multisampling technique is not supported by this device. D3DERR_INVALIDDEVICE is returned if DeviceType does not apply to this adapter.
Remarks
This method is intended for use with both render-target and depth-stencil surfaces because you must create both surfaces multisampled if you want to use them together.
The following code fragment shows how you could use CheckDeviceMultiSampleType to test for devices that support a specific multisampling method.
if( SUCCEEDED(pD3D->CheckDeviceMultiSampleType( pCaps->AdapterOrdinal,
pCaps->DeviceType, BackBufferFormat,
FALSE, D3DMULTISAMPLE_3_SAMPLES, NULL ) ) &&
SUCCEEDED(pD3D->CheckDeviceMultiSampleType( pCaps->AdapterOrdinal,
pCaps->DeviceType, DepthBufferFormat,
FALSE, D3DMULTISAMPLE_3_SAMPLES, NULL ) ) )
return S_OK;
The preceding code will return S_OK if the device supports the full-screen D3DMULTISAMPLE_3_SAMPLES multisampling method with the surface format.
See the remarks in D3DMULTISAMPLE_TYPE for additional information on working with and setting multisample types and quality levels.
Requirements
Requirement | Value |
---|---|
Target Platform | Windows |
Header | d3d9.h (include D3D9.h) |
Library | D3D9.lib |