Back buffer not scaling into fullscreen window when HardwareModeSwitch is off?

Hey there. I am having a severe bug in my game trying to implement a borderless fullscreen feature. The feature works okay, except for the fact that the back buffer does not scale into the window size if the back buffer size does not match the window’s.

Here’s an example of what I mean.

This first screenshot is taken with the game running at 1080p after a fresh start in borderless fullscreen. My laptop’s native resolution is 1080p and so the window’s size is 1080p, matching the back buffer width. Everything renders fine.

The next screenshot is what happens when I change the resolution to 1600x900 without restarting the game. The window’s client size is still 1080p, but the back buffer size no longer matches. The blue rectangle shows the back buffer’s area. It is rendering from the bottom left and there’s a large amount of black where there shouldn’t be.

This next screenshot shows what happens if I keep my settings as is in the previous one, but then restart the game. It’s the same bug, except that the back buffer is rendering from the top left this time.

Changing the game’s resolution back to 1920x1080 fixes the problem. Am I doing anything wrong? Here’s the code for setting my display mode. I’m using .NET Core and DesktopGL.

public void SetDisplayMode(DisplayMode displayMode, FullScreenMode fullscreenMode)
    // fullscreen mode
    switch (fullscreenMode)
        case FullScreenMode.Borderless:
            _graphics.IsFullScreen = true;
            _graphics.HardwareModeSwitch = false;
        case FullScreenMode.FullScreen:
            _graphics.IsFullScreen = true;
            _graphics.HardwareModeSwitch = true;
        case FullScreenMode.Windowed:
            _graphics.IsFullScreen = false;
            _graphics.HardwareModeSwitch = true;
    // resolution
    _graphics.PreferredBackBufferWidth = displayMode.Width;
    _graphics.PreferredBackBufferHeight = displayMode.Height;
    // Force the GUI to update since the resolution has changed.

    // applu changes.

I have confirmed that both GraphicsDevice.PresentationParameters and GraphicsDevice.Viewport are being updated with the correct settings. The game’s display mode IS being properly updated, but it seems there’s a bug with how the back buffer is drawn to the screen. Any help is greatly appreciated!

In fullscreen and borderless mode, I render the game window at my computer’s native resolution. However, I render my scene at 1080p in a RenderTarget2D and draw that, which I can resize the dimensions of at my leisure. I don’t know if this is the best way to do it, but implementing split-screen is pretty easy with it.

How are you rendering these regions?

My guess is that you are defining a virtual display , and this is perfectly valid. I use it for rendering across multiple monitors, but with only a single monitor I think the display will be scaled back to 1920 by 1080

So if you render a 1920 by 1080 region at the bottom left of the display you will end up with a black region at the top and right

Its not a bug, if your on fullscreen (or borderless fullscreen) your output render target needs to be the native resolution of your monitor. Currently it’s drawing your output to the position on screen of your monitors native resolution.

If you want your output resolution to be smaller than your monitors native resolution you need to output the scaled resolution your self.

You can query the current full screen display resolution by switching to full screen and gettimg GraphicsAdaptor.DefaultAdapter.CurrentDisplayMode.Width (or height)

In my games in my video settings when changing to fullscreen I revert the resolution to that full screen resolution.