[PR #5830] [MERGED] Shader API: [[post]] output and scale, a pack's own targets #6519

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5830
Author: @Teiwazik
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: shader/post-targets


📝 Commits (10+)

  • 3ab39ea Merge remote-tracking branch 'origin/main' into shader/s8-shadow-entities
  • b1d6819 Native mods: the screen hears of the wheel before it scrolls
  • 43207a5 Shader API: entities cast into the shadow map
  • c901615 Merge branch 'screen-mouse-button' into screen-mouse-scrolled
  • 11cd3f2 Shader API: the first-person player casts into the shadow map
  • bbbb185 Shader API: materials, an id by sprite, and shadows cut whole
  • 622786d Shader packs: pages, the layout of a Horizon pack's options page
  • fbf8c46 Shader API: [sky] clouds, sun and stars, for a sky that draws its own
  • 000eb64 Shader API: the [weather] stage colours rain and snow streaks
  • 753c565 Shader API: the blob stays where a pack has no sun to cast with

📊 Changes

41 files changed (+3389 additions, -332 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/horizon-client-render/src/assets.rs (+8 -0)
📝 crates/horizon-client-render/src/gfx.rs (+185 -16)
➕ crates/horizon-client-render/src/gfx/block_light.rs (+224 -0)
📝 crates/horizon-client-render/src/gfx/entity_batch.rs (+5 -0)
📝 crates/horizon-client-render/src/gfx/native_material.rs (+79 -19)
📝 crates/horizon-client-render/src/gfx/native_pack.rs (+49 -5)
📝 crates/horizon-client-render/src/gfx/native_post.rs (+501 -134)
📝 crates/horizon-client-render/src/gfx/native_shadow.rs (+180 -8)
📝 crates/horizon-client-render/src/gfx/native_sky.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/weather.rs (+169 -2)
📝 crates/horizon-client-render/src/graphics.rs (+10 -1)
📝 crates/horizon-client-render/src/hud.rs (+6 -0)
📝 crates/horizon-client-render/src/mesher.rs (+8 -0)
📝 crates/horizon-client-render/src/options_ui.rs (+117 -44)
📝 crates/horizon-client-render/src/shader_pack_list.rs (+9 -3)
📝 crates/horizon-client-render/src/sprites.rs (+243 -41)
📝 crates/horizon-client/src/game.rs (+52 -3)
📝 crates/horizon-client/src/game/entity_culling.rs (+3 -0)
📝 crates/horizon-client/src/game/native_block_entity_draw.rs (+58 -0)

...and 21 more files

📄 Description

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

Fixes #5829.

What

  • [[post]] output = "name" writes a target of the pack's own instead of the chain. Every pass's prelude declares var name: texture_2d<f32> from binding 32 of group 3, holding last frame's picture until written again. A pass reads a blank in place of the target it writes.
  • scale is 1, 0.5 or 0.25 of the world's size, and below 1 needs an output.
  • The next pass's previous stays the chain's last picture, so an output pass doesn't break the chain. history is now the chain's last picture too, which is the same frame as before when a pack has no outputs.
  • At most 4 targets. The manifest refuses an output or scale on the last pass, a name that isn't a free WGSL name, one target at two scales, and these keys outside [[post]].

Report carries the manifest, so the renderer can lay the passes out. A pack without these keys gets the same chain as before.

Proof

Tests: post_outputs_are_named_scaled_and_never_the_last_pass, a_pass_with_an_output_leaves_the_chain_as_it_was, and the existing the_last_pass_reads_last_frames_input_as_history, which still passes.

In game on Linux (RTX 3050 Ti), single player, with three passes: the world's red into output = "half" at scale = 0.5; the world's green along the chain; a last pass showing half on the left, previous on the right, and a top band that's white only if textureDimensions(half) equals half the resolution, rounded up. On screen:

  • The left half is red, the right half is green, so the chain's picture didn't take the output's.
  • The band is white (it shows the game's vignette on top).

No screenshots attached: they'd have to be committed to upload, and the scene shows Mojang textures.

Not checked: 0.25 scale and several targets in game (the manifest and plan tests cover the rules only), reading a target's last frame across frames, resizing the window while running, and lan_e2e (client-only rendering).

This overlaps native_post.rs with #5681 and #5753, whichever lands first; I'll merge main into the others.

pr_ready (tools/pr_ready.py --quick on teiwazik-laptop, against origin/main at f77b1391e, 2 min 19 s)

Check Result
Scope ✅ 9 files, +410 −77
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 515 passed (38 s)
rustfmt ✅ (9 s)
clippy ✅ (1 min 10 s)
tests: horizon-client-render, horizon-shader-api ✅ 860 passed (20 s)
doc tests ✅ 0 passed (1 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)

🤖 Generated with Claude Code

https://claude.ai/code/session_01EBqm1v5zTsDGwuZF6XKFjL


🔄 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/5830 **Author:** [@Teiwazik](https://github.com/Teiwazik) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shader/post-targets` --- ### 📝 Commits (10+) - [`3ab39ea`](https://github.com/horizon-rust/horizon/commit/3ab39ea98415cf91cbf58af324e3afcc87f8260c) Merge remote-tracking branch 'origin/main' into shader/s8-shadow-entities - [`b1d6819`](https://github.com/horizon-rust/horizon/commit/b1d6819737cabae0cda4c11268d1dfc9954cb652) Native mods: the screen hears of the wheel before it scrolls - [`43207a5`](https://github.com/horizon-rust/horizon/commit/43207a5a3d6afeee0061ed6aef9c68dcd0ce8d24) Shader API: entities cast into the shadow map - [`c901615`](https://github.com/horizon-rust/horizon/commit/c90161511b9404e22911a177208490b058d15e0f) Merge branch 'screen-mouse-button' into screen-mouse-scrolled - [`11cd3f2`](https://github.com/horizon-rust/horizon/commit/11cd3f220d91b1b99febea60ce035150bd8996b8) Shader API: the first-person player casts into the shadow map - [`bbbb185`](https://github.com/horizon-rust/horizon/commit/bbbb18595fdb024b76a7dda8e78a2ce92c7ad0dc) Shader API: [[materials]], an id by sprite, and shadows cut whole - [`622786d`](https://github.com/horizon-rust/horizon/commit/622786d90317822ff09249426417b3af4a8ef9f2) Shader packs: [[pages]], the layout of a Horizon pack's options page - [`fbf8c46`](https://github.com/horizon-rust/horizon/commit/fbf8c46b8e6834bf3faf0885ddc9718a421f5b41) Shader API: [sky] clouds, sun and stars, for a sky that draws its own - [`000eb64`](https://github.com/horizon-rust/horizon/commit/000eb647aaec5f178d89741ed56637797b8951a6) Shader API: the [weather] stage colours rain and snow streaks - [`753c565`](https://github.com/horizon-rust/horizon/commit/753c565883ce75bbfd9624ad53ed0de157a0c59b) Shader API: the blob stays where a pack has no sun to cast with ### 📊 Changes **41 files changed** (+3389 additions, -332 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-client-render/src/assets.rs` (+8 -0) 📝 `crates/horizon-client-render/src/gfx.rs` (+185 -16) ➕ `crates/horizon-client-render/src/gfx/block_light.rs` (+224 -0) 📝 `crates/horizon-client-render/src/gfx/entity_batch.rs` (+5 -0) 📝 `crates/horizon-client-render/src/gfx/native_material.rs` (+79 -19) 📝 `crates/horizon-client-render/src/gfx/native_pack.rs` (+49 -5) 📝 `crates/horizon-client-render/src/gfx/native_post.rs` (+501 -134) 📝 `crates/horizon-client-render/src/gfx/native_shadow.rs` (+180 -8) 📝 `crates/horizon-client-render/src/gfx/native_sky.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/weather.rs` (+169 -2) 📝 `crates/horizon-client-render/src/graphics.rs` (+10 -1) 📝 `crates/horizon-client-render/src/hud.rs` (+6 -0) 📝 `crates/horizon-client-render/src/mesher.rs` (+8 -0) 📝 `crates/horizon-client-render/src/options_ui.rs` (+117 -44) 📝 `crates/horizon-client-render/src/shader_pack_list.rs` (+9 -3) 📝 `crates/horizon-client-render/src/sprites.rs` (+243 -41) 📝 `crates/horizon-client/src/game.rs` (+52 -3) 📝 `crates/horizon-client/src/game/entity_culling.rs` (+3 -0) 📝 `crates/horizon-client/src/game/native_block_entity_draw.rs` (+58 -0) _...and 21 more files_ </details> ### 📄 Description > 🤖 Opened by Teiwazik's AI agent (Claude Code, Claude Opus 5.5), not by Teiwazik personally. Fixes #5829. ## What - `[[post]] output = "name"` writes a target of the pack's own instead of the chain. Every pass's prelude declares `var name: texture_2d<f32>` from binding 32 of group 3, holding last frame's picture until written again. A pass reads a blank in place of the target it writes. - `scale` is 1, 0.5 or 0.25 of the world's size, and below 1 needs an `output`. - The next pass's `previous` stays the chain's last picture, so an output pass doesn't break the chain. `history` is now the chain's last picture too, which is the same frame as before when a pack has no outputs. - At most 4 targets. The manifest refuses an output or scale on the last pass, a name that isn't a free WGSL name, one target at two scales, and these keys outside `[[post]]`. `Report` carries the manifest, so the renderer can lay the passes out. A pack without these keys gets the same chain as before. ## Proof Tests: `post_outputs_are_named_scaled_and_never_the_last_pass`, `a_pass_with_an_output_leaves_the_chain_as_it_was`, and the existing `the_last_pass_reads_last_frames_input_as_history`, which still passes. In game on Linux (RTX 3050 Ti), single player, with three passes: the world's red into `output = "half"` at `scale = 0.5`; the world's green along the chain; a last pass showing `half` on the left, `previous` on the right, and a top band that's white only if `textureDimensions(half)` equals half the resolution, rounded up. On screen: - The left half is red, the right half is green, so the chain's picture didn't take the output's. - The band is white (it shows the game's vignette on top). No screenshots attached: they'd have to be committed to upload, and the scene shows Mojang textures. Not checked: 0.25 scale and several targets in game (the manifest and plan tests cover the rules only), reading a target's last frame across frames, resizing the window while running, and `lan_e2e` (client-only rendering). This overlaps `native_post.rs` with #5681 and #5753, whichever lands first; I'll merge `main` into the others. **pr_ready** (`tools/pr_ready.py --quick` on teiwazik-laptop, against origin/main at f77b1391e, 2 min 19 s) | Check | Result | | --- | --- | | Scope | ✅ 9 files, +410 −77 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 515 passed (38 s) | | rustfmt | ✅ (9 s) | | clippy | ✅ (1 min 10 s) | | tests: horizon-client-render, horizon-shader-api | ✅ 860 passed (20 s) | | doc tests | ✅ 0 passed (1 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) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EBqm1v5zTsDGwuZF6XKFjL --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:22:13 +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#6519
No description provided.