[PR #4444] [MERGED] Shader packs 4/12: translate compute programs, size.buffer, options in shaders.properties #5626

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/4444
Author: @PzmuV1517
Created: 10/30/2026
Status: ✅ Merged
Merged: 10/31/2026
Merged by: @ludovic111

Base: main ← Head: shader-packs/04


📝 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
  • 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
  • b8f4137 Shader packs: 1D stand-ins, samplers check a custom texture's type, pack_textures is tested
  • e472d6f Shader packs: shaders.properties sees the pack's options, images wait for compute programs

📊 Changes

19 files changed (+1945 additions, -144 deletions)

View changed files

📝 Cargo.lock (+3 -0)
📝 crates/horizon-client-render/Cargo.toml (+1 -0)
📝 crates/horizon-client-render/src/gfx.rs (+1 -0)
📝 crates/horizon-client-render/src/gfx/pack_post.rs (+210 -63)
➕ crates/horizon-client-render/src/gfx/pack_textures.rs (+339 -0)
📝 crates/horizon-client/src/game/shader_packs.rs (+4 -1)
📝 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 (+319 -21)
📝 crates/horizon-shaders/src/translate/rewrite.rs (+22 -1)
📝 crates/horizon-shaders/src/translate/scan.rs (+139 -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 4 of 12 of the shader pack work from #3737. It builds on part 3 (#4443): this branch is that one plus the commits below, so review only these:

  • e944268c3 Shader packs: translate compute programs, read size.buffer, options in shaders.properties
  • 8f6c9f7d0 Shader packs: work group sizes a compute program can't use are refused, buffer sizes bounded
  • e472d6f7e Shader packs: shaders.properties sees the pack's options, images wait for compute programs

What and why

translate compute programs, read size.buffer, options in shaders.properties (e944268c3)

  • Compute programs (.csh, then _a to _z) are translated and carried before their composite-style program: images (colorimgN in its own format), workGroups and workGroupsRender, shared memory, barriers and subgroups. Compute-only programs are noted as not supported yet. Nothing dispatches them yet.
  • size.buffer.: a size of its own, relative to the render size (floats) or in pixels (integers).
  • shaders.properties and the program switches see the pack's options at their defaults (switches on, value options): Photon sizes its cloud buffers only under #if CLOUDS_TEMPORAL_UPSCALING == 4.
  • naga: subgroup operations, memory barriers, and barrier() as a work group barrier.

work group sizes a compute program can't use are refused, buffer sizes bounded (8f6c9f7d0)

workGroups needs three numbers and workGroupsRender two (or three, the last taken as 1);
another count fails the program with that message instead of running it 1x1. size.buffer.*
factors must be finite and positive, and every size resolves to at most 8192.

shaders.properties sees the pack's options, images wait for compute programs (e472d6f7e)

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 45 s)

Check Result
Scope ⚠️ 177 files, +122252 −155; 122285 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 (24 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 ✅ (39 s)
tests: workspace ❌ 2562 passed, 7 failed (1 min 11 s)
doc tests ✅ 0 passed (4 s)
content root tests ✅ 7 passed (18 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.

🔄 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/4444 **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/04` --- ### 📝 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 - [`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 - [`b8f4137`](https://github.com/horizon-rust/horizon/commit/b8f4137e2c1bb91386188d8124ebeeb47bd792aa) Shader packs: 1D stand-ins, samplers check a custom texture's type, pack_textures is tested - [`e472d6f`](https://github.com/horizon-rust/horizon/commit/e472d6f7e7556a99e2f3c674f8babde68985f100) Shader packs: shaders.properties sees the pack's options, images wait for compute programs ### 📊 Changes **19 files changed** (+1945 additions, -144 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` (+1 -0) 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+210 -63) ➕ `crates/horizon-client-render/src/gfx/pack_textures.rs` (+339 -0) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+4 -1) 📝 `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` (+319 -21) 📝 `crates/horizon-shaders/src/translate/rewrite.rs` (+22 -1) 📝 `crates/horizon-shaders/src/translate/scan.rs` (+139 -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 4 of 12 of the shader pack work from #3737. It builds on part 3 (#4443): this branch is that one plus the commits below, so review only these: - `e944268c3` Shader packs: translate compute programs, read size.buffer, options in shaders.properties - `8f6c9f7d0` Shader packs: work group sizes a compute program can't use are refused, buffer sizes bounded - `e472d6f7e` Shader packs: shaders.properties sees the pack's options, images wait for compute programs ## What and why **translate compute programs, read size.buffer, options in shaders.properties** (`e944268c3`) - Compute programs (<name>.csh, then _a to _z) are translated and carried before their composite-style program: images (colorimgN in its own format), workGroups and workGroupsRender, shared memory, barriers and subgroups. Compute-only programs are noted as not supported yet. Nothing dispatches them yet. - size.buffer.<buffer>: a size of its own, relative to the render size (floats) or in pixels (integers). - shaders.properties and the program switches see the pack's options at their defaults (switches on, value options): Photon sizes its cloud buffers only under #if CLOUDS_TEMPORAL_UPSCALING == 4. - naga: subgroup operations, memory barriers, and barrier() as a work group barrier. **work group sizes a compute program can't use are refused, buffer sizes bounded** (`8f6c9f7d0`) workGroups needs three numbers and workGroupsRender two (or three, the last taken as 1); another count fails the program with that message instead of running it 1x1. size.buffer.* factors must be finite and positive, and every size resolves to at most 8192. **shaders.properties sees the pack's options, images wait for compute programs** (`e472d6f7e`) ## 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 45 s) | Check | Result | | --- | --- | | Scope | ⚠️ 177 files, +122252 −155; 122285 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 (24 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 | ✅ (39 s) | | tests: workspace | ❌ 2562 passed, 7 failed (1 min 11 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ✅ 7 passed (18 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. --- <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#5626
No description provided.