[PR #1700] [MERGED] Shader packs, clean room 16: custom uniforms #3703

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

📋 Pull Request Information

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

Base: main ← Head: feat/shader-packs-custom-uniforms


📝 Commits (6)

  • 6c8880f Shader packs, clean room 15: globals initialized at run time, switch options
  • 505e8e9 Shader packs, clean room 16: custom uniforms
  • 754437f Merge branch 'feat/shader-packs-terrain-draw' into feat/shader-packs-run-globals
  • aebc95f Merge branch 'feat/shader-packs-run-globals' into feat/shader-packs-custom-uniforms
  • b73ca49 Merge feat/shader-packs-terrain-draw into feat/shader-packs-run-globals
  • ff3d57e Merge feat/shader-packs-run-globals into feat/shader-packs-custom-uniforms

📊 Changes

10 files changed (+901 additions, -28 deletions)

View changed files

📝 crates/horizon-client/src/gfx/pack_post.rs (+32 -4)
📝 crates/horizon-client/src/gfx/pack_uniforms.rs (+41 -0)
➕ crates/horizon-shaders/src/custom.rs (+570 -0)
📝 crates/horizon-shaders/src/lib.rs (+4 -0)
➕ crates/horizon-shaders/src/options.rs (+80 -0)
📝 crates/horizon-shaders/src/pack.rs (+33 -0)
📝 crates/horizon-shaders/src/post.rs (+24 -3)
📝 crates/horizon-shaders/src/translate/mod.rs (+15 -0)
📝 crates/horizon-shaders/src/translate/scan.rs (+95 -21)
📝 crates/horizon-shaders/tests/real_packs.rs (+7 -0)

📄 Description

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

Shader packs, clean room 16 (slice 6f): custom uniforms. Stacked on #1699.

What

uniform.<type>.<name>=<expr> and variable.<type>.<name>=<expr> of shaders.properties (§3.4), pulled forward from slice 10 because BSL and Complementary compute their lighting inputs with them:

  • New horizon_shaders::custom: an expression parser with C precedence, scalars and vectors (componentwise, scalars broadcast), the function table (math, vector, if, between, equals, smooth, random…).
  • Evaluated on the CPU once per frame, in file order, after the frame's own uniforms, and written to the programs that read them. smooth keeps its state per call site and halves the distance to its target every fade time (OQ-26 working answer). A name neither the frame nor the pack defines reads 0 and is listed once in the log.

About 655 lines, of which custom.rs is 570 (parser, evaluator, function table and tests: no natural cut that works alone).

Clean room

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

How tested

Unit tests expressions_follow_c_precedence_and_file_order, smooth_halves_the_distance_per_fade_time, bad_expressions_are_reported. Public test packs (black box): every custom uniform of BSL (17) and Complementary (21–22) parses; the names they read that Horizon doesn't provide yet are logged (biome, BIOME_*, heavyFog…).

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

pr_ready (tools/pr_ready.py --quick on ludovics-mac-mini, against origin/main at 07e46daa5, 7 min 3 s)

Check Result
Scope ⚠️ 41 files, +6862 −25; 6553 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 ✅ (24 s)
tests: workspace ✅ 1974 passed (5 min 47 s)
doc tests ✅ 1 passed (47 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.

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/1700 **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-custom-uniforms` --- ### 📝 Commits (6) - [`6c8880f`](https://github.com/horizon-rust/horizon/commit/6c8880fbd887a69af1f12acc5f2f9c3b64cbec85) Shader packs, clean room 15: globals initialized at run time, switch options - [`505e8e9`](https://github.com/horizon-rust/horizon/commit/505e8e960f9956a51bde92a52b737d4f7f413c69) Shader packs, clean room 16: custom uniforms - [`754437f`](https://github.com/horizon-rust/horizon/commit/754437fac663ae71ca7dd456a7a814018e27bf46) Merge branch 'feat/shader-packs-terrain-draw' into feat/shader-packs-run-globals - [`aebc95f`](https://github.com/horizon-rust/horizon/commit/aebc95fd00fc4f05b7694b33d18a6636aea2a32a) Merge branch 'feat/shader-packs-run-globals' into feat/shader-packs-custom-uniforms - [`b73ca49`](https://github.com/horizon-rust/horizon/commit/b73ca494a8db302713135f58ef22c2e986cab604) Merge feat/shader-packs-terrain-draw into feat/shader-packs-run-globals - [`ff3d57e`](https://github.com/horizon-rust/horizon/commit/ff3d57ea9c7986bc57ecdb2586f360274c7c1acc) Merge feat/shader-packs-run-globals into feat/shader-packs-custom-uniforms ### 📊 Changes **10 files changed** (+901 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/gfx/pack_post.rs` (+32 -4) 📝 `crates/horizon-client/src/gfx/pack_uniforms.rs` (+41 -0) ➕ `crates/horizon-shaders/src/custom.rs` (+570 -0) 📝 `crates/horizon-shaders/src/lib.rs` (+4 -0) ➕ `crates/horizon-shaders/src/options.rs` (+80 -0) 📝 `crates/horizon-shaders/src/pack.rs` (+33 -0) 📝 `crates/horizon-shaders/src/post.rs` (+24 -3) 📝 `crates/horizon-shaders/src/translate/mod.rs` (+15 -0) 📝 `crates/horizon-shaders/src/translate/scan.rs` (+95 -21) 📝 `crates/horizon-shaders/tests/real_packs.rs` (+7 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. **Shader packs, clean room 16 (slice 6f):** custom uniforms. Stacked on #1699. ## What `uniform.<type>.<name>=<expr>` and `variable.<type>.<name>=<expr>` of `shaders.properties` (§3.4), pulled forward from slice 10 because BSL and Complementary compute their lighting inputs with them: - New `horizon_shaders::custom`: an expression parser with C precedence, scalars and vectors (componentwise, scalars broadcast), the function table (math, vector, `if`, `between`, `equals`, `smooth`, `random`…). - Evaluated on the CPU once per frame, in file order, after the frame's own uniforms, and written to the programs that read them. `smooth` keeps its state per call site and halves the distance to its target every fade time (OQ-26 working answer). A name neither the frame nor the pack defines reads 0 and is listed once in the log. About 655 lines, of which `custom.rs` is 570 (parser, evaluator, function table and tests: no natural cut that works alone). ## Clean room Clean-room: implemented from `cleanroom/shader-packs-spec.md` revision 1, §3.4; no other loader's code read. ## How tested Unit tests `expressions_follow_c_precedence_and_file_order`, `smooth_halves_the_distance_per_fade_time`, `bad_expressions_are_reported`. Public test packs (black box): every custom uniform of BSL (17) and Complementary (21–22) parses; the names they read that Horizon doesn't provide yet are logged (`biome`, `BIOME_*`, `heavyFog`…). ## Self-check (whole stack, on its top branch `feat/shader-packs-real-buffers`) **pr_ready** (`tools/pr_ready.py --quick` on ludovics-mac-mini, against origin/main at 07e46daa5, 7 min 3 s) | Check | Result | | --- | --- | | Scope | ⚠️ 41 files, +6862 −25; 6553 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 | ✅ (24 s) | | tests: workspace | ✅ 1974 passed (5 min 47 s) | | doc tests | ✅ 1 passed (47 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`. ## 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:33 +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#3703
No description provided.