[PR #4255] [CLOSED] Far terrain: cheaper dirty-tile scan and tile meshing #5522

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/4255
Author: @levzzz5154
Created: 10/30/2026
Status: ❌ Closed

Base: main ← Head: perf/lod-cpu


📝 Commits (1)

  • 4f433ec Far terrain: cheaper dirty-tile scan and tile meshing

📊 Changes

2 files changed (+70 additions, -17 deletions)

View changed files

📝 crates/horizon-client-render/src/lod.rs (+36 -7)
📝 crates/horizon-client-render/src/lod/mesh.rs (+34 -10)

📄 Description

🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 themselves. The code is googte344's, from googte344/enhanced-rendering, and the commit credits them as author.

What and why

Two CPU-side savings in far terrain (LOD), with no change to what is drawn:

  • Dirty-tile scan (lod.rs). A replan marks every selected tile that overlaps or touches a changed tile. The old scan compared each selected tile with every changed tile, which is quadratic in a big replan (after a teleport or a large LOD distance change). The changed rectangles are now sorted by their left edge, with a running maximum of right edges, so each tile only tests rectangles that can reach it. The exact overlap and edge-adjacency test is unchanged, so the same tiles are marked.
  • Tile meshing (lod/mesh.rs). Faces gather in an FxHashMap instead of a BTreeMap, then sort by FaceKey before emission, so the mesh and its vertex order are identical. Each cell's step (the scan over finer tiles) is computed once instead of twice.

Review notes

  • The archive was made from main at 791d8b895 (2026-10-28) and never compiled. I rebased it onto the horizon-client-render crate split.
  • I left out the archive's gfx/lod.rs change (powi(2) swapped for a multiply plus a clamp): it saves nothing and changes behaviour for negative distances.
  • Not benchmarked: no existing bench covers LOD replanning or tile meshing.

Testing

  • cargo test -p horizon-client-render --lib lod: 27 passed
  • cargo clippy -p horizon-client-render --all-targets -- -D warnings: clean
  • cargo fmt --all --check: clean

🤖 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/4255 **Author:** [@levzzz5154](https://github.com/levzzz5154) **Created:** 10/30/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `perf/lod-cpu` --- ### 📝 Commits (1) - [`4f433ec`](https://github.com/horizon-rust/horizon/commit/4f433ec0fa3c55fd91bf653aaf49541f547ab5d9) Far terrain: cheaper dirty-tile scan and tile meshing ### 📊 Changes **2 files changed** (+70 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/lod.rs` (+36 -7) 📝 `crates/horizon-client-render/src/lod/mesh.rs` (+34 -10) </details> ### 📄 Description > 🤖 Opened by levzzz5154's AI agent (Claude Code, Claude Opus 5.5), not by levzzz5154 themselves. The code is googte344's, from [googte344/enhanced-rendering](https://github.com/googte344/enhanced-rendering), and the commit credits them as author. ## What and why Two CPU-side savings in far terrain (LOD), with no change to what is drawn: - **Dirty-tile scan (`lod.rs`).** A replan marks every selected tile that overlaps or touches a changed tile. The old scan compared each selected tile with every changed tile, which is quadratic in a big replan (after a teleport or a large LOD distance change). The changed rectangles are now sorted by their left edge, with a running maximum of right edges, so each tile only tests rectangles that can reach it. The exact overlap and edge-adjacency test is unchanged, so the same tiles are marked. - **Tile meshing (`lod/mesh.rs`).** Faces gather in an `FxHashMap` instead of a `BTreeMap`, then sort by `FaceKey` before emission, so the mesh and its vertex order are identical. Each cell's step (the scan over finer tiles) is computed once instead of twice. ## Review notes - The archive was made from main at 791d8b895 (2026-10-28) and never compiled. I rebased it onto the `horizon-client-render` crate split. - I left out the archive's `gfx/lod.rs` change (`powi(2)` swapped for a multiply plus a clamp): it saves nothing and changes behaviour for negative distances. - Not benchmarked: no existing bench covers LOD replanning or tile meshing. ## Testing - `cargo test -p horizon-client-render --lib lod`: 27 passed - `cargo clippy -p horizon-client-render --all-targets -- -D warnings`: clean - `cargo fmt --all --check`: clean 🤖 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 05:13: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#5522
No description provided.