Export (0) Print
Expand All
Expand Minimize

MultiSampleType Enumeration

Defines the levels of full-scene multisampling that the game machine can apply.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

public enum MultiSampleType

 Member nameDescription
SixteenSamplesEnables 16 levels of full-scene multisampling.
FifteenSamplesEnables 15 levels of full-scene multisampling.
FourteenSamplesEnables 14 levels of full-scene multisampling.
ThirteenSamplesEnables 13 levels of full-scene multisampling.
TwelveSamplesEnables 12 levels of full-scene multisampling.
ElevenSamplesEnables 11 levels of full-scene multisampling.
TenSamplesEnables 10 levels of full-scene multisampling.
NineSamplesEnables 9 levels of full-scene multisampling.
EightSamplesEnables 8 levels of full-scene multisampling.
SevenSamplesEnables 7 levels of full-scene multisampling.
SixSamplesEnables 6 levels of full-scene multisampling.
FiveSamplesEnables 5 levels of full-scene multisampling.
FourSamplesEnables 4 levels of full-scene multisampling.
ThreeSamplesEnables 3 levels of full-scene multisampling.
TwoSamplesEnables 2 levels of full-scene multisampling.
NonMaskableEnables the multisample quality value. For a quality of 1, the video card determines the best multisampling mode.
None Specifies no full-scene multisampling, and enables swap effects other than SwapEffect.Discard.

When multisampling is enabled, all subsamples of a pixel are updated in one pass. However, when subsamples are used for other effects that involve multiple rendering passes, the application can specify that only some of them be affected by a given rendering pass. This latter approach enables simulation of motion blur, depth-of-field focus effects, reflection blur, and other effects.

In addition to enabling full-scene multisampling when a Reset occurs, there are render states that turn various multisampling aspects on and off at fine-grained levels. For more information, see RenderState.

Multisampling is valid only on a swap chain that is created or reset with SwapEffect.Discard.

The multisampling antialiasing value can be set with the parameters or sub-parameters in the following methods.

ModuleParametersSub-parameters
CheckDeviceMultiSampleType multiSampleType, qualityLevels None
GraphicsDevice presentationParameters MultiSampleType, MultiSampleQuality
Reset presentationParameters MultiSampleType, MultiSampleQuality

Use the PreparingDeviceSettings event to set MultiSampleType after calling CheckDeviceMultiSampleType:

        void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            // Xbox 360 and most PCs support FourSamples/0 (4x) and TwoSamples/0 (2x)
            // antialiasing.
#if XBOX
            e.GraphicsDeviceInformation.PresentationParameters.MultiSampleQuality = 0;
            e.GraphicsDeviceInformation.PresentationParameters.MultiSampleType =
                MultiSampleType.FourSamples;
            return;
#endif
            int quality = 0;
            GraphicsAdapter adapter = e.GraphicsDeviceInformation.Adapter;
            SurfaceFormat format = adapter.CurrentDisplayMode.Format;
            // Check for 4xAA
            if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format,
                false, MultiSampleType.FourSamples, out quality))
            {
                // even if a greater quality is returned, we only want quality 0
                e.GraphicsDeviceInformation.PresentationParameters.MultiSampleQuality = 0;
                e.GraphicsDeviceInformation.PresentationParameters.MultiSampleType =
                    MultiSampleType.FourSamples;
            }
            // Check for 2xAA
            else if (adapter.CheckDeviceMultiSampleType(DeviceType.Hardware, format,
                false, MultiSampleType.TwoSamples, out quality))
            {
                // even if a greater quality is returned, we only want quality 0
                e.GraphicsDeviceInformation.PresentationParameters.MultiSampleQuality = 0;
                e.GraphicsDeviceInformation.PresentationParameters.MultiSampleType =
                    MultiSampleType.TwoSamples;
            }
            return;
        }

Xbox 360, Windows XP SP2, Windows Vista, Zune

Community Additions

ADD
Show:
© 2014 Microsoft