Export (0) Print
Expand All

PresentationParameters.MultiSampleType Property

Gets or sets the multisample type.

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

public MultiSampleType MultiSampleType { get; set; }

Property Value

The multisample type. Must be MultiSampleType.None unless SwapEffect has been set to SwapEffect.Discard. Multisampling is supported only if SwapEffect is SwapEffect.Discard.

Bb198158.caution(en-US,XNAGameStudio.20).gifCaution

In cases where the size of the back buffer and depth stencil buffer exceed the size of the Xbox 360 10 MB of embedded memory (EDRAM), the platform uses predicated tiling to compensate for the additional memory requirements. Predicated tiling renders scenes performed multiple times on subsections of the final render target dimensions. The multisampling chosen with the MultiSampleType property directly affects the size of the back buffer and may trigger predicated tiling.

Use the PreparingDeviceSettings event to set MultiSampleType after calling CheckDeviceMultiSampleType:

        void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e)
        {
            // Xbox 360 and most PCs support FourSamples/1 (4x) and TwoSamples/1 (2x)
            // antialiasing.
#if XBOX
            e.GraphicsDeviceInformation.PresentationParameters.MultiSampleQuality = 1;
            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 1
                e.GraphicsDeviceInformation.PresentationParameters.MultiSampleQuality = 1;
                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 1
                e.GraphicsDeviceInformation.PresentationParameters.MultiSampleQuality = 1;
                e.GraphicsDeviceInformation.PresentationParameters.MultiSampleType =
                    MultiSampleType.TwoSamples;
            }
            return;
        }

Xbox 360, Windows XP SP2, Windows Vista

Community Additions

ADD
Show:
© 2014 Microsoft