[PR #2112] [MERGED] Horizon shader packs: one WGSL prefixer for copies of the renderer's shaders #4017

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

📋 Pull Request Information

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

Base: main ← Head: feat/native-material-plumbing


📝 Commits (1)

  • acbcaad Horizon shader packs: one WGSL prefixer for copies of the renderer's shaders

📊 Changes

3 files changed (+128 additions, -50 deletions)

View changed files

📝 crates/horizon-client/src/gfx.rs (+1 -0)
📝 crates/horizon-client/src/gfx/native_sky.rs (+3 -50)
➕ crates/horizon-client/src/gfx/wgsl_prefix.rs (+124 -0)

📄 Description

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

First of two PRs for the material stage of Horizon's own shader packs. This one changes no pixels; the stage itself comes in the next PR, stacked on this one.

What

The sky stage runs a copy of terrain.wgsl's sky beside the pack's code, with every name prefixed horizon_sky_, so that no pack name can clash with Horizon's (the pack check refuses horizon_ names). The material stage needs the same thing for the terrain section, which also declares bindings and overrides. So:

  • gfx/wgsl_prefix.rs: section (a slice of terrain.wgsl) and prefixed(text, prefix). It renames every top-level function, struct, constant, override and module variable, and every use of one. A function's own var and let names stay as they are. Test: prefixes_top_level_names_and_their_uses_only. It also checks that every top-level declaration of terrain.wgsl is found.
  • native_sky.rs uses it. The sky's shader is unchanged, apart from where globals is declared. The sky's GPU test (a_pack_gets_vanilla_s_colour_and_draws_opaque: vanilla's sky and a pass-through pack give identical pixels) still passes.

Self-check

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 852e7cd52, 7 min 47 s)

Check Result
Scope ✅ 3 files, +128 −50
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (14 s)
clippy ✅ (2 min 31 s)
tests: horizon-client ✅ 1299 passed (3 min 58 s)
doc tests ✅ 0 passed (4 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 acbcaad74): 30 passed, 0 failed.

A/B: this changes only how the sky's shader text is built at load time; no frame work changes.

🤖 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/2112 **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-material-plumbing` --- ### 📝 Commits (1) - [`acbcaad`](https://github.com/horizon-rust/horizon/commit/acbcaad7431cbb4233ac1617731b1c30c9e40086) Horizon shader packs: one WGSL prefixer for copies of the renderer's shaders ### 📊 Changes **3 files changed** (+128 additions, -50 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/gfx.rs` (+1 -0) 📝 `crates/horizon-client/src/gfx/native_sky.rs` (+3 -50) ➕ `crates/horizon-client/src/gfx/wgsl_prefix.rs` (+124 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. First of two PRs for the material stage of Horizon's own shader packs. This one changes no pixels; the stage itself comes in the next PR, stacked on this one. ## What The sky stage runs a copy of terrain.wgsl's sky beside the pack's code, with every name prefixed `horizon_sky_`, so that no pack name can clash with Horizon's (the pack check refuses `horizon_` names). The material stage needs the same thing for the terrain section, which also declares bindings and overrides. So: - `gfx/wgsl_prefix.rs`: `section` (a slice of terrain.wgsl) and `prefixed(text, prefix)`. It renames every top-level function, struct, constant, override and module variable, and every use of one. A function's own `var` and `let` names stay as they are. Test: `prefixes_top_level_names_and_their_uses_only`. It also checks that every top-level declaration of terrain.wgsl is found. - `native_sky.rs` uses it. The sky's shader is unchanged, apart from where `globals` is declared. The sky's GPU test (`a_pack_gets_vanilla_s_colour_and_draws_opaque`: vanilla's sky and a pass-through pack give identical pixels) still passes. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 852e7cd52, 7 min 47 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +128 −50 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (14 s) | | clippy | ✅ (2 min 31 s) | | tests: horizon-client | ✅ 1299 passed (3 min 58 s) | | doc tests | ✅ 0 passed (4 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 acbcaad74): **30 passed, 0 failed**. A/B: this changes only how the sky's shader text is built at load time; no frame work changes. 🤖 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:14: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#4017
No description provided.