[PR #1771] [MERGED] Shader packs, clean room 31: entities and block entities #3752

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

📋 Pull Request Information

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

Base: main ← Head: feat/shader-packs-entities


📝 Commits (6)

  • b5a7911 Shader packs, clean room 30: the loader's alpha test
  • ab289a2 Shader packs, clean room 31: entities and block entities
  • 90fe138 Merge branch 'feat/shader-packs-entity-spans' into feat/shader-packs-alpha-test
  • c4856e6 Merge branch 'feat/shader-packs-alpha-test' into feat/shader-packs-entities
  • b0fd6e6 Merge feat/shader-packs-entity-spans into feat/shader-packs-alpha-test
  • 02248f4 Merge feat/shader-packs-alpha-test into feat/shader-packs-entities

📊 Changes

11 files changed (+728 additions, -20 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+5 -3)
📝 crates/horizon-client/src/gfx.rs (+24 -6)
📝 crates/horizon-client/src/gfx/pack_atlas.rs (+1 -0)
➕ crates/horizon-client/src/gfx/pack_entities.rs (+400 -0)
📝 crates/horizon-client/src/gfx/pack_post.rs (+127 -2)
📝 crates/horizon-client/src/gfx/pack_sky.rs (+2 -0)
📝 crates/horizon-client/src/gfx/pack_timing.rs (+2 -1)
📝 crates/horizon-shaders/src/lib.rs (+1 -1)
📝 crates/horizon-shaders/src/post.rs (+65 -4)
📝 crates/horizon-shaders/src/translate/mod.rs (+96 -1)
📝 crates/horizon-shaders/tests/real_packs.rs (+5 -2)

📄 Description

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

Shader packs, clean room 31: a pack draws entities and block entities. Stacked on #1770.

What

  • Which programs: gbuffers_entities draws entities and gbuffers_block draws block entities, with their fallbacks (spec 2.3: textured_lit → textured → basic, and terrain first for blocks). They draw after terrain, testing against its depth.

  • One draw per run: each run of #1769's spans is its own draw. It gets its own entityId or blockEntityId, and its entityColor (the hurt red, the white flashes), in a per-draw slot of HzDraw, picked with a dynamic offset.

  • Horizon keeps the rest: particles, cracks, beacon beams, name tags, entity shadows, End portals and clouds stay in Horizon's own entity draw. A run whose quads carry one of those overlay codes stays Horizon's too. The runs the pack drew are left out of Horizon's draw, which is still one call.

  • Vertices: Horizon's own entity vertex. The vertices are also read at set 1, so the pack gets:

    • the face normal where a vertex has none (block entities);
    • at_tangent along the texture's u;
    • mc_midTexCoord.

    This is the same convention as terrain (#1744).

  • Blending and alpha test: no blending, and the alpha test GREATER 0.1 (vanilla's cutout entity types, OQ-23). blend.* and alphaTest.* override.

    • Name tags and shadows, which blend, stay Horizon's until translucent entity draws exist (gbuffers_entities_translucent).
  • Without a shader pack nothing changes: the split runs only while a pack draws entities.

About 620 lines, over the size guide: the new gfx/pack_entities.rs is most of it (about 370 lines with its test), and its parts do not draw anything apart. The alpha test was split out into #1770.

Clean room

Clean-room: implemented from cleanroom/shader-packs-spec.md revision 1, §2.3, §4.2, §5.1, §5.3, §5.4, OQ-23; no other loader's code read.

How tested

  • Unit tests:
    • runs_split_the_list_between_pack_and_horizon: span ranges, which program draws which stage, beam quads stay Horizon's, entityColor;
    • the fallback chains in water_falls_back_to_terrain_and_blends.
  • Our own test packs (local, never committed):
    • entityId/blockEntityId colours: pig and cow (id 1) red, villager (2) green, a sheep the file lacks magenta (65535), the chest (block 1) red, the bell (2) green.
    • Normal visualiser: entity normals from the vertices; the chest's front from the face, (0, 0, −1).
  • All four test packs translate their entity and block programs (real_packs, Sildurs falls back to gbuffers_textured).
  • BSL and Complementary in game (screenshots local; their licences forbid uploading them):
    • Complementary: mobs, chest, bell and a dropped item look right.
    • BSL: albedo is right. Side faces of entities and block entities are darker than Horizon's own at noon; the same scene's planks side faces are dark too. To recheck once the shadow map exists (slice 8).
  • Parity: the 30 harnesses game.rs selects pass. gfx.rs selects 108; CI runs them.
  • lan_e2e (host in-frame, and on its server thread): self, nametags, chest, hurt, objects, cracks and looks pass.

Overhead (village scene, RD 16, 720p, Mac mini, HORIZON_SHADER_PACK_TIMING):

  • GPU: Horizon's own world copy is unchanged: 0.058–0.069 ms with BSL, 0.115–0.123 ms with Complementary (still over the 0.1 ms target, pending the copy pass removal). The pack's own entity and block programs cost 0.021–0.024 ms and 0.008–0.014 ms in BSL.
  • CPU: splitting the entity list and the per-run draws add about 0.05 ms to the CPU frame p50. That is the median of 5 alternating paired runs with BSL against #1769's binary (+0.027 to +0.218 ms, on a busy machine).
  • GPU p50: within noise, except one outlier round.

Self-check (whole stack, on its top branch feat/shader-packs-entities)

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 4a675206b, 7 min 24 s)

Check Result
Scope ⚠️ 54 files, +9933 −48; 9578 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (10 s)
clippy ✅ (34 s)
tests: workspace ✅ 2020 passed (6 min 8 s)
doc tests ✅ 1 passed (31 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Parity: 326 harnesses selected, because the root Cargo.toml and gfx.rs change earlier in the stack; CI runs them. Locally, the 30 harnesses game.rs selects pass on #1769 and on this stack's top. These PRs act only with HORIZON_SHADER_PACK. The Label row is the tool's generic hint: these PRs are skip-release. After this run, a 3-line fix to HORIZON_SHADER_PACK_TIMING's report went into #1771; rustfmt and clippy pass again on the top.

Needs Ludovic

Nothing. Label skip-release: players see no change.

🤖 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/1771 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/shader-packs-entities` --- ### 📝 Commits (6) - [`b5a7911`](https://github.com/horizon-rust/horizon/commit/b5a791170d1e1bec47f2508419d2918c72f891f1) Shader packs, clean room 30: the loader's alpha test - [`ab289a2`](https://github.com/horizon-rust/horizon/commit/ab289a2cf3f84fac470eb146e140c2fa7dc55f67) Shader packs, clean room 31: entities and block entities - [`90fe138`](https://github.com/horizon-rust/horizon/commit/90fe138e836881088c771c8d8106e090b836c1ba) Merge branch 'feat/shader-packs-entity-spans' into feat/shader-packs-alpha-test - [`c4856e6`](https://github.com/horizon-rust/horizon/commit/c4856e6febb28aeb6faa06c4c2ea6e5cf8c73c8a) Merge branch 'feat/shader-packs-alpha-test' into feat/shader-packs-entities - [`b0fd6e6`](https://github.com/horizon-rust/horizon/commit/b0fd6e660e4017e8f936b31ac3432eb760886de4) Merge feat/shader-packs-entity-spans into feat/shader-packs-alpha-test - [`02248f4`](https://github.com/horizon-rust/horizon/commit/02248f431479686b820ca2250010a658b8b4a71d) Merge feat/shader-packs-alpha-test into feat/shader-packs-entities ### 📊 Changes **11 files changed** (+728 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+5 -3) 📝 `crates/horizon-client/src/gfx.rs` (+24 -6) 📝 `crates/horizon-client/src/gfx/pack_atlas.rs` (+1 -0) ➕ `crates/horizon-client/src/gfx/pack_entities.rs` (+400 -0) 📝 `crates/horizon-client/src/gfx/pack_post.rs` (+127 -2) 📝 `crates/horizon-client/src/gfx/pack_sky.rs` (+2 -0) 📝 `crates/horizon-client/src/gfx/pack_timing.rs` (+2 -1) 📝 `crates/horizon-shaders/src/lib.rs` (+1 -1) 📝 `crates/horizon-shaders/src/post.rs` (+65 -4) 📝 `crates/horizon-shaders/src/translate/mod.rs` (+96 -1) 📝 `crates/horizon-shaders/tests/real_packs.rs` (+5 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Shader packs, clean room 31:** a pack draws entities and block entities. Stacked on #1770. ## What - **Which programs:** `gbuffers_entities` draws entities and `gbuffers_block` draws block entities, with their fallbacks (spec 2.3: `textured_lit` → `textured` → `basic`, and `terrain` first for blocks). They draw after terrain, testing against its depth. - **One draw per run:** each run of #1769's spans is its own draw. It gets its own `entityId` or `blockEntityId`, and its `entityColor` (the hurt red, the white flashes), in a per-draw slot of `HzDraw`, picked with a dynamic offset. - **Horizon keeps the rest:** particles, cracks, beacon beams, name tags, entity shadows, End portals and clouds stay in Horizon's own entity draw. A run whose quads carry one of those overlay codes stays Horizon's too. The runs the pack drew are left out of Horizon's draw, which is still one call. - **Vertices:** Horizon's own entity vertex. The vertices are also read at set 1, so the pack gets: - the face normal where a vertex has none (block entities); - `at_tangent` along the texture's u; - `mc_midTexCoord`. This is the same convention as terrain (#1744). - **Blending and alpha test:** no blending, and the alpha test GREATER 0.1 (vanilla's cutout entity types, OQ-23). `blend.*` and `alphaTest.*` override. - Name tags and shadows, which blend, stay Horizon's until translucent entity draws exist (`gbuffers_entities_translucent`). - **Without a shader pack** nothing changes: the split runs only while a pack draws entities. About 620 lines, over the size guide: the new `gfx/pack_entities.rs` is most of it (about 370 lines with its test), and its parts do not draw anything apart. The alpha test was split out into #1770. ## Clean room Clean-room: implemented from `cleanroom/shader-packs-spec.md` revision 1, §2.3, §4.2, §5.1, §5.3, §5.4, OQ-23; no other loader's code read. ## How tested - **Unit tests:** - `runs_split_the_list_between_pack_and_horizon`: span ranges, which program draws which stage, beam quads stay Horizon's, `entityColor`; - the fallback chains in `water_falls_back_to_terrain_and_blends`. - **Our own test packs** (local, never committed): - **`entityId`/`blockEntityId` colours:** pig and cow (id 1) red, villager (2) green, a sheep the file lacks magenta (65535), the chest (block 1) red, the bell (2) green. - **Normal visualiser:** entity normals from the vertices; the chest's front from the face, (0, 0, −1). - **All four test packs** translate their entity and block programs (`real_packs`, Sildurs falls back to `gbuffers_textured`). - **BSL and Complementary in game** (screenshots local; their licences forbid uploading them): - **Complementary:** mobs, chest, bell and a dropped item look right. - **BSL:** albedo is right. Side faces of entities and block entities are darker than Horizon's own at noon; the same scene's planks side faces are dark too. To recheck once the shadow map exists (slice 8). - **Parity:** the 30 harnesses `game.rs` selects pass. `gfx.rs` selects 108; CI runs them. - **lan_e2e** (host in-frame, and on its server thread): `self`, `nametags`, `chest`, `hurt`, `objects`, `cracks` and `looks` pass. **Overhead** (village scene, RD 16, 720p, Mac mini, `HORIZON_SHADER_PACK_TIMING`): - **GPU:** Horizon's own world copy is unchanged: 0.058–0.069 ms with BSL, 0.115–0.123 ms with Complementary (still over the 0.1 ms target, pending the copy pass removal). The pack's own entity and block programs cost 0.021–0.024 ms and 0.008–0.014 ms in BSL. - **CPU:** splitting the entity list and the per-run draws add about 0.05 ms to the CPU frame p50. That is the median of 5 alternating paired runs with BSL against #1769's binary (+0.027 to +0.218 ms, on a busy machine). - **GPU p50:** within noise, except one outlier round. ## Self-check (whole stack, on its top branch `feat/shader-packs-entities`) **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 4a675206b, 7 min 24 s) | Check | Result | | --- | --- | | Scope | ⚠️ 54 files, +9933 −48; 9578 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (10 s) | | clippy | ✅ (34 s) | | tests: workspace | ✅ 2020 passed (6 min 8 s) | | doc tests | ✅ 1 passed (31 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 326 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 314 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Parity: 326 harnesses selected, because the root `Cargo.toml` and `gfx.rs` change earlier in the stack; CI runs them. Locally, the 30 harnesses `game.rs` selects pass on #1769 and on this stack's top. These PRs act only with `HORIZON_SHADER_PACK`. The Label row is the tool's generic hint: these PRs are `skip-release`. After this run, a 3-line fix to `HORIZON_SHADER_PACK_TIMING`'s report went into #1771; rustfmt and clippy pass again on the top. ## Needs Ludovic Nothing. Label `skip-release`: players see no change. 🤖 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 04:12:03 +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#3752
No description provided.