[PR #6875] [MERGED] Shader packs: interface block members keep their own qualifiers #7166

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

📋 Pull Request Information

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

Base: main ← Head: shaderpacks/interface-block-qualifiers


📝 Commits (2)

  • 25e50f6 Shader packs: interface block members keep their own qualifiers
  • 4a8e739 Merge main into #6875

📊 Changes

3 files changed (+346 additions, -1 deletions)

View changed files

📝 crates/horizon-shaders/src/preprocess.rs (+1 -1)
➕ crates/horizon-shaders/src/translate/interface_blocks.rs (+302 -0)
📝 crates/horizon-shaders/src/translate/mod.rs (+43 -0)

📄 Description

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

What and why

Part of #6812 (its translation failures; the black picture has other causes, below).

GLSL lets the members of an in/out interface block carry their own interpolation and layout qualifiers (GLSL 4.60, 4.3.9: out VertexData { flat int id; vec2 uv; } vOut;). naga's GLSL frontend refuses a qualifier on a member ("Expected Void, Struct or a type, found Interpolation(Flat)"), and with Shrimple v0.12 every gbuffers program (terrain, block, entities, translucent entities, damaged block, particles, hand, water) failed that way in all three dimensions.

translate/interface_blocks.rs rewrites such a block before the scan: each member becomes a varying of its own, hz_<block>_<member> (the next stage's block gives it the same name: GLSL matches blocks by block name and members by name), instance.member reads it, and a block without an instance name keeps its members' names. Line breaks stay where they were, so errors still name the pack's lines. Uniform and buffer blocks, blocks with an instance array (a geometry stage's input) and blocks whose instance is used whole are left as written. The varyings then go through the same path as the pack's other varyings, qualifiers included.

Measured with real_packs over Modrinth's 40 most-downloaded shader packs (SHOW_ERRORS=1, the game's load_post path), against main at 5197790e5: programs skipped 330 → 295, none newly skipped. Shrimple: 33 skipped gbuffers programs → 3 (gbuffers_hand, now stopped by currentRenderedItemId, a #3172 uniform). The other 5 are RenderPearl programs whose blocks now get past the parse.

In the game (fast build, three scenes) Shrimple's terrain, entities, particles and water now draw with their own programs, but its picture stays black as on main: other pieces it needs are still missing (its texClouds 3D custom texture and imgLocalBlockMask image are "not provided yet", and its shadow program uses a geometry stage). This pull request fixes the translation part only.

Note on #6812's list: the composite errors it quotes (imgLocalBlockMask, StaticBlockMap, darknessFactor...) come from real_packs's composite loop, which translates every file without the pack's iris.features macros; in the game's path (load_post, with them) Shrimple's composite programs all translate already.

Tests: interface_block_members_keep_their_qualifiers (a flat member arrives as a flat input; it fails on main with the issue's error), and interface_blocks::tests (lines kept, instance.member renamed, a block without instance, blocks left alone).

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). The rule followed is the GLSL 4.60 specification, 4.3.9 (interface blocks); glslangValidator 1.4.363 accepts a block with a flat member.

Other projects' code

none. No Iris, OptiFine or pack code read; Shrimple was only run as a black box, and the qualifier form was found with programs written for this (a flat member of a block reproduces Shrimple's error exactly).

Self-check

pr_ready (tools/pr_ready.py --quick on plony-pc, against origin/main at 5197790e5, 2 min 16 s)

Check Result
Scope ✅ 3 files, +346 −1
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 607 passed (32 s)
rustfmt ✅ (6 s)
clippy ✅ (1 min 35 s)
tests: horizon-shaders ✅ 127 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/6875 **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/interface-block-qualifiers` --- ### 📝 Commits (2) - [`25e50f6`](https://github.com/horizon-rust/horizon/commit/25e50f64938e4ff466e60d083368fe5b58dcd76b) Shader packs: interface block members keep their own qualifiers - [`4a8e739`](https://github.com/horizon-rust/horizon/commit/4a8e739a6a0296c1088e49e238735b400f8b890e) Merge main into #6875 ### 📊 Changes **3 files changed** (+346 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-shaders/src/preprocess.rs` (+1 -1) ➕ `crates/horizon-shaders/src/translate/interface_blocks.rs` (+302 -0) 📝 `crates/horizon-shaders/src/translate/mod.rs` (+43 -0) </details> ### 📄 Description > 🤖 Opened by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally. ## What and why Part of #6812 (its translation failures; the black picture has other causes, below). GLSL lets the members of an `in`/`out` interface block carry their own interpolation and layout qualifiers (GLSL 4.60, 4.3.9: `out VertexData { flat int id; vec2 uv; } vOut;`). naga's GLSL frontend refuses a qualifier on a member ("Expected Void, Struct or a type, found Interpolation(Flat)"), and with Shrimple v0.12 every gbuffers program (terrain, block, entities, translucent entities, damaged block, particles, hand, water) failed that way in all three dimensions. `translate/interface_blocks.rs` rewrites such a block before the scan: each member becomes a varying of its own, `hz_<block>_<member>` (the next stage's block gives it the same name: GLSL matches blocks by block name and members by name), `instance.member` reads it, and a block without an instance name keeps its members' names. Line breaks stay where they were, so errors still name the pack's lines. Uniform and buffer blocks, blocks with an instance array (a geometry stage's input) and blocks whose instance is used whole are left as written. The varyings then go through the same path as the pack's other varyings, qualifiers included. Measured with `real_packs` over Modrinth's 40 most-downloaded shader packs (`SHOW_ERRORS=1`, the game's `load_post` path), against main at 5197790e5: programs skipped 330 → 295, none newly skipped. Shrimple: 33 skipped gbuffers programs → 3 (`gbuffers_hand`, now stopped by `currentRenderedItemId`, a #3172 uniform). The other 5 are RenderPearl programs whose blocks now get past the parse. In the game (fast build, three scenes) Shrimple's terrain, entities, particles and water now draw with their own programs, but its picture stays black as on main: other pieces it needs are still missing (its `texClouds` 3D custom texture and `imgLocalBlockMask` image are "not provided yet", and its shadow program uses a geometry stage). This pull request fixes the translation part only. Note on #6812's list: the composite errors it quotes (`imgLocalBlockMask`, `StaticBlockMap`, `darknessFactor`...) come from `real_packs`'s composite loop, which translates every file without the pack's `iris.features` macros; in the game's path (`load_post`, with them) Shrimple's composite programs all translate already. Tests: `interface_block_members_keep_their_qualifiers` (a `flat` member arrives as a flat input; it fails on main with the issue's error), and `interface_blocks::tests` (lines kept, `instance.member` renamed, a block without instance, blocks left alone). ## 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). The rule followed is the GLSL 4.60 specification, 4.3.9 (interface blocks); `glslangValidator` 1.4.363 accepts a block with a `flat` member. ## Other projects' code none. No Iris, OptiFine or pack code read; Shrimple was only run as a black box, and the qualifier form was found with programs written for this (a `flat` member of a block reproduces Shrimple's error exactly). ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on plony-pc, against origin/main at 5197790e5, 2 min 16 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +346 −1 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 607 passed (32 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (1 min 35 s) | | tests: horizon-shaders | ✅ 127 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:35:08 +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#7166
No description provided.