#9558·MonoGame

DesktopVK: switching PresentationInterval at runtime makes Present ~4x slower until the device is recreated

Author: TiradoxCreated Sep 25, 2026Updated Sep 25, 2026

Prerequisites

  • I have verified this issue is present in the develop branch
  • I have searched open and closed issues to ensure it has not already been reported.

LLM Declaration

  • I used an LLM to generate the code or fix in this Issue.

MonoGame Version

MonoGame 3.8.5.1

Which MonoGame platform are you using?

MonoGame Cross-Platform Desktop Vulkan Application

Operating System

Windows 11, NVIDIA GeForce 5060 ti 16GB, driver 617.14

Description

If the graphics card starts up with VSync enabled and VSync is subsequently turned off, it outputs frames roughly four times slower than if it had started without VSync from the beginning. The only fix is ​​a restart. Most likely, upon startup, the NVIDIA driver selects a specific path for delivering frames to the screen-optimizing it for VSync-and does not switch paths when VSync is later disabled. Frames are delivered without waiting, but they travel along the old, slower route-likely involving an extra frame copy at each step.

Additional notes: In MGVK_RecreateSwapChain the present mode is chosen only between FIFO and IMMEDIATE; MAILBOX is never selected. Supporting MAILBOX for PresentInterval.Immediate (when available) would give tear-free uncapped rendering and might sidestep this issue. Related: with IMMEDIATE on laptops (Intel / hybrid graphics) a maximized window tears, because presentation goes through independent flip and bypasses DWM. So "IMMEDIATE forever plus own frame pacing" does not work as a workaround.

Steps to Reproduce

Steps to reproduce:

  1. Run without arguments (swapchain created IMMEDIATE) and note the FPS in the title.
  2. Run with the vsync argument (swapchain created FIFO). The FPS is capped at the refresh rate, as expected.
  3. Press V to switch to Immediate.
cs
using System.Diagnostics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

public class Repro : Game
{
    readonly GraphicsDeviceManager _graphics;
    SpriteBatch _batch;
    Texture2D _pixel;
    KeyboardState _prev;
    readonly Stopwatch _clock = Stopwatch.StartNew();
    int _frames;

    public Repro(bool startWithVSync)
    {
        _graphics = new GraphicsDeviceManager(this)
        {
            SynchronizeWithVerticalRetrace = startWithVSync,
            PreferredBackBufferWidth = 1280,
            PreferredBackBufferHeight = 720,
        };
        IsFixedTimeStep = false;
    }

    protected override void LoadContent()
    {
        _batch = new SpriteBatch(GraphicsDevice);
        _pixel = new Texture2D(GraphicsDevice, 1, 1);
        _pixel.SetData(new[] { Color.White });
    }

    protected override void Update(GameTime gameTime)
    {
        var keys = Keyboard.GetState();

        // V toggles vsync at runtime.
        if (keys.IsKeyDown(Keys.V) && _prev.IsKeyUp(Keys.V))
        {
            var pp = GraphicsDevice.PresentationParameters;
            pp.PresentationInterval = pp.PresentationInterval == PresentInterval.Immediate
                ? PresentInterval.One
                : PresentInterval.Immediate;
            GraphicsDevice.Reset();
        }

        _prev = keys;
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        _batch.Begin();
        _batch.Draw(_pixel, new Rectangle(100, 100, 200, 200), Color.White);
        _batch.End();

        _frames++;
        if (_clock.ElapsedMilliseconds >= 1000)
        {
            Window.Title = $"{_frames} fps, {GraphicsDevice.PresentationParameters.PresentationInterval}";
            _frames = 0;
            _clock.Restart();
        }
    }
}

public static class Program
{
    public static void Main(string[] args)
    {
        using var game = new Repro(startWithVSync: args.Length > 0 && args[0] == "vsync");
        game.Run();
    }
}

Minimal Example Repo

No response

Expected Behavior

Аfter step 3 the FPS is the same as in step 1.

Resulting Behavior

After step 3 the FPS is about 4x lower (on my machine ~11 400 vs ~2 800 fps). Pressing V again or resizing the window does not help; only restarting the app does. Switching before the window is shown gives the same ~2 800.

Files

No response