[SOLVED] mg 3.6 crashes over 4096px

Hello all,

Loading texture bigger than 4096
using (var stream = new FileStream("Content/4097x1000.png", FileMode.Open)){ _tex = (Texture2D.FromStream(GraphicsDevice, stream)); }
System.InvalidOperationException: This image format is not supported ---> SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments]

Setting window size bigger than 4096:
_graphics.PreferredBackBufferWidth = 4097;
Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException: Failed to create graphics device! ---> SharpDX.SharpDXException: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments]

Texture size is not a big problem – I can slice bitmaps to 4096 segments.
The main issues for me is the limit for window size - I need more than 4096 in width… much more. Is there any way to fix it?

Hi An_J!

Welcome to the board.

  1. This thread here suggests that this limit is imposed by your graphics hardware, not MonoGame.

  2. The issue with the window size is, that setting the backbuffer is not the same as setting the window-size.
    The backbuffer is the maximum resolution you’ll be able to draw (think of it as a big texture) and that’s going to be displayed on the monitor. Obviously the restrictions of point 1 applies here as well, so you won’t be able to draw a higher resolution that 4096x4096 with your hardware.
    Nevertheless you’ll be able to draw to a bigger window… Your image will be resized automatically.
    Use your maximum backbuffer height and width (4096x4096), set GraphicsDeviceManager.HardwareModeSwitch to false and IsFullScreen to true. That will give you a borderless fullscreen window if I’m not mistaken.

Hope that helps and that I’m correct.

Hello throbax,
Thanks for the response. :]

I’m pretty sure it’s not a hardware issue --> I tested it on 2 machines:

  • laptop with GTX 960M
  • desktop with GTX 1080
    …if not 1080 then who can do it? :wink:

Anyway, to cut “it’s your hardware’s fault” speculations I can add that using MG 3.5.1 I have no problems with setting backbuffer to 9720x3840 [resolution I need] and loading same size [and event bigger, up to 16k width] textures.
Unfortunately 3.5.1 has different issues so I’d love to move to 3.6.


Oh. Thx. Didn’t know that. Just searched for the issue. Sounded reasonable.
@Jjagg any ideas on this one?

@An_J Try setting the GraphicsProfile to HiDef.

1 Like

I was seeing the same issue when switching to 3.6, but I was using 3.4 before that. I normally don’t save textures larger than 4096, but I accidentally had one saved as 5000 and I hadn’t noticed until 3.6 crashed on me for trying to load it.

Unfortunately I don’t have a solution or a reason for it, but you aren’t alone in experiencing it.

Thank you very much @Jjagg!
This seems to solve my problem :slight_smile:

btw, was HiDef default setting in prev ver of MG?


4096x4096 with Reach Profile?
I thought the limit for that was 2048x2048?

Yes, 4096 with Reach.

Yes it was. We know how we’re gonna throw better exceptions for issues because of a low GraphicsProfile, so this should improve in the future.