[PR #4450] [MERGED] Shader packs 9/12: translate geometry stages of terrain's shadow program #5632

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

📋 Pull Request Information

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

Base: main ← Head: shader-packs/09


📝 Commits (10+)

  • fcd2161 Shader packs: atomic functions on a component of a shared integer vector
  • 6e385e7 Shader packs: Iris's camera uniforms
  • 92b62f0 Shader packs: translate geometry stages of terrain's shadow program
  • 62a673e Shader packs: eye uniforms are the player's in third person, compound assignments on atomic vectors
  • ba64c55 Shader packs: geometry stages are tested, take unsized inputs, images keep a layout on the line before
  • 888fc0f Shader packs: relativeEyePosition points from the eye to the camera, uint indices on split vectors
  • ed70681 Shader packs: gl_InstanceID is 0 in a folded vertex stage, shadow_water has no cutout test
  • fd94b69 Merge the stack below (main merged) into #4448
  • 75b0939 Merge the stack below (main merged) into #4450
  • 8f43b2d Merge main into #4448

📊 Changes

11 files changed (+1231 additions, -35 deletions)

View changed files

📝 crates/horizon-client-render/src/camera.rs (+8 -0)
📝 crates/horizon-client-render/src/gfx.rs (+5 -0)
📝 crates/horizon-client-render/src/gfx/pack_uniforms.rs (+41 -4)
📝 crates/horizon-client/src/game.rs (+10 -0)
📝 crates/horizon-shaders/src/lib.rs (+3 -3)
📝 crates/horizon-shaders/src/post.rs (+204 -24)
➕ crates/horizon-shaders/src/translate/atomic_vectors.rs (+349 -0)
➕ crates/horizon-shaders/src/translate/geometry.rs (+572 -0)
📝 crates/horizon-shaders/src/translate/mod.rs (+20 -0)
📝 crates/horizon-shaders/src/translate/rewrite.rs (+4 -2)
📝 crates/horizon-shaders/tests/real_packs.rs (+15 -2)

📄 Description

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

  • 92b62f0f0 Shader packs: translate geometry stages of terrain's shadow program
  • ba64c5574 Shader packs: geometry stages are tested, take unsized inputs, images keep a layout on the line before
  • ed70681a0 Shader packs: gl_InstanceID is 0 in a folded vertex stage, shadow_water has no cutout test

What and why

translate geometry stages of terrain's shadow program (92b62f0f0)

A shadow program of terrain with a geometry stage (shadow.gsh): wgpu has none, so its vertex, geometry and fragment stages become one vertex stage and the fragment stage (translate_geometry). Each vertex invocation stands for one corner of one triangle the geometry stage may emit: it reads its input triangle's three vertices itself (GeometryInputs says how), runs the pack's vertex stage on them, then the geometry stage, and keeps its corner.

  • The shadow pass has the cutout test (GREATER 0.1) unless alphaTest. says otherwise: leaves cast the shadow of their texels, not of their blocks.
  • Images declared without a format take the one image.* gives them.
  • gl_VertexID became hz_VertexID: the compatibility inputs' prefix gl_Vertex matched it first.

The game gives no GeometryInputs yet, so such programs are still skipped.

geometry stages are tested, take unsized inputs, images keep a layout on the line before (ba64c5574)

A unit test folds a small shadow program with a geometry stage and checks its triangle count.
It found that inputs declared without a size (in vec3 v[]) were unsized arrays naga refuses;
they have the triangle's three elements. An image declared with its layout on the line before
no longer gets a second one.

gl_InstanceID is 0 in a folded vertex stage, shadow_water has no cutout test (ed70681a0)

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

Check Result
Scope ⚠️ 185 files, +125113 −290; 125247 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 ✅ (35 s)
tests: workspace ❌ 2562 passed, 7 failed (1 min 2 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/4450 **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/09` --- ### 📝 Commits (10+) - [`fcd2161`](https://github.com/horizon-rust/horizon/commit/fcd21612876425d80f0b2a4753a971e5653f503e) Shader packs: atomic functions on a component of a shared integer vector - [`6e385e7`](https://github.com/horizon-rust/horizon/commit/6e385e741f4e389f611cc9c20c4e435e29e54c50) Shader packs: Iris's camera uniforms - [`92b62f0`](https://github.com/horizon-rust/horizon/commit/92b62f0f0ee9af9902f770b0e6df642ce668675c) Shader packs: translate geometry stages of terrain's shadow program - [`62a673e`](https://github.com/horizon-rust/horizon/commit/62a673ec2ccc8e32919eeb35e1196bc468d7b613) Shader packs: eye uniforms are the player's in third person, compound assignments on atomic vectors - [`ba64c55`](https://github.com/horizon-rust/horizon/commit/ba64c557465f8b6178c2be93cafdca0b0f643c82) Shader packs: geometry stages are tested, take unsized inputs, images keep a layout on the line before - [`888fc0f`](https://github.com/horizon-rust/horizon/commit/888fc0fafd8f34f10433f1e161d95a3a9e118780) Shader packs: relativeEyePosition points from the eye to the camera, uint indices on split vectors - [`ed70681`](https://github.com/horizon-rust/horizon/commit/ed70681a0f595b770d3512e6c6ee11cce9202e1b) Shader packs: gl_InstanceID is 0 in a folded vertex stage, shadow_water has no cutout test - [`fd94b69`](https://github.com/horizon-rust/horizon/commit/fd94b69918bd136f75807f12cc5637752afcc78d) Merge the stack below (main merged) into #4448 - [`75b0939`](https://github.com/horizon-rust/horizon/commit/75b0939fa45bc790064ce4cc09ba245d704b2487) Merge the stack below (main merged) into #4450 - [`8f43b2d`](https://github.com/horizon-rust/horizon/commit/8f43b2de7c32031aed65d57f520b266f26565b21) Merge main into #4448 ### 📊 Changes **11 files changed** (+1231 additions, -35 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/camera.rs` (+8 -0) 📝 `crates/horizon-client-render/src/gfx.rs` (+5 -0) 📝 `crates/horizon-client-render/src/gfx/pack_uniforms.rs` (+41 -4) 📝 `crates/horizon-client/src/game.rs` (+10 -0) 📝 `crates/horizon-shaders/src/lib.rs` (+3 -3) 📝 `crates/horizon-shaders/src/post.rs` (+204 -24) ➕ `crates/horizon-shaders/src/translate/atomic_vectors.rs` (+349 -0) ➕ `crates/horizon-shaders/src/translate/geometry.rs` (+572 -0) 📝 `crates/horizon-shaders/src/translate/mod.rs` (+20 -0) 📝 `crates/horizon-shaders/src/translate/rewrite.rs` (+4 -2) 📝 `crates/horizon-shaders/tests/real_packs.rs` (+15 -2) </details> ### 📄 Description Part 9 of 12 of the shader pack work from #3737. It builds on part 8 (#4448): this branch is that one plus the commits below, so review only these: - `92b62f0f0` Shader packs: translate geometry stages of terrain's shadow program - `ba64c5574` Shader packs: geometry stages are tested, take unsized inputs, images keep a layout on the line before - `ed70681a0` Shader packs: gl_InstanceID is 0 in a folded vertex stage, shadow_water has no cutout test ## What and why **translate geometry stages of terrain's shadow program** (`92b62f0f0`) A shadow program of terrain with a geometry stage (shadow.gsh): wgpu has none, so its vertex, geometry and fragment stages become one vertex stage and the fragment stage (translate_geometry). Each vertex invocation stands for one corner of one triangle the geometry stage may emit: it reads its input triangle's three vertices itself (GeometryInputs says how), runs the pack's vertex stage on them, then the geometry stage, and keeps its corner. - The shadow pass has the cutout test (GREATER 0.1) unless alphaTest.<program> says otherwise: leaves cast the shadow of their texels, not of their blocks. - Images declared without a format take the one image.* gives them. - gl_VertexID became hz_VertexID: the compatibility inputs' prefix gl_Vertex matched it first. The game gives no GeometryInputs yet, so such programs are still skipped. **geometry stages are tested, take unsized inputs, images keep a layout on the line before** (`ba64c5574`) A unit test folds a small shadow program with a geometry stage and checks its triangle count. It found that inputs declared without a size (in vec3 v[]) were unsized arrays naga refuses; they have the triangle's three elements. An image declared with its layout on the line before no longer gets a second one. **gl_InstanceID is 0 in a folded vertex stage, shadow_water has no cutout test** (`ed70681a0`) ## 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 32 s) | Check | Result | | --- | --- | | Scope | ⚠️ 185 files, +125113 −290; 125247 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 | ✅ (35 s) | | tests: workspace | ❌ 2562 passed, 7 failed (1 min 2 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:56 +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#5632
No description provided.