[PR #6725] [MERGED] Software rendering: a chosen API tries the GPU first, menus 3x faster on WARP/llvmpipe #7057

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/6725
Author: @ludovic111
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: perf/low-end-menu


📝 Commits (2)

  • 3011a79 Renderer: a chosen graphics API with no GPU tries the others before software
  • 2b874ae Menu blur: half size on a software adapter

📊 Changes

2 files changed (+238 additions, -69 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+81 -22)
📝 crates/horizon-client-render/src/menu_blur.rs (+157 -47)

📄 Description

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

Part of #5185 (the reporter's OpenGL crash on GL 4.0 is #6341, merged after their Nightly).

Why

The reporter's log (i5-3470 + Intel HD 2500, Windows, Nightly c9d474d): with DirectX 12 as the graphics API, DirectX 12's only adapter was WARP (Microsoft Basic Render Driver), so Horizon drew every frame on the CPU: 90% CPU, the UI bundle ready after 101 s instead of 9 s, minutes to reach the title. The same PC's GPU works through OpenGL. Auto mode already tries every backend on a GPU before software (#3985), but a chosen API went straight to its own software adapter.

Telemetry (last 30 days): 81 installs rendered on a software adapter (31 on WARP, the rest llvmpipe), with session median frames of 100 to 370 ms and sessions of a minute or two.

On a software adapter, every blurred menu (Options, the world list, the first-launch screen) runs vanilla's menu blur: six full-screen passes. On llvmpipe at 1440x900 that is ~250 ms of CPU per frame, and those menus ran at 3 FPS.

What

  • gfx.rs device_search: the chosen API's backends on a GPU, then the other backends Auto would try on a GPU, then the chosen backends with a software adapter. DirectX 12 never falls back to Vulkan: the launcher picks DirectX 12 after Vulkan crashed natively in the driver (#746), and trying Vulkan again would crash in a loop.
  • menu_blur.rs: on a software adapter (DeviceType::Cpu), the blur copies the frame, averages it down to half width and height, runs its six passes there with half the radius (the same extent), and the last pass samples back up into the frame. GPUs run the blur exactly as before.

Numbers

llvmpipe (Mesa 26.0.8, Vulkan) on playhorizon as the stand-in for a PC rendering in software, 1440x900, horizon-ctl bench 8 on the Options screen opened from the title (default blur 5), two alternated rounds, CPUs 0-3 shared with builds (load ~30):

main 06f842dc3 this PR
FPS 2.6 / 2.7 7.4 / 7.7
GPU ms per frame (p50) 344 / 374 125 / 128
CPU ms per frame (llvmpipe's threads) 388 / 427 149 / 164

Blur radius on main, same screen: 0 → 25 ms, 1 → 112 ms, 3 → 172 ms, 5 → 273 ms, 10 → 434 ms GPU per frame. The title screen itself (no blur) was already 21 ms CPU per frame (38 FPS) there. Opening Options or Horizon Settings takes one frame (~0.9 s on llvmpipe): no pipeline is compiled on the UI thread when a menu opens.

Not measured: a real Intel HD 2500 or WARP (no such machine here). The adapter choice has a unit test: a_chosen_api_without_a_gpu_tries_the_others_before_software.

Look

GPUs: unchanged (both changes act only on a software adapter or when the chosen API has no GPU). Software adapters: the menu background is blurred from a half-size copy; the_half_size_blur_blurs_like_the_full_size_one checks it blurs a striped frame to the same even grey as the full-size blur.

Self-check

pr_ready (tools/pr_ready.py --quick on playhorizon, against origin/main at 06f842dc3, 18 min 5 s)

Check Result
Scope ✅ 2 files, +238 −69
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 595 passed (1 min 10 s)
rustfmt ✅ (13 s)
clippy ✅ (8 min 25 s)
tests: horizon-client-render ✅ 990 passed (7 min 33 s)
doc tests ✅ 0 passed (2 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 ➖ 136 affected, to run in CI (--quick): ambient_sound, armor_stand_frost, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal and 124 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Run on the two commits before their rebase onto main 57cc476ac8 (a clean replay: main's verify failure at 06f842dc3, the stale mod API output, was fixed by #6720). Render tests single-threaded (RUST_TEST_THREADS=1): playhorizon has no GPU and its GPU tests crash when run in parallel on llvmpipe.

🤖 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/6725 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/low-end-menu` --- ### 📝 Commits (2) - [`3011a79`](https://github.com/horizon-rust/horizon/commit/3011a79600620e7f3577b3b97977a7de857aaa73) Renderer: a chosen graphics API with no GPU tries the others before software - [`2b874ae`](https://github.com/horizon-rust/horizon/commit/2b874aea1ce338e1c6b14a92f37362f2a45525ed) Menu blur: half size on a software adapter ### 📊 Changes **2 files changed** (+238 additions, -69 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+81 -22) 📝 `crates/horizon-client-render/src/menu_blur.rs` (+157 -47) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #5185 (the reporter's OpenGL crash on GL 4.0 is #6341, merged after their Nightly). ## Why The reporter's log (i5-3470 + Intel HD 2500, Windows, Nightly c9d474d): with DirectX 12 as the graphics API, DirectX 12's only adapter was WARP (Microsoft Basic Render Driver), so Horizon drew every frame on the CPU: 90% CPU, the UI bundle ready after 101 s instead of 9 s, minutes to reach the title. The same PC's GPU works through OpenGL. Auto mode already tries every backend on a GPU before software (#3985), but a chosen API went straight to its own software adapter. Telemetry (last 30 days): 81 installs rendered on a software adapter (31 on WARP, the rest llvmpipe), with session median frames of 100 to 370 ms and sessions of a minute or two. On a software adapter, every blurred menu (Options, the world list, the first-launch screen) runs vanilla's menu blur: six full-screen passes. On llvmpipe at 1440x900 that is ~250 ms of CPU per frame, and those menus ran at 3 FPS. ## What - `gfx.rs` `device_search`: the chosen API's backends on a GPU, then the other backends Auto would try on a GPU, then the chosen backends with a software adapter. DirectX 12 never falls back to Vulkan: the launcher picks DirectX 12 after Vulkan crashed natively in the driver (#746), and trying Vulkan again would crash in a loop. - `menu_blur.rs`: on a software adapter (`DeviceType::Cpu`), the blur copies the frame, averages it down to half width and height, runs its six passes there with half the radius (the same extent), and the last pass samples back up into the frame. GPUs run the blur exactly as before. ## Numbers llvmpipe (Mesa 26.0.8, Vulkan) on playhorizon as the stand-in for a PC rendering in software, 1440x900, `horizon-ctl bench 8` on the Options screen opened from the title (default blur 5), two alternated rounds, CPUs 0-3 shared with builds (load ~30): | | main 06f842dc3 | this PR | |---|---|---| | FPS | 2.6 / 2.7 | **7.4 / 7.7** | | GPU ms per frame (p50) | 344 / 374 | **125 / 128** | | CPU ms per frame (llvmpipe's threads) | 388 / 427 | **149 / 164** | Blur radius on main, same screen: 0 → 25 ms, 1 → 112 ms, 3 → 172 ms, 5 → 273 ms, 10 → 434 ms GPU per frame. The title screen itself (no blur) was already 21 ms CPU per frame (38 FPS) there. Opening Options or Horizon Settings takes one frame (~0.9 s on llvmpipe): no pipeline is compiled on the UI thread when a menu opens. Not measured: a real Intel HD 2500 or WARP (no such machine here). The adapter choice has a unit test: `a_chosen_api_without_a_gpu_tries_the_others_before_software`. ## Look GPUs: unchanged (both changes act only on a software adapter or when the chosen API has no GPU). Software adapters: the menu background is blurred from a half-size copy; `the_half_size_blur_blurs_like_the_full_size_one` checks it blurs a striped frame to the same even grey as the full-size blur. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on playhorizon, against origin/main at 06f842dc3, 18 min 5 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +238 −69 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 595 passed (1 min 10 s) | | rustfmt | ✅ (13 s) | | clippy | ✅ (8 min 25 s) | | tests: horizon-client-render | ✅ 990 passed (7 min 33 s) | | doc tests | ✅ 0 passed (2 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 | ➖ 136 affected, to run in CI (--quick): ambient_sound, armor_stand_frost, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers, block_particles, block_removal and 124 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Run on the two commits before their rebase onto main 57cc476ac8 (a clean replay: main's verify failure at 06f842dc3, the stale mod API output, was fixed by #6720). Render tests single-threaded (`RUST_TEST_THREADS=1`): playhorizon has no GPU and its GPU tests crash when run in parallel on llvmpipe. 🤖 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-03 06:33:00 +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#7057
No description provided.