[PR #3489] [MERGED] Uniform sections are shared, and the sky-source scan skips them #5019

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3489
Author: @ThatCakeIsAPie
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/30/2026
Merged by: @ludovic111

Base: main ← Head: feat/level-shape-10


📝 Commits (10+)

  • 8e445b4 Merge the data pack worldgen series (feat/datapack-worldgen-4) under the level-shape series
  • 72317bb Worldgen: a level's build range from its dimension type, a data pack's over vanilla's
  • 0a72ffb Each level's shape from the world's dimension types, local and remote
  • 148d592 Uniform sections are shared, and the sky-source scan skips them
  • c3daaa8 Worldgen: data packs' block state providers join the state_providers bundle
  • ab82d71 Merge feat/level-shape-9 into feat/level-shape-10: data packs' block state providers
  • 3b58497 Merge main (through the carried #3487) into level-shape-9
  • 04cbf91 Merge branch 'pt1-3488' into pt1-3489
  • cc1e38e Merge branch 'pt1-3487' into pt1-3488
  • 2c74f84 Merge branch 'pt1-3488' into pt1-3489

📊 Changes

24 files changed (+451 additions, -112 deletions)

View changed files

📝 crates/horizon-client-render/src/chunk.rs (+82 -3)
📝 crates/horizon-client-render/src/datapack.rs (+7 -9)
📝 crates/horizon-client-render/src/light.rs (+34 -2)
📝 crates/horizon-client/src/game.rs (+9 -15)
📝 crates/horizon-client/src/game/consume.rs (+3 -3)
📝 crates/horizon-client/src/game/dedicated.rs (+2 -0)
📝 crates/horizon-client/src/game/initial_spawn.rs (+1 -1)
📝 crates/horizon-client/src/game/integrated.rs (+2 -0)
📝 crates/horizon-client/src/game/lan.rs (+2 -0)
📝 crates/horizon-client/src/game/levels.rs (+2 -1)
📝 crates/horizon-client/src/game/minecarts.rs (+1 -1)
📝 crates/horizon-client/src/game/native_world_read.rs (+12 -11)
📝 crates/horizon-client/src/game/remote.rs (+17 -3)
📝 crates/horizon-client/src/game/remote_chunks.rs (+8 -0)
📝 crates/horizon-client/src/game/render_tick.rs (+1 -1)
📝 crates/horizon-client/src/game/world_loading.rs (+52 -5)
📝 crates/horizon-client/src/lan/conn.rs (+1 -1)
📝 crates/horizon-client/src/lan/data.rs (+65 -8)
📝 crates/horizon-client/src/lan/hub.rs (+5 -14)
📝 crates/horizon-client/src/lan/mod.rs (+4 -0)

...and 4 more files

📄 Description

🤖 Opened by ThatCakeIsAPie's AI agent (Claude), not by ThatCakeIsAPie themself.

Builds on #3488 (feat/level-shape-9): until that merges, its commits show here too; this PR's own change is the commit(s) on top.

What and why

Part 10 of the level-shape series: the cost of a tall level. Chunk::empty allocated an Arc<Section> per section, about 180 bytes each with the header and slot. That's 4 KB a chunk at vanilla's 24 sections, and 24 KB at To The Max's 131. At render distance 32 (4,225 chunks), the empty air above the terrain alone would be about 100 MB.

  • chunk::share_uniform: sections of one block, one biome and one light value are one allocation per kind, shared by every column. That covers new chunks, freshly lit chunks (apply_lighting, apply_relighting) and saved light (light_from_layers). Edits copy them, as Arc::make_mut already does for the worker snapshots. The map is reset when the block palette's width changes.
  • The relighter's lowest_sky_source passes over a uniform section that light goes through (the air of a tall column) instead of testing each of its 16 blocks.

Memory only: every value read is the same.

Vanilla reference

None

Self-check

Tests

  • a_tall_column_is_lit_to_its_top also checks that the empty sections above the terrain are one allocation, shared with another chunk lit the same way.
  • empty_chunk_missing_neighbours_and_no_sky now checks that its uniform sections end up as one shared allocation. It used to check that lighting kept each section's own.
  • tests/tall_column.rs, streaming_meshes, generation_saves, lan_bot, and tools/test_light_parity.py (see below).

python3 tools/test_light_parity.py on this branch: vanilla 26.3 lights its scene, and Horizon relights every saved chunk with shared sections and the sky-scan shortcut.

1179648 values compared: 0 sky and 0 block light values differ
100 edits: 0 light values differ from a full relight
light parity ok

(As in part 3, the Windows-only Perflib lines of the vanilla server's log were added to vanilla_world_check.py's benign list locally for the run.)

Run before this branch was rebased from upstream/main 56f968e11 onto fe3333f3f. After the rebase, CI's two clippy commands pass on it again, and pr_ready was re-run at the top of its series (#3490).

pr_ready (tools/pr_ready.py --quick --base upstream/main on DESKTOP-LT6RAH8, against upstream/main at 56f968e11, 12 min 8 s)

Check Result
Scope ⚠️ 102 files, +2855 −677; 3254 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 398 run, FAILED (failures=2, errors=8, skipped=1) (1 min 22 s)
rustfmt ✅ (12 s)
clippy ✅ (1 min 15 s)
tests: horizon-client, horizon-protocol, horizon-world ❌ 1105 passed, 2 failed (7 min 0 s)
doc tests ✅ 0 passed (2 min 13 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)

The Scope row counts the whole stack against upstream main; this PR's own part (over feat/level-shape-9) is 2 files, +79 −5, 84 lines of code.

The Python tests fail on upstream main on this Windows machine too, more often there (main 56f968e11: failures=3, errors=13; path separators, symlink privilege). CI runs them on Linux.

crash::tests::stacks_start_at_the_panicking_frame and save::tests::session_lock_is_exclusive fail on upstream main here too (Windows only).

Suggested label: skip-release.

🤖 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/3489 **Author:** [@ThatCakeIsAPie](https://github.com/ThatCakeIsAPie) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/30/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/level-shape-10` --- ### 📝 Commits (10+) - [`8e445b4`](https://github.com/horizon-rust/horizon/commit/8e445b4c3d7cb3f01678294d54f47408b8748186) Merge the data pack worldgen series (feat/datapack-worldgen-4) under the level-shape series - [`72317bb`](https://github.com/horizon-rust/horizon/commit/72317bb0c65d0e8486fc539af1a5d8d629ecb84b) Worldgen: a level's build range from its dimension type, a data pack's over vanilla's - [`0a72ffb`](https://github.com/horizon-rust/horizon/commit/0a72ffbf5c4dbf61aa32ca6f0db1ee329bab77b4) Each level's shape from the world's dimension types, local and remote - [`148d592`](https://github.com/horizon-rust/horizon/commit/148d59256761c04a7ed86a9c450b11f002710b92) Uniform sections are shared, and the sky-source scan skips them - [`c3daaa8`](https://github.com/horizon-rust/horizon/commit/c3daaa876206b9dfbec7666b1c80f5a5679c31bf) Worldgen: data packs' block state providers join the state_providers bundle - [`ab82d71`](https://github.com/horizon-rust/horizon/commit/ab82d71a960b6a11637f0971968d283dc5e2f2ef) Merge feat/level-shape-9 into feat/level-shape-10: data packs' block state providers - [`3b58497`](https://github.com/horizon-rust/horizon/commit/3b584979a895efd0312323a57402c99f41c7982a) Merge main (through the carried #3487) into level-shape-9 - [`04cbf91`](https://github.com/horizon-rust/horizon/commit/04cbf91533be6430823412eeacaee495ff3f8ecb) Merge branch 'pt1-3488' into pt1-3489 - [`cc1e38e`](https://github.com/horizon-rust/horizon/commit/cc1e38ef22f6b41660bf824723c17df1d2b3cb4d) Merge branch 'pt1-3487' into pt1-3488 - [`2c74f84`](https://github.com/horizon-rust/horizon/commit/2c74f84b979675490f945f085d2f4ac7b6997632) Merge branch 'pt1-3488' into pt1-3489 ### 📊 Changes **24 files changed** (+451 additions, -112 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/chunk.rs` (+82 -3) 📝 `crates/horizon-client-render/src/datapack.rs` (+7 -9) 📝 `crates/horizon-client-render/src/light.rs` (+34 -2) 📝 `crates/horizon-client/src/game.rs` (+9 -15) 📝 `crates/horizon-client/src/game/consume.rs` (+3 -3) 📝 `crates/horizon-client/src/game/dedicated.rs` (+2 -0) 📝 `crates/horizon-client/src/game/initial_spawn.rs` (+1 -1) 📝 `crates/horizon-client/src/game/integrated.rs` (+2 -0) 📝 `crates/horizon-client/src/game/lan.rs` (+2 -0) 📝 `crates/horizon-client/src/game/levels.rs` (+2 -1) 📝 `crates/horizon-client/src/game/minecarts.rs` (+1 -1) 📝 `crates/horizon-client/src/game/native_world_read.rs` (+12 -11) 📝 `crates/horizon-client/src/game/remote.rs` (+17 -3) 📝 `crates/horizon-client/src/game/remote_chunks.rs` (+8 -0) 📝 `crates/horizon-client/src/game/render_tick.rs` (+1 -1) 📝 `crates/horizon-client/src/game/world_loading.rs` (+52 -5) 📝 `crates/horizon-client/src/lan/conn.rs` (+1 -1) 📝 `crates/horizon-client/src/lan/data.rs` (+65 -8) 📝 `crates/horizon-client/src/lan/hub.rs` (+5 -14) 📝 `crates/horizon-client/src/lan/mod.rs` (+4 -0) _...and 4 more files_ </details> ### 📄 Description > 🤖 Opened by ThatCakeIsAPie's AI agent (Claude), not by ThatCakeIsAPie themself. **Builds on #3488 (`feat/level-shape-9`)**: until that merges, its commits show here too; this PR's own change is the commit(s) on top. ## What and why Part 10 of the level-shape series: the cost of a tall level. `Chunk::empty` allocated an `Arc<Section>` per section, about 180 bytes each with the header and slot. That's 4 KB a chunk at vanilla's 24 sections, and 24 KB at To The Max's 131. At render distance 32 (4,225 chunks), the empty air above the terrain alone would be about 100 MB. - `chunk::share_uniform`: sections of one block, one biome and one light value are one allocation per kind, shared by every column. That covers new chunks, freshly lit chunks (`apply_lighting`, `apply_relighting`) and saved light (`light_from_layers`). Edits copy them, as `Arc::make_mut` already does for the worker snapshots. The map is reset when the block palette's width changes. - The relighter's `lowest_sky_source` passes over a uniform section that light goes through (the air of a tall column) instead of testing each of its 16 blocks. Memory only: every value read is the same. ## Vanilla reference None ## Self-check **Tests** - `a_tall_column_is_lit_to_its_top` also checks that the empty sections above the terrain are one allocation, shared with another chunk lit the same way. - `empty_chunk_missing_neighbours_and_no_sky` now checks that its uniform sections end up as one shared allocation. It used to check that lighting kept each section's own. - `tests/tall_column.rs`, `streaming_meshes`, `generation_saves`, `lan_bot`, and `tools/test_light_parity.py` (see below). `python3 tools/test_light_parity.py` on this branch: vanilla 26.3 lights its scene, and Horizon relights every saved chunk with shared sections and the sky-scan shortcut. ``` 1179648 values compared: 0 sky and 0 block light values differ 100 edits: 0 light values differ from a full relight light parity ok ``` (As in part 3, the Windows-only `Perflib` lines of the vanilla server's log were added to `vanilla_world_check.py`'s benign list locally for the run.) Run before this branch was rebased from upstream/main 56f968e11 onto fe3333f3f. After the rebase, CI's two clippy commands pass on it again, and pr_ready was re-run at the top of its series (#3490). **pr_ready** (`tools/pr_ready.py --quick --base upstream/main` on DESKTOP-LT6RAH8, against upstream/main at 56f968e11, 12 min 8 s) | Check | Result | | --- | --- | | Scope | ⚠️ 102 files, +2855 −677; 3254 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 398 run, FAILED (failures=2, errors=8, skipped=1) (1 min 22 s) | | rustfmt | ✅ (12 s) | | clippy | ✅ (1 min 15 s) | | tests: horizon-client, horizon-protocol, horizon-world | ❌ 1105 passed, 2 failed (7 min 0 s) | | doc tests | ✅ 0 passed (2 min 13 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) | The Scope row counts the whole stack against upstream main; this PR's own part (over `feat/level-shape-9`) is 2 files, +79 −5, 84 lines of code. The Python tests fail on upstream main on this Windows machine too, more often there (main 56f968e11: failures=3, errors=13; path separators, symlink privilege). CI runs them on Linux. `crash::tests::stacks_start_at_the_panicking_frame` and `save::tests::session_lock_is_exclusive` fail on upstream main here too (Windows only). Suggested label: `skip-release`. 🤖 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:09:38 +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#5019
No description provided.