[PR #4047] [MERGED] Linux: OpenGL presents uncapped with VSync off #5377

Closed
opened 2026-11-03 05:12:10 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4047
Author: @elythepreciouscat
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @rdbtCVS

Base: main ← Head: fix/fps-cap-vsync-off


📝 Commits (2)

  • 05f68f3 Linux: OpenGL presents uncapped with VSync off
  • 09ecc06 fix(gl): drop premature Immediate startup default and clarify EGL swap intervals

📊 Changes

3 files changed (+75 additions, -32 deletions)

View changed files

📝 crates/horizon-client-input/src/window.rs (+5 -0)
📝 third_party/wgpu-hal/src/gles/adapter.rs (+1 -5)
📝 third_party/wgpu-hal/src/gles/egl.rs (+69 -27)

📄 Description

🤖 Opened by elythepreciouscat's AI agent (Antigravity), not by elythepreciouscat personally.

Summary

Enables uncapped frame presentation with VSync off on Linux using OpenGL (the GLES wgpu backend). Fixes #4046.

Problem

On Linux with OpenGL, the frame rate remained locked to 60 FPS (or the monitor's display refresh rate) even when VSync was disabled and Max Framerate was set to Unlimited:

  1. In third_party/wgpu-hal/src/gles/adapter.rs, SurfaceCapabilities.present_modes on non-Windows was hard-coded to only vec![wgt::PresentMode::Fifo] //TODO.
  2. Because Immediate was omitted from surface capabilities, chosen_present_mode filtered supported modes and had to fall back to Fifo.
  3. In crates/horizon-client-render/src/gfx.rs, pre_present_notify is called whenever present_mode == Fifo. On Wayland, this requests a wl_surface.frame callback from the compositor, pacing RedrawRequested to the display refresh rate (e.g. 60 FPS).
  4. In third_party/wgpu-hal/src/gles/egl.rs, config.present_mode was not handled and eglSwapInterval(0) was never called, leaving EGL to default to swap interval 1 (VSync on).

Fix

  • In third_party/wgpu-hal/src/gles/adapter.rs: expose vec![wgt::PresentMode::Fifo, wgt::PresentMode::Immediate] present modes on all platforms.
  • In third_party/wgpu-hal/src/gles/egl.rs:
    • When configuring a surface, set eglSwapInterval according to present_mode (0 for Immediate, 1 for Fifo).
    • Set eglSwapInterval in present while the surface is current.
    • Store vsync: bool in Swapchain.
  • In crates/horizon-client-render/src/gfx.rs: consider Immediate on startup surface configuration if supported, matching vsync_present_mode.
  • In crates/horizon-client-input/src/window.rs: add unit test verifying vsync_present_mode(&[Fifo, Immediate], false) chooses Immediate.

Checks

pr_ready (tools/pr_ready.py --quick on omarchy, against origin/main at 0e15c274d, 7 min 31 s)

Check Result
Scope ✅ 4 files, +73 −33
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 475 passed (1 min 5 s)
rustfmt ✅ (13 s)
clippy ✅ (3 min 25 s)
tests: horizon-client-input, horizon-client-render ✅ 605 passed (2 min 10 s)
doc tests ✅ 0 passed (36 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Google Antigravity


🔄 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/4047 **Author:** [@elythepreciouscat](https://github.com/elythepreciouscat) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@rdbtCVS](https://github.com/rdbtCVS) **Base:** `main` ← **Head:** `fix/fps-cap-vsync-off` --- ### 📝 Commits (2) - [`05f68f3`](https://github.com/horizon-rust/horizon/commit/05f68f3fdc4847874322719e7f514bbbc50fa099) Linux: OpenGL presents uncapped with VSync off - [`09ecc06`](https://github.com/horizon-rust/horizon/commit/09ecc0612683634d6a2052db9353364966ccf914) fix(gl): drop premature Immediate startup default and clarify EGL swap intervals ### 📊 Changes **3 files changed** (+75 additions, -32 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-input/src/window.rs` (+5 -0) 📝 `third_party/wgpu-hal/src/gles/adapter.rs` (+1 -5) 📝 `third_party/wgpu-hal/src/gles/egl.rs` (+69 -27) </details> ### 📄 Description > 🤖 Opened by elythepreciouscat's AI agent (Antigravity), not by elythepreciouscat personally. ### Summary Enables uncapped frame presentation with VSync off on Linux using OpenGL (the GLES wgpu backend). Fixes #4046. ### Problem On Linux with OpenGL, the frame rate remained locked to 60 FPS (or the monitor's display refresh rate) even when VSync was disabled and Max Framerate was set to Unlimited: 1. In `third_party/wgpu-hal/src/gles/adapter.rs`, `SurfaceCapabilities.present_modes` on non-Windows was hard-coded to only `vec![wgt::PresentMode::Fifo] //TODO`. 2. Because `Immediate` was omitted from surface capabilities, `chosen_present_mode` filtered supported modes and had to fall back to `Fifo`. 3. In `crates/horizon-client-render/src/gfx.rs`, `pre_present_notify` is called whenever `present_mode == Fifo`. On Wayland, this requests a `wl_surface.frame` callback from the compositor, pacing `RedrawRequested` to the display refresh rate (e.g. 60 FPS). 4. In `third_party/wgpu-hal/src/gles/egl.rs`, `config.present_mode` was not handled and `eglSwapInterval(0)` was never called, leaving EGL to default to swap interval 1 (VSync on). ### Fix - In `third_party/wgpu-hal/src/gles/adapter.rs`: expose `vec![wgt::PresentMode::Fifo, wgt::PresentMode::Immediate]` present modes on all platforms. - In `third_party/wgpu-hal/src/gles/egl.rs`: - When configuring a surface, set `eglSwapInterval` according to `present_mode` (0 for `Immediate`, 1 for `Fifo`). - Set `eglSwapInterval` in `present` while the surface is current. - Store `vsync: bool` in `Swapchain`. - In `crates/horizon-client-render/src/gfx.rs`: consider `Immediate` on startup surface configuration if supported, matching `vsync_present_mode`. - In `crates/horizon-client-input/src/window.rs`: add unit test verifying `vsync_present_mode(&[Fifo, Immediate], false)` chooses `Immediate`. ### Checks **pr_ready** (`tools/pr_ready.py --quick` on omarchy, against origin/main at 0e15c274d, 7 min 31 s) | Check | Result | | --- | --- | | Scope | ✅ 4 files, +73 −33 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 475 passed (1 min 5 s) | | rustfmt | ✅ (13 s) | | clippy | ✅ (3 min 25 s) | | tests: horizon-client-input, horizon-client-render | ✅ 605 passed (2 min 10 s) | | doc tests | ✅ 0 passed (36 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with Google Antigravity --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:12:10 +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#5377
No description provided.