[PR #7459] [MERGED] Shader packs: a custom uniform's smooth reads a leading number as its id, as in Iris #7612

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7459
Author: @arslanarm
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: shaderpacks/smooth-id


📝 Commits (1)

  • 9d20f0c Shader packs: a custom uniform's smooth reads a leading number as its id, as in Iris

📊 Changes

1 file changed (+68 additions, -7 deletions)

View changed files

📝 crates/horizon-shaders/src/custom.rs (+68 -7)

📄 Description

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

What and why

Fixes #7452.

Found while investigating #6812; it doesn't change Shrimple's picture.

A custom uniform's smooth(...) (shaders.properties) read its first argument as the value whenever it had three or fewer arguments. Iris 1.11.7 reads it as the call's id when it is written as a number and more arguments follow, so:

expression Iris 1.11.7 main
smooth(1, 5, 0.0001) 5 1
smooth(5, 0.0001) ~0 (0.0001) 5
smooth(2.5, 6, 0.0001) 6 2.5

Any other first argument is the value, as before: smooth(cameraPosition.y / 10, 5, 0.0001), smooth(1.5 * 2, 6.5) (3) and smooth(-3, 6, 0.0001) (-3) agree. Iris drops a uniform whose smooth has four arguments and no number first, or five; it reads 0 there. Now:

  • custom.rs: smooth skips a first argument that is a number literal when more follow; smooth_arguments refuses the calls Iris drops, with a note, so the uniform is left out and reads 0.

How the cause was found

  1. Probe pack sem1 (my own): 40 custom uniforms with known values, one stripe each, painted by final, read back from screenshots, in Iris 1.11.7 and in Horizon main 6e1635c1e (and again with this branch on 7504abf07: every smooth stripe now matches Iris). Everything agreed except lerp (Iris has no such function) and smooth with two or three arguments.
  2. Probe packs smooth2 and smooth3 (my own) in Iris: the table above, plus smooth(y, 5, f) = y, smooth(7, y) = y, smooth((2), 6, f) = 6, smooth(4) = 4. Iris's own log names the two uniforms it couldn't resolve ("Failed to resolve uniform t0 / t4"): the four-argument call with cameraPosition.y / 10 first, and the five-argument call. The drop rule is probed for four arguments with cameraPosition.y / 10 first and five with a number first; other counts are extrapolated.
  3. From Horizon's code: custom.rs chose the form by the number of arguments only.

This was found while looking for why Shrimple v0.12 is dark. It does not change Shrimple's picture (below); it is an Iris difference any pack can hit. I did not open, extract, or read any pack's files, nor Horizon's preprocessed or translated text of any pack. What I know of Shrimple comes only from running it: real_packs output, Horizon's and Iris's game logs, HORIZON_SHADER_PACK_SKIP runs, screenshots, and #6812's text.

Measured

  • real_packs (SHOW_ERRORS=1), Shrimple alone, main 7504abf07 vs this branch (7162dd824): identical apart from timings.
  • In the game (fast builds, Xvfb, fresh homes, scenes ow_ground_noon, ow_ground_sunset, ow_ground_night), main 7504abf07 vs this branch: Shrimple's scores against Iris are the same (diff 88.9 / 58.4 / 13.0, 0..255), and the mean absolute difference between the two builds' pictures is 0.02 / 0.00 / 0.00. So this is not what keeps Shrimple dark; no screenshots.

Tests

  • custom::tests::smooth_reads_a_leading_number_as_its_id: nine forms with Iris's values from the probes. On main's code (7504abf07, the new tests added to its custom.rs) it fails ([1.0, 5.0, 2.5, 2.0, 6.96, 3.0, -3.0, 7.0, 4.0] against [5.0, 0.0001, 6.0, 6.0, 6.96, 3.0, -3.0, 6.96, 4.0]).
  • custom::tests::smooth_calls_iris_does_not_resolve_are_left_out: the four- and five-argument calls are left out with a note. On main's code (7504abf07, the new tests added to its custom.rs) it fails (all three uniforms kept).

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

Horizon-only (shader packs; vanilla has no such feature). Sources:

  • OptiFine's shaders.properties documentation (OptiFineDoc/doc/shaders.properties at 83d482c38, "Custom uniforms"): smooth([id], val, [fadeInTime, [fadeOutTime]]).
  • Black-box runs of Iris 1.11.7 with probe packs of my own, and its log. Iris's log also prints its expression resolver's debug trace (Iris class names) for unresolved uniforms. I saw it for an earlier typing probe; it did not inform this change.

Other projects' code

none. No Iris, OptiFine or pack code read.

Self-check

pr_ready (tools/pr_ready.py --quick on plony-pc, against origin/main at f696adc89, 1 min 45 s)

Check Result
Scope ✅ 1 files, +68 −7
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 614 passed (30 s)
rustfmt ✅ (7 s)
clippy ✅ (1 min 6 s)
tests: horizon-shaders ✅ 156 passed (1 s)
doc tests ✅ 0 passed
content root tests ➖ content root untouched
mod API up to date ➖ native hooks 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


🔄 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/7459 **Author:** [@arslanarm](https://github.com/arslanarm) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shaderpacks/smooth-id` --- ### 📝 Commits (1) - [`9d20f0c`](https://github.com/horizon-rust/horizon/commit/9d20f0cc84a66c47e44d60bb2db104abc83781e0) Shader packs: a custom uniform's smooth reads a leading number as its id, as in Iris ### 📊 Changes **1 file changed** (+68 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-shaders/src/custom.rs` (+68 -7) </details> ### 📄 Description > 🤖 Opened by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally. ## What and why Fixes #7452. Found while investigating #6812; it doesn't change Shrimple's picture. A custom uniform's `smooth(...)` (`shaders.properties`) read its first argument as the value whenever it had three or fewer arguments. Iris 1.11.7 reads it as the call's id when it is written as a number and more arguments follow, so: | expression | Iris 1.11.7 | main | |---|---|---| | `smooth(1, 5, 0.0001)` | 5 | 1 | | `smooth(5, 0.0001)` | ~0 (0.0001) | 5 | | `smooth(2.5, 6, 0.0001)` | 6 | 2.5 | Any other first argument is the value, as before: `smooth(cameraPosition.y / 10, 5, 0.0001)`, `smooth(1.5 * 2, 6.5)` (3) and `smooth(-3, 6, 0.0001)` (-3) agree. Iris drops a uniform whose `smooth` has four arguments and no number first, or five; it reads 0 there. Now: - `custom.rs`: `smooth` skips a first argument that is a number literal when more follow; `smooth_arguments` refuses the calls Iris drops, with a note, so the uniform is left out and reads 0. ### How the cause was found 1. Probe pack `sem1` (my own): 40 custom uniforms with known values, one stripe each, painted by `final`, read back from screenshots, in Iris 1.11.7 and in Horizon main 6e1635c1e (and again with this branch on 7504abf07: every `smooth` stripe now matches Iris). Everything agreed except `lerp` (Iris has no such function) and `smooth` with two or three arguments. 2. Probe packs `smooth2` and `smooth3` (my own) in Iris: the table above, plus `smooth(y, 5, f)` = y, `smooth(7, y)` = y, `smooth((2), 6, f)` = 6, `smooth(4)` = 4. Iris's own log names the two uniforms it couldn't resolve ("Failed to resolve uniform t0 / t4"): the four-argument call with `cameraPosition.y / 10` first, and the five-argument call. The drop rule is probed for four arguments with `cameraPosition.y / 10` first and five with a number first; other counts are extrapolated. 3. From Horizon's code: `custom.rs` chose the form by the number of arguments only. This was found while looking for why Shrimple v0.12 is dark. It does not change Shrimple's picture (below); it is an Iris difference any pack can hit. I did not open, extract, or read any pack's files, nor Horizon's preprocessed or translated text of any pack. What I know of Shrimple comes only from running it: `real_packs` output, Horizon's and Iris's game logs, `HORIZON_SHADER_PACK_SKIP` runs, screenshots, and #6812's text. ### Measured - `real_packs` (`SHOW_ERRORS=1`), Shrimple alone, main 7504abf07 vs this branch (7162dd824): identical apart from timings. - In the game (fast builds, Xvfb, fresh homes, scenes `ow_ground_noon`, `ow_ground_sunset`, `ow_ground_night`), main 7504abf07 vs this branch: Shrimple's scores against Iris are the same (diff 88.9 / 58.4 / 13.0, 0..255), and the mean absolute difference between the two builds' pictures is 0.02 / 0.00 / 0.00. So this is not what keeps Shrimple dark; no screenshots. ### Tests - `custom::tests::smooth_reads_a_leading_number_as_its_id`: nine forms with Iris's values from the probes. On main's code (7504abf07, the new tests added to its `custom.rs`) it fails (`[1.0, 5.0, 2.5, 2.0, 6.96, 3.0, -3.0, 7.0, 4.0]` against `[5.0, 0.0001, 6.0, 6.0, 6.96, 3.0, -3.0, 6.96, 4.0]`). - `custom::tests::smooth_calls_iris_does_not_resolve_are_left_out`: the four- and five-argument calls are left out with a note. On main's code (7504abf07, the new tests added to its `custom.rs`) it fails (all three uniforms kept). ## 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 Horizon-only (shader packs; vanilla has no such feature). Sources: - OptiFine's `shaders.properties` documentation (OptiFineDoc/doc/shaders.properties at 83d482c38, "Custom uniforms"): `smooth([id], val, [fadeInTime, [fadeOutTime]])`. - Black-box runs of Iris 1.11.7 with probe packs of my own, and its log. Iris's log also prints its expression resolver's debug trace (Iris class names) for unresolved uniforms. I saw it for an earlier typing probe; it did not inform this change. ## Other projects' code none. No Iris, OptiFine or pack code read. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on plony-pc, against origin/main at f696adc89, 1 min 45 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +68 −7 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 614 passed (30 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (1 min 6 s) | | tests: horizon-shaders | ✅ 156 passed (1 s) | | doc tests | ✅ 0 passed | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks 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) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 07:20:46 +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#7612
No description provided.