[PR #7236] [MERGED] Shader packs: a stray #endif and an #if left open are warnings, as in Iris #7431

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

📋 Pull Request Information

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

Base: main ← Head: shaderpacks/unbalanced-conditionals


📝 Commits (1)

  • 8cf2eaf Shader packs: a stray #endif and an #if left open are warnings, as in Iris

📊 Changes

2 files changed (+33 additions, -2 deletions)

View changed files

📝 crates/horizon-shaders/src/post.rs (+1 -1)
📝 crates/horizon-shaders/src/preprocess.rs (+32 -1)

📄 Description

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

What and why

Fixes #7167.

Iris 1.11.7 draws a program that has a stray #endif: it logs #endif without #if and goes on. It also draws a program whose #if is still open at the end of the file, silently. Two probe packs written for this showed both (Iris + Sodium 0.9.2 on 26.3, one scene; the final pass paints a colour only if it compiles).

Horizon reported both as errors and skipped the program:

  • Pegasus v0.5: main_f.glsl:2152: `#endif` without `#if` . Every gbuffers program was skipped, in every dimension, so terrain and water had no program.
  • Bloop 1.8.0-Alpha-3: composite6.fsh:0: `#if` without `#endif` , in all three dimensions.

What changes, in preprocess.rs:

  • Both cases are now warnings, which the game logs like a condition read as false.
  • The stray #endif is ignored.
  • The open #if reads on to the end of the file.

Ruled out first: about 50 inputs written for this were run through Horizon and glslang. They differed in two cases, neither of them this one: a // comment ending in a backslash (a separate fix that changes no pack) and CR-only line ends.

Measured with real_packs (SHOW_ERRORS=1), Modrinth's 40 most-downloaded packs, main fbb17c980 against this branch:

Pack Skipped programs, main This branch
Pegasus v0.5 99 (all gbuffers programs, 3 dimensions) 0
Bloop 1.8.0-Alpha-3 composite6 and prepare1 in 3 dimensions prepare1 only (#7168)
  • Pegasus now has terrain Some("gbuffers_terrain"), water Some("gbuffers_water") in every dimension.
  • Bloop's composite6 now shows one more warning that its skip used to hide (#if TAA_USE_YCOCG`: the condition ends too early; read as false).
  • Photon's stage-file pass drops from 12 diagnostics to 9: one stray #endif in program/c3_taau_prep.fsh is now a warning. Its loaded programs don't change.
  • No other pack's output changes.

Test: unbalanced_conditionals_warn_and_the_code_goes_on. Run against main's code it fails: both cases are errors there ([Diagnostic { line: 7, "`#endif` without `#if`" }, Diagnostic { line: 0, "`#if` without `#endif`" }]).

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: black-box runs of Iris 1.11.7 with probe packs of our own, and the GLSL 4.60 specification, 3.3 Preprocessor.

Other projects' code

none. No Iris, OptiFine or pack code was read. Pegasus ("All rights reserved") and Bloop (CC BY-NC-SA 4.0) were only run as black boxes.

Self-check

pr_ready (tools/pr_ready.py --quick on plony-pc, against origin/main at fbb17c980, 3 min 12 s)

Check Result
Scope ✅ 2 files, +33 −2
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 612 passed (33 s)
rustfmt ✅ (7 s)
clippy ✅ (2 min 28 s)
tests: horizon-shaders ✅ 143 passed (3 s)
doc tests ✅ 0 passed (1 s)
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/7236 **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/unbalanced-conditionals` --- ### 📝 Commits (1) - [`8cf2eaf`](https://github.com/horizon-rust/horizon/commit/8cf2eaf48da3679dce35bd24024f27ba411c50dd) Shader packs: a stray #endif and an #if left open are warnings, as in Iris ### 📊 Changes **2 files changed** (+33 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-shaders/src/post.rs` (+1 -1) 📝 `crates/horizon-shaders/src/preprocess.rs` (+32 -1) </details> ### 📄 Description > 🤖 Opened by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally. ## What and why Fixes #7167. Iris 1.11.7 draws a program that has a stray `#endif`: it logs `#endif without #if` and goes on. It also draws a program whose `#if` is still open at the end of the file, silently. Two probe packs written for this showed both (Iris + Sodium 0.9.2 on 26.3, one scene; the `final` pass paints a colour only if it compiles). Horizon reported both as errors and skipped the program: - **Pegasus v0.5:** ``main_f.glsl:2152: `#endif` without `#if` ``. Every gbuffers program was skipped, in every dimension, so terrain and water had no program. - **Bloop 1.8.0-Alpha-3:** ``composite6.fsh:0: `#if` without `#endif` ``, in all three dimensions. What changes, in `preprocess.rs`: - Both cases are now **warnings**, which the game logs like a condition read as false. - The stray `#endif` is ignored. - The open `#if` reads on to the end of the file. Ruled out first: about 50 inputs written for this were run through Horizon and glslang. They differed in two cases, neither of them this one: a `//` comment ending in a backslash (a separate fix that changes no pack) and CR-only line ends. **Measured** with `real_packs` (`SHOW_ERRORS=1`), Modrinth's 40 most-downloaded packs, main fbb17c980 against this branch: | Pack | Skipped programs, main | This branch | | --- | --- | --- | | Pegasus v0.5 | 99 (all gbuffers programs, 3 dimensions) | 0 | | Bloop 1.8.0-Alpha-3 | `composite6` and `prepare1` in 3 dimensions | `prepare1` only (#7168) | - Pegasus now has `terrain Some("gbuffers_terrain"), water Some("gbuffers_water")` in every dimension. - Bloop's `composite6` now shows one more warning that its skip used to hide (``#if TAA_USE_YCOCG`: the condition ends too early; read as false``). - Photon's stage-file pass drops from 12 diagnostics to 9: one stray `#endif` in `program/c3_taau_prep.fsh` is now a warning. Its loaded programs don't change. - No other pack's output changes. Test: `unbalanced_conditionals_warn_and_the_code_goes_on`. Run against main's code it fails: both cases are errors there (``[Diagnostic { line: 7, "`#endif` without `#if`" }, Diagnostic { line: 0, "`#if` without `#endif`" }]``). ## 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: black-box runs of Iris 1.11.7 with probe packs of our own, and the GLSL 4.60 specification, 3.3 Preprocessor. ## Other projects' code none. No Iris, OptiFine or pack code was read. Pegasus ("All rights reserved") and Bloop (CC BY-NC-SA 4.0) were only run as black boxes. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on plony-pc, against origin/main at fbb17c980, 3 min 12 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +33 −2 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 612 passed (33 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (2 min 28 s) | | tests: horizon-shaders | ✅ 143 passed (3 s) | | doc tests | ✅ 0 passed (1 s) | | 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 06:39:25 +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#7431
No description provided.