I just updated to the current MonoGame Version (3.6.0.1625) and now my game’s causing an exception on starting. using (MyGame game = new MyGame()) game.Run();
Ein Ausnahmefehler des Typs “Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException” ist in MonoGame.Framework.dll aufgetreten.
Zusätzliche Informationen: Failed to create graphics device!
Unfortunately I can’t tell, which version I used before, but it was an Dev 3.6.0.x, I installed it in October or November last year.
In Game Constructor I do the following stuff on my GraphicsDeviceManager: graphics = new GraphicsDeviceManager(this); graphics.HardwareModeSwitch = false; graphics.PreferMultiSampling = GameSettings.Graphics.MSAA;
Thanks for helping!
I’ve just installed VS2017 and Monogame 3.6 onto a new laptop I’ve just got (first one, always use desktops) and I was getting the same sort of error message (never had the problem on my desktop pc).
I found this line in my code:
_graphics.PreferMultiSampling = true;
and removing it also made my app work as it should. Thanks for the heads up - though I can’t remember what this will do and why I put it to true in the first place
It shoudl enable MSAA and set the multisample count to the highest level supported by your GPU. You can still enable multisampling by setting the multisample count directly. For details see this post: Quick Overview: How to work with MSAA (DirectX too!)
Thanks for the refresher, been a while since I’ve done any MG stuff but like to keep the binaries on the machine just in case. Thanks for the link too!
I’ve just built MonoGame starting from the code as October 5th, 2017, and I still get the exception if I don’t comment out
GraphicsDeviceManager.PreferMultiSampling = true;
Debugging a bit I see that the exception is generated by
_swapChain = new SwapChain(dxgiFactory, dxgiDevice, desc);
of GraphicsDevice.DirectX.cs
The same line passes well up to commits dated mid January 2017.
Digging further I found out that with commits before January 2017 in above SwapChain call desc.SampleDescription.Count is 8 and desc.SampleDescription.Quality is 16, while with later commits such values are 32 and -1. By replacing a 32 with an 8 in line
presentationParameters.MultiSampleCount = GraphicsDevice != null
? GraphicsDevice.GraphicsCapabilities.MaxMultiSampleCount
: 32;
of GraphicsDevice.DirectX.cs and in line
private const int MultiSampleCountLimit = 32;
of GraphicsCapabilities.cs I get desc.SampleDescription.Count = 8 and desc.SampleDescription.Quality = 16 and no crash.
Note that the line of GraphicsDevice.DirectX.cs is executed twice before the call to SwapChain(), and both times GraphicsDevice is null, so that the fixed limit is selected without checking the capabilities of the platform.
I hope this helps to define how to proceed. By the moment I proceed with above lines changed.