[PR #7243] [MERGED] Shader packs: a line comment ending in a backslash runs on #7439

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

📋 Pull Request Information

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

Base: main ← Head: shaderpacks/line-comment-continuation


📝 Commits (2)

  • 9d88442 Shader packs: a line comment ending in a backslash runs on
  • 7b8f97e Merge origin/main into shaderpacks/line-comment-continuation

📊 Changes

1 file changed (+31 additions, -1 deletions)

View changed files

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

📄 Description

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

What and why

Fixes #7233

The problem: GLSL 4.60, 3.4 Comments: "a single-line comment ending in the line-continuation character (\) includes the next line in the comment". Iris 1.11.7 does this. In a probe pack written for this (#version 330 compatibility, one scene), a #define on the line after such a comment stays undefined in Iris, both after code and with the comment alone on its line. Horizon ended the comment at the line break and read the next line as code or a directive.

The fix: in strip_comments (preprocess.rs), a // comment now runs on through every line that ends in a backslash. Its line breaks stay, so later lines keep their numbers.

Measured with real_packs (SHOW_ERRORS=1, Modrinth's 40 most-downloaded packs), main 10f472d86 against this branch: the output is identical apart from timings. No pack in that set depends on this.

Test: a_line_comment_runs_on_after_a_backslash covers a comment after code, a comment alone on its line with a CRLF line end, and the line numbers after them. Run against main's code it fails: [Diagnostic { line: 11, "`#endif` without `#if`" }] (the #endif the comment should take is read).

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: the GLSL 4.60 specification, 3.4 Comments, and a black-box run of Iris 1.11.7 with a probe pack of our own.

Other projects' code

none. No Iris, OptiFine or pack code was read.

Self-check

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

Check Result
Scope ✅ 1 files, +31 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 612 passed (32 s)
rustfmt ✅ (7 s)
clippy ✅ (50 s)
tests: horizon-shaders ✅ 140 passed (2 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/7243 **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/line-comment-continuation` --- ### 📝 Commits (2) - [`9d88442`](https://github.com/horizon-rust/horizon/commit/9d8844213295f6988ea44cba25c308e7fba59fd0) Shader packs: a line comment ending in a backslash runs on - [`7b8f97e`](https://github.com/horizon-rust/horizon/commit/7b8f97e3fe954a5b7d5623ad2e7ed443643cece4) Merge origin/main into shaderpacks/line-comment-continuation ### 📊 Changes **1 file changed** (+31 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-shaders/src/preprocess.rs` (+31 -1) </details> ### 📄 Description > 🤖 Opened by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally. ## What and why Fixes #7233 **The problem:** GLSL 4.60, 3.4 Comments: "a single-line comment ending in the line-continuation character (\\) includes the next line in the comment". Iris 1.11.7 does this. In a probe pack written for this (`#version 330 compatibility`, one scene), a `#define` on the line after such a comment stays undefined in Iris, both after code and with the comment alone on its line. Horizon ended the comment at the line break and read the next line as code or a directive. **The fix:** in `strip_comments` (`preprocess.rs`), a `//` comment now runs on through every line that ends in a backslash. Its line breaks stay, so later lines keep their numbers. **Measured** with `real_packs` (`SHOW_ERRORS=1`, Modrinth's 40 most-downloaded packs), main 10f472d86 against this branch: the output is identical apart from timings. No pack in that set depends on this. Test: `a_line_comment_runs_on_after_a_backslash` covers a comment after code, a comment alone on its line with a CRLF line end, and the line numbers after them. Run against main's code it fails: ``[Diagnostic { line: 11, "`#endif` without `#if`" }]`` (the `#endif` the comment should take is read). ## 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: the GLSL 4.60 specification, 3.4 Comments, and a black-box run of Iris 1.11.7 with a probe pack of our own. ## Other projects' code none. No Iris, OptiFine or pack code was read. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on plony-pc, against origin/main at 10f472d86, 1 min 31 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +31 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 612 passed (32 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (50 s) | | tests: horizon-shaders | ✅ 140 passed (2 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 06:39: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#7439
No description provided.