[PR #5701] [MERGED] Shader packs: four more translation fixes (sampler names, const parameters, arrays of arrays) #6449

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5701
Author: @TobiasLogic
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: shaderpacks/translation-fixes-2


📝 Commits (3)

  • 181d5f5 Shader packs: four more translation fixes (sampler names, const parameters, arrays of arrays)
  • c7782f2 Merge main into #5701 (#5371 changed translate/rewrite.rs and mod.rs)
  • d139c57 Merge main into #5701

📊 Changes

2 files changed (+182 additions, -7 deletions)

View changed files

📝 crates/horizon-shaders/src/translate/mod.rs (+76 -0)
📝 crates/horizon-shaders/src/translate/rewrite.rs (+106 -7)

📄 Description

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

What and why

Fixes #5699.

Four translation fixes in rewrite.rs, each with a test in translate/mod.rs:

  • Samplers named like functions (samplers_named_like_functions_translate): a sampler name followed by ( is the function call, not the sampler. Bloop's uniform sampler2D texture; read as texture(texture, uv).
  • Locals named like samplers (locals_named_like_samplers_read_them_first): a local named like a sampler or a sampler parameter hides it only from the end of its initializer (Stage::scope_start, GLSL 4.60 §4.2.2), so float depth = texture(depth, c).x samples the parameter. Before, a local named like a sampler parameter wasn't treated as hiding it at all.
  • const parameters (const_parameters_translate): a parameter's const, which naga's parser refuses, is dropped. It only promises the function doesn't write the parameter.
  • Arrays of arrays (arrays_of_arrays_keep_their_order): naga's frontend nests two or more dimensions in a type the other way round (float x[3][2] comes out as 2 arrays of 3; also float[3][2], struct members and parameters). Stage::type_dimensions finds such a run after a type name or a declared name, and it's written reversed so the frontend's reversal gives GL's order back; accesses (x[2][1]) are untouched. The test checks the outer sizes and that x[2][1] validates.

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

Pack main this PR
Bloop 1.8.0 Alpha 3 43 "Expected Semicolon, found LeftParen"; 45 programs skipped; 1 composite-style program loads none of those; 7 skipped; 7 load (prepare, prepare2, deferred, composite, composite8, composite9, final)
Potato v1.0d composite1 skipped ("Expected RightParen, found Identifier") composite1 loads

The arrays-of-arrays reversal is a naga frontend bug; this works around it in the source until naga fixes it.

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 (GLSL 4.60 §4.1.9 for arrays of arrays, §4.2.2 for scope). GL drivers, and so Iris, run these packs.

Self-check

pr_ready (tools/pr_ready.py --quick on a2fdb8f4bb53, against origin/main at c51dcda01, 4 min 15 s)

Check Result
Scope ✅ 2 files, +182 −7
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 511 passed (54 s)
rustfmt ✅ (11 s)
clippy ✅ (2 min 45 s)
tests: horizon-shaders ✅ 97 passed (24 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 (Ubuntu 24.04, stable Rust 1.99.1), GPU tests on lavapipe.

🤖 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/5701 **Author:** [@TobiasLogic](https://github.com/TobiasLogic) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shaderpacks/translation-fixes-2` --- ### 📝 Commits (3) - [`181d5f5`](https://github.com/horizon-rust/horizon/commit/181d5f5ed66c516c560650577009e1a7726ab75f) Shader packs: four more translation fixes (sampler names, const parameters, arrays of arrays) - [`c7782f2`](https://github.com/horizon-rust/horizon/commit/c7782f2656dde78103237490bd8cf9330e535fee) Merge main into #5701 (#5371 changed translate/rewrite.rs and mod.rs) - [`d139c57`](https://github.com/horizon-rust/horizon/commit/d139c570fa53bb7b00ac8d4878da6f9bc867efa7) Merge main into #5701 ### 📊 Changes **2 files changed** (+182 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-shaders/src/translate/mod.rs` (+76 -0) 📝 `crates/horizon-shaders/src/translate/rewrite.rs` (+106 -7) </details> ### 📄 Description > 🤖 Opened by TobiasLogic's AI agent (Claude Code, Claude Opus 5.5), not by TobiasLogic personally. ## What and why Fixes #5699. Four translation fixes in `rewrite.rs`, each with a test in `translate/mod.rs`: - **Samplers named like functions** (`samplers_named_like_functions_translate`): a sampler name followed by `(` is the function call, not the sampler. Bloop's `uniform sampler2D texture;` read as `texture(texture, uv)`. - **Locals named like samplers** (`locals_named_like_samplers_read_them_first`): a local named like a sampler or a sampler parameter hides it only from the end of its initializer (`Stage::scope_start`, GLSL 4.60 §4.2.2), so `float depth = texture(depth, c).x` samples the parameter. Before, a local named like a sampler *parameter* wasn't treated as hiding it at all. - **`const` parameters** (`const_parameters_translate`): a parameter's `const`, which naga's parser refuses, is dropped. It only promises the function doesn't write the parameter. - **Arrays of arrays** (`arrays_of_arrays_keep_their_order`): naga's frontend nests two or more dimensions in a type the other way round (`float x[3][2]` comes out as 2 arrays of 3; also `float[3][2]`, struct members and parameters). `Stage::type_dimensions` finds such a run after a type name or a declared name, and it's written reversed so the frontend's reversal gives GL's order back; accesses (`x[2][1]`) are untouched. The test checks the outer sizes and that `x[2][1]` validates. Measured with Horizon main and this PR on the same world: | Pack | main | this PR | | --- | --- | --- | | Bloop 1.8.0 Alpha 3 | 43 "Expected Semicolon, found LeftParen"; 45 programs skipped; 1 composite-style program loads | none of those; 7 skipped; 7 load (prepare, prepare2, deferred, composite, composite8, composite9, final) | | Potato v1.0d | `composite1` skipped ("Expected RightParen, found Identifier") | `composite1` loads | The arrays-of-arrays reversal is a naga frontend bug; this works around it in the source until naga fixes it. ## 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 (GLSL 4.60 §4.1.9 for arrays of arrays, §4.2.2 for scope). GL drivers, and so Iris, run these packs. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on a2fdb8f4bb53, against origin/main at c51dcda01, 4 min 15 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +182 −7 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 511 passed (54 s) | | rustfmt | ✅ (11 s) | | clippy | ✅ (2 min 45 s) | | tests: horizon-shaders | ✅ 97 passed (24 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 (Ubuntu 24.04, stable Rust 1.99.1), GPU tests on lavapipe. 🤖 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:20:51 +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#6449
No description provided.