[PR #995] [MERGED] Far terrain: capped on integrated GPUs, held back on 4-thread machines #2971

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

📋 Pull Request Information

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

Base: main ← Head: perf/lod-integrated-gpu


📝 Commits (5)

  • bf8d849 Far terrain: no dark band at the full-detail edge, no black cliffs
  • 895dc26 Far terrain: no faces for caves nothing can see into
  • af9d888 Far terrain: time each step of Lod::update
  • c468938 Far terrain: bounded render-thread work while tiles generate
  • 5148b2e Far terrain: capped on integrated GPUs, held back on 4-thread machines

📊 Changes

10 files changed (+925 additions, -193 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+66 -30)
📝 crates/horizon-client/src/game/control.rs (+1 -0)
📝 crates/horizon-client/src/gfx.rs (+59 -14)
📝 crates/horizon-client/src/gfx/lod.rs (+120 -1)
📝 crates/horizon-client/src/gfx/resident.rs (+30 -10)
📝 crates/horizon-client/src/graphics.rs (+60 -0)
📝 crates/horizon-client/src/graphics_ui.rs (+1 -1)
📝 crates/horizon-client/src/lod.rs (+334 -95)
📝 crates/horizon-client/src/lod/mesh.rs (+245 -42)
📝 crates/horizon-client/src/streaming.rs (+9 -0)

📄 Description

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

Follow-up to @Online5277's terrain LODs (#771): integrated GPUs and 4-thread machines. Stacked on #994 (review the last commit).

What

  • LOD Distance cap on integrated GPUs: integrated GPUs other than Apple's draw far terrain to 128 chunks at most, whatever LOD Distance says (graphics::INTEGRATED_LOD_DISTANCE, Graphics::lod_distance_on). The setting itself is untouched, so the same options file gives the full distance on a discrete GPU. The option's description now says "Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks." horizon-ctl status reports lod.effective_distance. Apple GPUs report as integrated (unified memory) but have the bandwidth for every distance, so they are left out (M4 Pro: GPU ≤ 0.6 ms at LOD 1024, see #993).
  • Generation pacing on ≤ 4 threads: while the near terrain is still loading (Streaming::busy), far terrain starts no detail and at most one sample job per 500 ms. Far terrain already used one sampling thread on these machines. Without pacing, that thread, the decoration thread and the mesher took cores from the near chunks and the frame. With 5 or more threads nothing changes.

Why 128 on the HD 620

ThinkPad, Intel HD 620 (Mesa ANV, Xvfb, nice 19), RD 12, build #994 without the cap:

LOD covered in vertex MB FPS overview / meadow / peak 1% low GPU ms CPU ms
off (main) – – 281 (meadow) 126 3.5 1.7
64 711 s 422 102.7 / 119.6 / 103.5 76 / 110 / 24 9.6 / 8.3 / 9.1 5.0 / 3.9 / 6.1
128 822 s 585 78.3 / 84.8 / 80.0 64 / 63 / 19 12.7 / 11.7 / 11.7 4.9 / 5.4 / 7.8
256 not in 900 s (52% of tiles) 506 so far 65.5 / 70.3 / 86.1 27 / 34 / 24 14.4 / 13.8 / 8.6 11.2 / 10.0 / 9.9

At 128 chunks the HD 620 finishes generating in under 14 minutes and holds about 80 FPS. At 256 it hadn't sampled half the tiles after 15 minutes, and was already below 70 FPS with roughly 40% of its vertex memory still to come (#993 at LOD 256 reaches 753–840 MB on the Mac). The cap applies only to a setting above 128: 64 and 128 behave as before.

Pacing: ThinkPad HD 620, 4 threads, RD 12

Launch to near terrain settled (streaming idle, mesh count steady 3 s), then an 8 s bench at the meadow while far tiles keep generating. Two rounds, builds in turn:

build LOD near terrain in FPS 1% low CPU ms
main off 21.3, 22.1 s 280.8, 282.0 125.6, 115.6 1.69, 1.64
this stack off 21.3, 20.8 s 283.8, 277.8 132.4, 118.6 1.64, 1.77
#993 64 23.7, 25.4 s 229.8, 257.6 63.9, 135.0 3.03, 1.77
this stack 64 21.3, 17.4 s 244.2, 267.6 80.3, 167.6 2.14, 1.26

With LOD 64 the near terrain now loads as fast as with LODs off. Full far coverage at LOD 64 takes 702 s against 711 s on #993: the hold only lasts while the near terrain loads.

LODs off is identical to main

  • Screenshots (Mac, trio.sh: main / stack / main, animation off, six views plus HUD and inventory, in ~/code/horizon-parity/shots/perf-frame-9/trio-d1*): meadow, forest, slope, overview, HUD and inventory differ by 0 px outside animated areas. Mountain and peak differ by 49 and 32 px. That is one tree at the fog edge (crop-off-mountain.png), from streaming order: the terrain vertex total varies more between two main runs (43 KB) than between main and the stack (288 B).
  • FPS on the HD 620: the table above, LOD off rows (281/282 against 284/278).
  • FPS on the Mac (RD 12, LOD off, overview / meadow / peak, two rounds): main 1094/1324/1033 and 775/1370/1182, stack 756/978/1012 and 1000/1492/1226. Within the noise of a shared machine at 1000 FPS; the CPU ms ranges overlap (main 0.56–0.96, stack 0.47–0.95).

Self-check

cargo fmt --all --check                                    ok
cargo clippy --workspace --all-targets -- -D warnings      ok
cargo test -p horizon-client --lib                         924 passed, 13 ignored
tools/parity.py --changed origin/main                      98 passed, 0 failed (run on the whole stack)

New test: integrated_gpus_other_than_apple_cap_the_lod_distance (also checks that the description names the cap).

Kira: card#23.

🤖 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/995 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/lod-integrated-gpu` --- ### 📝 Commits (5) - [`bf8d849`](https://github.com/horizon-rust/horizon/commit/bf8d84930fe5675d4bb667220d48a1d347c13715) Far terrain: no dark band at the full-detail edge, no black cliffs - [`895dc26`](https://github.com/horizon-rust/horizon/commit/895dc26848cef7ca0e10badc2a3030ea7252748d) Far terrain: no faces for caves nothing can see into - [`af9d888`](https://github.com/horizon-rust/horizon/commit/af9d88841075a1af5ff2b1ac1d1c1e689084b043) Far terrain: time each step of Lod::update - [`c468938`](https://github.com/horizon-rust/horizon/commit/c468938a66acd102c4adef86848b1b060b5985e6) Far terrain: bounded render-thread work while tiles generate - [`5148b2e`](https://github.com/horizon-rust/horizon/commit/5148b2ee2c30117606503b4e7e4e337b59afe6fb) Far terrain: capped on integrated GPUs, held back on 4-thread machines ### 📊 Changes **10 files changed** (+925 additions, -193 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+66 -30) 📝 `crates/horizon-client/src/game/control.rs` (+1 -0) 📝 `crates/horizon-client/src/gfx.rs` (+59 -14) 📝 `crates/horizon-client/src/gfx/lod.rs` (+120 -1) 📝 `crates/horizon-client/src/gfx/resident.rs` (+30 -10) 📝 `crates/horizon-client/src/graphics.rs` (+60 -0) 📝 `crates/horizon-client/src/graphics_ui.rs` (+1 -1) 📝 `crates/horizon-client/src/lod.rs` (+334 -95) 📝 `crates/horizon-client/src/lod/mesh.rs` (+245 -42) 📝 `crates/horizon-client/src/streaming.rs` (+9 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Follow-up to @Online5277's terrain LODs (#771): integrated GPUs and 4-thread machines. Stacked on #994 (review the last commit). ## What - **LOD Distance cap on integrated GPUs:** integrated GPUs other than Apple's draw far terrain to **128 chunks** at most, whatever LOD Distance says (`graphics::INTEGRATED_LOD_DISTANCE`, `Graphics::lod_distance_on`). The setting itself is untouched, so the same options file gives the full distance on a discrete GPU. The option's description now says "Coarse distant terrain in local worlds. Integrated GPUs stop at 128 chunks." `horizon-ctl status` reports `lod.effective_distance`. Apple GPUs report as integrated (unified memory) but have the bandwidth for every distance, so they are left out (M4 Pro: GPU ≤ 0.6 ms at LOD 1024, see #993). - **Generation pacing on ≤ 4 threads:** while the near terrain is still loading (`Streaming::busy`), far terrain starts no detail and at most one sample job per 500 ms. Far terrain already used one sampling thread on these machines. Without pacing, that thread, the decoration thread and the mesher took cores from the near chunks and the frame. With 5 or more threads nothing changes. ## Why 128 on the HD 620 ThinkPad, Intel HD 620 (Mesa ANV, Xvfb, nice 19), RD 12, build #994 without the cap: | LOD | covered in | vertex MB | FPS overview / meadow / peak | 1% low | GPU ms | CPU ms | | --- | --- | --- | --- | --- | --- | --- | | off (main) | – | – | 281 (meadow) | 126 | 3.5 | 1.7 | | 64 | 711 s | 422 | 102.7 / 119.6 / 103.5 | 76 / 110 / 24 | 9.6 / 8.3 / 9.1 | 5.0 / 3.9 / 6.1 | | 128 | 822 s | 585 | 78.3 / 84.8 / 80.0 | 64 / 63 / 19 | 12.7 / 11.7 / 11.7 | 4.9 / 5.4 / 7.8 | | 256 | not in 900 s (52% of tiles) | 506 so far | 65.5 / 70.3 / 86.1 | 27 / 34 / 24 | 14.4 / 13.8 / 8.6 | 11.2 / 10.0 / 9.9 | At 128 chunks the HD 620 finishes generating in under 14 minutes and holds about 80 FPS. At 256 it hadn't sampled half the tiles after 15 minutes, and was already below 70 FPS with roughly 40% of its vertex memory still to come (#993 at LOD 256 reaches 753–840 MB on the Mac). The cap applies only to a setting above 128: 64 and 128 behave as before. ## Pacing: ThinkPad HD 620, 4 threads, RD 12 Launch to near terrain settled (streaming idle, mesh count steady 3 s), then an 8 s bench at the meadow while far tiles keep generating. Two rounds, builds in turn: | build | LOD | near terrain in | FPS | 1% low | CPU ms | | --- | --- | --- | --- | --- | --- | | main | off | 21.3, 22.1 s | 280.8, 282.0 | 125.6, 115.6 | 1.69, 1.64 | | this stack | off | 21.3, 20.8 s | 283.8, 277.8 | 132.4, 118.6 | 1.64, 1.77 | | #993 | 64 | 23.7, 25.4 s | 229.8, 257.6 | 63.9, 135.0 | 3.03, 1.77 | | this stack | 64 | **21.3, 17.4 s** | **244.2, 267.6** | **80.3, 167.6** | **2.14, 1.26** | With LOD 64 the near terrain now loads as fast as with LODs off. Full far coverage at LOD 64 takes 702 s against 711 s on #993: the hold only lasts while the near terrain loads. ## LODs off is identical to main - **Screenshots** (Mac, `trio.sh`: main / stack / main, animation off, six views plus HUD and inventory, in `~/code/horizon-parity/shots/perf-frame-9/trio-d1*`): meadow, forest, slope, overview, HUD and inventory differ by 0 px outside animated areas. Mountain and peak differ by 49 and 32 px. That is one tree at the fog edge (`crop-off-mountain.png`), from streaming order: the terrain vertex total varies more between two main runs (43 KB) than between main and the stack (288 B). - **FPS on the HD 620:** the table above, LOD off rows (281/282 against 284/278). - **FPS on the Mac** (RD 12, LOD off, overview / meadow / peak, two rounds): main 1094/1324/1033 and 775/1370/1182, stack 756/978/1012 and 1000/1492/1226. Within the noise of a shared machine at 1000 FPS; the CPU ms ranges overlap (main 0.56–0.96, stack 0.47–0.95). ## Self-check ``` cargo fmt --all --check ok cargo clippy --workspace --all-targets -- -D warnings ok cargo test -p horizon-client --lib 924 passed, 13 ignored tools/parity.py --changed origin/main 98 passed, 0 failed (run on the whole stack) ``` New test: `integrated_gpus_other_than_apple_cap_the_lod_distance` (also checks that the description names the cap). Kira: card#23. 🤖 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 16:00:31 +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#2971
No description provided.