[PR #7244] [MERGED] Shader packs: images no image.* gives read zero instead of skipping the program #7437

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/7244
Author: @arslanarm
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: shaderpacks/missing-images


📝 Commits (3)

  • cdcee20 Shader packs: images no image.* gives read zero instead of skipping the program
  • b94dd92 Merge main into #7244
  • 428e9d9 Shader pack image stand-ins: the test passes main's new storage-buffer minimums

📊 Changes

2 files changed (+250 additions, -17 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx/pack_images.rs (+97 -0)
📝 crates/horizon-client-render/src/gfx/pack_post.rs (+153 -17)

📄 Description

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

What and why

Part of #6812.

A program that declares a storage image that no image.<name> entry gives was skipped, with "image x is not provided yet". With Shrimple v0.12 that skipped gbuffers_water, composite13 and composite17 (dimension 0), for imgLocalBlockMask.

Iris 1.11.7 runs such a program. Its loads read zero, even after it stored into the image (observed with a probe pack of my own). Now:

  • bindings (gfx/pack_post.rs) binds such an image to a stand-in of its declared format and dimension (Image::StandIn), and notes "image x has no image.x; it reads zero". This applies to the image a compute program reads as its copy too.
  • pack_images::StandIn is a single texel, one per format and dimension, made after the passes are built. It is zeroed (a copy from a zero buffer) before every pass that binds it. Accesses to other texels are out of bounds; with the probe pack on Vulkan, those loads read zero.

How the cause was found (black-box only)

  1. The game's log on main (fbb17c980), Shrimple, 3 scenes: gbuffers_water, composite13 and composite17 each logged "image imgLocalBlockMask is not provided yet". There was no "image.…: not an image" note, so Horizon had read no image.imgLocalBlockMask key.
  2. From Horizon's code, bindings returns None for an image with no image.* entry (not a buffer's colorimgN). That skips the pass.
  3. I wrote a probe pack, noimage, with a composite that declares layout(rgba8) image2D and layout(r32ui) uimage3D. No image.* declares either. It loads from both, stores into one and calls imageAtomicOr on the other, and paints one stripe per value.
    • Iris 1.11.7: the program runs, and the loads read 0 (rgb 0, alpha 0, uint 0).
    • Horizon main: "composite: image imgMissing is not provided yet", the program is skipped, and the world shows.
    • This branch: the same stripes as Iris.
  4. Before that, I checked whether Horizon reads shaders.properties conditionals as Iris does, with three probe packs of my own (feature flags in properties, feature flags in GLSL, option forms). All the forms I probed matched except one: Iris defines its IRIS_FEATURE_* flags in shaders.properties whether or not the pack lists them. A fix for that left Shrimple's real_packs output unchanged, so it is not part of this.

I did not open, extract, or read any pack's files, nor Horizon's preprocessed or translated text of any pack. Everything about Shrimple above comes from real_packs output, the game's ordinary log, screenshots, and the text of issue #6812.

Measured

  • real_packs (SHOW_ERRORS=1, main fbb17c980 vs this branch): identical apart from timings, for Shrimple alone and for 37 of the 40 packs (all but FastPBR, Kappa and Nostalgia, which this machine's rules keep from being run). This changes only the renderer, which real_packs doesn't reach.
  • In the game (fast builds, Xvfb, fresh homes, scenes ow_ground_noon, ow_ground_sunset, ow_ground_night), the log's differences from main:
    • the three "not provided yet" notes become "has no image.imgLocalBlockMask; it reads zero";
    • world0 runs 42 programs instead of 40 (composite13 and composite17 are added);
    • "translucent terrain draws with gbuffers_water" is new.
  • The picture is still almost black, as on main. Mean absolute difference to Iris 1.11.7, in 0..255, main → this branch: noon 92.8 → 92.4, sunset 58.6 → 58.4, night 12.8 → 12.8. So this does not make Shrimple look right yet, and there are no screenshots.

Tests

gfx::pack_post::tests::an_image_without_an_entry_reads_zero: an interface with two uimage3D r32ui images and one image2D rgba8 image, none of which an image.* gives. On main bindings returns None (the pass is skipped). Here the pass keeps them as stand-ins: two formats give two stand-ins, with a note for each. A stand-in holding 7 reads 0 after clear. With clear made a no-op the test fails ([7, 0, 0, 0]). It needs a GPU and returns early without one, like a_shader_compiler_panic_skips_the_pass. The test uses the new stand-in API, so it doesn't build on main; it was not run there.

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:

  • ShaderDoc's "Custom Images", where an image is declared by image.<name>.
  • Black-box runs of Iris 1.11.7 with a probe pack of my own.

Other projects' code

none. No Iris, OptiFine or pack code read; Shrimple was only run as a black box.

Self-check

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

Check Result
Scope ✅ 2 files, +247 −17
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 612 passed (36 s)
rustfmt ✅ (7 s)
clippy ✅ (23 s)
tests: horizon-client-render ✅ 1157 passed (36 s)
doc tests ✅ 0 passed (1 s)
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/7244 **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/missing-images` --- ### 📝 Commits (3) - [`cdcee20`](https://github.com/horizon-rust/horizon/commit/cdcee209cb1e62198f84ffb930c5518e5cf9f011) Shader packs: images no image.* gives read zero instead of skipping the program - [`b94dd92`](https://github.com/horizon-rust/horizon/commit/b94dd927e137d89885e468f78a647fcbcb214efd) Merge main into #7244 - [`428e9d9`](https://github.com/horizon-rust/horizon/commit/428e9d94d130fce4509ec698de8073d682e39e26) Shader pack image stand-ins: the test passes main's new storage-buffer minimums ### 📊 Changes **2 files changed** (+250 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx/pack_images.rs` (+97 -0) 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+153 -17) </details> ### 📄 Description > 🤖 Opened by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally. ## What and why Part of #6812. A program that declares a storage image that no `image.<name>` entry gives was skipped, with "image `x` is not provided yet". With Shrimple v0.12 that skipped `gbuffers_water`, `composite13` and `composite17` (dimension 0), for `imgLocalBlockMask`. Iris 1.11.7 runs such a program. Its loads read zero, even after it stored into the image (observed with a probe pack of my own). Now: - `bindings` (`gfx/pack_post.rs`) binds such an image to a stand-in of its declared format and dimension (`Image::StandIn`), and notes "image `x` has no `image.x`; it reads zero". This applies to the image a compute program reads as its copy too. - `pack_images::StandIn` is a single texel, one per format and dimension, made after the passes are built. It is zeroed (a copy from a zero buffer) before every pass that binds it. Accesses to other texels are out of bounds; with the probe pack on Vulkan, those loads read zero. ### How the cause was found (black-box only) 1. The game's log on main (fbb17c980), Shrimple, 3 scenes: `gbuffers_water`, `composite13` and `composite17` each logged "image `imgLocalBlockMask` is not provided yet". There was no "`image.…`: not an image" note, so Horizon had read no `image.imgLocalBlockMask` key. 2. From Horizon's code, `bindings` returns `None` for an image with no `image.*` entry (not a buffer's `colorimgN`). That skips the pass. 3. I wrote a probe pack, `noimage`, with a `composite` that declares `layout(rgba8) image2D` and `layout(r32ui) uimage3D`. No `image.*` declares either. It loads from both, stores into one and calls `imageAtomicOr` on the other, and paints one stripe per value. - Iris 1.11.7: the program runs, and the loads read 0 (rgb 0, alpha 0, uint 0). - Horizon main: "composite: image `imgMissing` is not provided yet", the program is skipped, and the world shows. - This branch: the same stripes as Iris. 4. Before that, I checked whether Horizon reads `shaders.properties` conditionals as Iris does, with three probe packs of my own (feature flags in properties, feature flags in GLSL, option forms). All the forms I probed matched except one: Iris defines its `IRIS_FEATURE_*` flags in `shaders.properties` whether or not the pack lists them. A fix for that left Shrimple's `real_packs` output unchanged, so it is not part of this. I did not open, extract, or read any pack's files, nor Horizon's preprocessed or translated text of any pack. Everything about Shrimple above comes from `real_packs` output, the game's ordinary log, screenshots, and the text of issue #6812. ### Measured - `real_packs` (`SHOW_ERRORS=1`, main fbb17c980 vs this branch): identical apart from timings, for Shrimple alone and for 37 of the 40 packs (all but FastPBR, Kappa and Nostalgia, which this machine's rules keep from being run). This changes only the renderer, which `real_packs` doesn't reach. - In the game (fast builds, Xvfb, fresh homes, scenes `ow_ground_noon`, `ow_ground_sunset`, `ow_ground_night`), the log's differences from main: - the three "not provided yet" notes become "has no `image.imgLocalBlockMask`; it reads zero"; - `world0` runs 42 programs instead of 40 (`composite13` and `composite17` are added); - "translucent terrain draws with gbuffers_water" is new. - The picture is still almost black, as on main. Mean absolute difference to Iris 1.11.7, in 0..255, main → this branch: noon 92.8 → 92.4, sunset 58.6 → 58.4, night 12.8 → 12.8. So this does not make Shrimple look right yet, and there are no screenshots. ### Tests `gfx::pack_post::tests::an_image_without_an_entry_reads_zero`: an interface with two `uimage3D r32ui` images and one `image2D rgba8` image, none of which an `image.*` gives. On main `bindings` returns `None` (the pass is skipped). Here the pass keeps them as stand-ins: two formats give two stand-ins, with a note for each. A stand-in holding 7 reads 0 after `clear`. With `clear` made a no-op the test fails (`[7, 0, 0, 0]`). It needs a GPU and returns early without one, like `a_shader_compiler_panic_skips_the_pass`. The test uses the new stand-in API, so it doesn't build on main; it was not run there. ## 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: - ShaderDoc's "Custom Images", where an image is declared by `image.<name>`. - Black-box runs of Iris 1.11.7 with a probe pack of my own. ## Other projects' code none. No Iris, OptiFine or pack code read; Shrimple was only run as a black box. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on plony-pc, against origin/main at fbb17c980, 1 min 43 s) | Check | Result | | --- | --- | | Scope | ✅ 2 files, +247 −17 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 612 passed (36 s) | | rustfmt | ✅ (7 s) | | clippy | ✅ (23 s) | | tests: horizon-client-render | ✅ 1157 passed (36 s) | | doc tests | ✅ 0 passed (1 s) | | 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#7437
No description provided.