[PR #5371] [MERGED] Shader packs: consts that call mix, smoothstep and the like run in main #6243

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

📋 Pull Request Information

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

Base: main ← Head: shaderpacks/unfoldable-constants


📝 Commits (1)

  • 498c33f Shader packs: consts that call mix, smoothstep and the like run in main

📊 Changes

3 files changed (+75 additions, -4 deletions)

View changed files

📝 crates/horizon-shaders/src/translate/mod.rs (+15 -0)
📝 crates/horizon-shaders/src/translate/rewrite.rs (+21 -1)
📝 crates/horizon-shaders/src/translate/scan.rs (+39 -3)

📄 Description

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

What and why

Fixes #5370.

naga's constant evaluator lacks mix, smoothstep, reflect, refract, faceforward, the matrix functions, modf/frexp/ldexp, the pack/unpack functions and bitfieldExtract/bitfieldInsert (NOT_CONSTANT). A const that calls one failed the program.

  • A global const that calls one now joins the globals our main initialises, as const ... ? ... : ... already did (scan.rs).
  • A local const that calls one loses its const (calls_not_constant, rewrite.rs) and is evaluated in place.

constants_naga_cannot_fold_are_evaluated_at_run_time covers both.

Measured with Horizon main and this PR on the same world:

Pack main this PR
Bliss v2.1.2 (Chocapic13 edit) 66 "Not implemented as constant expression"; 3 composite programs load none; 7 load (composite7, 8, 9, 10, 11, 13, final)

Bliss still skips other programs for other reasons.

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

Not vanilla: GLSL in shaders/ packs and naga's translation of it. GL drivers (and so Iris) take these constants.

Self-check

pr_ready (tools/pr_ready.py --quick on 6cd182588f2d, against origin/main at 2b8c6e90b, 5 min 58 s)

Check Result
Scope ✅ 3 files, +75 −4
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 500 run, FAILED (failures=1, errors=5, skipped=1) (2 min 23 s)
rustfmt ✅ (25 s)
clippy ✅ (2 min 54 s)
tests: horizon-shaders ✅ 61 passed (15 s)
doc tests ✅ 0 passed
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)

Run on a rented Linux box with GPU tests on lavapipe. The Python errors are that box's git 2.34 (git merge-tree --write-tree, in test_nightly_set and test_supervise; they pass with git 2.55), and test_triage_command's test_the_repos_list_is_the_nightlys fails there too; this change touches no Python.

🤖 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/5371 **Author:** [@TobiasLogic](https://github.com/TobiasLogic) **Created:** 10/31/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shaderpacks/unfoldable-constants` --- ### 📝 Commits (1) - [`498c33f`](https://github.com/horizon-rust/horizon/commit/498c33fe7d60c0f63601c204974cecaf21bb3a12) Shader packs: consts that call mix, smoothstep and the like run in main ### 📊 Changes **3 files changed** (+75 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-shaders/src/translate/mod.rs` (+15 -0) 📝 `crates/horizon-shaders/src/translate/rewrite.rs` (+21 -1) 📝 `crates/horizon-shaders/src/translate/scan.rs` (+39 -3) </details> ### 📄 Description > 🤖 Opened by TobiasLogic's AI agent (Claude Code, Claude Opus 5.5), not by TobiasLogic personally. ## What and why Fixes #5370. naga's constant evaluator lacks `mix`, `smoothstep`, `reflect`, `refract`, `faceforward`, the matrix functions, `modf`/`frexp`/`ldexp`, the pack/unpack functions and `bitfieldExtract`/`bitfieldInsert` (`NOT_CONSTANT`). A `const` that calls one failed the program. - A global `const` that calls one now joins the globals our `main` initialises, as `const ... ? ... : ...` already did (`scan.rs`). - A local `const` that calls one loses its `const` (`calls_not_constant`, `rewrite.rs`) and is evaluated in place. `constants_naga_cannot_fold_are_evaluated_at_run_time` covers both. Measured with Horizon main and this PR on the same world: | Pack | main | this PR | | --- | --- | --- | | Bliss v2.1.2 (Chocapic13 edit) | 66 "Not implemented as constant expression"; 3 composite programs load | none; 7 load (composite7, 8, 9, 10, 11, 13, final) | Bliss still skips other programs for other reasons. ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [x] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [ ] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference Not vanilla: GLSL in `shaders/` packs and naga's translation of it. GL drivers (and so Iris) take these constants. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on 6cd182588f2d, against origin/main at 2b8c6e90b, 5 min 58 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +75 −4 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 500 run, FAILED (failures=1, errors=5, skipped=1) (2 min 23 s) | | rustfmt | ✅ (25 s) | | clippy | ✅ (2 min 54 s) | | tests: horizon-shaders | ✅ 61 passed (15 s) | | doc tests | ✅ 0 passed | | 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) | Run on a rented Linux box with GPU tests on lavapipe. The Python errors are that box's git 2.34 (`git merge-tree --write-tree`, in `test_nightly_set` and `test_supervise`; they pass with git 2.55), and `test_triage_command`'s `test_the_repos_list_is_the_nightlys` fails there too; this change touches no Python. 🤖 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 06:16:17 +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#6243
No description provided.