[PR #4446] [MERGED] Shader packs 6/12: uniform fixes, IS_IRIS; read storage buffers and custom images #5628

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

Base: main ← Head: shader-packs/06


📝 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

180 files changed (+123386 additions, -241 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 (+34 -3)
📝 crates/horizon-client-render/src/gfx/pack_hand.rs (+4 -5)
📝 crates/horizon-client-render/src/gfx/pack_post.rs (+713 -129)
➕ 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 (+57 -0)
📝 crates/horizon-shaders/src/options.rs (+68 -22)
📝 crates/horizon-shaders/src/pack.rs (+2 -2)
📝 crates/horizon-shaders/src/post.rs (+315 -4)
📝 crates/horizon-shaders/src/preprocess.rs (+33 -0)
📝 crates/horizon-shaders/src/properties.rs (+27 -5)
➕ crates/horizon-shaders/src/textures.rs (+427 -0)

...and 80 more files

📄 Description

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

  • 01664d49f Shader packs: matrix elements in custom uniforms are m.column.row
  • 77a69f342 Shader packs: the view bob is in gbufferModelView, not gbufferProjection
  • 3a0de65fa Shader packs: IS_IRIS and Iris feature flags, sized array types in global initializers
  • af942d8ae Shader packs: read storage buffers and custom images
  • de054759f Shader packs: the hand doesn't spin with nausea, and the buffer and image parsers are tested
  • 7d4377297 Shader packs: SSBO and CUSTOM_IMAGES wait for their bindings, three sizes make a 3D image

What and why

matrix elements in custom uniforms are m.column.row (01664d49f)

gbufferModelViewInverse.1.0 read row 1, column 0: the transpose. Packs turn a view direction to the world as inverse.0.0 * x + inverse.1.0 * y + ..., so Photon's sun direction (from sunPosition) turned with the camera: the sky lit as another time of day when looking around, swung with view bobbing, and the sun was missing.

the view bob is in gbufferModelView, not gbufferProjection (77a69f342)

Packs invert only gbufferProjection's perspective terms when they rebuild positions, so a bob inside it moved every rebuilt position, and the lighting with it, while walking. The bob and the nausea spin are now part of the model-view, where GL drew them; the product is the same, and the hand's projection no longer adds the bob a second time.

IS_IRIS and Iris feature flags, sized array types in global initializers (3a0de65fa)

  • IS_IRIS is defined: packs take Iris's extensions (compute programs, images, custom textures) only where it is, and Rethinking Voxels draws an error screen without it. iris.features.optional defines IRIS_FEATURE_ for the features Horizon has; a required one it lacks is noted.
  • A global initialized with the size on its type (ivec3[6] offsets = ivec3) kept only the size as its type.
  • naga: constant shifts drop the bits shifted out, as GLSL says (1 << 31).

read storage buffers and custom images (af942d8ae)

  • bufferObject.: a storage buffer of n bytes (or bytes per pixel of the render size). Buffer blocks are bound in set 4 and lose their access qualifiers so that every stage binds them alike.
  • image.: 2D and 3D images of the pack's, with their format, size (or the render size scaled), sampler name and whether they clear before each frame.
  • iris.features: SSBO and CUSTOM_IMAGES are supported.
  • A 3D image (iimage3D) is declared as 3D.
  • naga: atomicAdd and the other atomic functions on buffers and shared memory, imageAtomic*.

Nothing binds them yet.

the hand doesn't spin with nausea, and the buffer and image parsers are tested (de054759f)

gbufferModelView holds the nausea spin the world turns with; the hand's projection now takes
it out again, as vanilla's hand never spun. Tests cover bufferObject., image.,
iris.features.* and buffer blocks with and without a binding.

SSBO and CUSTOM_IMAGES wait for their bindings, three sizes make a 3D image (7d4377297)

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 ⚠️ 180 files, +123386 −241; 123488 lines of code: over 500, split it if it can ship in parts
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅ (1 s)
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 ✅ (38 s)
tests: workspace ❌ 2562 passed, 7 failed (1 min 12 s)
doc tests ✅ 0 passed (3 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 (4 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/4446 **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/06` --- ### 📝 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 **180 files changed** (+123386 additions, -241 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` (+34 -3) 📝 `crates/horizon-client-render/src/gfx/pack_hand.rs` (+4 -5) 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+713 -129) ➕ `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` (+57 -0) 📝 `crates/horizon-shaders/src/options.rs` (+68 -22) 📝 `crates/horizon-shaders/src/pack.rs` (+2 -2) 📝 `crates/horizon-shaders/src/post.rs` (+315 -4) 📝 `crates/horizon-shaders/src/preprocess.rs` (+33 -0) 📝 `crates/horizon-shaders/src/properties.rs` (+27 -5) ➕ `crates/horizon-shaders/src/textures.rs` (+427 -0) _...and 80 more files_ </details> ### 📄 Description Part 6 of 12 of the shader pack work from #3737. It builds on part 5 (#4445): this branch is that one plus the commits below, so review only these: - `01664d49f` Shader packs: matrix elements in custom uniforms are m.column.row - `77a69f342` Shader packs: the view bob is in gbufferModelView, not gbufferProjection - `3a0de65fa` Shader packs: IS_IRIS and Iris feature flags, sized array types in global initializers - `af942d8ae` Shader packs: read storage buffers and custom images - `de054759f` Shader packs: the hand doesn't spin with nausea, and the buffer and image parsers are tested - `7d4377297` Shader packs: SSBO and CUSTOM_IMAGES wait for their bindings, three sizes make a 3D image ## What and why **matrix elements in custom uniforms are m.column.row** (`01664d49f`) gbufferModelViewInverse.1.0 read row 1, column 0: the transpose. Packs turn a view direction to the world as inverse.0.0 * x + inverse.1.0 * y + ..., so Photon's sun direction (from sunPosition) turned with the camera: the sky lit as another time of day when looking around, swung with view bobbing, and the sun was missing. **the view bob is in gbufferModelView, not gbufferProjection** (`77a69f342`) Packs invert only gbufferProjection's perspective terms when they rebuild positions, so a bob inside it moved every rebuilt position, and the lighting with it, while walking. The bob and the nausea spin are now part of the model-view, where GL drew them; the product is the same, and the hand's projection no longer adds the bob a second time. **IS_IRIS and Iris feature flags, sized array types in global initializers** (`3a0de65fa`) - IS_IRIS is defined: packs take Iris's extensions (compute programs, images, custom textures) only where it is, and Rethinking Voxels draws an error screen without it. iris.features.optional defines IRIS_FEATURE_<name> for the features Horizon has; a required one it lacks is noted. - A global initialized with the size on its type (ivec3[6] offsets = ivec3[](...)) kept only the size as its type. - naga: constant shifts drop the bits shifted out, as GLSL says (1 << 31). **read storage buffers and custom images** (`af942d8ae`) - bufferObject.<n>: a storage buffer of n bytes (or bytes per pixel of the render size). Buffer blocks are bound in set 4 and lose their access qualifiers so that every stage binds them alike. - image.<name>: 2D and 3D images of the pack's, with their format, size (or the render size scaled), sampler name and whether they clear before each frame. - iris.features: SSBO and CUSTOM_IMAGES are supported. - A 3D image (iimage3D) is declared as 3D. - naga: atomicAdd and the other atomic functions on buffers and shared memory, imageAtomic*. Nothing binds them yet. **the hand doesn't spin with nausea, and the buffer and image parsers are tested** (`de054759f`) gbufferModelView holds the nausea spin the world turns with; the hand's projection now takes it out again, as vanilla's hand never spun. Tests cover bufferObject.*, image.*, iris.features.* and buffer blocks with and without a binding. **SSBO and CUSTOM_IMAGES wait for their bindings, three sizes make a 3D image** (`7d4377297`) ## 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 | ⚠️ 180 files, +123386 −241; 123488 lines of code: over 500, split it if it can ship in parts | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ (1 s) | | 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 | ✅ (38 s) | | tests: workspace | ❌ 2562 passed, 7 failed (1 min 12 s) | | doc tests | ✅ 0 passed (3 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 (4 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#5628
No description provided.