Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multisampling in DesktopGL #7338

Merged
merged 3 commits into from
Aug 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions MonoGame.Framework/GraphicsDeviceManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,11 @@ private void CreateDevice()

try
{
var gdi = DoPreparingDeviceSettings();

if (!_initialized)
Initialize();
Initialize(gdi);

var gdi = DoPreparingDeviceSettings();
CreateDevice(gdi);
}
catch (NoSuitableGraphicsDeviceException)
Expand Down Expand Up @@ -368,15 +369,12 @@ private void DisposeGraphicsDevice()

partial void PlatformInitialize(PresentationParameters presentationParameters);

private void Initialize()
private void Initialize(GraphicsDeviceInformation gdi)
{
_game.Window.SetSupportedOrientations(_supportedOrientations);

var presentationParameters = new PresentationParameters();
PreparePresentationParameters(presentationParameters);

// Allow for any per-platform changes to the presentation.
PlatformInitialize(presentationParameters);
PlatformInitialize(gdi.PresentationParameters);

_initialized = true;
}
Expand Down
6 changes: 6 additions & 0 deletions MonoGame.Framework/Platform/GraphicsDeviceManager.SDL.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ partial void PlatformInitialize(PresentationParameters presentationParameters)
Sdl.GL.SetAttribute(Sdl.GL.Attribute.ContextMajorVersion, 2);
Sdl.GL.SetAttribute(Sdl.GL.Attribute.ContextMinorVersion, 1);

if (presentationParameters.MultiSampleCount > 0)
{
Sdl.GL.SetAttribute(Sdl.GL.Attribute.MultiSampleBuffers, 1);
Sdl.GL.SetAttribute(Sdl.GL.Attribute.MultiSampleSamples, presentationParameters.MultiSampleCount);
}

((SdlGameWindow)SdlGameWindow.Instance).CreateWindow();
}
}
Expand Down