[PR #5184] [MERGED] Shader packs: face normals and mc_Entity for terrain on every GPU #6129

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

📋 Pull Request Information

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

Base: main ← Head: shaderpacks/terrain-normals-everywhere


📝 Commits (1)

  • 6d7323a Shader packs: face normals and mc_Entity for terrain on every GPU

📊 Changes

2 files changed (+18 additions, -11 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+4 -1)
📝 crates/horizon-client-render/src/gfx/flat.rs (+14 -10)

📄 Description

🤖 Opened by TobiasLogic's AI agent (Claude Code, Claude Opus 5.5), not by TobiasLogic personally.

What and why

Fixes #5183.

A shaders/ pack's terrain program gets each quad's face normal and its block's mc_Entity only in flat draws (PackAtlas::terrain_inputs(flat) reads them from the arena page and the block id table). The per-section path gives (0, 1, 0) and -1. Flat draws were created only where flat::wanted allowed: Metal and Intel Gen11's Vulkan driver. So on NVIDIA and AMD every pack lit all terrain as if it faced up, and block.properties did nothing for terrain.

  • flat::wanted: flat draws exist wherever the device supports them (supported), unless HORIZON_FLAT_DRAWS=0.
  • flat::for_vanilla: where frames without a pack still draw flat (Metal past MIN_SECTIONS, Intel Gen11, HORIZON_FLAT_DRAWS=1), as before. Elsewhere min_sections is usize::MAX, so the existing condition (pack_terrain || shadow_view.is_some()) is the only way into a flat frame: a pack's terrain and shadow pass draw flat, everything else keeps per-section draws. Flat's index list and call buffers start small and grow only when a frame draws flat. Each section upload also writes its ids into its page's Section ids by block table (Flat::add): one u32 per 256 vertices, about 175 KB per 256 MB arena page (0.07% of the terrain's memory), also without a pack.

Related: #4451 draws geometry stages only for flat draws (pack_terrain_flat); with this they run on these GPUs too.

Measured on an NVIDIA GPU (Vulkan) with a probe pack whose gbuffers_terrain writes gl_Normal and mc_Entity into the frame, and a block.properties mapping stone, grass and oak leaves to 10, 11 and 12; compared with Minecraft 26.3 + Iris 1.11.7 on the same world and camera, at the 272 terrain samples where both view positions agree:

normal as Iris mc_Entity as Iris
Horizon main 99 of 272 (the top faces) 29 of 272 (all -1)
This PR 272 of 272 272 of 272

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Not vanilla: the shaders/ pack format (gl_Normal, mc_Entity from block.properties). The reference is Iris 1.11.7 on Minecraft 26.3, run and observed with a probe pack (no source read). Without a pack, draws are as before on every device.

Self-check

pr_ready (tools/pr_ready.py --quick on 6cd182588f2d, against origin/main at 27cb8f96b, 6 min 32 s)

Check Result
Scope ✅ 2 files, +18 −11
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 495 run, FAILED (errors=4) (2 min 21 s)
rustfmt ✅ (24 s)
clippy ✅ (2 min 22 s)
tests: horizon-client-render ✅ 707 passed (1 min 22 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 ➖ 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)

Run on a rented Linux box with GPU tests on lavapipe. The 4 Python errors are that box's git 2.34 (git merge-tree --write-tree, in test_nightly_set and test_supervise); they pass with git 2.55.

Screenshots

BSL v10.1.8 on the same NVIDIA GPU: with mc_Entity BSL knows the pool is water and draws its own water, as in Iris; on main it falls back to the plain texture. (The leaves and grass still differ for other reasons.)

BSL: Iris, Horizon main, Horizon main with this PR

🤖 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/5184 **Author:** [@TobiasLogic](https://github.com/TobiasLogic) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shaderpacks/terrain-normals-everywhere` --- ### 📝 Commits (1) - [`6d7323a`](https://github.com/horizon-rust/horizon/commit/6d7323af8c53e4192800b58141af8f2128843c6b) Shader packs: face normals and mc_Entity for terrain on every GPU ### 📊 Changes **2 files changed** (+18 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+4 -1) 📝 `crates/horizon-client-render/src/gfx/flat.rs` (+14 -10) </details> ### 📄 Description > 🤖 Opened by TobiasLogic's AI agent (Claude Code, Claude Opus 5.5), not by TobiasLogic personally. ## What and why Fixes #5183. A `shaders/` pack's terrain program gets each quad's face normal and its block's `mc_Entity` only in flat draws (`PackAtlas::terrain_inputs(flat)` reads them from the arena page and the block id table). The per-section path gives `(0, 1, 0)` and -1. Flat draws were created only where `flat::wanted` allowed: Metal and Intel Gen11's Vulkan driver. So on NVIDIA and AMD every pack lit all terrain as if it faced up, and `block.properties` did nothing for terrain. - `flat::wanted`: flat draws exist wherever the device supports them (`supported`), unless `HORIZON_FLAT_DRAWS=0`. - `flat::for_vanilla`: where frames without a pack still draw flat (Metal past `MIN_SECTIONS`, Intel Gen11, `HORIZON_FLAT_DRAWS=1`), as before. Elsewhere `min_sections` is `usize::MAX`, so the existing condition (`pack_terrain || shadow_view.is_some()`) is the only way into a flat frame: a pack's terrain and shadow pass draw flat, everything else keeps per-section draws. `Flat`'s index list and call buffers start small and grow only when a frame draws flat. Each section upload also writes its ids into its page's `Section ids by block` table (`Flat::add`): one `u32` per 256 vertices, about 175 KB per 256 MB arena page (0.07% of the terrain's memory), also without a pack. Related: #4451 draws geometry stages only for flat draws (`pack_terrain_flat`); with this they run on these GPUs too. Measured on an NVIDIA GPU (Vulkan) with a probe pack whose `gbuffers_terrain` writes `gl_Normal` and `mc_Entity` into the frame, and a `block.properties` mapping stone, grass and oak leaves to 10, 11 and 12; compared with Minecraft 26.3 + Iris 1.11.7 on the same world and camera, at the 272 terrain samples where both view positions agree: | | normal as Iris | `mc_Entity` as Iris | | --- | --- | --- | | Horizon main | 99 of 272 (the top faces) | 29 of 272 (all -1) | | This PR | 272 of 272 | 272 of 272 | ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [x] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Not vanilla: the `shaders/` pack format (`gl_Normal`, `mc_Entity` from `block.properties`). The reference is Iris 1.11.7 on Minecraft 26.3, run and observed with a probe pack (no source read). Without a pack, draws are as before on every device. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on 6cd182588f2d, against origin/main at 27cb8f96b, 6 min 32 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +18 −11 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 495 run, FAILED (errors=4) (2 min 21 s) | | rustfmt | ✅ (24 s) | | clippy | ✅ (2 min 22 s) | | tests: horizon-client-render | ✅ 707 passed (1 min 22 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 | ➖ 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) | Run on a rented Linux box with GPU tests on lavapipe. The 4 Python errors are that box's git 2.34 (`git merge-tree --write-tree`, in `test_nightly_set` and `test_supervise`); they pass with git 2.55. ## Screenshots BSL v10.1.8 on the same NVIDIA GPU: with `mc_Entity` BSL knows the pool is water and draws its own water, as in Iris; on main it falls back to the plain texture. (The leaves and grass still differ for other reasons.) ![BSL: Iris, Horizon main, Horizon main with this PR](https://raw.githubusercontent.com/TobiasLogic/horizon/pr-assets/pr5.png) 🤖 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:12:40 +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#6129
No description provided.