[PR #2875] [MERGED] Linux: OpenGL can present to the window #4664

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2875
Author: @elythepreciouscat
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @ludovic111

Base: main ← Head: fix/linux-opengl


📝 Commits (3)

  • c06a7d4 Linux: OpenGL can present to the window
  • 50ebc9d Merge remote-tracking branch 'origin/main' into cg24/f2875
  • 945a98f Merge remote-tracking branch 'origin/main' into upd/2875

📊 Changes

5 files changed (+68 additions, -12 deletions)

View changed files

📝 README.md (+1 -1)
📝 crates/horizon-client-render/src/gfx.rs (+24 -3)
📝 crates/horizon-client-render/src/graphics.rs (+38 -3)
📝 crates/horizon-client-render/src/graphics_ui.rs (+4 -4)
📝 docs/benchmark.md (+1 -1)

📄 Description

What and why

OpenGL was the last backend tried on Linux, but it could never show anything. The renderer created its wgpu::Instance without a display handle, so the GL backend set EGL up on EGL_MESA_platform_surfaceless. That platform has no window-capable configs: the surface came back as gl not compatible with provided surface, and a machine with no working Vulkan had nothing left to fall back to.

The instance now gets the window's display connection (WindowDisplay forwards HasDisplayHandle), so wgpu-hal creates its EGL display from the X11 or Wayland connection the window is on. The other backends are unaffected: Vulkan and Metal receive their window handles separately.

The Graphics API row was hidden on Linux while OpenGL was unreachable, so there was no way to pick it. GraphicsApi::choices() now holds the per-system list (Auto, Vulkan, OpenGL on Linux; all four on Windows; Auto only on macOS); the row appears wherever there is a choice and cycles that list. README.md and docs/benchmark.md mention OpenGL 3.3 on Linux.

Self-check

cargo fmt --check, cargo clippy -p horizon-client --all-targets -- -D warnings, and the graphics tests (cargo test -p horizon-client graphics::, 7 passed, plus indirect_draws_are_validated_only_in_debug_builds_and_on_directx_12) pass.

Manual, on an Intel HD 4000 with Mesa crocus (OpenGL 4.2), on both X11 and Wayland:

  • graphicsApi: opengl, HORIZON_GRAPHICS_API=opengl and WGPU_BACKEND=gl each start and present the world (checked in screenshots).
  • Auto, with the Vulkan ICDs hidden so Vulkan cannot open, falls through to OpenGL and presents.

🔄 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/2875 **Author:** [@elythepreciouscat](https://github.com/elythepreciouscat) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/linux-opengl` --- ### 📝 Commits (3) - [`c06a7d4`](https://github.com/horizon-rust/horizon/commit/c06a7d451199f83954f2e9f9e95c34bd54986d24) Linux: OpenGL can present to the window - [`50ebc9d`](https://github.com/horizon-rust/horizon/commit/50ebc9de600798467360d2949f20f35596f9f0ec) Merge remote-tracking branch 'origin/main' into cg24/f2875 - [`945a98f`](https://github.com/horizon-rust/horizon/commit/945a98f8bcdc7a64533157de82a6c91cdd10a401) Merge remote-tracking branch 'origin/main' into upd/2875 ### 📊 Changes **5 files changed** (+68 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -1) 📝 `crates/horizon-client-render/src/gfx.rs` (+24 -3) 📝 `crates/horizon-client-render/src/graphics.rs` (+38 -3) 📝 `crates/horizon-client-render/src/graphics_ui.rs` (+4 -4) 📝 `docs/benchmark.md` (+1 -1) </details> ### 📄 Description ## What and why OpenGL was the last backend tried on Linux, but it could never show anything. The renderer created its `wgpu::Instance` without a display handle, so the GL backend set EGL up on `EGL_MESA_platform_surfaceless`. That platform has no window-capable configs: the surface came back as `gl not compatible with provided surface`, and a machine with no working Vulkan had nothing left to fall back to. The instance now gets the window's display connection (`WindowDisplay` forwards `HasDisplayHandle`), so wgpu-hal creates its EGL display from the X11 or Wayland connection the window is on. The other backends are unaffected: Vulkan and Metal receive their window handles separately. The Graphics API row was hidden on Linux while OpenGL was unreachable, so there was no way to pick it. `GraphicsApi::choices()` now holds the per-system list (Auto, Vulkan, OpenGL on Linux; all four on Windows; Auto only on macOS); the row appears wherever there is a choice and cycles that list. `README.md` and `docs/benchmark.md` mention OpenGL 3.3 on Linux. ## Self-check `cargo fmt --check`, `cargo clippy -p horizon-client --all-targets -- -D warnings`, and the graphics tests (`cargo test -p horizon-client graphics::`, 7 passed, plus `indirect_draws_are_validated_only_in_debug_builds_and_on_directx_12`) pass. Manual, on an Intel HD 4000 with Mesa crocus (OpenGL 4.2), on both X11 and Wayland: - `graphicsApi: opengl`, `HORIZON_GRAPHICS_API=opengl` and `WGPU_BACKEND=gl` each start and present the world (checked in screenshots). - Auto, with the Vulkan ICDs hidden so Vulkan cannot open, falls through to OpenGL and presents. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:07:02 +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#4664
No description provided.