[PR #2051] [MERGED] Horizon shader packs: one frame uniform per pack, apart from its post passes #3965

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

📋 Pull Request Information

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

Base: main ← Head: feat/native-shader-frame


📝 Commits (1)

  • a68c2f5 Horizon shader packs: one frame uniform per pack, apart from its post passes

📊 Changes

3 files changed (+180 additions, -102 deletions)

View changed files

📝 crates/horizon-client/src/gfx.rs (+41 -32)
➕ crates/horizon-client/src/gfx/native_pack.rs (+52 -0)
📝 crates/horizon-client/src/gfx/native_post.rs (+87 -70)

📄 Description

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

#2028 is merged; this builds on it, and #1863 (the sky stage) builds on this. This is the part of #1863 that changes no pixels, split out so that #1863 stays near the size rule.

What

No change for players or pack authors. This reorganises the code that runs one of Horizon's own shader packs:

  • gfx/native_pack.rs: NativePack holds the running pack: its frame uniform, its post passes and the timer of its passes. Renderer::native replaces native_post.
  • NativeFrame (in native_post.rs) owns the frame buffer. The renderer writes it once a frame, before the world draws, so every stage of a pack reads the same time and frame_index. The sky stage in #1863 reads it too.
  • NativePost::run takes the pack's timer, and no longer the queue or the frame.
  • present_constants is shared, for the sky's pipeline in #1863.

Checked

  • Golden Hour's post passes still draw: ~/code/horizon-parity/screenshots/shaders-api-2/frame-west-pack.png (offscreen, Metal, sunset facing west), against sky-west-off.png with no pack.
  • The GPU test passes_chain_through_half_float_targets_with_options_and_depth passes with the shared frame.

Self-check

pr_ready (tools/pr_ready.py --quick --base origin/feat/shader-packs-page on ludovics-mac-mini, against origin/feat/shader-packs-page at 70b832d65, 3 min 7 s)

Check Result
Scope ✅ 3 files, +180 −102
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (6 s)
clippy ✅
tests: horizon-client ✅ 1296 passed (2 min 35 s)
doc tests ✅ 0 passed (3 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 30 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, hardcore_respawn, locator_bar, mace, marker_particles, online_mode and 18 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Harnesses (tools/parity.py --changed origin/main at a68c2f587, before #2028 merged, so its files too): 38 passed, 0 failed.

A/B, no pack (paired, alternating, 3 rounds of horizon-ctl bench 15, offscreen; the machine was busy): #2028's head CPU mean 0.800 ms, GPU mean 1.786 ms; this PR CPU mean 0.758 ms (0.839 / 0.708 / 0.726), GPU mean 1.726 ms. No cost.

🤖 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/2051 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/native-shader-frame` --- ### 📝 Commits (1) - [`a68c2f5`](https://github.com/horizon-rust/horizon/commit/a68c2f587d5d0b5cdab3d556b74511963eb16501) Horizon shader packs: one frame uniform per pack, apart from its post passes ### 📊 Changes **3 files changed** (+180 additions, -102 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/gfx.rs` (+41 -32) ➕ `crates/horizon-client/src/gfx/native_pack.rs` (+52 -0) 📝 `crates/horizon-client/src/gfx/native_post.rs` (+87 -70) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. #2028 is merged; this builds on it, and #1863 (the sky stage) builds on this. This is the part of #1863 that changes no pixels, split out so that #1863 stays near the size rule. ## What No change for players or pack authors. This reorganises the code that runs one of Horizon's own shader packs: - `gfx/native_pack.rs`: `NativePack` holds the running pack: its `frame` uniform, its post passes and the timer of its passes. `Renderer::native` replaces `native_post`. - `NativeFrame` (in `native_post.rs`) owns the `frame` buffer. The renderer writes it once a frame, before the world draws, so every stage of a pack reads the same `time` and `frame_index`. The sky stage in #1863 reads it too. - `NativePost::run` takes the pack's timer, and no longer the queue or the frame. - `present_constants` is shared, for the sky's pipeline in #1863. ## Checked - Golden Hour's post passes still draw: `~/code/horizon-parity/screenshots/shaders-api-2/frame-west-pack.png` (offscreen, Metal, sunset facing west), against `sky-west-off.png` with no pack. - The GPU test `passes_chain_through_half_float_targets_with_options_and_depth` passes with the shared frame. ## Self-check **pr_ready** (`tools/pr_ready.py --quick --base origin/feat/shader-packs-page` on ludovics-mac-mini, against origin/feat/shader-packs-page at 70b832d65, 3 min 7 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +180 −102 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (6 s) | | clippy | ✅ | | tests: horizon-client | ✅ 1296 passed (2 min 35 s) | | doc tests | ✅ 0 passed (3 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 30 affected, to run in CI (--quick): block_removal, command_exec, composter, crafter, cursor_death, dedicated_server, dispenser, hardcore_respawn, locator_bar, mace, marker_particles, online_mode and 18 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Harnesses (`tools/parity.py --changed origin/main` at a68c2f587, before #2028 merged, so its files too): **38 passed, 0 failed**. A/B, no pack (paired, alternating, 3 rounds of `horizon-ctl bench 15`, offscreen; the machine was busy): #2028's head CPU mean 0.800 ms, GPU mean 1.786 ms; this PR CPU mean 0.758 ms (0.839 / 0.708 / 0.726), GPU mean 1.726 ms. No cost. 🤖 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:13: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#3965
No description provided.