[PR #715] [MERGED] VSync on waits for the display whatever the present mode (#684) #2753

Closed
opened 2026-11-02 15:58:47 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/715
Author: @ludovic111
Created: 10/17/2026
Status: ✅ Merged
Merged: 10/17/2026
Merged by: @ludovic111

Base: main ← Head: fix/vsync-windowed


📝 Commits (1)

  • f537c84 VSync on waits for the display whatever the present mode (#684)

📊 Changes

5 files changed (+49 additions, -27 deletions)

View changed files

📝 crates/horizon-client/src/gfx.rs (+11 -24)
📝 crates/horizon-client/src/graphics.rs (+3 -1)
📝 crates/horizon-client/src/graphics_ui.rs (+1 -1)
📝 crates/horizon-client/src/window.rs (+33 -0)
📝 docs/graphics.md (+1 -1)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Fixes #684.

Cause

Renderer::set_present_mode let an explicit Present Mode setting (Fifo, Mailbox or Immediate) win over the VSync option: when the surface supported the named mode, the VSync toggle was never looked at. With Present Mode = Immediate, VSync on still presented with Immediate (uncapped); with Mailbox it depended on the driver, which matches "only works in fullscreen with present mode mailbox". Only Present Mode = Auto went through vanilla's GpuSurface.PresentMode.getSupportedVsyncMode.

Fix

Vanilla 26.3 has no present-mode option: VSync on always means Fifo, VSync off means the first of Immediate, Mailbox and Fifo the surface supports. Horizon's Present Mode setting now applies only while VSync is off; VSync on presents with Fifo in a window and in fullscreen alike. The choice is a pure function (window::chosen_present_mode) with a unit test over every setting. The surface is reconfigured whenever the chosen mode changes, windowed or not (this path already ran on every options change). The tooltip and docs/graphics.md say that the setting applies only with VSync off.

Present mode chosen (Mac mini M4 Pro, Metal: Fifo and Immediate supported, no Mailbox)

Read from the surface configuration in a running game, windowed, after changing the options:

Present Mode VSync before after
Auto on Fifo Fifo
Auto off Immediate Immediate
Immediate on Immediate Fifo
Immediate off Immediate Immediate
Mailbox (unsupported on Metal) on Fifo Fifo
Mailbox (unsupported on Metal) off Immediate Immediate
Fifo on Fifo Fifo
Fifo off Fifo Fifo (the setting applies with VSync off)

On a Vulkan surface that supports Mailbox, Mailbox + VSync on used to present with Mailbox and now uses Fifo.

Limits of this check: the Mac mini's session is locked, so the window compositor throttles every windowed run to about the display rate whatever the mode, and I could not watch the cap itself on screen. The cap on Windows and KDE is not verified here. If u_patrick runs with Present Mode = Auto, this PR does not explain the report (Auto already chose Fifo with VSync on); their Present Mode value would tell. #558 and #635 did not reproduce on the Mac.

Checks

  • cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo test -p horizon-client --lib: pass.
  • Local parity (tools/parity.py --changed origin/main): 88 passed, 0 failed (world_spawn and locator_bar passed on retry without reused oracle results).
  • Rendering is unchanged: only the swapchain present mode differs.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/715 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/17/2026 **Status:** ✅ Merged **Merged:** 10/17/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/vsync-windowed` --- ### 📝 Commits (1) - [`f537c84`](https://github.com/horizon-rust/horizon/commit/f537c84ebb626170d05f88bd00d8654f1698b102) VSync on waits for the display whatever the present mode (#684) ### 📊 Changes **5 files changed** (+49 additions, -27 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/gfx.rs` (+11 -24) 📝 `crates/horizon-client/src/graphics.rs` (+3 -1) 📝 `crates/horizon-client/src/graphics_ui.rs` (+1 -1) 📝 `crates/horizon-client/src/window.rs` (+33 -0) 📝 `docs/graphics.md` (+1 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Fixes #684. ## Cause `Renderer::set_present_mode` let an explicit Present Mode setting (Fifo, Mailbox or Immediate) win over the VSync option: when the surface supported the named mode, the VSync toggle was never looked at. With Present Mode = Immediate, VSync on still presented with Immediate (uncapped); with Mailbox it depended on the driver, which matches "only works in fullscreen with present mode mailbox". Only Present Mode = Auto went through vanilla's `GpuSurface.PresentMode.getSupportedVsyncMode`. ## Fix Vanilla 26.3 has no present-mode option: VSync on always means Fifo, VSync off means the first of Immediate, Mailbox and Fifo the surface supports. Horizon's Present Mode setting now applies only while VSync is off; VSync on presents with Fifo in a window and in fullscreen alike. The choice is a pure function (`window::chosen_present_mode`) with a unit test over every setting. The surface is reconfigured whenever the chosen mode changes, windowed or not (this path already ran on every options change). The tooltip and `docs/graphics.md` say that the setting applies only with VSync off. ## Present mode chosen (Mac mini M4 Pro, Metal: Fifo and Immediate supported, no Mailbox) Read from the surface configuration in a running game, windowed, after changing the options: | Present Mode | VSync | before | after | | --- | --- | --- | --- | | Auto | on | Fifo | Fifo | | Auto | off | Immediate | Immediate | | Immediate | on | **Immediate** | Fifo | | Immediate | off | Immediate | Immediate | | Mailbox (unsupported on Metal) | on | Fifo | Fifo | | Mailbox (unsupported on Metal) | off | Immediate | Immediate | | Fifo | on | Fifo | Fifo | | Fifo | off | Fifo | Fifo (the setting applies with VSync off) | On a Vulkan surface that supports Mailbox, Mailbox + VSync on used to present with Mailbox and now uses Fifo. Limits of this check: the Mac mini's session is locked, so the window compositor throttles every windowed run to about the display rate whatever the mode, and I could not watch the cap itself on screen. The cap on Windows and KDE is not verified here. If u_patrick runs with Present Mode = Auto, this PR does not explain the report (Auto already chose Fifo with VSync on); their Present Mode value would tell. #558 and #635 did not reproduce on the Mac. ## Checks - `cargo fmt --all --check`, `cargo clippy --workspace --all-targets -- -D warnings`, `cargo test -p horizon-client --lib`: pass. - Local parity (`tools/parity.py --changed origin/main`): 88 passed, 0 failed (world_spawn and locator_bar passed on retry without reused oracle results). - Rendering is unchanged: only the swapchain present mode differs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:58:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2753
No description provided.