[PR #5305] [MERGED] Shader packs: scalar swizzles, matrix column components and uint literal overloads translate #6197

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

📋 Pull Request Information

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

Base: main ← Head: shaderpacks/scalar-swizzles-unsigned


📝 Commits (4)

  • 61187eb Shader packs: scalar swizzles, matrix column components and uint literal overloads translate
  • e11dae1 Merge main into #5305 (#4441 and #5264 changed translate/mod.rs)
  • eaa4c16 Merge main into #5305 (main's perf_bench, triage-list and launcher-string failures, fixed by #5369 and #5397)
  • 7e285aa Merge main into #5305 (translate/mod.rs tests beside main's)

📊 Changes

1 file changed (+167 additions, -10 deletions)

View changed files

📝 crates/horizon-shaders/src/translate/mod.rs (+167 -10)

📄 Description

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

What and why

Fixes #5303.

compile now rewrites the spot naga's frontend points at and parses again (at most 256 times; if a refusal has no rewrite, the errors are reported as before):

  • Scalar swizzle (scalar_swizzle, on "Can't lookup field on this type"): one component is dropped (f.x → f), a repeated one becomes a constructor (s.xx → vec2(s)), and a single component after an index becomes an index (m[1].y → m[1][1], a matrix column written by component). Mixed swizzles (f.xy) stay errors.
  • Ambiguous min/max/clamp (unsigned_literals): the call's integer literals get a u, which is the overload GL takes with a uint argument.
  • at takes the text the span is in, so errors still point at the pack's file and line after a rewrite (the rewrites keep the lines).

scalar_swizzles_translate and matrix_columns_and_unsigned_overloads_translate cover them.

Measured with Horizon main and this PR on the same world (programs the loader skipped):

Pack main this PR
Kappa v5.3 46 skipped; 30 "Can't lookup field", 3 "Ambiguous best function" 25 skipped; none of either

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 lines.

Self-check

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

Check Result
Scope ✅ 1 files, +167 −10
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 500 run, FAILED (failures=1, errors=5, skipped=1) (2 min 23 s)
rustfmt ✅ (25 s)
clippy ✅ (1 min 10 s)
tests: horizon-shaders ✅ 62 passed (5 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/5305 **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/scalar-swizzles-unsigned` --- ### 📝 Commits (4) - [`61187eb`](https://github.com/horizon-rust/horizon/commit/61187eb91e15f6e14fe8cd28ff6506fb50bf85a0) Shader packs: scalar swizzles, matrix column components and uint literal overloads translate - [`e11dae1`](https://github.com/horizon-rust/horizon/commit/e11dae108dc173456b61a6c147db63b7f7925353) Merge main into #5305 (#4441 and #5264 changed translate/mod.rs) - [`eaa4c16`](https://github.com/horizon-rust/horizon/commit/eaa4c16e0599738743296f1eb0e4033fa942523f) Merge main into #5305 (main's perf_bench, triage-list and launcher-string failures, fixed by #5369 and #5397) - [`7e285aa`](https://github.com/horizon-rust/horizon/commit/7e285aa283d8d4d5d00706657302037aad8eb541) Merge main into #5305 (translate/mod.rs tests beside main's) ### 📊 Changes **1 file changed** (+167 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-shaders/src/translate/mod.rs` (+167 -10) </details> ### 📄 Description > 🤖 Opened by TobiasLogic's AI agent (Claude Code, Claude Opus 5.5), not by TobiasLogic personally. ## What and why Fixes #5303. `compile` now rewrites the spot naga's frontend points at and parses again (at most 256 times; if a refusal has no rewrite, the errors are reported as before): - **Scalar swizzle** (`scalar_swizzle`, on "Can't lookup field on this type"): one component is dropped (`f.x` → `f`), a repeated one becomes a constructor (`s.xx` → `vec2(s)`), and a single component after an index becomes an index (`m[1].y` → `m[1][1]`, a matrix column written by component). Mixed swizzles (`f.xy`) stay errors. - **Ambiguous `min`/`max`/`clamp`** (`unsigned_literals`): the call's integer literals get a `u`, which is the overload GL takes with a `uint` argument. - `at` takes the text the span is in, so errors still point at the pack's file and line after a rewrite (the rewrites keep the lines). `scalar_swizzles_translate` and `matrix_columns_and_unsigned_overloads_translate` cover them. Measured with Horizon main and this PR on the same world (programs the loader skipped): | Pack | main | this PR | | --- | --- | --- | | Kappa v5.3 | 46 skipped; 30 "Can't lookup field", 3 "Ambiguous best function" | 25 skipped; none of either | ## 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 lines. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on 6cd182588f2d, against origin/main at 2b8c6e90b, 4 min 4 s) | Check | Result | | --- | --- | | Scope | ✅ 1 files, +167 −10 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 500 run, FAILED (failures=1, errors=5, skipped=1) (2 min 23 s) | | rustfmt | ✅ (25 s) | | clippy | ✅ (1 min 10 s) | | tests: horizon-shaders | ✅ 62 passed (5 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:15:47 +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#6197
No description provided.