[PR #1668] [MERGED] Shader packs, clean room: fewer passes and loads in post-processing #3674

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

📋 Pull Request Information

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

Base: main ← Head: feat/shader-packs-post-perf


📝 Commits (1)

  • 466b1de Shader packs: fewer passes and no needless loads in post-processing

📊 Changes

2 files changed (+125 additions, -55 deletions)

View changed files

📝 crates/horizon-client/src/gfx/pack_post.rs (+118 -55)
📝 crates/horizon-client/src/gfx/pack_post.wgsl (+7 -0)

📄 Description

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

Shader packs, clean room: post-processing performance. Stacked on #1656.

What

Fewer passes and less memory traffic in the post-processing runtime of #1656 (performance is the first priority; target ≥95% of the no-pack FPS):

  • A buffer is cleared only when a program reads it before one writes all of it; the remaining clears ride in the blit pass as attachments the blit shader leaves alone, instead of passes of their own.
  • The blit writes depthtex0 only when some program reads it.
  • Attachments a pass overwrites whole (the blit's colortex0 and depth, every composite output, final's window) start with a clear instead of a load, which spares a tiled GPU (Apple, mobile) reading them back first.
  • The blit's bind group is kept until the world target changes size.

About 180 lines, in gfx/pack_post.rs and pack_post.wgsl only.

Clean room

Clean-room: implemented from cleanroom/shader-packs-spec.md revision 1, §2.1, §6.1, §6.2; no other loader's code read.

How tested

  • Screenshots with Horizon's post-test pack unchanged from #1656 (tint, depth bands, vignette; same orientation).
  • Benchmark (--benchmark forest, offscreen, fast profile, fresh mktemp -d homes, 3 runs each, interleaved). The Mac mini was still busy (load average ~68 from other sessions), so the spread is wide:
no pack (median avg FPS / 1% low) post-test pack / no pack added frame time
1280×720, RD 8 1871 / 553 1714 / 323 91.6% +0.049 ms (was +0.071 ms in #1656)
1920×1080, RD 12 1290 / 379 1588 / 298 inconclusive (runs 1257–1869 on both sides) —

The fixed cost dropped by about a third at 720p. At ~1800 FPS a 0.05 ms pass is 8% of the frame; at 120–300 FPS it is under 1.5%. A rerun on a quiet machine comes with the gbuffers slice, where the pack replaces Horizon's terrain draw instead of adding to it.

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

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 16d49fe66, 11 min 9 s)

Check Result
Scope ⚠️ 37 files, +5804 −13; 5544 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 ✅ (4 s)
clippy ✅ (22 s)
tests: workspace ✅ 1967 passed (10 min 9 s)
doc tests ✅ 1 passed (34 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 (the root Cargo.toml and gfx.rs earlier in the stack); CI runs them. Nothing here acts without HORIZON_SHADER_PACK. The Label row is the tool's generic hint: these PRs are skip-release. After this run, the slice 11 commit was amended to drop an unused Target variant (cargo test/clippy -D warnings of horizon-shaders rerun: pass).

Needs Ludovic

Nothing. Label skip-release: it runs only behind HORIZON_SHADER_PACK.

🤖 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/1668 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/24/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/shader-packs-post-perf` --- ### 📝 Commits (1) - [`466b1de`](https://github.com/horizon-rust/horizon/commit/466b1de4c4d19f6632c79ecca13a09645be34f25) Shader packs: fewer passes and no needless loads in post-processing ### 📊 Changes **2 files changed** (+125 additions, -55 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/gfx/pack_post.rs` (+118 -55) 📝 `crates/horizon-client/src/gfx/pack_post.wgsl` (+7 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Shader packs, clean room: post-processing performance.** Stacked on #1656. ## What Fewer passes and less memory traffic in the post-processing runtime of #1656 (performance is the first priority; target ≥95% of the no-pack FPS): - A buffer is cleared only when a program reads it before one writes all of it; the remaining clears ride in the blit pass as attachments the blit shader leaves alone, instead of passes of their own. - The blit writes `depthtex0` only when some program reads it. - Attachments a pass overwrites whole (the blit's colortex0 and depth, every composite output, `final`'s window) start with a clear instead of a load, which spares a tiled GPU (Apple, mobile) reading them back first. - The blit's bind group is kept until the world target changes size. About 180 lines, in `gfx/pack_post.rs` and `pack_post.wgsl` only. ## Clean room Clean-room: implemented from `cleanroom/shader-packs-spec.md` revision 1, §2.1, §6.1, §6.2; no other loader's code read. ## How tested - Screenshots with Horizon's `post-test` pack unchanged from #1656 (tint, depth bands, vignette; same orientation). - **Benchmark** (`--benchmark forest`, offscreen, `fast` profile, fresh `mktemp -d` homes, 3 runs each, interleaved). The Mac mini was still busy (load average ~68 from other sessions), so the spread is wide: | | no pack (median avg FPS / 1% low) | `post-test` | pack / no pack | added frame time | |---|---|---|---|---| | 1280×720, RD 8 | 1871 / 553 | 1714 / 323 | 91.6% | +0.049 ms (was +0.071 ms in #1656) | | 1920×1080, RD 12 | 1290 / 379 | 1588 / 298 | inconclusive (runs 1257–1869 on both sides) | — | The fixed cost dropped by about a third at 720p. At ~1800 FPS a 0.05 ms pass is 8% of the frame; at 120–300 FPS it is under 1.5%. A rerun on a quiet machine comes with the gbuffers slice, where the pack replaces Horizon's terrain draw instead of adding to it. ## Self-check (whole stack, on its top branch `feat/shader-packs-atlas`) **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 16d49fe66, 11 min 9 s) | Check | Result | | --- | --- | | Scope | ⚠️ 37 files, +5804 −13; 5544 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 | ✅ (4 s) | | clippy | ✅ (22 s) | | tests: workspace | ✅ 1967 passed (10 min 9 s) | | doc tests | ✅ 1 passed (34 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 (the root `Cargo.toml` and `gfx.rs` earlier in the stack); CI runs them. Nothing here acts without `HORIZON_SHADER_PACK`. The Label row is the tool's generic hint: these PRs are `skip-release`. After this run, the slice 11 commit was amended to drop an unused `Target` variant (`cargo test`/`clippy -D warnings` of `horizon-shaders` rerun: pass). ## Needs Ludovic Nothing. Label `skip-release`: it runs only behind `HORIZON_SHADER_PACK`. 🤖 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:11:19 +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#3674
No description provided.