[PR #4445] [MERGED] Shader packs 5/12: run compute programs, buffer sizes, the pack's own sky #5627

Closed
opened 2026-11-03 05:13:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: shader-packs/05


📝 Commits (10+)

  • d085cab Shader packs: outputs narrower than vec4, inverse(), alphaTestRef and the cutout test
  • 6b0f026 Shader packs: read custom textures (texture.*)
  • 1763989 Shader packs: a raw texture's sizes are bounded and checked
  • 6485363 Shader packs: a pack that defines its own inverse() keeps it
  • e654965 Shader packs: draw custom textures, and what Photon needed to render in game
  • e944268 Shader packs: translate compute programs, read size.buffer, options in shaders.properties
  • e75b7ff Shader packs: run compute programs, buffer sizes and the pack's own sky
  • ec259a2 Shader packs: a custom texture over the device's limits is skipped with a note
  • 8f6c9f7 Shader packs: work group sizes a compute program can't use are refused, buffer sizes bounded
  • 83c30ba Shader packs: draw passes sample their copies too, and a sky program that writes nothing hides vanilla's

📊 Changes

19 files changed (+2460 additions, -212 deletions)

View changed files

📝 Cargo.lock (+3 -0)
📝 crates/horizon-client-render/Cargo.toml (+1 -0)
📝 crates/horizon-client-render/src/gfx.rs (+34 -3)
📝 crates/horizon-client-render/src/gfx/pack_post.rs (+709 -127)
➕ crates/horizon-client-render/src/gfx/pack_textures.rs (+339 -0)
📝 crates/horizon-client/src/game/shader_packs.rs (+7 -2)
📝 crates/horizon-shaders/Cargo.toml (+2 -0)
📝 crates/horizon-shaders/src/lib.rs (+11 -5)
📝 crates/horizon-shaders/src/options.rs (+68 -22)
📝 crates/horizon-shaders/src/pack.rs (+2 -2)
📝 crates/horizon-shaders/src/post.rs (+155 -4)
➕ crates/horizon-shaders/src/textures.rs (+427 -0)
📝 crates/horizon-shaders/src/translate/mod.rs (+306 -21)
📝 crates/horizon-shaders/src/translate/rewrite.rs (+22 -1)
📝 crates/horizon-shaders/src/translate/scan.rs (+132 -14)
📝 crates/horizon-shaders/tests/real_packs.rs (+18 -2)
📝 third_party/naga/src/front/glsl/builtins.rs (+207 -1)
📝 third_party/naga/src/front/glsl/functions.rs (+4 -5)
📝 third_party/naga/src/front/glsl/variables.rs (+13 -3)

📄 Description

Part 5 of 12 of the shader pack work from #3737. It builds on part 4 (#4444): this branch is that one plus the commits below, so review only these:

  • e75b7ff98 Shader packs: run compute programs, buffer sizes and the pack's own sky
  • 83c30ba17 Shader packs: draw passes sample their copies too, and a sky program that writes nothing hides vanilla's
  • a48662db3 Shader packs: a pass whose buffers differ in size is skipped, images bind in every program

What and why

run compute programs, buffer sizes and the pack's own sky (e75b7ff98)

  • Compute programs dispatch before their composite-style program, over workGroups or workGroupsRender times the target's size; their images bind the side colortexN reads, and a pass that samples and stores one buffer samples a copy taken first. The MC_GL_KHR_shader_subgroup_* macros are defined when the device has subgroups.
  • size.buffer: a pass draws at the size of the buffers it writes, and those buffers clear apart from the blit.
  • A gbuffers_skybasic or gbuffers_skytextured that writes nothing still hides vanilla's sky or sun and moon, and the world's background is colortex0's clear colour when the pack sets it: vanilla's fog colour was added to Photon's sky, and hid its stars.

Photon v1.4 at 2560x1440 on an M5: 8 to 50 FPS (GPU 125 to 21.5 ms), its sky light from the compute program, quarter-resolution clouds.

draw passes sample their copies too, and a sky program that writes nothing hides vanilla's (83c30ba17)

A composite or deferred program that samples colortexN and stores to colorimgN now samples
a copy taken before it runs, as compute programs did; it sampled an empty texture. Whether
vanilla's sky and sun are drawn depends on the pack having the program, not on it building a
pass.

a pass whose buffers differ in size is skipped, images bind in every program (a48662db3)

Vanilla reference

Horizon-only: vanilla has no shader packs. Nothing changes unless a pack is selected.

Self-check

pr_ready (tools/pr_ready.py --quick on Mac, against origin/main at 27cb8f96b, 2 min 17 s)

Check Result
Scope ⚠️ 177 files, +122767 −223; 122868 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ✅ 495 passed (25 s)
rustfmt ✅ (4 s)
Rust ⚠️ 1.98.1 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with rustup update
clippy ✅ (31 s)
tests: workspace ❌ 2187 passed, 1 failed (49 s)
doc tests ✅ 0 passed (4 s)
content root tests ✅ 7 passed (19 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅
launcher clippy ✅ (1 s)
launcher tests ❌ 315 passed, 1 failed (3 s)
Parity ➖ 359 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 347 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Failures that aren't from this stack:

  • The horizon-port-pack resource pack tests and the launcher's modpacks::tests::resource_only_profile_can_play_without_enabling_or_overwriting_packs fail with "/var: not an ordinary directory" on macOS, where /var is a symlink. The resource pack tests fail the same way on main itself, and this stack changes neither horizon-port-pack nor the launcher.
  • gfx::frame_gen::optical_flow::tests::finds_a_shift_and_a_scene_change is main's and fails now and then in a full run on this machine, on main too (1 of 5 runs); nothing here touches it. When it fails first, cargo stops before the horizon-port-pack tests.

🔄 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/4445 **Author:** [@PzmuV1517](https://github.com/PzmuV1517) **Created:** 10/30/2026 **Status:** ✅ Merged **Merged:** 10/31/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `shader-packs/05` --- ### 📝 Commits (10+) - [`d085cab`](https://github.com/horizon-rust/horizon/commit/d085cabe41a8bcd8146c93c31eb1ea95e2b6b5e1) Shader packs: outputs narrower than vec4, inverse(), alphaTestRef and the cutout test - [`6b0f026`](https://github.com/horizon-rust/horizon/commit/6b0f0261e9b31a16528275fdcccc8170534b2fb6) Shader packs: read custom textures (texture.*) - [`1763989`](https://github.com/horizon-rust/horizon/commit/17639892ece3aa3aa3313a73e752b96fc50b368a) Shader packs: a raw texture's sizes are bounded and checked - [`6485363`](https://github.com/horizon-rust/horizon/commit/6485363dc2516cf9ea5c6e3ed0296646577aaa74) Shader packs: a pack that defines its own inverse() keeps it - [`e654965`](https://github.com/horizon-rust/horizon/commit/e65496594f9a4c9772aaebc3e9b4c7288a8b3fa7) Shader packs: draw custom textures, and what Photon needed to render in game - [`e944268`](https://github.com/horizon-rust/horizon/commit/e944268c3eb49c61062f788dec00c1e711d0b560) Shader packs: translate compute programs, read size.buffer, options in shaders.properties - [`e75b7ff`](https://github.com/horizon-rust/horizon/commit/e75b7ff982c29a6f3c3521de2b2c43b24aadc4b0) Shader packs: run compute programs, buffer sizes and the pack's own sky - [`ec259a2`](https://github.com/horizon-rust/horizon/commit/ec259a221a91ff01abbc84f3ff9bdc93261d6bb7) Shader packs: a custom texture over the device's limits is skipped with a note - [`8f6c9f7`](https://github.com/horizon-rust/horizon/commit/8f6c9f7d0cdd4ad206148e9f99cb23212e916952) Shader packs: work group sizes a compute program can't use are refused, buffer sizes bounded - [`83c30ba`](https://github.com/horizon-rust/horizon/commit/83c30ba172dafcda3fa775914f288167b1647f5a) Shader packs: draw passes sample their copies too, and a sky program that writes nothing hides vanilla's ### 📊 Changes **19 files changed** (+2460 additions, -212 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+3 -0) 📝 `crates/horizon-client-render/Cargo.toml` (+1 -0) 📝 `crates/horizon-client-render/src/gfx.rs` (+34 -3) 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+709 -127) ➕ `crates/horizon-client-render/src/gfx/pack_textures.rs` (+339 -0) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+7 -2) 📝 `crates/horizon-shaders/Cargo.toml` (+2 -0) 📝 `crates/horizon-shaders/src/lib.rs` (+11 -5) 📝 `crates/horizon-shaders/src/options.rs` (+68 -22) 📝 `crates/horizon-shaders/src/pack.rs` (+2 -2) 📝 `crates/horizon-shaders/src/post.rs` (+155 -4) ➕ `crates/horizon-shaders/src/textures.rs` (+427 -0) 📝 `crates/horizon-shaders/src/translate/mod.rs` (+306 -21) 📝 `crates/horizon-shaders/src/translate/rewrite.rs` (+22 -1) 📝 `crates/horizon-shaders/src/translate/scan.rs` (+132 -14) 📝 `crates/horizon-shaders/tests/real_packs.rs` (+18 -2) 📝 `third_party/naga/src/front/glsl/builtins.rs` (+207 -1) 📝 `third_party/naga/src/front/glsl/functions.rs` (+4 -5) 📝 `third_party/naga/src/front/glsl/variables.rs` (+13 -3) </details> ### 📄 Description Part 5 of 12 of the shader pack work from #3737. It builds on part 4 (#4444): this branch is that one plus the commits below, so review only these: - `e75b7ff98` Shader packs: run compute programs, buffer sizes and the pack's own sky - `83c30ba17` Shader packs: draw passes sample their copies too, and a sky program that writes nothing hides vanilla's - `a48662db3` Shader packs: a pass whose buffers differ in size is skipped, images bind in every program ## What and why **run compute programs, buffer sizes and the pack's own sky** (`e75b7ff98`) - Compute programs dispatch before their composite-style program, over workGroups or workGroupsRender times the target's size; their images bind the side colortexN reads, and a pass that samples and stores one buffer samples a copy taken first. The MC_GL_KHR_shader_subgroup_* macros are defined when the device has subgroups. - size.buffer: a pass draws at the size of the buffers it writes, and those buffers clear apart from the blit. - A gbuffers_skybasic or gbuffers_skytextured that writes nothing still hides vanilla's sky or sun and moon, and the world's background is colortex0's clear colour when the pack sets it: vanilla's fog colour was added to Photon's sky, and hid its stars. Photon v1.4 at 2560x1440 on an M5: 8 to 50 FPS (GPU 125 to 21.5 ms), its sky light from the compute program, quarter-resolution clouds. **draw passes sample their copies too, and a sky program that writes nothing hides vanilla's** (`83c30ba17`) A composite or deferred program that samples colortexN and stores to colorimgN now samples a copy taken before it runs, as compute programs did; it sampled an empty texture. Whether vanilla's sky and sun are drawn depends on the pack having the program, not on it building a pass. **a pass whose buffers differ in size is skipped, images bind in every program** (`a48662db3`) ## Vanilla reference Horizon-only: vanilla has no shader packs. Nothing changes unless a pack is selected. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on Mac, against origin/main at 27cb8f96b, 2 min 17 s) | Check | Result | | --- | --- | | Scope | ⚠️ 177 files, +122767 −223; 122868 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ✅ 495 passed (25 s) | | rustfmt | ✅ (4 s) | | Rust | ⚠️ 1.98.1 is older than CI's stable (1.99): clippy may flag lints CI doesn't, update with `rustup update` | | clippy | ✅ (31 s) | | tests: workspace | ❌ 2187 passed, 1 failed (49 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ✅ 7 passed (19 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ | | launcher clippy | ✅ (1 s) | | launcher tests | ❌ 315 passed, 1 failed (3 s) | | Parity | ➖ 359 affected, to run in CI (--quick): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 347 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Failures that aren't from this stack: - The `horizon-port-pack` resource pack tests and the launcher's `modpacks::tests::resource_only_profile_can_play_without_enabling_or_overwriting_packs` fail with "/var: not an ordinary directory" on macOS, where `/var` is a symlink. The resource pack tests fail the same way on main itself, and this stack changes neither `horizon-port-pack` nor the launcher. - `gfx::frame_gen::optical_flow::tests::finds_a_shift_and_a_scene_change` is main's and fails now and then in a full run on this machine, on main too (1 of 5 runs); nothing here touches it. When it fails first, cargo stops before the `horizon-port-pack` tests. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:13:53 +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#5627
No description provided.