Backbuffer Swapchain Stays Clamped to Defaults When Larger PreferredBackBufferWidth/Height is Set

Open
#9,629 3 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp
Domain
backend, game-dev

Research direction

Start by tracing how DesktopVK applies PreferredBackBufferWidth and PreferredBackBufferHeight and creates or resizes the Vulkan swapchain; inspect the change in #9585, which the issue identifies as the point after which rendering became clipped. Reproduce with a 1280x800 backbuffer and compare the SDL window size with the swapchain and framebuffer sizes. Done when the swapchain matches the preferred dimensions and rendering covers the full area.

Written by the indexing model from the issue text.

Description

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.6.1

Which MonoGame platform are you using?

MonoGame Cross-Platform Desktop Vulkan Application

Operating System

Windows 11 / Linux

Description

On DesktopVK, setting PreferredBackBufferWidth and/or PreferredBackBufferHeight larger than the 800x480 default resizes the window, but creates the Vulkan swapchain while the SDL window is still at 800x480.
Vulkan clamps the swapchain to 800x480, and cached size checks prevent it from recreating after the window resizes.

See this Discord thread for further context.

Steps to Reproduce

Apply these in game ctor:

_graphics.PreferredBackBufferWidth = 1280;
_graphics.PreferredBackBufferHeight = 800;
_graphics.ApplyChanges();

Draw outside the default 800x480 boundaries.

Minimal Example Repo

No response

Expected Behavior

Both the window and the Vulkan swapchain should be 1280x800, and we should be able to render to the entire area.

Resulting Behavior

The window opens up at 1280x800, PresentationParameters and Viewport report 1280x800, but the actual Vulkan swapchain/framebuffer is stuck at 800x480:

In 3.8.6.1 (after #9585): Rendering is clipped to the 800x480 region, and everything past that area is ignored.
In 3.8.6 (before #9585): The 800x480 backbuffer is stretched to fill the larger window.

Files

No response

Dominant language
C#
Stars
14.7k
Forks
3.1k
Avg merge
13h 17m
Merged PRs (30d)
5

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MonoGame/MonoGame

All issues in MonoGame/MonoGame

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.