[PR #6934] [MERGED] Shader packs: the standard macros Iris 1.11.7 defines #7207

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

📋 Pull Request Information

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

Base: main ← Head: shaderpacks/iris-standard-macros


📝 Commits (2)

📊 Changes

2 files changed (+73 additions, -20 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+4 -2)
📝 crates/horizon-shaders/src/macros.rs (+69 -18)

📄 Description

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

What and why

Fixes #6881.

Packs choose their code paths with the standard macros; Horizon's differed from what Iris 1.11.7 defines. What Iris defines was observed black-box with probe packs written for this: each stripe of the final pass is green or red for a defined macro, or carries a macro's value in the colour's bytes; run in Iris 1.11.7 + Sodium 0.9.2 on 26.3 (Linux, NVIDIA), with Mipmap Levels 4 and 2, and with the pack's #version 330 and 460.

Macro Iris 1.11.7 Horizon before Here
MC_GL_VERSION, MC_GLSL_VERSION 330 (also under #version 460) 460 330
IRIS_VERSION 11107 – 11107
IRIS_HAS_TRANSLUCENCY_SORTING defined – defined (Horizon sorts translucent terrain as vanilla does, gfx/translucency.rs)
MC_MIPMAP_LEVEL the Mipmap Levels option (4, 2) – the renderer's mipmap levels
MC_GL_VENDOR_*, MC_GL_RENDERER_* NVIDIA, OTHER none OTHER, OTHER
IRIS_TAG_SUPPORT 2 – – (block tags are not read yet: block_ids.rs)
MAX_COLOR_BUFFERS 32 16 16 (Horizon has 16 colortex buffers)

The GL vendor: OptiFine's shaders.txt (E, F) defines one vendor and one renderer. Horizon draws through wgpu, not a GL driver, so it says OTHER: packs take driver extensions behind the vendor macro. With MC_GL_VENDOR_NVIDIA, RenderPearl (MIT) enables GL_NV_gpu_shader5 and its 16-bit integer types (prelude/compat.glsl), and 9 more of its programs failed to translate (Expected RightParen, found Identifier("i16vec2")).

The vendor, renderer and mipmap macros come from the renderer (Macros::define_renderer, called by Renderer::define_pack_macros), so they reach packs when a pack loads, like the subgroup extension macros.

Measured over Modrinth's 40 most-downloaded shader packs, each macro alone against main c1f308fe6:

  • Translation (real_packs, SHOW_ERRORS=1): every diagnostic and skipped program is the same as on main (313 skipped, composite-style 1509 ok / 45 failing), for each macro and for the whole change.
  • Which packs' code a macro changes (a hash of each stage file after preprocessing, nothing printed): GL 330, MC_MIPMAP_LEVEL and the OTHER vendor/renderer change no file of any of the 40 packs. IRIS_VERSION changes Complementary Reimagined/Unbound, Spooklementary, Rethinking Voxels, Noble and both Fantasy builds; IRIS_HAS_TRANSLUCENCY_SORTING changes 6 files of each Complementary.
  • Pictures for those 7 packs (fast build, 3 scenes), main vs this change vs Iris 1.11.7: the change stays within run-to-run noise (mean difference 0.0–1.8) and the distance to Iris is unchanged (±0.4; e.g. Complementary Reimagined 11.2 / 8.4 / 0.8 on both).

Tests: programs_see_the_versions_iris_reports, programs_see_the_renderers_vendor_and_mipmap_levels (both fail on main).

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: OptiFine's shaders.txt (Standard Macros, A–I), and black-box runs of Iris 1.11.7 with probe packs of our own.

Other projects' code

RenderPearl v2.7.2 (MIT; github.com/Luracasmus/renderpearl@86de79c4fa/shaders/prelude/compat.glsl, tag v2.7.2, the same file as in the Modrinth v2.7.2 zip): read shaders/prelude/compat.glsl to see why the vendor macro broke it. Nothing copied. No Iris, OptiFine or other pack code read; the other packs were only run as black boxes.

Self-check

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

Check Result
Scope ✅ 2 files, +74 −6
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 610 run, FAILED (failures=1, skipped=1) (31 s)
rustfmt ✅ (6 s)
clippy ✅ (1 min 33 s)
tests: horizon-client-render, horizon-shaders ❌ 1082 passed, 1 failed (1 min 12 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)

The two ❌ fail the same way on main c1f308fe6 with this branch's files reverted (checked on this machine): gfx::entity_skin::tests::the_shader_writes_what_the_cpu_reference_computes (one float ULP apart on this GPU) and tests/test_world_input_capture.py (input_trace not found when it builds its native-mouse snippet).

🤖 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/6934 **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/iris-standard-macros` --- ### 📝 Commits (2) - [`5a54774`](https://github.com/horizon-rust/horizon/commit/5a54774bf7dd9e1094633294f07e2035fa6f718b) Shader packs: the standard macros Iris 1.11.7 defines - [`9467453`](https://github.com/horizon-rust/horizon/commit/946745362c3b4a868523dee0c456acbefb487ccc) Merge main into #6934 ### 📊 Changes **2 files changed** (+73 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+4 -2) 📝 `crates/horizon-shaders/src/macros.rs` (+69 -18) </details> ### 📄 Description > 🤖 Opened by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally. ## What and why Fixes #6881. Packs choose their code paths with the standard macros; Horizon's differed from what Iris 1.11.7 defines. What Iris defines was observed black-box with probe packs written for this: each stripe of the `final` pass is green or red for a defined macro, or carries a macro's value in the colour's bytes; run in Iris 1.11.7 + Sodium 0.9.2 on 26.3 (Linux, NVIDIA), with Mipmap Levels 4 and 2, and with the pack's `#version` 330 and 460. | Macro | Iris 1.11.7 | Horizon before | Here | |---|---|---|---| | `MC_GL_VERSION`, `MC_GLSL_VERSION` | 330 (also under `#version 460`) | 460 | 330 | | `IRIS_VERSION` | 11107 | – | 11107 | | `IRIS_HAS_TRANSLUCENCY_SORTING` | defined | – | defined (Horizon sorts translucent terrain as vanilla does, `gfx/translucency.rs`) | | `MC_MIPMAP_LEVEL` | the Mipmap Levels option (4, 2) | – | the renderer's mipmap levels | | `MC_GL_VENDOR_*`, `MC_GL_RENDERER_*` | `NVIDIA`, `OTHER` | none | `OTHER`, `OTHER` | | `IRIS_TAG_SUPPORT` | 2 | – | – (block tags are not read yet: `block_ids.rs`) | | `MAX_COLOR_BUFFERS` | 32 | 16 | 16 (Horizon has 16 colortex buffers) | The GL vendor: OptiFine's shaders.txt (E, F) defines one vendor and one renderer. Horizon draws through wgpu, not a GL driver, so it says `OTHER`: packs take driver extensions behind the vendor macro. With `MC_GL_VENDOR_NVIDIA`, RenderPearl (MIT) enables `GL_NV_gpu_shader5` and its 16-bit integer types (`prelude/compat.glsl`), and 9 more of its programs failed to translate (`Expected RightParen, found Identifier("i16vec2")`). The vendor, renderer and mipmap macros come from the renderer (`Macros::define_renderer`, called by `Renderer::define_pack_macros`), so they reach packs when a pack loads, like the subgroup extension macros. **Measured** over Modrinth's 40 most-downloaded shader packs, each macro alone against main c1f308fe6: - Translation (`real_packs`, `SHOW_ERRORS=1`): every diagnostic and skipped program is the same as on main (313 skipped, composite-style 1509 ok / 45 failing), for each macro and for the whole change. - Which packs' code a macro changes (a hash of each stage file after preprocessing, nothing printed): GL 330, `MC_MIPMAP_LEVEL` and the `OTHER` vendor/renderer change no file of any of the 40 packs. `IRIS_VERSION` changes Complementary Reimagined/Unbound, Spooklementary, Rethinking Voxels, Noble and both Fantasy builds; `IRIS_HAS_TRANSLUCENCY_SORTING` changes 6 files of each Complementary. - Pictures for those 7 packs (fast build, 3 scenes), main vs this change vs Iris 1.11.7: the change stays within run-to-run noise (mean difference 0.0–1.8) and the distance to Iris is unchanged (±0.4; e.g. Complementary Reimagined 11.2 / 8.4 / 0.8 on both). Tests: `programs_see_the_versions_iris_reports`, `programs_see_the_renderers_vendor_and_mipmap_levels` (both fail on main). ## 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: OptiFine's `shaders.txt` (Standard Macros, A–I), and black-box runs of Iris 1.11.7 with probe packs of our own. ## Other projects' code RenderPearl v2.7.2 (MIT; https://github.com/Luracasmus/renderpearl/blob/86de79c4fa7d07fb47628dd9620efb10fb4be9d9/shaders/prelude/compat.glsl, tag v2.7.2, the same file as in the Modrinth v2.7.2 zip): read `shaders/prelude/compat.glsl` to see why the vendor macro broke it. Nothing copied. No Iris, OptiFine or other pack code read; the other packs were only run as black boxes. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on plony-pc, against origin/main at c1f308fe6, 3 min 22 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +74 −6 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 610 run, FAILED (failures=1, skipped=1) (31 s) | | rustfmt | ✅ (6 s) | | clippy | ✅ (1 min 33 s) | | tests: horizon-client-render, horizon-shaders | ❌ 1082 passed, 1 failed (1 min 12 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) | The two ❌ fail the same way on main c1f308fe6 with this branch's files reverted (checked on this machine): `gfx::entity_skin::tests::the_shader_writes_what_the_cpu_reference_computes` (one float ULP apart on this GPU) and `tests/test_world_input_capture.py` (`input_trace` not found when it builds its native-mouse snippet). 🤖 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:44 +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#7207
No description provided.