[PR #4447] [MERGED] Shader packs 7/12: bind storage buffers, images and atomics; compute-only programs #5629

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

📋 Pull Request Information

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

Base: main ← Head: shader-packs/07


📝 Commits (10+)

  • c29967b Shader packs: macro calls whose arguments span lines
  • 914e5d0 Vendor naga 30.0.1 unchanged
  • a59d378 Shader packs: struct varyings, Vulkan type names as identifiers, naga's GLSL gaps
  • 6edd81d Shader packs: a continued property value stops where its branch does
  • 3e1641b Shader packs: a directive ends a continued property value
  • 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
  • 01664d4 Shader packs: matrix elements in custom uniforms are m.column.row

📊 Changes

181 files changed (+123890 additions, -260 deletions)

View changed files

📝 Cargo.lock (+3 -2)
📝 Cargo.toml (+3 -1)
📝 THIRD_PARTY_NOTICES.md (+6 -0)
📝 crates/horizon-client-render/Cargo.toml (+1 -0)
📝 crates/horizon-client-render/src/gfx.rs (+39 -3)
📝 crates/horizon-client-render/src/gfx/pack_hand.rs (+4 -5)
➕ crates/horizon-client-render/src/gfx/pack_images.rs (+238 -0)
📝 crates/horizon-client-render/src/gfx/pack_post.rs (+949 -144)
➕ crates/horizon-client-render/src/gfx/pack_textures.rs (+339 -0)
📝 crates/horizon-client-render/src/gfx/pack_uniforms.rs (+4 -3)
📝 crates/horizon-client/src/game/shader_packs.rs (+10 -2)
📝 crates/horizon-shaders/Cargo.toml (+2 -0)
📝 crates/horizon-shaders/src/custom.rs (+6 -5)
📝 crates/horizon-shaders/src/lib.rs (+11 -5)
📝 crates/horizon-shaders/src/macros.rs (+62 -0)
📝 crates/horizon-shaders/src/options.rs (+68 -22)
📝 crates/horizon-shaders/src/pack.rs (+2 -2)
📝 crates/horizon-shaders/src/post.rs (+333 -8)
📝 crates/horizon-shaders/src/preprocess.rs (+33 -0)
📝 crates/horizon-shaders/src/properties.rs (+27 -5)

...and 80 more files

📄 Description

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

  • 19f894495 Shader packs: bind storage buffers and custom images, and atomics on them
  • dd028c594 Shader packs: compute-only programs
  • eb54435be Shader packs: real_packs prints a program's bindings with PRINT_PROGRAM
  • 026faad74 Shader packs: images clear before the shadow programs write them, buffers stay within the device's limits
  • 0a19224cf Shader packs: images a GPU can't make are left out, a resize rebinds every pass

What and why

bind storage buffers and custom images, and atomics on them (19f894495)

  • Storage buffers are zeroed once and kept across frames, bound in set 4 to every program that declares the buffer block.
  • The pack's images are made at their size, cleared before each frame when asked, and bound as images by name and as textures by their sampler name.
  • Images an atomic function uses bind for atomics; the device asks for texture atomics, storage buffers in vertex shaders and texture clears where the GPU has them.

Rethinking Voxels r0.1-beta9 loads 10 programs and draws; its shadow pass (a geometry stage) and compute-only programs remain.

compute-only programs (dd028c594)

A prepare, deferred, composite or shadowcomp program of compute stages only (.csh without .vsh and .fsh) runs its stages in order where the program would draw. shadowcomp programs also run the compute stages they carry.

real_packs prints a program's bindings with PRINT_PROGRAM (eb54435be)

images clear before the shadow programs write them, buffers stay within the device's limits (026faad74)

Clearing image.* happened after the shadow and shadowcomp programs ran, wiping what they
stored; it now opens the frame. A bufferObject.* larger than the device binds is made at the
largest size it takes, with a warning, and its per-pixel size no longer overflows.

images a GPU can't make are left out, a resize rebinds every pass (0a19224cf)

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

Check Result
Scope ⚠️ 181 files, +123890 −260; 124009 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 ✅ (32 s)
tests: workspace ❌ 2562 passed, 7 failed (1 min 1 s)
doc tests ✅ 0 passed (4 s)
content root tests ✅ 7 passed (17 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
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/4447 **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/07` --- ### 📝 Commits (10+) - [`c29967b`](https://github.com/horizon-rust/horizon/commit/c29967b1aa69a50d4ef3d3223523431e2fb4b8f6) Shader packs: macro calls whose arguments span lines - [`914e5d0`](https://github.com/horizon-rust/horizon/commit/914e5d01039326ccbd9b581ac108342549435d0b) Vendor naga 30.0.1 unchanged - [`a59d378`](https://github.com/horizon-rust/horizon/commit/a59d378bf4603f8ff54dd5d730b6b517b35752e7) Shader packs: struct varyings, Vulkan type names as identifiers, naga's GLSL gaps - [`6edd81d`](https://github.com/horizon-rust/horizon/commit/6edd81d368eb98e6551e35d5bc8f2ac3287daeac) Shader packs: a continued property value stops where its branch does - [`3e1641b`](https://github.com/horizon-rust/horizon/commit/3e1641b754d0179734d1cc6c0c55b82a091571f8) Shader packs: a directive ends a continued property value - [`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 - [`01664d4`](https://github.com/horizon-rust/horizon/commit/01664d49f58960493ba53326ce189c7010753bbc) Shader packs: matrix elements in custom uniforms are m.column.row ### 📊 Changes **181 files changed** (+123890 additions, -260 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+3 -2) 📝 `Cargo.toml` (+3 -1) 📝 `THIRD_PARTY_NOTICES.md` (+6 -0) 📝 `crates/horizon-client-render/Cargo.toml` (+1 -0) 📝 `crates/horizon-client-render/src/gfx.rs` (+39 -3) 📝 `crates/horizon-client-render/src/gfx/pack_hand.rs` (+4 -5) ➕ `crates/horizon-client-render/src/gfx/pack_images.rs` (+238 -0) 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+949 -144) ➕ `crates/horizon-client-render/src/gfx/pack_textures.rs` (+339 -0) 📝 `crates/horizon-client-render/src/gfx/pack_uniforms.rs` (+4 -3) 📝 `crates/horizon-client/src/game/shader_packs.rs` (+10 -2) 📝 `crates/horizon-shaders/Cargo.toml` (+2 -0) 📝 `crates/horizon-shaders/src/custom.rs` (+6 -5) 📝 `crates/horizon-shaders/src/lib.rs` (+11 -5) 📝 `crates/horizon-shaders/src/macros.rs` (+62 -0) 📝 `crates/horizon-shaders/src/options.rs` (+68 -22) 📝 `crates/horizon-shaders/src/pack.rs` (+2 -2) 📝 `crates/horizon-shaders/src/post.rs` (+333 -8) 📝 `crates/horizon-shaders/src/preprocess.rs` (+33 -0) 📝 `crates/horizon-shaders/src/properties.rs` (+27 -5) _...and 80 more files_ </details> ### 📄 Description Part 7 of 12 of the shader pack work from #3737. It builds on part 6 (#4446): this branch is that one plus the commits below, so review only these: - `19f894495` Shader packs: bind storage buffers and custom images, and atomics on them - `dd028c594` Shader packs: compute-only programs - `eb54435be` Shader packs: real_packs prints a program's bindings with PRINT_PROGRAM - `026faad74` Shader packs: images clear before the shadow programs write them, buffers stay within the device's limits - `0a19224cf` Shader packs: images a GPU can't make are left out, a resize rebinds every pass ## What and why **bind storage buffers and custom images, and atomics on them** (`19f894495`) - Storage buffers are zeroed once and kept across frames, bound in set 4 to every program that declares the buffer block. - The pack's images are made at their size, cleared before each frame when asked, and bound as images by name and as textures by their sampler name. - Images an atomic function uses bind for atomics; the device asks for texture atomics, storage buffers in vertex shaders and texture clears where the GPU has them. Rethinking Voxels r0.1-beta9 loads 10 programs and draws; its shadow pass (a geometry stage) and compute-only programs remain. **compute-only programs** (`dd028c594`) A prepare, deferred, composite or shadowcomp program of compute stages only (.csh without .vsh and .fsh) runs its stages in order where the program would draw. shadowcomp programs also run the compute stages they carry. **real_packs prints a program's bindings with PRINT_PROGRAM** (`eb54435be`) **images clear before the shadow programs write them, buffers stay within the device's limits** (`026faad74`) Clearing image.* happened after the shadow and shadowcomp programs ran, wiping what they stored; it now opens the frame. A bufferObject.* larger than the device binds is made at the largest size it takes, with a warning, and its per-pixel size no longer overflows. **images a GPU can't make are left out, a resize rebinds every pass** (`0a19224cf`) ## 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 28 s) | Check | Result | | --- | --- | | Scope | ⚠️ 181 files, +123890 −260; 124009 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 | ✅ (32 s) | | tests: workspace | ❌ 2562 passed, 7 failed (1 min 1 s) | | doc tests | ✅ 0 passed (4 s) | | content root tests | ✅ 7 passed (17 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | 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:54 +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#5629
No description provided.