Manager.CheckDeviceMultiSampleType Method
Determines whether a multisampling technique is available on the current device.
Namespace: Microsoft.WindowsMobile.DirectX.Direct3D
Assembly: Microsoft.WindowsMobile.DirectX (in microsoft.windowsmobile.directx.dll)
Syntax
'Declaration
Public Shared Function CheckDeviceMultiSampleType ( _
adapter As Integer, _
deviceType As DeviceType, _
surfaceFormat As Format, _
windowed As Boolean, _
multiSampleType As MultiSampleType _
) As Boolean
'Usage
Dim adapter As Integer
Dim deviceType As DeviceType
Dim surfaceFormat As Format
Dim windowed As Boolean
Dim multiSampleType As MultiSampleType
Dim returnValue As Boolean
returnValue = Manager.CheckDeviceMultiSampleType(adapter, deviceType, surfaceFormat, windowed, multiSampleType)
public static bool CheckDeviceMultiSampleType (
int adapter,
DeviceType deviceType,
Format surfaceFormat,
bool windowed,
MultiSampleType multiSampleType
)
public:
static bool CheckDeviceMultiSampleType (
int adapter,
DeviceType deviceType,
Format surfaceFormat,
bool windowed,
MultiSampleType multiSampleType
)
public static boolean CheckDeviceMultiSampleType (
int adapter,
DeviceType deviceType,
Format surfaceFormat,
boolean windowed,
MultiSampleType multiSampleType
)
public static function CheckDeviceMultiSampleType (
adapter : int,
deviceType : DeviceType,
surfaceFormat : Format,
windowed : boolean,
multiSampleType : MultiSampleType
) : boolean
Not applicable.
Parameters
- adapter
Ordinal number that denotes the display adapter to query. AdapterListCollection.Default is always the primary display adapter.
- deviceType
Member of the DeviceType enumeration that identifies the device type.
- surfaceFormat
Member of the Format enumeration that identifies the surface to be multisampled.
- windowed
Set to true to inquire about windowed multisampling. Set to false to inquire about full-screen multisampling.
- multiSampleType
Member of the MultiSampleType enumeration that identifies the multisampling technique to test.
Return Value
true if the method succeeds; otherwise, false.
Remarks
This method is intended for use with both render target and depth stencil surfaces because they must be created as multisampled to be used together.
Example
The following code example shows how to check for support of a specific multisampling method.
Public Sub CheckDeviceMultiSampleType()
' Test some formats
IsDeviceMultiSampleOK(DepthFormat.D16, Format.A8R8G8B8, MultiSampleType.TwoSamples)
If result <> Fix(ResultCode.Success) Then
System.Windows.Forms.MessageBox.Show(String.Format("The multisample options are invalid: {0}", result))
End If
End Sub 'CheckDeviceMultiSampleType
Public Function IsDeviceMultiSampleOK(ByVal depthFmt As DepthFormat, ByVal backbufferFmt As Format, ByVal multisampleType As MultiSampleType) As Boolean
Dim ai As AdapterInformation = Microsoft.WindowsMobile.DirectX.Direct3D.Manager.Adapters.Default
Dim qualityLevels As Integer = 0
' Verify that the render target surface supports the given multisample type
If Microsoft.WindowsMobile.DirectX.Direct3D.Manager.CheckDeviceMultiSampleType(ai.Adapter, DeviceType.Default, backbufferFmt, False, multisampleType) Then
' Verify that the depth stencil surface supports the given multisample type
If Microsoft.WindowsMobile.DirectX.Direct3D.Manager.CheckDeviceMultiSampleType(ai.Adapter, DeviceType.Default, CType(depthFmt, Format), False, multisampleType) Then
Return True ' if both calls succeed
End If
End If
Return False
' if either call fails. NOTE: HRESULT passed back in result
End Function
public void CheckDeviceMultiSampleType()
{
// Test some formats
IsDeviceMultiSampleOK(DepthFormat.D16, Format.A8R8G8B8, MultiSampleType.TwoSamples);
if (result != (int)ResultCode.Success)
System.Windows.Forms.MessageBox.Show(String.Format("The multisample options are invalid: {0}", result));
}
public bool IsDeviceMultiSampleOK(DepthFormat depthFmt, Format backbufferFmt, MultiSampleType multisampleType)
{
AdapterInformation ai = Microsoft.WindowsMobile.DirectX.Direct3D.Manager.Adapters.Default;
int qualityLevels = 0;
// Verify that the render target surface supports the given multisample type
if (Microsoft.WindowsMobile.DirectX.Direct3D.Manager.CheckDeviceMultiSampleType(ai.Adapter, DeviceType.Default, backbufferFmt, false, multisampleType))
{
// Verify that the depth stencil surface supports the given multisample type
if (Microsoft.WindowsMobile.DirectX.Direct3D.Manager.CheckDeviceMultiSampleType(ai.Adapter, DeviceType.Default, (Format)depthFmt, false, multisampleType))
{
return true; // if both calls succeed
}
}
return false; // if either call fails. NOTE: HRESULT passed back in result
}
Platforms
Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Version Information
.NET Compact Framework
Supported in: 2.0
See Also
Reference
Manager Class
Manager Members
Microsoft.WindowsMobile.DirectX.Direct3D Namespace